News for hackers. Stuff that matters.
Re:How does GDB call functions? by DannyBee on Friday January 05, 2018 @01:12PM (#16080360)
When you say fail, what happens?

If you mean you can't call them, yes, it's shared libs, they aren't in the address space yet. If you mean something else (IE the symbol info is wrong), you can debug what is going on as follows:

The logic for when it builds minimal symbol tables, converting them to partial symbol tables, and then full symbol tables, is incredibly convoluted.

In theory, needing a full symbol with type info should just cause the right thing to happen lazily.

In practice, it does not.

You can debug what is going on by doing this:

  (gdb) set debug symbol-lookup 1
  (gdb) set debug symtab-create 1
  (gdb) file <your executable>
  (gdb) p strcmp("foo", "bar")
  <look at output>
  (gdb) b main
  (gdb) p strcmp
  <look at output>
This is going to produce a truly ridiculous amount of output on a large executable (so i'd use a minimal one :P), but by comparing the output you get trying to use the symbol before and after "b main" should give you some idea what is going on.

There are no comments on this comment yet.