Need help debugging plugin

David Malcolm dmalcolm at redhat.com
Mon Apr 16 21:51:56 UTC 2012


On Mon, 2012-04-16 at 18:37 -0300, Emílio Wuerges wrote:
> Hi,
> 
> 
> I'm using gcc-python-plugin in my pass for x86_64 happily until now.
> But now I'm trying it to use it for arm and I get this error message:
> 
> ew at arrakis:~/work/mibench/security/sha$
> /home/ew/work/sca-python/bin/gcc-with-ipet -Wall -c  sha_driver.c
> cc1: error: fail to initialize plugin
> /home/ew/gcc-python-plugin/gcc-python-plugin/python.so
> 
> Can someone tell me what should I do to debug this error? I have no
> idea how to start.
IIRC this error message happens if the plugin's plugin_init() returns a
non-zero result, which can happen for various reasons.  One of them is
if there's a mismatch between the exact version of gcc that the plugin
was built with vs the exact version of gcc that's trying to load the
plugin - there needs to be an exact match.

Debugging the plugin with gdb is a little fiddly, so I've written some
notes on how to do it within docs/getting-involved.rst, which you can
see in HTML form here:
http://gcc-python-plugin.readthedocs.org/en/latest/getting-involved.html#debugging-the-plugin-s-c-code

Hopefully that will enable you to run the plugin under gdb, set a
breakpoint on the plugin's "plugin_init", and step through it, which
should (I hope) shed light on why it's failing.  Caveat: I wrote the
notes based on my experiences on Fedora; I've not tried it on Ubuntu -
does it work?

> If you are curious this is how I'm using gcc-python-plugin
> 
> 
> All I did in my script was to change the gcc to arm-linux-gnueabi-gcc
> wich comes with ubuntu:
[...snip...]
> export LD_PRELOAD=libpython2.7.so
FWIW, I don't know why this is needed, but for some reason the above
does seem to be needed on Ubuntu.


Hope this is helpful - good luck!
Dave



More information about the gcc-python-plugin mailing list