Need help debugging plugin

David Malcolm dmalcolm at redhat.com
Mon Apr 16 22:18:29 UTC 2012


On Mon, 2012-04-16 at 19:02 -0300, Emílio Wuerges wrote:
> Thanks Dave,
> 
> I can do it by myself now.
Excellent.

> Btw, I'll never use the plugin with the same gcc I'm building the
> plugin. I want to cross-compile to arm.
I think my wording below was wrong; I meant that you have to build the
plugin against the headers for the exact version of gcc that you intend
the plugin to run inside.  Sorry about that.

FWIW I've haven't yet tried to use it with a cross-compiler (hence my
sloppiness below), but it ought to work.


> []'s
> 
> 
> On Mon, Apr 16, 2012 at 6:51 PM, David Malcolm <dmalcolm at redhat.com> wrote:
> > 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
> >
> > _______________________________________________
> > gcc-python-plugin mailing list
> > gcc-python-plugin at lists.fedorahosted.org
> > https://fedorahosted.org/mailman/listinfo/gcc-python-plugin
> 
> 
> 




More information about the gcc-python-plugin mailing list