[PATCHv2,10/18] gdb: Override store_sym_names_in_linkage_form_p for Go language

Message ID 6f536bde4ccb11596c92a0787eb90a5026641cdd.1596638296.git.andrew.burgess@embecosm.com
State New
Headers show
Series
  • Further updates for the language class structure
Related show

Commit Message

Andrew Burgess Aug. 5, 2020, 2:45 p.m.
When store_sym_names_in_linkage_form_p was introduced in this commit:

  commit 59cc4834e53565da1de4a7b615ed8890ed55c7da
  Date:   Tue Mar 27 08:57:16 2018 -0500

      problem looking up some symbols when they have a linkage name

A special case was left behind for Go, however, this special case was
not really needed anymore, it could be handled by having
store_sym_names_in_linkage_form_p return the true for go, instead of
false.

This commit overrides store_sym_names_in_linkage_form_p for Go, and
then removes the special case.  As store_sym_names_in_linkage_form_p
is only called once throughout GDB this should be perfectly safe.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* dwarf2/read.c (dwarf2_physname): Remove special case for
	language_go.
	* go-lang.c (go_language::store_sym_names_in_linkage_form_p): New
	member function.
---
 gdb/ChangeLog     | 7 +++++++
 gdb/dwarf2/read.c | 6 ------
 gdb/go-lang.c     | 4 ++++
 3 files changed, 11 insertions(+), 6 deletions(-)

-- 
2.25.4

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 521e0dd5029..20d90d4a45f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -10600,12 +10600,6 @@  dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
 	{
 	  /* Do nothing (do not demangle the symbol name).  */
 	}
-      else if (cu->language == language_go)
-	{
-	  /* This is a lie, but we already lie to the caller new_symbol.
-	     new_symbol assumes we return the mangled name.
-	     This just undoes that lie until things are cleaned up.  */
-	}
       else
 	{
 	  /* Use DMGL_RET_DROP for C++ template functions to suppress
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index ed18f01dbdc..dfc0dddc616 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -638,6 +638,10 @@  class go_language : public language_defn
 	    && go_classify_struct_type (type) == GO_TYPE_STRING);
   }
 
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
 };
 
 /* Single instance of the Go language class.  */