public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* debugging dynamically loadable code
@ 2006-04-03 16:09 Pupeno
  2006-04-03 16:35 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Pupeno @ 2006-04-03 16:09 UTC (permalink / raw)
  To: gdb

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

Hello, hope this is not off-topic,
I need to debug some code that is located in a dynamic library, a .so file. 
This file is loaded by a program at run-time (with dlopen I supouse). So I 
load this program into gdb (using ddd) and my problem is that I can't open 
the yet-unloaded sources and/or set a break point on them.
If I run the program to let it load the .so file it'll be too late because I 
need to debug the module initialization code.
I know I should put a breakpoint between the loading and the running of the 
module, but I can't find it. The module is loaded thru a custom script this 
application interprets, so, it's hard to dig that code.
Any ideas how can I do my debugging ?
Thank you.
-- 
Pupeno <pupeno@pupeno.com> (http://pupeno.com)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: debugging dynamically loadable code
  2006-04-03 16:09 debugging dynamically loadable code Pupeno
@ 2006-04-03 16:35 ` Daniel Jacobowitz
  2006-04-03 21:23   ` Pupeno
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-04-03 16:35 UTC (permalink / raw)
  To: Pupeno; +Cc: gdb

On Mon, Apr 03, 2006 at 06:09:33PM +0200, Pupeno wrote:
> Any ideas how can I do my debugging ?

You can do one of two things here:

 - "set stop-on-solib-events 1".  This will cause GDB to stop when
shared libraries are loaded or unloaded.  You can use "info shared" to
see if the library you want has been loaded after a stop.

 - Pending breakpoints.  You can set a breakpoint by filename:line or
function name, even if that object hasn't been loaded yet - you just
may not be able to do it using the DDD GUI.  You need GDB 6.3 or 6.4
for this to work.  I don't know if DDD lets you get at the GDB console
usefully.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: debugging dynamically loadable code
  2006-04-03 16:35 ` Daniel Jacobowitz
@ 2006-04-03 21:23   ` Pupeno
  2006-04-03 21:27     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Pupeno @ 2006-04-03 21:23 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

On Monday, 3 de April de 2006 18:34, Daniel Jacobowitz wrote:
> On Mon, Apr 03, 2006 at 06:09:33PM +0200, Pupeno wrote:
> > Any ideas how can I do my debugging ?
>
> You can do one of two things here:
>
>  - "set stop-on-solib-events 1".  This will cause GDB to stop when
> shared libraries are loaded or unloaded.  You can use "info shared" to
> see if the library you want has been loaded after a stop.
It halted the process very soon, maybe some loading I was not aware of and I 
was not sure how to continue.

>  - Pending breakpoints.  You can set a breakpoint by filename:line or
> function name, even if that object hasn't been loaded yet - 
Oh, that worked, particurarly breakpoint on filename:line. I tried pending 
breakpoints once but it didn't work, it just didn't break, now it worked like 
a charm.

> you just 
> may not be able to do it using the DDD GUI.  You need GDB 6.3 or 6.4
> for this to work.  I don't know if DDD lets you get at the GDB console
> usefully.
Yes, I can do it, DDD let's you access gdb console, sometimes it behaves 
funny, but the data show makes it worth it.

Thank you.
-- 
Pupeno <pupeno@pupeno.com> (http://pupeno.com)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: debugging dynamically loadable code
  2006-04-03 21:23   ` Pupeno
@ 2006-04-03 21:27     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-04-03 21:27 UTC (permalink / raw)
  To: Pupeno; +Cc: gdb

On Mon, Apr 03, 2006 at 11:21:35PM +0200, Pupeno wrote:
> On Monday, 3 de April de 2006 18:34, Daniel Jacobowitz wrote:
> > On Mon, Apr 03, 2006 at 06:09:33PM +0200, Pupeno wrote:
> > > Any ideas how can I do my debugging ?
> >
> > You can do one of two things here:
> >
> >  - "set stop-on-solib-events 1".  This will cause GDB to stop when
> > shared libraries are loaded or unloaded.  You can use "info shared" to
> > see if the library you want has been loaded after a stop.
> It halted the process very soon, maybe some loading I was not aware of and I 
> was not sure how to continue.

You can just say continue and try info shared again, until you see the
library you want.  Anyway, if pending breakpoints work for you, use
those instead.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-03 21:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-03 16:09 debugging dynamically loadable code Pupeno
2006-04-03 16:35 ` Daniel Jacobowitz
2006-04-03 21:23   ` Pupeno
2006-04-03 21:27     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).