Adding an auxiliary shared library to a debug session

Paul Pluzhnikov ppluzhnikov@google.com
Mon Nov 9 14:25:00 GMT 2009


On Sun, Nov 8, 2009 at 4:41 PM, Andriy Symonovych <sima.rv@gmail.com> wrote:

> I'm trying to do following:
> 1. I have `test` program running with PID 12345
> 2. I attach with gdb to it: gdb test 12345
> 3. Load my library somehow in GDB CLI, library contains some
> helper functions which I can call using GDB CLI `call` command
>
> I'm asking about 3rd step, is there any way to do this?

Assuming the inferior process is linked with libdl, giving this

  call dlopen("/mylib", 0)

to GDB would (I believe) do what you want.

[You may need to change 0 to whatever RTLD_LOCAL is on your system.]

Cheers,
-- 
Paul Pluzhnikov



More information about the Gdb mailing list