public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug backtrace/29074] New: gdb fails to find a shared library for a function
@ 2022-04-20 6:20 rui314 at gmail dot com
2023-07-31 22:18 ` [Bug backtrace/29074] " tromey at sourceware dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: rui314 at gmail dot com @ 2022-04-20 6:20 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29074
Bug ID: 29074
Summary: gdb fails to find a shared library for a function
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: backtrace
Assignee: unassigned at sourceware dot org
Reporter: rui314 at gmail dot com
Target Milestone: ---
It looks like gdb sometimes fails to find a shared library name for a function.
My shared library ends with something like this:
ruiu@blue:~/mold$ objdump -d liba.so
<<<omit>>>
0000000000001140 <_ZL5func2i>:
1140: 55 push %rbp
1141: 48 89 e5 mov %rsp,%rbp
1144: 48 83 ec 10 sub $0x10,%rsp
1148: 89 7d fc mov %edi,-0x4(%rbp)
114b: e8 c0 fe ff ff call 1010 <abort@plt>
ruiu@blue:~/mold$
So, the DSO's text segment ends with a call to `abort`. Since GCC knows `abort`
does not return, it can emit code like this.
When gdb tries to lookup a shared library using a function return address as a
key, the "return address" for the above function is one byte beyond the
executable segment of the DSO. Because of that, gdb fails to find a shared
library for that function. An example output is shown below:
Program received signal SIGABRT, Aborted.
0x00007ffff70b0cdb in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff70b0cdb in raise () from /lib64/libc.so.6
#1 0x00007ffff70b2375 in abort () from /lib64/libc.so.6
#2 0x00007ffff7ff0140 in func2(int) ()
#3 0x00007ffff7ff0123 in func(int) () from ./liba.so
#4 0x0000000000201149 in main () at a1.cpp:2
The third line from the bottom lacks the shared library name.
I believe gdb has to subtract one byte from a return address before using it to
lookup a shared library.
This is originally reported at https://github.com/rui314/mold/issues/444
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug backtrace/29074] gdb fails to find a shared library for a function
2022-04-20 6:20 [Bug backtrace/29074] New: gdb fails to find a shared library for a function rui314 at gmail dot com
@ 2023-07-31 22:18 ` tromey at sourceware dot org
2023-07-31 22:47 ` sam at gentoo dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-07-31 22:18 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29074
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Another case of bug#8416.
Easy to fix but I am not sure how to write a robust test.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug backtrace/29074] gdb fails to find a shared library for a function
2022-04-20 6:20 [Bug backtrace/29074] New: gdb fails to find a shared library for a function rui314 at gmail dot com
2023-07-31 22:18 ` [Bug backtrace/29074] " tromey at sourceware dot org
@ 2023-07-31 22:47 ` sam at gentoo dot org
2023-08-01 21:12 ` tromey at sourceware dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: sam at gentoo dot org @ 2023-07-31 22:47 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29074
Sam James <sam at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://sourceware.org/bugz
| |illa/show_bug.cgi?id=8416,
| |https://github.com/rui314/m
| |old/issues/444
CC| |sam at gentoo dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug backtrace/29074] gdb fails to find a shared library for a function
2022-04-20 6:20 [Bug backtrace/29074] New: gdb fails to find a shared library for a function rui314 at gmail dot com
2023-07-31 22:18 ` [Bug backtrace/29074] " tromey at sourceware dot org
2023-07-31 22:47 ` sam at gentoo dot org
@ 2023-08-01 21:12 ` tromey at sourceware dot org
2023-08-03 17:18 ` tromey at sourceware dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-08-01 21:12 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29074
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-08-01
Status|UNCONFIRMED |NEW
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org
Ever confirmed|0 |1
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug backtrace/29074] gdb fails to find a shared library for a function
2022-04-20 6:20 [Bug backtrace/29074] New: gdb fails to find a shared library for a function rui314 at gmail dot com
` (2 preceding siblings ...)
2023-08-01 21:12 ` tromey at sourceware dot org
@ 2023-08-03 17:18 ` tromey at sourceware dot org
2023-08-04 17:37 ` tromey at sourceware dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-08-03 17:18 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29074
--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Perhaps a non-robust test is good enough.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug backtrace/29074] gdb fails to find a shared library for a function
2022-04-20 6:20 [Bug backtrace/29074] New: gdb fails to find a shared library for a function rui314 at gmail dot com
` (3 preceding siblings ...)
2023-08-03 17:18 ` tromey at sourceware dot org
@ 2023-08-04 17:37 ` tromey at sourceware dot org
2023-08-26 16:34 ` cvs-commit at gcc dot gnu.org
2023-08-26 16:35 ` tromey at sourceware dot org
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-08-04 17:37 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29074
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2023-August/201370.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug backtrace/29074] gdb fails to find a shared library for a function
2022-04-20 6:20 [Bug backtrace/29074] New: gdb fails to find a shared library for a function rui314 at gmail dot com
` (4 preceding siblings ...)
2023-08-04 17:37 ` tromey at sourceware dot org
@ 2023-08-26 16:34 ` cvs-commit at gcc dot gnu.org
2023-08-26 16:35 ` tromey at sourceware dot org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-26 16:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29074
--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9030a82d6f700e03ab143f0d002e9f21ae2fd52f
commit 9030a82d6f700e03ab143f0d002e9f21ae2fd52f
Author: Tom Tromey <tom@tromey.com>
Date: Tue Aug 1 15:09:49 2023 -0600
Use get_frame_address_in_block in print_frame
The author of 'mold' pointed out that with a certain shared library,
gdb would fail to find the shared library's name in 'bt'.
The function in question appeared at the end of the .so's .text
segment and ended with a call to 'abort'.
This turned out to be a classic case of calling get_frame_pc when
get_frame_address_in_block is needed -- the former will be off-by-one
for purposes of finding the enclosing function or shared library.
The included test fails without the patch on my system. However, I
imagine it can't be assumed to reliably fail. Nevertheless it seemed
worth doing.
Regression tested on x86-64 Fedora 38.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29074
Reviewed-by: Kevin Buettner <kevinb@redhat.com>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug backtrace/29074] gdb fails to find a shared library for a function
2022-04-20 6:20 [Bug backtrace/29074] New: gdb fails to find a shared library for a function rui314 at gmail dot com
` (5 preceding siblings ...)
2023-08-26 16:34 ` cvs-commit at gcc dot gnu.org
@ 2023-08-26 16:35 ` tromey at sourceware dot org
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2023-08-26 16:35 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29074
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |14.1
Status|NEW |RESOLVED
--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-08-26 16:35 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 6:20 [Bug backtrace/29074] New: gdb fails to find a shared library for a function rui314 at gmail dot com
2023-07-31 22:18 ` [Bug backtrace/29074] " tromey at sourceware dot org
2023-07-31 22:47 ` sam at gentoo dot org
2023-08-01 21:12 ` tromey at sourceware dot org
2023-08-03 17:18 ` tromey at sourceware dot org
2023-08-04 17:37 ` tromey at sourceware dot org
2023-08-26 16:34 ` cvs-commit at gcc dot gnu.org
2023-08-26 16:35 ` tromey at sourceware dot org
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).