This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[obv] (reread_symbols): Reset psymtabs_addrmap to NULL
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Wed, 3 Jun 2009 17:52:24 -0700 (PDT)
- Subject: [obv] (reread_symbols): Reset psymtabs_addrmap to NULL
Hi.
Rerunning an executable after stripping it crashes gdb:
gdb$ gcc -g hello.c -o hello.x64
gdb$ ./gdb -nx hello.x64
GNU gdb (GDB) 6.8.50.20090603-cvs
Copyright (C) 2009 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 "x86_64-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) start
Temporary breakpoint 1 at 0x40049c: file hello.c, line 6.
Starting program: /usr/local/g3/gnu/sourceware/addr-map-segv/build/obj64/gdb/hello.x64
Temporary breakpoint 1, main () at hello.c:6
6 printf ("Hello.\n");
(gdb) shell strip hello.x64
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
`/usr/local/g3/gnu/sourceware/addr-map-segv/build/obj64/gdb/hello.x64' has changed; re-reading symbols.
(no debugging symbols found)
Starting program: /usr/local/g3/gnu/sourceware/addr-map-segv/build/obj64/gdb/hello.x64
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Segmentation fault
gdb$
I traced it to a stray psymtabs_addrmap pointer.
Checked in as obvious.
2009-06-03 Doug Evans <dje@google.com>
* symfile.c (reread_symbols): Reset psymtabs_addrmap to NULL
after discarding its contents.
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.229
diff -u -p -r1.229 symfile.c
--- symfile.c 24 May 2009 12:27:35 -0000 1.229
+++ symfile.c 4 Jun 2009 00:46:57 -0000
@@ -2361,6 +2361,7 @@ reread_symbols (void)
objfile->sections = NULL;
objfile->symtabs = NULL;
objfile->psymtabs = NULL;
+ objfile->psymtabs_addrmap = NULL;
objfile->free_psymtabs = NULL;
objfile->cp_namespace_symtab = NULL;
objfile->msymbols = NULL;