Re: [Question] Is there a way to specify an offset to the loaded symbols?

"Marten Ringwelski" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <C6PHAT5IYGSA.1APOB21T12C7M@marten-xps>
On Thu Oct 29, 2020 at 2:29 PM CET, Christian Biesinger wrote:
> On Thu, Oct 29, 2020 at 9:23 AM Marten Ringwelski <[email protected]>
> 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

Thank you, that was easier than expected!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.