Your message dated Sun, 03 Aug 2025 16:59:00 -0400
with message-id <[email protected]>
and subject line Closing bug
has caused the Debian Bug report #352657,
regarding gdb incorrectly caches shared library symbol information
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
352657: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=352657
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gdb
Version: 6.4-1
Severity: normal
> cat a.c
int main()
{
return 0;
}
> rm -r b.c && touch b.c
> gcc -shared -o a.so a.c
> gcc -o a b.c a.so
> export LD_LIBRARY_PATH=`pwd`
> gdb ./a
...
(gdb) tb main
Breakpoint 1 at 0x8048384
(gdb) run
Starting program: /home/nikita/bug/a
Breakpoint 1 at 0xb7f6d66a
0xb7f6d66a in main () from /home/nikita/bug/a.so
(gdb) kill
Kill the program being debugged? (y or n) y
(gdb) file ./a
Load new symbol table from "/home/nikita/bug/a"? (y or n) y
Reading symbols from /home/nikita/bug/a...done.
(gdb) tb main
Cannot access memory at address 0xb7f6d664
Here, 'main' is defined in a shared library. As far as I understand, gdb
cached some information about a.so over 'file' command, but this
information got invalid.
This may be related to the fact that now on different executions of the same
program kernel maps same shared libraries at different addresses.
If program is executed at less once after 'file' command, problem disappears.
Also, problem disappears if 'nosharedlibrary' is entered before 'file'.
Note: the above command sequence is just a minimal example to trigger
the bug; initially we faced the bug in a complex environment, where gdb was
controlled by a wrapper script, and reloading file was required.
-- System Information:
Debian Release: 3.1
APT prefers proposed-updates
APT policy: (640, 'proposed-updates'), (640, 'stable'), (620,
'testing-proposed-updates'), (620, 'testing'), (600, 'unstable'), (550,
'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
Versions of packages gdb depends on:
ii libc6 2.3.5-8 GNU C Library: Shared libraries an
ii libncurses5 5.5-1 Shared libraries for terminal hand
ii libreadline5 5.0-10 GNU readline and history libraries
gdb recommends no packages.
-- no debconf information
--- End Message ---
--- Begin Message ---
Not surprisingly, I can't reproduce this on GDB 16.1:
--8<---------------cut here---------------start------------->8---
(gdb) tb main
Temporary breakpoint 1 at 0x112d: file 1.c, line 3.
(gdb) r
Starting program: /root/a.out
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Temporary breakpoint 1, main () at 1.c:3
3 return 0;
(gdb) kill
Kill the program being debugged? (y or n) y
[Inferior 1 (process 5849) killed]
(gdb) file ./a.out
Load new symbol table from "./a.out"? (y or n) y
Reading symbols from ./a.out...
(gdb) tb main
Temporary breakpoint 2 at 0x112d: file 1.c, line 3.
--8<---------------cut here---------------end--------------->8---
This bug is almost 20 years old; GDB has been almost completely
rewritten since then, and I don't recall seeing a similar problem
recently.
I'm taking the liberty to close this bug. Feel free reopen if it's
still applicable.
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/
signature.asc
Description: PGP signature
--- End Message ---