[binutils-gdb] [gdb] Fix regression in dwarf2_name

Tom de Vries vries@sourceware.org
Wed Sep 30 19:49:04 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=95eb9e54a51fdb819c8525a0a33138d861f31bc8

commit 95eb9e54a51fdb819c8525a0a33138d861f31bc8
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Sep 30 21:49:01 2020 +0200

    [gdb] Fix regression in dwarf2_name
    
    Since commit 2c830f5475 "Change some uses of DW_STRING to string method" we
    have these regressions:
    ...
    FAIL: gdb.base/info-types-c++.exp: info types
    FAIL: gdb.cp/anon-struct.exp: print type of t::t
    FAIL: gdb.cp/anon-struct.exp: print type of X::t2
    FAIL: gdb.cp/anon-struct.exp: print type of X::t2::t2
    FAIL: gdb.cp/anon-struct.exp: print type of t3::~t3
    ...
    
    Fix these in dwarf2_name by updating attr_name each time attr is updated.
    
    Tested on x86_64-linux.
    
    gdb/ChangeLog:
    
    2020-09-30  Tom de Vries  <tdevries@suse.de>
    
            PR symtab/26683
            * dwarf2/read.c (dwarf2_name): Update attr_name after attr is updated.

Diff:
---
 gdb/ChangeLog     | 5 +++++
 gdb/dwarf2/read.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c448589b679..e297075f00b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-09-30  Tom de Vries  <tdevries@suse.de>
+
+	PR symtab/26683
+	* dwarf2/read.c (dwarf2_name): Update attr_name after attr is updated.
+
 2020-09-30  Tom Tromey  <tromey@adacore.com>
 
 	* dwarf2/read.c (handle_variant): Use constant_value.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index c0a89ecbe1e..973a375641e 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -22632,6 +22632,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
       if (!attr || attr_name == NULL)
 	{
 	  attr = dw2_linkage_name_attr (die, cu);
+	  attr_name = attr == nullptr ? nullptr : attr->as_string ();
 	  if (attr == NULL || attr_name == NULL)
 	    return NULL;
 
@@ -22645,6 +22646,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
 		return nullptr;
 
 	      attr->set_string_canonical (objfile->intern (demangled.get ()));
+	      attr_name = attr->as_string ();
 	    }
 
 	  /* Strip any leading namespaces/classes, keep only the


More information about the Gdb-cvs mailing list