public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Matt Rice <ratmice@gmail.com>
To: Alexander Miloslavskiy <alexandr.miloslavskiy@gmail.com>
Cc: GDB <gdb@sourceware.org>
Subject: Re: Disambiguating symbols by module
Date: Fri, 3 Sep 2021 14:53:30 +0000	[thread overview]
Message-ID: <CACTLOFrNX5BY7S9cLV5H1sZpWnNs6H_U7eZ2HH6AP8cNMfXXTQ@mail.gmail.com> (raw)
In-Reply-To: <eb710c06-9bba-6621-8b0c-27fe0abc669a@gmail.com>

On Fri, Sep 3, 2021 at 2:35 PM Alexander Miloslavskiy
<alexandr.miloslavskiy@gmail.com> 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.

  reply	other threads:[~2021-09-03 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 20:48 Alexander Miloslavskiy
2021-09-03 14:31 ` Matt Rice
2021-09-03 14:35   ` Alexander Miloslavskiy
2021-09-03 14:53     ` Matt Rice [this message]
2021-09-03 14:57       ` Alexander Miloslavskiy
2021-09-03 16:06         ` Martin Simmons
2021-09-03 16:13           ` Alexander Miloslavskiy
2021-09-03 16:25 ` Christian Biesinger
2021-09-03 20:58   ` Alexander Miloslavskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACTLOFrNX5BY7S9cLV5H1sZpWnNs6H_U7eZ2HH6AP8cNMfXXTQ@mail.gmail.com \
    --to=ratmice@gmail.com \
    --cc=alexandr.miloslavskiy@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).