debug dynamically loaded library

debug dynamically loaded library

Post by Christian Schul » Sat, 11 Nov 2000 04:00:00



Hiya,

I would like to debug a program which dynamically loads a shared library
with dlopen() with dbx and/or the graphical workshop de* on linux
with gdb.

I have no problem with the basic debugging, but experience the following
problem: when the shared library is not loaded, I cannot set breakpoints
for code in the shared library. This means, I have to set a breakpoint
after the loading call and set the further breakpoints when this
breakpoint is reached.

Any hints how to resolve this problem?

Irix de*s have a nice feature called pendingtraps which allows to
define breakpoints on not yet loaded modules. Is there something similar
in gdb on Linux?

Or, is there a way to tell gdb to load the dynamically loaded shared
library when starting the program although it's not in the list of
shared libraries in the program?

Furthermore, is there a way to save breakpoints between sessions?

I'm using the following versions of gdb version GNU gdb 19991004

Any help is appreciated.

Christian

 
 
 

debug dynamically loaded library

Post by J.H.M. Dassen (R » Sun, 12 Nov 2000 04:00:00



>I have no problem with the basic debugging, but experience the following
>problem: when the shared library is not loaded, I cannot set breakpoints
>for code in the shared library. This means, I have to set a breakpoint
>after the loading call and set the further breakpoints when this breakpoint
>is reached.
>Or, is there a way to tell gdb to load the dynamically loaded shared
>library when starting the program although it's not in the list of shared
>libraries in the program?

Inside gdb, try
        set environment LD_PRELOAD /path/to/the/library.so.version

HTH,
--


 
 
 

debug dynamically loaded library

Post by Christian Schul » Tue, 14 Nov 2000 04:00:00


Ray,

sounded good, but unfortunately it doesn't work.

Thanks and sigh,
Christian



> >I have no problem with the basic debugging, but experience the following
> >problem: when the shared library is not loaded, I cannot set breakpoints
> >for code in the shared library. This means, I have to set a breakpoint
> >after the loading call and set the further breakpoints when this breakpoint
> >is reached.

> >Or, is there a way to tell gdb to load the dynamically loaded shared
> >library when starting the program although it's not in the list of shared
> >libraries in the program?

> Inside gdb, try
>         set environment LD_PRELOAD /path/to/the/library.so.version

> HTH,
> --


 
 
 

debug dynamically loaded library

Post by Dominique BOUR » Wed, 15 Nov 2000 04:00:00


I experienced the same problem... Solved by using kdevelop 1.2 on Mandrake
7.0 v2 only.. It works neither on RedHat, nor Suse, nor Mandrake 7.1 or
higher...
Strange problem...



Quote:> Hiya,

> I would like to debug a program which dynamically loads a shared library
> with dlopen() with dbx and/or the graphical workshop de* on linux
> with gdb.

> I have no problem with the basic debugging, but experience the following
> problem: when the shared library is not loaded, I cannot set breakpoints
> for code in the shared library. This means, I have to set a breakpoint
> after the loading call and set the further breakpoints when this
> breakpoint is reached.

> Any hints how to resolve this problem?

> Irix de*s have a nice feature called pendingtraps which allows to
> define breakpoints on not yet loaded modules. Is there something similar
> in gdb on Linux?

> Or, is there a way to tell gdb to load the dynamically loaded shared
> library when starting the program although it's not in the list of
> shared libraries in the program?

> Furthermore, is there a way to save breakpoints between sessions?

> I'm using the following versions of gdb version GNU gdb 19991004

> Any help is appreciated.

> Christian

 
 
 

1. debugging dynamically loaded libraries

I'm using Sun Workshop 6.1 on a Solaris 8 machine. I've been through
the dbx manual, but I'm apparently missing something. I've set pathmap
in my .dbxrc, have all the source, object and executable files in the
right place. However, dbx won't break inside a dynamically loaded
library, even when it accepts the breakpoint.

Also, it won't show symbols in a core file for any dynamically loaded
libraries, just hex numbers.

Is there something obvious I'm missing? I'd appreciate a slap upside
the head if I need one.

Thanks

Joe

2. HELP on configure CERN httpd as News PROXI

3. debug info wanted for dynamically loaded funct.

4. O(1) scheduler starvation

5. WHICH LINUX??? NONE!!!

6. Apache & FrontPage without M$ extension

7. using gdb with dynamically loaded .so libraries

8. Dynamically Loaded Shared Libraries and dbx

9. Dynamically loading a ****.so library

10. Unresolved references in dynamically loaded shared library (SunOS 4.1.3)

11. Controlling exports in Dynamically loaded shared libraries