examining Linux core file?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

examining Linux core file?

Chuck Tuffli-2
If a Linux application running under the Linux emulation  (a.k.a.
Linuxulator) core dumps, is it possible to examine the resulting core
file? lldb didn't seem to like it:

# file mremap05.core
mremap05.core: ELF 64-bit LSB core file x86-64, version 1 (FreeBSD),
FreeBSD-style, from 'ases/bin/mremap05'
# lldb -c mremap05.core testcases/bin/mremap05
(lldb) target create "testcases/bin/mremap05" --core "mremap05.core"
error: Unable to find process plug-in for core file
'/compat/linux/opt/ltp/mremap05.core'
(lldb) bt
error: invalid process

FreeBSD's gdb seems to recognize this is as Linux, but doesn't know
where to go from there:
# /usr/libexec/gdb -q ./testcases/bin/mremap05 mremap05.core

warning: A handler for the OS ABI "GNU/Linux" is not built into this
configuration
of GDB.  Attempting to continue with the default i386:x86-64 settings.

Dwarf Error: wrong version in compilation unit header (is 4, should be
2) [in module /compat/linux/opt/ltp/testcases/bin/mremap05]

warning: core file may not match specified executable file.
Core was generated by `./testcases/bin/mremap05'.
Program terminated with signal 11, Segmentation fault.
#0  0x0040eb01 in ?? ()
(gdb) bt
#0  0x0040eb01 in ?? ()
Cannot access memory at address 0xdbea00

The gdb from CentOS, on the other hand, seems to think this is a FreeBSD core:
# gdb -q ./testcases/bin/mremap05 mremap05.core
Reading symbols from /opt/ltp/testcases/bin/mremap05...done.

warning: A handler for the OS ABI "FreeBSD ELF" is not built into this
configuration
of GDB.  Attempting to continue with the default i386:x86-64 settings.

"/opt/ltp/mremap05.core": no core file handler recognizes format

Are there any other approaches to  consider? TIA.

--chuck
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: examining Linux core file?

Benjamin Kaduk-2
On Sun, Jan 14, 2018 at 07:57:01AM -0800, Chuck Tuffli wrote:
> If a Linux application running under the Linux emulation  (a.k.a.
> Linuxulator) core dumps, is it possible to examine the resulting core
> file? lldb didn't seem to like it:

I wonder how a Linux gdb running under the Linuxulator would fare
with it?

-Ben
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: examining Linux core file?

Chuck Tuffli-2
On Sun, Jan 14, 2018 at 7:31 PM, Benjamin Kaduk <[hidden email]> wrote:
> On Sun, Jan 14, 2018 at 07:57:01AM -0800, Chuck Tuffli wrote:
>> If a Linux application running under the Linux emulation  (a.k.a.
>> Linuxulator) core dumps, is it possible to examine the resulting core
>> file? lldb didn't seem to like it:
>
> I wonder how a Linux gdb running under the Linuxulator would fare
> with it?

Sorry, that's what I was trying to show with the last example. The
Linux gdb from CentOS running under the Linuxulator gives:

# gdb -q ./testcases/bin/mremap05 mremap05.core
Reading symbols from /opt/ltp/testcases/bin/mremap05...done.

warning: A handler for the OS ABI "FreeBSD ELF" is not built into this
configuration
of GDB.  Attempting to continue with the default i386:x86-64 settings.

"/opt/ltp/mremap05.core": no core file handler recognizes format

--chuck
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: examining Linux core file?

Pedro Giffuni-4
In reply to this post by Chuck Tuffli-2
> On Sun, Jan 14, 2018 at 7:31 PM, Benjamin Kaduk <[hidden email]> wrote:
> > On Sun, Jan 14, 2018 at 07:57:01AM -0800, Chuck Tuffli wrote:
> >> If a Linux application running under the Linux emulation  (a.k.a.
> >> Linuxulator) core dumps, is it possible to examine the resulting core
> >> file? lldb didn't seem to like it:
> >
> > I wonder how a Linux gdb running under the Linuxulator would fare
> > with it?
>
> Sorry, that's what I was trying to show with the last example. The
> Linux gdb from CentOS running under the Linuxulator gives:
>
> # gdb -q ./testcases/bin/mremap05 mremap05.core
> Reading symbols from /opt/ltp/testcases/bin/mremap05...done.
>
> warning: A handler for the OS ABI "FreeBSD ELF" is not built into this
> configuration
> of GDB.  Attempting to continue with the default i386:x86-64 settings.
>
> "/opt/ltp/mremap05.core": no core file handler recognizes format

Weird, I think you would need to build a cross-gdb.

My memory is sketchy but you may need to build a complete
cross-toolchain for that. Long-long ago we actually did that but the
resulting linux binaries were weird and needed branding always.

Pedro.

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: examining Linux core file?

Konstantin Belousov
On Mon, Jan 15, 2018 at 10:02:58PM -0500, Pedro Giffuni wrote:

> > On Sun, Jan 14, 2018 at 7:31 PM, Benjamin Kaduk <[hidden email]> wrote:
> > > On Sun, Jan 14, 2018 at 07:57:01AM -0800, Chuck Tuffli wrote:
> > >> If a Linux application running under the Linux emulation  (a.k.a.
> > >> Linuxulator) core dumps, is it possible to examine the resulting core
> > >> file? lldb didn't seem to like it:
> > >
> > > I wonder how a Linux gdb running under the Linuxulator would fare
> > > with it?
> >
> > Sorry, that's what I was trying to show with the last example. The
> > Linux gdb from CentOS running under the Linuxulator gives:
> >
> > # gdb -q ./testcases/bin/mremap05 mremap05.core
> > Reading symbols from /opt/ltp/testcases/bin/mremap05...done.
> >
> > warning: A handler for the OS ABI "FreeBSD ELF" is not built into this
> > configuration
> > of GDB.  Attempting to continue with the default i386:x86-64 settings.
> >
> > "/opt/ltp/mremap05.core": no core file handler recognizes format
>
> Weird, I think you would need to build a cross-gdb.
>
> My memory is sketchy but you may need to build a complete
> cross-toolchain for that. Long-long ago we actually did that but the
> resulting linux binaries were weird and needed branding always.

No cross-toolchain will help there.  Problem is that the binary is Linux,
while core is FreeBSD.  There are enough details significant to the debugger
that make such combination a new platform.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: examining Linux core file?

O'Connor, Daniel-2


> On 16 Jan 2018, at 20:29, Konstantin Belousov <[hidden email]> wrote:
>>
>> My memory is sketchy but you may need to build a complete
>> cross-toolchain for that. Long-long ago we actually did that but the
>> resulting linux binaries were weird and needed branding always.
>
> No cross-toolchain will help there.  Problem is that the binary is Linux,
> while core is FreeBSD.  There are enough details significant to the debugger
> that make such combination a new platform.

Using ktrace / linux_kdump might help - or at least give some clues as to where it's failing too.

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: examining Linux core file?

Chuck Tuffli-2
On Tue, Jan 16, 2018 at 5:30 PM, O'Connor, Daniel <[hidden email]> wrote:

>
>
>> On 16 Jan 2018, at 20:29, Konstantin Belousov <[hidden email]> wrote:
>>>
>>> My memory is sketchy but you may need to build a complete
>>> cross-toolchain for that. Long-long ago we actually did that but the
>>> resulting linux binaries were weird and needed branding always.
>>
>> No cross-toolchain will help there.  Problem is that the binary is Linux,
>> while core is FreeBSD.  There are enough details significant to the debugger
>> that make such combination a new platform.
>
> Using ktrace / linux_kdump might help - or at least give some clues as to where it's failing too.

The ktrace output is interesting. Is there any way to show the address
causing the segfault?

dmesg shows:
pid 1123 (apt-get), uid 0: exited on signal 11 (core dumped)

ktrace shows:
...
  1123 apt-get  1516724569.278210 CALL  L64  write(0x1,0x800644000,0x21)
  1123 apt-get  1516724569.284901 GIO   L64  fd 1 wrote 33 bytes
       "\rBuilding dependency tree... 50%\r"
  1123 apt-get  1516724569.291711 RET   L64  write 33/0x21
  1123 apt-get  1516724569.298353 CALL  L64  gettimeofday(0x7fffffffd410,0)
  1123 apt-get  1516724569.305308 RET   L64  gettimeofday 0
  1123 apt-get  1516724569.312174 PSIG  L64  SIGSEGV SIG_DFL code=SEGV_MAPERR
  1123 apt-get  1516724569.312183 NAMI  L64  "apt-get.core"

--chuck
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: examining Linux core file?

O'Connor, Daniel-2


> On 24 Jan 2018, at 11:15, Chuck Tuffli <[hidden email]> wrote:
>>
>> Using ktrace / linux_kdump might help - or at least give some clues as to where it's failing too.
>
> The ktrace output is interesting. Is there any way to show the address
> causing the segfault?

Not AFAIK, because ktrace only knows about syscalls :(

> dmesg shows:
> pid 1123 (apt-get), uid 0: exited on signal 11 (core dumped)
>
> ktrace shows:
> ...
>  1123 apt-get  1516724569.278210 CALL  L64  write(0x1,0x800644000,0x21)
>  1123 apt-get  1516724569.284901 GIO   L64  fd 1 wrote 33 bytes
>       "\rBuilding dependency tree... 50%\r"
>  1123 apt-get  1516724569.291711 RET   L64  write 33/0x21
>  1123 apt-get  1516724569.298353 CALL  L64  gettimeofday(0x7fffffffd410,0)
>  1123 apt-get  1516724569.305308 RET   L64  gettimeofday 0
>  1123 apt-get  1516724569.312174 PSIG  L64  SIGSEGV SIG_DFL code=SEGV_MAPERR
>  1123 apt-get  1516724569.312183 NAMI  L64  "apt-get.core"

Looks pretty innocent.. :-/

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: examining Linux core file?

John Baldwin
In reply to this post by Chuck Tuffli-2
On Sunday, January 14, 2018 07:57:01 AM Chuck Tuffli wrote:

> If a Linux application running under the Linux emulation  (a.k.a.
> Linuxulator) core dumps, is it possible to examine the resulting core
> file? lldb didn't seem to like it:
>
> # file mremap05.core
> mremap05.core: ELF 64-bit LSB core file x86-64, version 1 (FreeBSD),
> FreeBSD-style, from 'ases/bin/mremap05'
> # lldb -c mremap05.core testcases/bin/mremap05
> (lldb) target create "testcases/bin/mremap05" --core "mremap05.core"
> error: Unable to find process plug-in for core file
> '/compat/linux/opt/ltp/mremap05.core'
> (lldb) bt
> error: invalid process
>
> FreeBSD's gdb seems to recognize this is as Linux, but doesn't know
> where to go from there:
> # /usr/libexec/gdb -q ./testcases/bin/mremap05 mremap05.core
>
> warning: A handler for the OS ABI "GNU/Linux" is not built into this
> configuration
> of GDB.  Attempting to continue with the default i386:x86-64 settings.
>
> Dwarf Error: wrong version in compilation unit header (is 4, should be
> 2) [in module /compat/linux/opt/ltp/testcases/bin/mremap05]
>
> warning: core file may not match specified executable file.
> Core was generated by `./testcases/bin/mremap05'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x0040eb01 in ?? ()
> (gdb) bt
> #0  0x0040eb01 in ?? ()
> Cannot access memory at address 0xdbea00
>
> The gdb from CentOS, on the other hand, seems to think this is a FreeBSD core:
> # gdb -q ./testcases/bin/mremap05 mremap05.core
> Reading symbols from /opt/ltp/testcases/bin/mremap05...done.
>
> warning: A handler for the OS ABI "FreeBSD ELF" is not built into this
> configuration
> of GDB.  Attempting to continue with the default i386:x86-64 settings.
>
> "/opt/ltp/mremap05.core": no core file handler recognizes format
>
> Are there any other approaches to  consider? TIA.

Try gdb from ports.

--
John Baldwin
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"