Hello,

I am playing with coccinelle and want to debug a scenario where spatch does not
yield what I'd expect. Given this SmPL-snipplet (just a test case):

@@
identifier client, data;
@@
        i2c_set_clientdata(client, data);
        ...
+       i2c_set_clientdata(client, NULL);
        kfree(data);

and checking a kernel-source file

        spatch -sp_file clientdata.cocci -outplace drivers/hwmon/ad7414.c

I think it should give me a match (going the error-path in the probe_function),
but it doesn't. Commenting out the 'return 0' in that function, it will give me
the match. I did a minimal test case to check if gotos are handled properly,
but for the testcase, it works fine.

Testcase-SmPL:

@@
@@
        foo();
        ...
+       baz();
        bar();

Testcase-Pseudocode:

void main(void) {


        foo();

        if (hurz())
                goto out;

        blub();
        bar();
        return 0;

out:
        bar();
        return 1;

}

So, I am stuck how to proceed. What are useful debug strategies now to see
where I (or the program) am wrong? Pointers to documentation/threads/wiki will
do, I just couldn't find any.

Regards and thanks for this tool!

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to