public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* dwfl_link_map_report() on a core file with sysroot? Opens the wrong solibs?
@ 2018-12-13 20:27 Luke Diamand
       [not found] ` <CAORpzuOC4yGnrbtYjD=kxhJ-ytfJ0tQ3+iDq1NPZ9g8jenVi0g@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Luke Diamand @ 2018-12-13 20:27 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Roland McGrath

I'm trying to get callstacks out of a core file using libdwfl where
the ELF files live in a sysroot (and are from a different
architecture, ARM).

I'm possibly doing something stupid as I find that
dwfl_link_map_report() opens /lib/libpthread.so on the *host* rather
than the libpthread.so from my sysroot. It obviously doesn't then get
very far.

I called elf_begin(), dwfl_begin() and then dwfl_core_file_report(),
passing in the path to the executable (in the sysroot).

There's a comment in link_map.c around line 390 which says:

// XXX hook for sysroot

So inspired by this, I hacked in some code to open files relative to
my sysroot and it all started working.

Am I just missing some obvious setup, or is this just missing sysroot support?

Thanks!
Luke

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dwfl_link_map_report() on a core file with sysroot? Opens the wrong solibs?
       [not found] ` <CAORpzuOC4yGnrbtYjD=kxhJ-ytfJ0tQ3+iDq1NPZ9g8jenVi0g@mail.gmail.com>
@ 2018-12-14 13:44   ` Luke Diamand
  2019-01-06 21:04     ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Luke Diamand @ 2018-12-14 13:44 UTC (permalink / raw)
  To: Roland McGrath; +Cc: elfutils-devel

On Thu, 13 Dec 2018 at 22:37, Roland McGrath <roland@hack.frob.com> wrote:
>
> I think it's just missing. The hardest part is just deciding how the configuration should work.

Thanks. My current attempt adds a new function call,
dwfl_set_sysroot(), which works, but feels a bit clunky. I might see
if I can just use the find_elf callback instead.


>
> On Thu, Dec 13, 2018, 12:27 Luke Diamand <luke@diamand.org wrote:
>>
>> I'm trying to get callstacks out of a core file using libdwfl where
>> the ELF files live in a sysroot (and are from a different
>> architecture, ARM).
>>
>> I'm possibly doing something stupid as I find that
>> dwfl_link_map_report() opens /lib/libpthread.so on the *host* rather
>> than the libpthread.so from my sysroot. It obviously doesn't then get
>> very far.
>>
>> I called elf_begin(), dwfl_begin() and then dwfl_core_file_report(),
>> passing in the path to the executable (in the sysroot).
>>
>> There's a comment in link_map.c around line 390 which says:
>>
>> // XXX hook for sysroot
>>
>> So inspired by this, I hacked in some code to open files relative to
>> my sysroot and it all started working.
>>
>> Am I just missing some obvious setup, or is this just missing sysroot support?
>>
>> Thanks!
>> Luke
>>
> --
>
>
> Thanks,
> Roland

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dwfl_link_map_report() on a core file with sysroot? Opens the wrong solibs?
  2018-12-14 13:44   ` Luke Diamand
@ 2019-01-06 21:04     ` Mark Wielaard
  2019-01-06 22:04       ` Luke Diamand
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2019-01-06 21:04 UTC (permalink / raw)
  To: Luke Diamand; +Cc: Roland McGrath, elfutils-devel

On Fri, Dec 14, 2018 at 01:44:17PM +0000, Luke Diamand wrote:
> On Thu, 13 Dec 2018 at 22:37, Roland McGrath <roland@hack.frob.com> wrote:
> >
> > I think it's just missing. The hardest part is just deciding how the configuration should work.
> 
> Thanks. My current attempt adds a new function call,
> dwfl_set_sysroot(), which works, but feels a bit clunky. I might see
> if I can just use the find_elf callback instead.

If you got this working please let us know.
It might help others and/or deciding how to add a proper
interface/config/hook for it.

Thanks,

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dwfl_link_map_report() on a core file with sysroot? Opens the wrong solibs?
  2019-01-06 21:04     ` Mark Wielaard
@ 2019-01-06 22:04       ` Luke Diamand
  0 siblings, 0 replies; 4+ messages in thread
From: Luke Diamand @ 2019-01-06 22:04 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Roland McGrath, elfutils-devel

On Sun, 6 Jan 2019 at 21:04, Mark Wielaard <mark@klomp.org> wrote:
>
> On Fri, Dec 14, 2018 at 01:44:17PM +0000, Luke Diamand wrote:
> > On Thu, 13 Dec 2018 at 22:37, Roland McGrath <roland@hack.frob.com> wrote:
> > >
> > > I think it's just missing. The hardest part is just deciding how the configuration should work.
> >
> > Thanks. My current attempt adds a new function call,
> > dwfl_set_sysroot(), which works, but feels a bit clunky. I might see
> > if I can just use the find_elf callback instead.
>
> If you got this working please let us know.
> It might help others and/or deciding how to add a proper
> interface/config/hook for it.
>

I have a fix which I think does the right thing - I've been playing
around with core files from a Raspberry Pi and analysing them on a
Linux x86 PC using eu-stack. Christmas and New Year intervened but I
hope to submit something once I've recovered from that.

Thanks!
Luke

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-06 22:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 20:27 dwfl_link_map_report() on a core file with sysroot? Opens the wrong solibs? Luke Diamand
     [not found] ` <CAORpzuOC4yGnrbtYjD=kxhJ-ytfJ0tQ3+iDq1NPZ9g8jenVi0g@mail.gmail.com>
2018-12-14 13:44   ` Luke Diamand
2019-01-06 21:04     ` Mark Wielaard
2019-01-06 22:04       ` Luke Diamand

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).