public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Christian Biesinger <cbiesinger@google.com>
To: Marten Ringwelski <git@maringuu.de>
Cc: Reuben Thomas via Gdb <gdb@sourceware.org>
Subject: Re: [Question] Is there a way to specify an offset to the loaded symbols?
Date: Thu, 29 Oct 2020 13:29:51 +0100	[thread overview]
Message-ID: <CAPTJ0XFkJJ=hPwzfN6LKeL-xGOuHJDkeq8cfSL2hxy3GOXHvEA@mail.gmail.com> (raw)
In-Reply-To: <C6P83HUYSLQG.1C4V3A4P7XZDD@marten-xps>

On Thu, Oct 29, 2020 at 9:23 AM Marten Ringwelski <git@maringuu.de> wrote:
>
> Hello,
> for some reason that is not important here I need to debug a binary that is executed by calling the linker manually.
> In my case I do `/lib/ld-musl-x86_64.so.1 binary`.
> The problem with this is that gdb now obviously thinks that I want to debug `/lib/ld-musl-x86_64.so.1`. This is not the case.
> Loading the symbols from `binary` does not help since the the linker loads the process into memory and the jumps to its main.
>
> In other words I have the symbols for the binary to be debugged but the binary is loaded into memory with an offset so the symbols are offseted.
> Is there any way to get this working?

add-symbol-file lets you specify an address but maybe it's easier if
you just use patchelf --set-interpreter to make it use
/lib/ld-musl-x86_64.so.1

Christian

  reply	other threads:[~2020-10-29 12:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  8:13 Marten Ringwelski
2020-10-29 12:29 ` Christian Biesinger [this message]
2020-10-29 15:26   ` Marten Ringwelski

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='CAPTJ0XFkJJ=hPwzfN6LKeL-xGOuHJDkeq8cfSL2hxy3GOXHvEA@mail.gmail.com' \
    --to=cbiesinger@google.com \
    --cc=gdb@sourceware.org \
    --cc=git@maringuu.de \
    /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).