Re: Disambiguating symbols by module
Matt Rice via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CACTLOFrNX5BY7S9cLV5H1sZpWnNs6H_U7eZ2HH6AP8cNMfXXTQ@mail.gmail.com> |
On Fri, Sep 3, 2021 at 2:35 PM Alexander Miloslavskiy <[email protected]> wrote: > > > > On 03.09.2021 17:31, Matt Rice wrote: > > Been a while since I've needed to do this, but IIRC you can just set a > > breakpoint using the symbol address too, like: > > > > (gdb) break *0x00007ffff6d7a3b0 > > > > I don't know of or believe there is any nicer syntax like > > object_file.o:symbol_name, which one could imagine might be possible. > > Thanks! > > Right, currently in order to call 'ps()' I have to manually do the > following: > > (gdb) info function ^ps$ > Non-debugging symbols: > 0x00007ffff6d7a3b0 ps > > (gdb) call (void)0x00007ffff6d7a3b0() > > That is, I manually find the address, then use it to call the function. > > I'd like to avoid that extra first step somehow and have some > address-independent command. I don't really know of any satisfactory solution then... The best workaround I can come up with is to put the address in a convience variable (which could perhaps be automated with some python scripts in your gdbinit, to gain some address independence). (gdb) set $ps = 0x00007ffff6d7a3b0 With that, you can at least use: (gdb) call (void)($ps)() I haven't tried it, but if you look at https://sourceware.org/systemtap/wiki/MakeDoWithoutDebugInfo Given that there is some probe support in gdb, maybe there is a way to make use of kprobe.module(NAME).function(FUNCTION) to get the address.