On 04/29/2010 02:54 AM, Sebastien Binet wrote:
hi there,
I just managed to install dehydra on an ArchLinux box (here is my
package btw: http://aur.archlinux.org/packages.php?ID=36835)
My plan was to use dehydra as a gccxml replacement to wrap C and C++
libraries for e.g. python.
but, it seems I ran into a roadblock.
Yes it should work well for that. That's how I wrap the GCC
datastructures for Treehydra. In my case I cheat and compile the
relevant headers with g++ as I find that frontend to be easier to work with.
Unfortunately our C support is a little incomplete. Should be pretty
easy to fix for someone who needs to analyze C. Many people have asked
about C support, perhaps someone will contribute a few fixes.
while processing C++ code ran fine, processing the following C code:
/* emacs, this is -*-c-*- */
struct C
{
int i;
float f;
};
static
int
foo()
{ return 42; }
int bar() { return 42; }
/* eof */
crashed like so:
$ gcc -fPIC -Wall -std=c99 -fplugin=/usr/lib/dehydra/gcc_dehydra.so -
fplugin-arg-gcc_dehydra-=./dump_types.js -shared -o ./t2.so ./t2.c
util.c:164: Assertion failed:0.
If the file compiles correctly without invoking dehydra please file a
bug, include a testcase or .ii file produced with -save-temps
$ gcc --version
gcc (GCC) 4.5.0
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
this doesn't fail when only the struct is present.
being able to also analyze C code bases would be greatly valuable :)
what would need to be done to try fix this ?
Filing a bug is a start: https://bugzilla.mozilla.org/show_bug.cgi?id=562707
The trick to making dehydra work with C now is to add a guard every time
it references some C++ feature that isn't available in the C frontend.
See isGPlusPlus() bits in the patch that I landed in above bug. For now
disabled the pre_generalize hook that was causing the above crash since
that code does not expect C(it should be easy to fix this with
isGPlusPlus() checks).
To debug problems like this run gcc with -v to get the cc1 commandline,
then either launch it from gdb or attach to it. It may help to specify
the plugin path using an absolute path(otherwise gdb may have issues
finding it). It's also useful to compile gcc with debug info, I use the
following: ../gcc/configure --enable-checking CFLAGS="-g3 -O0"
--prefix=/home/taras/gcc-dehydra/gcc-fast-build/../installed
--enable-languages=c,c++
Good luck,
Taras
_______________________________________________
dev-static-analysis mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-static-analysis