This is the mail archive of the gdb-prs@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]

[Bug gdb/16822] Segmentation fault on add-symbol-file command


https://sourceware.org/bugzilla/show_bug.cgi?id=16822

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com

--- Comment #4 from Keith Seitz <keiths at redhat dot com> ---
[reproduced on x86_64-linux/Fedora 20 with --target=tick6x-ti-elf]

GDB is crashing in dwarf2_physname on DW_AT_MIPS_linkage_name. This DIE is at
offset 0x144a:

 [  144a]    subprogram
             sibling              (ref4) [  14b8]
             name                 (string) "funcCall"
             low_pc               (addr) 0x000086c0 <funcCall>
             high_pc              (addr) 0x000086d0 <myTask>
             decl_column          (data1) 5
             decl_file            (data1) 1
             decl_line            (data1) 10
             external             (flag) Yes
             type                 (ref_addr) [  1fc7]
             MIPS_fde             (string) "funcCall"
             MIPS_tail_loop_begin (string) "../main.c"
             MIPS_epilog_begin    (data1) 10
             MIPS_loop_unroll_factor (data1) 5
             MIPS_software_pipeline_depth (string) "../main.c"
             MIPS_linkage_name    (data1) 13
             MIPS_stride          (data1) 1
             lo_user+0x14         (data1) 8

DW_AT_MIPS_linkage_name does not have a valid type. It should be a
NULL-terminated string of some sort.

Nonetheless, gdb should be able to recover gracefully from this situation. Here
is an unofficial patch/hack to reroute dwarf2_physname to using the computed
physname instead of the linkage name for this case:

---
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 64f7383..c7f94fd 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8517,7 +8517,10 @@ dwarf2_physname (const char *name, struct die_info *die,
struct dwarf2_cu *cu)

   /* DW_AT_linkage_name is missing in some cases - depend on what GDB
      has computed.  */
-  if (attr && DW_STRING (attr))
+  if (attr
+      && (attr->form == DW_FORM_strp || attr->form == DW_FORM_string
+      || attr->form == DW_FORM_GNU_strp_alt)
+      && DW_STRING (attr))
     {
       char *demangled;

---

This should prevent the sefault and get you going again until an official patch
is committed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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