-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dear Kotaro,
Am 09.07.2015 um 14:56 schrieb objectiveK2:
> I'm trying to run CPAChecker against a linux driver, but I'm having
> parse errors. I've identified which code is causing the parse
> error, then I've also found some workarounds. Could you tell me if
> my workaround is appropriate, if there's other appropriate way, or
> if this is CPAChecker bug ?
>
> Here is what I did: 1) preprocess the driver code $ cd <kernel
> tree> $ make drivers/net/ethernet/micrel/ks8851_mll.i
>
> 2) run cpa.sh $ ./scripts/cpa.sh -predicateAnalysis ks8851_mll.i
>
> 3) observed error "Error: Parsing failed (line **: Syntax error:
> _here: (unsigned long)&&_here;) (EclipseCParser.buildCFA, SEVERE)
>
>
> The symptom occurs at a macro in "include/linux/kernel.h"
>
> #define _THIS_IP_ ({ __label__ __here; __here: (unsigned
> long)&&__here; })
As Vadim already wrote, this is a bug in Eclipse CDT.
We have reported it and they have fixed it already,
so we are currently just waiting for a released version of CDT
that includes the change.
In practice, most occurrences of this macro are not relevant for
verification purposes as they only serve to produce a unique id,
thus I recommend to use the redefinition of the macro as a workaround
like Vadim proposed.
You can also maybe also use a preprocessor argument to overwrite the
macro definition without actually changing the file.
> Then I've found two workaround for this:
>
> 1) Put parentheses around '$$__here' If I change the expression
> like this, the symptom won't occur anymore, but another error
> message will appear. - unsigned long hoge = ({ __label__ __here;
> __here: (unsigned long)&&__here; }); + unsigned long hoge = ({
> __label__ __here; __here: (unsigned long)(&&__here); });
>
> Next error will be: Error: Parsing failed(line **: Unsupported
> statement type CASTLabelStatement at end of compound-statement
> expression: _here: (unsigned long)(&&_here);)
> (EclipseCParser.buildCFA, SEVERE)
This should work, but it seems the AST inside this ({ }) expression
is too complex for CPAchecker here. I will look into this.
> 2) Put ; after label expression __here: It seems CPAchecker
> accidentally tries to interpret : as a operator. So this error will
> disappear by the modification below. - unsigned long hoge = ({
> __label__ __here; __here: (unsigned long)(&&__here); }); +
> unsigned long hoge = ({ __label__ __here; __here:; (unsigned
> long)(&&__here); });
>
> This solves for the simple code. But unfortunately for the actual
> driver code, next error is "java.lang.IllegalArgumentException" at
> Preconditions.checkAegument(Preconditions.java).
Could you please post the full stack trace for this error?
Preconditions is just a helper method that is called in a lot of places.
> Also, is there any document/instruction/tutorial that would help me
> applying kernel driver source code for CPAChecker? I've been
> looking for how svcomp benchmark verification tasks(Device Drivers
> Linux 64-bit) was generated, but I couldn't even preprocess any
> driver code with CIL tool.
The best solution I know would be to use the LDV tools as recommended
by Vadim.
Greetings, Philipp
- --
Philipp Wendler
Lehrstuhl für Softwaresysteme
Universität Passau
Raum IM 110 - Tel.: 0851/509-3093
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJVnpv/AAoJEGLA94wxqd6M8msQAI/bspMPOlKvf5iAaLytdVck
3e7ul4exYVfFb2+wt0rEREbaLiq3KKLn24v/+QNoUMb81NEI5u/vzBkjxDm9MvxR
Xe+wy4Mn5yTG/ORRMCi+Mt1reP0VynNfzF/V1NhZlbm9tQ3K5CJz2jgVv3mBykQh
53PMTznkD73ziqKGVQwXpbeNTG/A6fZG6vv5C1vvFVb3naiQqWfiXMCcv5+b7W39
swIJM0p0W1+Qj47cFWnDpTBi6Ha/dIa70a0jYsne4+9nmGQ4UHYY/kyMSPVXAWOJ
K/PhBpOHA3CQQ9uaSoHXG/W9U/l5iUEhtWO1dv6FOy2OwezOEHaC2S/h+Ve+gl3+
mZDm4YqJt9a0DD0whG5817wmMYnjZNNRuxqFziIjI0gMp8n+R3FvSVGxAvbmPmxU
w062JhHGx1fnbbNJn8XmPeo3+bPJtOIO5NZr+iQuOsjMKmDsbpo01acxJsUQn2XE
nbVKFOlz8CVEhy01SVH25Eg7idI34G9W55pvrrFlBQzFKYYlKJ6KY3Yrfh3BalTe
aDSK176YO1Qdm+2Bt8/FjkrTEAWM/jUCxIETERLdtegiyZSnE8/wOKizI1IGnJ7N
EldXdGcVFfXLNXqyrOFjHcnCJFNoRZ5R9MkpglE5bDDkM/i8fZLQkjq2nnUJ8F2U
Zj6Tioms7FEdv0h29JI5
=GH52
-----END PGP SIGNATURE-----