Fix dwarf2_string_attr for -gsplit-dwarf

Message ID 20171025092432.108380-1-leszeks@google.com
State New, archived
Headers

Commit Message

Terekhov, Mikhail via Gdb-patches Oct. 25, 2017, 9:24 a.m. UTC
  The dwarf2_string_attr did not allow DW_FORM_GNU_str_index as a form for
string types. This manifested as null strings in the namespace_name
lookup (replaced with "(anonymous namespace)") when debugging
Fission-compiled code.

gdb/ChangeLog:

	* dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_strp_alt.

(cherry picked from commits 16eb6b2db49e6cf2fdca56efd37689fcc170cd37 and
b33404388e5bbd8a1fddfde73cd4593ae2b557e8)
---
 gdb/ChangeLog    | 4 ++++
 gdb/dwarf2read.c | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Comments

Yao Qi Oct. 25, 2017, 2:53 p.m. UTC | #1
"Leszek Swirski via gdb-patches" <gdb-patches@sourceware.org> writes:

> gdb/ChangeLog:
>
> 	* dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_strp_alt.

s/DW_FORM_GNU_strp_alt/DW_FORM_GNU_str_index

Otherwise, patch is good to me.
  
Simon Marchi Oct. 25, 2017, 3:25 p.m. UTC | #2
On 2017-10-25 05:24, Leszek Swirski via gdb-patches wrote:
> The dwarf2_string_attr did not allow DW_FORM_GNU_str_index as a form 
> for
> string types. This manifested as null strings in the namespace_name
> lookup (replaced with "(anonymous namespace)") when debugging
> Fission-compiled code.
> 
> gdb/ChangeLog:
> 
> 	* dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_strp_alt.
> 
> (cherry picked from commits 16eb6b2db49e6cf2fdca56efd37689fcc170cd37 
> and
> b33404388e5bbd8a1fddfde73cd4593ae2b557e8)
> ---
>  gdb/ChangeLog    | 4 ++++
>  gdb/dwarf2read.c | 4 +++-
>  2 files changed, 7 insertions(+), 1 deletion(-)

Hi Leszek,

It's not mentioned, but from the context of the ChangeLog change, I 
understand this is for the 8.0 branch?  8.0.1 was already released, and 
I don't know if there are plans for a 8.0.2.  But in any case, 
cherry-picking this fix doesn't hurt for anybody building from the 
gdb-8.0-branch.

Thanks,

Simon
  
Terekhov, Mikhail via Gdb-patches Oct. 25, 2017, 3:27 p.m. UTC | #3
> It's not mentioned, but from the context of the ChangeLog change, I
> understand this is for the 8.0 branch?  8.0.1 was already released, and I
> don't know if there are plans for a 8.0.2.  But in any case, cherry-picking
> this fix doesn't hurt for anybody building from the gdb-8.0-branch.

Yes, sorry, I should have made that clearer.
  
Simon Marchi Oct. 26, 2017, 11:44 p.m. UTC | #4
On 2017-10-25 11:27, Leszek Swirski via gdb-patches wrote:
>> It's not mentioned, but from the context of the ChangeLog change, I
>> understand this is for the 8.0 branch?  8.0.1 was already released, 
>> and I
>> don't know if there are plans for a 8.0.2.  But in any case, 
>> cherry-picking
>> this fix doesn't hurt for anybody building from the gdb-8.0-branch.
> 
> Yes, sorry, I should have made that clearer.

I pushed the patch and added a reference to the original PR in the 
ChangeLog.

Thanks!

Simon
  
Terekhov, Mikhail via Gdb-patches Oct. 27, 2017, 9:18 a.m. UTC | #5
> I pushed the patch and added a reference to the original PR in the
> ChangeLog.

Thanks Simon.
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b77435ce7a..bfa2359a35 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@ 
+2017-10-25  Leszek Swirski  <leszeks@google.com>
+
+	* dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_str_index.
+
 2017-10-16  Walfred Tedeschi  <walfred.tedeschi@intel.com>
 
 	* features/Makefile (i386-avx-mpx-avx512-pku.dat): Add backslash 
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8503e6171c..93ec587787 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17577,7 +17577,9 @@  dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c
   if (attr != NULL)
     {
       if (attr->form == DW_FORM_strp || attr->form == DW_FORM_line_strp
-	  || attr->form == DW_FORM_string || attr->form == DW_FORM_GNU_strp_alt)
+	  || attr->form == DW_FORM_string
+	  || attr->form == DW_FORM_GNU_str_index
+	  || attr->form == DW_FORM_GNU_strp_alt)
 	str = DW_STRING (attr);
       else
         complaint (&symfile_complaints,