Denis
Denis

Reputation: 1534

gdb7.7 does not load shared libraries

Perhaps, i misunderstand something, but i can't make Gdb to read debug libraries. what i do from command line is:

gdb
file problem_exec
b main
r

GDB stops at:

(gdb) r
Starting program: /Users/.../problem_exec

Breakpoint 1, main (argc=<error reading variable: Could not find the frame base for "main(int, char**)".>, argv=<error reading variable: Could not find the frame base for "main(int, char**)".>)

No shared libraries:

(gdb) info shared
No shared libraries loaded at this time.

The last command gives: "No shared libraries loaded at this time."

My .gdbinit looks like:

# file .gdbinit
set stop-on-solib-events 1
# stop gdb from stepping over functions and output diagnostics
set step-mode on
set breakpoint pending on
set env DYLD_LIBRARY_PATH path1:path2:path3
#automatically load shared libraries (on/off):
set auto-solib-add on

I am sure that an executable is linked against debug version of the shared libraries (in total there are some 30 libraries, but the one I am interested in is definitely compiled in a debug mode). I checked it with otool -L problem_exec

If I run program, it goes until a run-time error in the library I want to debug, but i can not step in.
Am I missing something?

p.s. I run self-compiled version of Gdb on os-x.

UPDATE: it could be related to this problem.

Upvotes: 3

Views: 1749

Answers (1)

Employed Russian
Employed Russian

Reputation: 213937

set stop-on-solib-events 1

With that setting, GDB should stop before any shared libraries are loaded.

When you do this:

file problem_exec
b main
r
    ... where is GDB stopped?
info shared

If GDB is stopped at main, then shared libraries should be loaded. But if it is stopped in the dynamic loader (as I expect it is), then they should not be loaded yet.

Upvotes: 2

Related Questions