This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Q] loading a shared library at a gdb breakpoint


Hi,

How can I do the following at a breakpoint in gdb (on Linux)?

- load a shared library (say libfoo.so) into the process 
  memory; libfoo.so is not loaded by the running 
  application being debugged. 

- call a function defined in libfoo.so?

add-symbol-file file address doesn't seem to work.
info shared does not list the library (see below)

-------------

(gdb) info shared
>From        To          Syms Read   Shared Object Library
0x40017800  0x40017b04  Yes         ./libentry.so
0x42015380  0x421132e8  Yes         /lib/tls/libc.so.6
0x40000bd0  0x40011acf  Yes         /lib/ld-linux.so.2
(gdb) add-shared-symbol-file libfoo.so
This command is not available in this configuration of GDB.
(gdb) add-symbol-file libfoo.so 0x40018000
add symbol table from file "libfoo.so" at
        .text_addr = 0x40018000
(y or n) y
Reading symbols from libfoo.so...done.
Error in re-setting breakpoint 1:
Function "main" not defined.
(gdb) info shared
>From        To          Syms Read   Shared Object Library
0x40017800  0x40017b04  Yes         ./libentry.so
0x42015380  0x421132e8  Yes         /lib/tls/libc.so.6
0x40000bd0  0x40011acf  Yes         /lib/ld-linux.so.2

-----------------

Thanks in advance for your help,

Bharadwaj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]