This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: gdb: Incorrect stack unwinding if compressed debug info is used
- From: Tom Tromey <tromey at redhat dot com>
- To: Vladimir Simonov <sv at sw dot ru>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 04 Feb 2011 09:34:20 -0700
- Subject: Re: gdb: Incorrect stack unwinding if compressed debug info is used
- References: <1296238472.3009.ezmlm@sourceware.org> <4D46D872.6080407@sw.ru>
>>>>> "Vladimir" == Vladimir Simonov <sv@sw.ru> writes:
Vladimir> I've spend some time and, looks like, found the problem. It is in
Vladimir> dwarf2_symbol_mark_computed function (dwarf2read.c). Check
Vladimir> "DW_UNSND (attr) < dwarf2_per_objfile->loc.size"
Vladimir> is incorrect if compressed section is used.
Thanks for finding this.
Since fill_in_loclist_baton is going to read the loc section right away
anyhow, it seems to me that it is simpler to just have
dwarf2_symbol_mark_computed do it.
Could you try the appended?
I didn't audit the other uses of .size (yet) to see if this problem
occurs elsewhere.
Tom
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 6a98d57..e1657b6 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -14361,6 +14361,13 @@ static void
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
{
+ if (attr_form_is_section_offset (attr))
+ /* We need to read the section before we can check its size,
+ because the size is only valid once the section is
+ uncompressed. */
+ dwarf2_read_section (dwarf2_per_objfile->objfile,
+ &dwarf2_per_objfile->loc);
+
if (attr_form_is_section_offset (attr)
/* ".debug_loc" may not exist at all, or the offset may be outside
the section. If so, fall through to the complaint in the