Re: Disambiguating symbols by module

Matt Rice via Gdb
2021-09-03T14:32:01Z

On Thu, Sep 2, 2021 at 8:48 PM Alexander Miloslavskiy via Gdb
<gdb@sourceware.org> wrote:0x00007ffff6d7a3b0
>
> Hello,
>0x00007ffff6d7a3b0
> I spend much time debugging Java with GDB.
>
> In order to obtain current Java callstack, I do this:
> (gdb) call (void)ps()
>
> The problem is, the function's name is too short and gdb confuses it
> with a variable in a different library:
>
> (gdb) info var ^ps$
> File ../../cipher/blowfish.c:
> 256: static const u32 ps[18];
>
> (gdb) info function ^ps$
> Non-debugging symbols:
> 0x00007ffff6d7a3b0 ps
>
> Here, the symbol I want is a non-debugging symbol. This also means that
> I can't disambiguate it by the source file name.
>
> Is there a syntax to disambiguate the symbol?

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.