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]

[commit/dwarf2/Ada] Adjust handling of Ada DIEs after dwarf2_physname patch.


Hello,

This patch fixes some regressions introduced by the dwarf2_physname
patch.  For Ada, we prefer the DW_AT_MIPS_linkage_name if available
for the name attribute.  Eventually, we will want to be able to use
both, so that users can reference an entity using either linkage name
or natural name.  But that's for another time...

gdb/ChangeLog:

        Adjust handling of Ada DIEs after dwarf2_physname patch.
        * dwarf2read.c (dwarf2_compute_name): Add handling of Ada DIEs.

Tested on x86_64-linux. No regression. Checked in.

---
 gdb/dwarf2read.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1f25a45..fd75c74 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3324,6 +3324,9 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
    compute the physname for the object, which include a method's
    formal parameters (C++/Java) and return type (Java).
 
+   For Ada, return the DIE's linkage name rather than the fully qualified
+   name.  PHYSNAME is ignored..
+
    The result is allocated on the objfile_obstack and canonicalized.  */
 
 static const char *
@@ -3396,6 +3399,19 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
 	    }
 	}
     }
+  else if (cu->language == language_ada)
+    {
+      /* For Ada unit, we prefer the linkage name over the name, as
+	 the former contains the exported name, which the user expects
+	 to be able to reference.  Ideally, we want the user to be able
+	 to reference this entity using either natural or linkage name,
+	 but we haven't started looking at this enhancement yet.  */
+      struct attribute *attr;
+
+      attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+      if (attr && DW_STRING (attr))
+	name = DW_STRING (attr);
+    }
 
   return name;
 }
-- 
1.6.3.3


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