Debug shared libraries with gdb ???

Debug shared libraries with gdb ???

Post by Bruce G Wils » Sat, 13 Jul 1996 04:00:00



Could anyone give me pointers to information on how to debug shared
libraries with gdb ?  I seem to get garbage names on the stack when
I step into functions in the shared library and do a backtrace.

For example:

(gdb) where
#0  0xef740750 in _environ ()
#1  0xef74074c in _environ ()
#2  0xef74070c in _environ ()
#3  0x10740 in foo () at test2.c:11
#4  0x1071c in main (argc=1, argv=0xeffffa24) at test2.c:5

Where _environ should be function names "bar()" and "baz()" in the
shared library.

I'm on SunOS 5.4 using gcc 2.7.2 and gdb 4.11 .  Could there be a
problem with one of the versions I'm using that an upgrade could help ?

TIA.

 
 
 

1. debugging shared libraries with gdb

Hi,

Is it impossible to debug shared libraries using
gdb on Linux ?

I can compile and debug the contained files.

After adding '.' to the LD_LIBRARY_PATH
it will run.

I tried debugging but received this error:

(gdb) l
1 #include "libhello.h"
2
3 int main ( void ) {
4   print_hello();
5   return 0;
6 }
(gdb) b 4
Breakpoint 1 at 0x80484a4: file usehello.c, line 4.
(gdb) c
The program is not being run.
(gdb) run
Starting program: /root/tmp/shared/usehello
/root/tmp/shared/usehello: can't load library 'libhello.so'

Program exited with code 020.
(gdb) quit

Relevant information:

OS: Linux 2.0.29
gcc version: gcc version 2.7.2.3
gdb version: 4.16 (i486-slackware-linux)
Machine: Pentium II

Thanks

[ libhello.c < 1K ]
#include <stdio.h>

void print_hello(void ) {
  printf ( "Hello,library.\n" );

[ libhello.h < 1K ]

void print_hello ( void ) ;

[ usehello.c < 1K ]
#include "libhello.h"

int main ( void ) {
  print_hello();
  return 0;

- Show quoted text -

2. Linux Kernel for ALPHA PC?

3. debugging shared libraries using gdb

4. shared library dependency and priority questions

5. gdb/ddd shared library debugging problem

6. What ever happened to Slackware?

7. How can i debug a shared library using gdb..

8. The Interactive Dance Compilation you can play and Mix on your PC!! 5224

9. Shared Library Debugging with -ldl / gdb "eval.c" no such file

10. Debugging shared libraries with gcc 2.95.2, gdb 4.18

11. debugging a shared library using gdb on linux

12. Debugging shared libraries. gdb unexpected behaviour.

13. Will strip(debug shared library) == nodebug shared library ?