public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Sterling Augustine <saugustine@google.com>
To: Matthew Rinaldi <mjrinal@g.clemson.edu>
Cc: gdb@sourceware.org
Subject: Re: Adding user-defined symbols to GDB
Date: Wed, 26 Jan 2022 17:53:16 -0800	[thread overview]
Message-ID: <CAEG7qUymXFo34WgSbdThWZdxvAx7zm16LQa7S+ghfwJ3ZWbp5g@mail.gmail.com> (raw)
In-Reply-To: <YfHfb8MDunW30KEd@ephemeral>

I don't know of a way to do it without an objfile, but the method in that
script is far more complicated than it needs to be.

I would have to work out the details, but a linker script with simple
symbol-value assignments could easily produce this.

symbol0 = value0
symbol1 = value1

then run ld with the right options so it doesn't pull in startfiles and
what not. Then add-symbol-file from inside gdb.

On Wed, Jan 26, 2022 at 3:55 PM Matthew Rinaldi via Gdb <gdb@sourceware.org>
wrote:

> Hello,
>
> I have a list of symbols that I have parsed out from a section within
> the binary. The data is not in any standard symbol table format. I have
> extracted the symbol's name and address. I want to add these symbols to
> GDB, but it is non-trivial. The solutions that I have seen for adding
> new user-defined symbols do not look ideal for a seemingly simple task.
>
> Example:
> https://github.com/mahaloz/decomp2gef/blob/main/decomp2gef.py#L247
>
> Is it possible to have a feature/command where the user could add
> symbols directly to GDB without the use of an objfile?
>
> I brought it up with Simon Marchi, and he said the following:
> > But off-hand, I don't see why this wouldn't be possible. Each objfile
> > could have a list of user-defined symbols, that lookup_symbol_in_objfile
> > would search in addition to the other regular methods.
>
> Thank you,
> Matthew Rinaldi
>

  reply	other threads:[~2022-01-27  1:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 23:55 Matthew Rinaldi
2022-01-27  1:53 ` Sterling Augustine [this message]
2022-01-28 16:25 ` Jan Vrany

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=CAEG7qUymXFo34WgSbdThWZdxvAx7zm16LQa7S+ghfwJ3ZWbp5g@mail.gmail.com \
    --to=saugustine@google.com \
    --cc=gdb@sourceware.org \
    --cc=mjrinal@g.clemson.edu \
    /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).