]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/go-lang.c
Make gdb.base/index-cache.exp work with readnow board (PR 24669)
[thirdparty/binutils-gdb.git] / gdb / go-lang.c
index 022b8de2da64d9cc707e6a60ddd03426c4d9e07e..6473468d4d96ba9a403d51a0bd2b0d458ea627dc 100644 (file)
@@ -1,6 +1,6 @@
 /* Go language support routines for GDB, the GNU debugger.
 
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
+   Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -106,8 +106,8 @@ static int
 sixg_string_p (struct type *type)
 {
   if (TYPE_NFIELDS (type) == 2
-      && TYPE_TAG_NAME (type) != NULL
-      && strcmp (TYPE_TAG_NAME (type), "string") == 0)
+      && TYPE_NAME (type) != NULL
+      && strcmp (TYPE_NAME (type), "string") == 0)
     return 1;
 
   return 0;
@@ -130,6 +130,16 @@ go_classify_struct_type (struct type *type)
   return GO_TYPE_NONE;
 }
 
+/* Return true if TYPE is a string.  */
+
+static bool
+go_is_string_type_p (struct type *type)
+{
+  type = check_typedef (type);
+  return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+         && go_classify_struct_type (type) == GO_TYPE_STRING);
+}
+
 /* Subroutine of unpack_mangled_go_symbol to simplify it.
    Given "[foo.]bar.baz", store "bar" in *PACKAGEP and "baz" in *OBJECTP.
    We stomp on the last '.' to nul-terminate "bar".
@@ -577,7 +587,6 @@ extern const struct language_defn go_language_defn =
   NULL,
   &exp_descriptor_c,
   go_parse,
-  go_yyerror,
   null_post_parser,
   c_printchar,                 /* Print a character constant.  */
   c_printstr,                  /* Function to print string constant.  */
@@ -590,6 +599,7 @@ extern const struct language_defn go_language_defn =
   default_read_var_value,      /* la_read_var_value */
   NULL,                                /* Language specific skip_trampoline.  */
   NULL,                                /* name_of_this */
+  false,                       /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal, 
   basic_lookup_transparent_type,
   go_demangle,                 /* Language specific symbol demangler.  */
@@ -612,7 +622,8 @@ extern const struct language_defn go_language_defn =
   &default_varobj_ops,
   NULL,
   NULL,
-  LANG_MAGIC
+  go_is_string_type_p,
+  "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
 static void *