Fw: Debugging plugins with gdb

2010-08-11 Thread Jeff Saremi
Sending this to "gcc" since I got no help from sending it to "gcc-help"

--- On Sun, 8/8/10, Jeff Saremi  wrote:

> From: Jeff Saremi 
> Subject: Debugging plugins with gdb
> To: gcc-h...@gcc.gnu.org
> Date: Sunday, August 8, 2010, 9:52 AM
> I'd like to step into my plugin to
> see if I can debug it. My plugin currently causes gcc to
> crash.
> Trying to use "break execute_x" command in
> "add-symbol-file myplugin.so" but neither of them work. The
> first one complains that "function not defined" and the 2nd
> one says that "the address where .so has been loaded is
> missing".
> Try run with the arugments did not help either. After gcc
> returns, it has unloaded the shared libraries.
> I'd appreciate if anyone would share his experience in
> successfully debugging a plugin. thanks
> jeff
> 



Re: Fw: Debugging plugins with gdb

2010-08-11 Thread Andrew Pinski
On Wed, Aug 11, 2010 at 3:52 PM, Jeff Saremi  wrote:
> Sending this to "gcc" since I got no help from sending it to "gcc-help"

Are you trying to debug gcc or cc1/cc1plus?  If the former try running
with -v and seeing that cc1/cc1plus is involved and then debug
cc1/cc1plus instead.

Thanks,
Andrew Pinski


Re: Fw: Debugging plugins with gdb

2010-08-11 Thread Daniel Jacobowitz
On Wed, Aug 11, 2010 at 03:52:17PM -0700, Jeff Saremi wrote:
> > Trying to use "break execute_x" command in
> > "add-symbol-file myplugin.so" but neither of them work. The
> > first one complains that "function not defined"

Did it ask you if you want to make the breakpoint pending?  If it did,
say yes.  If it didn't, try a newer version of GDB.

-- 
Daniel Jacobowitz
CodeSourcery


Re: Fw: Debugging plugins with gdb

2010-08-11 Thread Jeff Saremi
Daniel/Andrew
thanks so much. I was using gdb version 7.1. So it understood deferred 
breakpoints but as long as I started gdb with something like ~/bin/gcc it never 
stopped in my function.
As soon as I switched to running gdb on cc1, it worked!
Now i can work on debugging the seg-fault i'm causing.