This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Fix occasional unresolving of line number info
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 8 Feb 2011 12:28:36 +0100
- Subject: [patch] Fix occasional unresolving of line number info
Hi,
glibc-2.12.90-21.x86_64
glibc-debuginfo-2.12.90-21.x86_64
gdb -nx /lib64/libgcc_s.so.1 -ex 'l _Unwind_RaiseException' -ex q
No line number known for _Unwind_RaiseException.
The problem is that objfile->symtabs is unordered while the current code
expects some ordering. In this case `s' is $24 so the entry $20 is never
found.
(gdb) plist objfile->symtabs filename
$7 = 0x2057e20 "/usr/include/stdio.h"
$8 = 0x2057df0 "/usr/include/sys/ucontext.h"
$9 = 0x2057dc0 "/usr/include/bits/sigstack.h"
$10 = 0x2057d90 "/usr/include/bits/sigcontext.h"
$11 = 0x2057d60 "../../../gcc/unwind-dw2.h"
$12 = 0x2057d00 "/usr/src/debug/gcc-4.5.1-20100924/obj-x86_64-redhat-linux/gcc/include/unwind.h"
$13 = 0x2057cd0 "../../../include/dwarf2.h"
$14 = 0x2057ca0 "../../../gcc/config/i386/i386.h"
$15 = 0x2057c60 "/usr/include/bits/pthreadtypes.h"
$16 = 0x2057c30 "/usr/include/bits/sigset.h"
$17 = 0x2057c00 "/usr/include/libio.h"
$18 = 0x2057bd0 "/usr/include/bits/types.h"
$19 = 0x2057b70 "/usr/src/debug/gcc-4.5.1-20100924/obj-x86_64-redhat-linux/gcc/include/stddef.h"
$20 = 0x2057b40 "../../../gcc/unwind.inc"
$21 = 0x2057b10 "../../../gcc/gthr-posix.h"
$22 = 0x2057ad0 "../../../gcc/config/i386/linux-unwind.h"
$23 = 0x2057aa0 "../../../gcc/unwind-dw2-fde.h"
$24 = 0x2057a70 "../../../gcc/unwind-dw2.c"
$25 = 0x2057a40 "../../../gcc/unwind-pe.h"
I have checked all the other iterations via symtab->next use the whole list of
objfile->symtabs.
There may have been some intended ordering of psymtabs before addrmap was
introduced, not sure.
I do not have a minimal testcase, though. Still this cannot be a regression.
No regressions on {x86_64,x86_64-m32,i686}-fedora14-linux-gnu.
Thanks,
Jan
gdb/
2011-02-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* symtab.c (find_pc_sect_line): New variable objfile, initialize it
from S. Iterate S using ALL_OBJFILE_SYMTABS. Verify BV for each S.
* symtab.h (struct symtab) <next>: Comment extension.
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1904,6 +1904,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
struct blockvector *bv;
struct minimal_symbol *msymbol;
struct minimal_symbol *mfunsym;
+ struct objfile *objfile;
/* Info on best line seen so far, and where it starts, and its file. */
@@ -2031,13 +2032,17 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
}
bv = BLOCKVECTOR (s);
+ objfile = s->objfile;
/* Look at all the symtabs that share this blockvector.
They all have the same apriori range, that we found was right;
but they have different line tables. */
- for (; s && BLOCKVECTOR (s) == bv; s = s->next)
+ ALL_OBJFILE_SYMTABS (objfile, s)
{
+ if (BLOCKVECTOR (s) != bv)
+ continue;
+
/* Find the best line in this symtab. */
l = LINETABLE (s);
if (!l)
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -738,8 +738,7 @@ struct section_offsets
struct symtab
{
-
- /* Chain of all existing symtabs. */
+ /* Unordered chain of all existing symtabs of this objfile. */
struct symtab *next;