From: d.dorau@avm.de
To: musl@lists.openwall.com
Subject: [musl] Tracking shared libraries in GDB not working?
Date: Wed, 15 Dec 2021 14:10:12 +0100 [thread overview]
Message-ID: <OFDD2E28A9.281622C6-ONC12587AC.0045A9CE-C12587AC.00485872@avm.de> (raw)
In-Reply-To:
Hello,
I have an issue using gdb with musl and am hoping that you might be able to help me:
I am cross compiling a linux+musl based firmware for a MIPS platform and then
connecting a multiarch-gdb to a gdbserver on that device.
This seems to work well, as well as loading all necessary symbols from the host.
However, when running the application on the target device, gdb seems to be unable
to track the loading of shared libraries the application was linked against.
If I break at main() and enter "info shared", only the loader is shown.
gdb) target remote 192.168.190.33:2345
Remote debugging using 192.168.190.33:2345
Reading symbols from /home/ddorau/gu/GU_MASTER/filesystem_temp/usr/bin/pbd...
Reading symbols from /home/ddorau/gu/GU_MASTER/filesystem_temp/usr/bin/.debug/pbd...
Reading symbols from /home/ddorau/gu/GU_MASTER/filesystem_temp/lib/ld-musl-mips-sf.so.1...
Reading symbols from /home/ddorau/gu/GU_MASTER/filesystem_temp/lib/.debug/libc.so...
0x77f40ee0 in _dlstart () from /home/ddorau/gu/GU_MASTER/filesystem_temp/lib/ld-musl-mips-sf.so.1
(gdb) break main
Breakpoint 1 at 0x55557e10: file pbserver.c, line 11668.
(gdb) continue Continuing.
Breakpoint 1, main (argc=1, argv=0x7fffd564) at pbserver.c:11668
11668 {
(gdb) info shared
From To Syms Read Shared Object Library
0x77f40740 0x77fba844 Yes /home/ddorau/gu/GU_MASTER/filesystem_temp/lib/ld-musl-mips-sf.so.1
If I repeat that whole process on a glibc based ARM platform, it works as expected. There,
gdb is able to notice all shared libraries the application was linked against and shows them
correspondingly:
(gdb) i shared
From To Syms Read Shared Object Library
0xb6fcea00 0xb6fe9d90 Yes (*) /home/ddorau/gu/GU_MASTER/filesystem_temp/lib/ld-linux.so.3
0xb6faa168 0xb6fbbc08 Yes /home/ddorau/gu/GU_MASTER/filesystem_temp/usr/lib/libbsd.so.0
0xb6f956f0 0xb6f95cc8 Yes (*) /home/ddorau/gu/GU_MASTER/filesystem_temp/lib/libwdt.so.1
0xb6f7d0c8 0xb6f826e0 Yes (*) /home/ddorau/gu/GU_MASTER/filesystem_temp/lib/libmxml.so.1
0xb6f68984 0xb6f6994c Yes (*) /home/ddorau/gu/GU_MASTER/filesystem_temp/lib/libdl.so.2
[...]
The libraries are actually loaded successfully, just the gdbserver does not recognize this.
I'm not familiar with the internals, but assuming gdb would use some kind of breakpoint in the
loader to notice which libraries are loaded (and to what address).
It seems I am missing some necessary step for the platform using musl which would enable the same
behaviour. Am I maybe missing musl related patches for the gdbserver which allows it to track the
process of loading those shared libraries?
I would very much appreciate if anyone can help me find the missing piece.
Thanks
Daniel
next reply other threads:[~2021-12-15 13:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 13:10 d.dorau [this message]
2021-12-15 15:20 ` Rich Felker
2021-12-20 8:54 ` d.dorau
2022-01-09 5:14 ` Rich Felker
2023-01-10 20:02 ` Hauke Mehrtens
2023-01-17 23:14 ` Hauke Mehrtens
2023-01-18 16:03 ` Rich Felker
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=OFDD2E28A9.281622C6-ONC12587AC.0045A9CE-C12587AC.00485872@avm.de \
--to=d.dorau@avm.de \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).