public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29969] New: Fail to load file-backed mapping from arm coredump
@ 2023-01-06 15:15 jhaefliger at gmail dot com
  0 siblings, 0 replies; only message in thread
From: jhaefliger at gmail dot com @ 2023-01-06 15:15 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29969

            Bug ID: 29969
           Summary: Fail to load file-backed mapping from arm coredump
           Product: gdb
           Version: 10.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: jhaefliger at gmail dot com
  Target Milestone: ---

Created attachment 14561
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14561&action=edit
Archive containing the application and coredump

I'm trying to debug a crash of a simple application using a coredump. This
application has been cross-compiled on a Ubuntu 18.04 host
(x86_64-pc-linux-gnu) for an embedded device with an ARM cpu
(arm-buildroot-linux-uclibcgnueabi). I used buildroot as system builder to make
my distribution and run it with qemu (the issue is the same if I use the
device)

Application is very simple. It makes just an exception and then, Linux
generates a coredump accordingly:

#include <iostream>

int main() {
    std::cout << "Hello World! \n";
    throw std::exception();
    return 0;
}

This application has been compiled with gcc using following command:
arm-buildroot-linux-uclibcgnueabi-g++ -c -pipe -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0
--sysroot=/home/jerome/dev/oem/distro/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot
-O0 -g -std=gnu++11 -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG
-I../hello-world -I.
-I../oem/distro/buildroot/output/host/mkspecs/devices/linux-buildroot-g++ -o
main.o ../hello-world/main.cpp

GCC version is 11.3.0

When I try opening the coredump with the binary (that includes the symbols) on
my host, gdb failed to load file-backed mapping:
$ arm-buildroot-linux-uclibcgnueabi-gdb -x
~/dev/oem/distro/buildroot/output/staging/usr/share/buildroot/gdbinit
hello-world hello-world.6.468.core.1857

GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu
--target=arm-buildroot-linux-uclibcgnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello-world...

warning: Can't open file /usr/bin/hello-world during file-backed mapping note
processing

warning: Can't open file /lib/libuClibc-1.0.42.so during file-backed mapping
note processing

warning: Can't open file /lib/libgcc_s.so.1 during file-backed mapping note
processing

warning: Can't open file /usr/lib/libstdc++.so.6.0.29 during file-backed
mapping note processing

warning: Can't open file /lib/libatomic.so.1.2.0 during file-backed mapping
note processing

warning: Can't open file /lib/ld-uClibc-1.0.42.so during file-backed mapping
note processing
[New LWP 1857]
Core was generated by `hello-world'.
Program terminated with signal SIGABRT, Aborted.
#0  0xb6d44a9c in ?? ()
(gdb) add-symbol-file
add-symbol-file takes a file name and an address
(gdb) add-symbol-file hello-world
add symbol table from file "hello-world"
(y or n) y
Reading symbols from hello-world...
(gdb) bt
#0  0xb6d44a9c in ?? ()
#1  0xbeffcc00 in ?? ()
(gdb) maint print core-file-backed-mappings
(gdb) info proc mappings
Mapped address spaces:

        Start Addr   End Addr       Size     Offset objfile
          0x4a0000   0x4a1000     0x1000        0x0 /usr/bin/hello-world
          0x4b0000   0x4b1000     0x1000        0x0 /usr/bin/hello-world
          0x4b1000   0x4b2000     0x1000     0x1000 /usr/bin/hello-world
        0xb6cf5000 0xb6d64000    0x6f000        0x0 /lib/libuClibc-1.0.42.so
        0xb6d73000 0xb6d74000     0x1000    0x6e000 /lib/libuClibc-1.0.42.so
        0xb6d74000 0xb6d75000     0x1000    0x6f000 /lib/libuClibc-1.0.42.so
        0xb6d8b000 0xb6da8000    0x1d000        0x0 /lib/libgcc_s.so.1
        0xb6db7000 0xb6db8000     0x1000    0x1c000 /lib/libgcc_s.so.1
        0xb6db8000 0xb6db9000     0x1000    0x1d000 /lib/libgcc_s.so.1
        0xb6db9000 0xb6eff000   0x146000        0x0
/usr/lib/libstdc++.so.6.0.29
        0xb6f0f000 0xb6f14000     0x5000   0x146000
/usr/lib/libstdc++.so.6.0.29
        0xb6f14000 0xb6f17000     0x3000   0x14b000
/usr/lib/libstdc++.so.6.0.29
        0xb6f19000 0xb6f1c000     0x3000        0x0 /lib/libatomic.so.1.2.0
        0xb6f2b000 0xb6f2c000     0x1000     0x2000 /lib/libatomic.so.1.2.0
        0xb6f2c000 0xb6f2d000     0x1000     0x3000 /lib/libatomic.so.1.2.0
        0xb6f2e000 0xb6f34000     0x6000        0x0 /lib/ld-uClibc-1.0.42.so
        0xb6f44000 0xb6f45000     0x1000     0x6000 /lib/ld-uClibc-1.0.42.so
        0xb6f45000 0xb6f46000     0x1000     0x7000 /lib/ld-uClibc-1.0.42.so

============================

Content of gdbinit is:
add-auto-load-safe-path
/home/jerome/dev/oem/distro/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot
set sysroot
/home/jerome/dev/oem/distro/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot

If I move the hello-world to /usr/bin/hello-world, I can display the callstack
and is displayed as expected.

I have tried different versions of GDB and this problem is not present on 9.2
but present on 11.2. I suspect this change:
https://github.com/bminor/binutils-gdb/commit/db082f5979ff95409b7de7a2a96d083f2642c8c3#diff-b5a7f498799a7683f323e2c1f99ec3f921e1a1713df7480ad65fec9353bdaa5eR215
has introduced this issue but not 100% sure it is.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-06 15:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 15:15 [Bug gdb/29969] New: Fail to load file-backed mapping from arm coredump jhaefliger at gmail dot com

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