This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb: Incorrect stack unwinding if compressed debug info is used


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]