Add dwarf2_per_objfile member to DWARF batons
[deliverable/binutils-gdb.git] / gdb / language.c
index 03985d3e0cc092ef7722cf45f73f052a01785244..ff76ae7ece608676badf5b2ae715066cf269c40d 100644 (file)
@@ -410,7 +410,7 @@ language_info (int quietly)
 int
 pointer_type (struct type *type)
 {
-  return TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type);
+  return type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type);
 }
 
 \f
@@ -500,19 +500,6 @@ language_str (enum language lang)
   return languages[lang]->la_name;
 }
 
-static void
-set_check (const char *ignore, int from_tty)
-{
-  printf_unfiltered (
-     "\"set check\" must be followed by the name of a check subcommand.\n");
-  help_list (setchecklist, "set check ", all_commands, gdb_stdout);
-}
-
-static void
-show_check (const char *ignore, int from_tty)
-{
-  cmd_show_list (showchecklist, from_tty, "");
-}
 \f
 
 /* Build and install the "set language LANG" command.  */
@@ -684,9 +671,12 @@ default_word_break_characters (void)
 /* Print the index of array elements using the C99 syntax.  */
 
 void
-default_print_array_index (struct value *index_value, struct ui_file *stream,
+default_print_array_index (struct type *index_type, LONGEST index,
+                          struct ui_file *stream,
                           const struct value_print_options *options)
 {
+  struct value *index_value = value_from_longest (index_type, index);
+
   fprintf_filtered (stream, "[");
   LA_VALUE_PRINT (index_value, stream, options);
   fprintf_filtered (stream, "] = ");
@@ -699,14 +689,14 @@ default_symbol_name_matcher (const char *symbol_search_name,
                             const lookup_name_info &lookup_name,
                             completion_match_result *comp_match_res)
 {
-  const std::string &name = lookup_name.name ();
+  gdb::string_view name = lookup_name.name ();
   completion_match_for_lcd *match_for_lcd
     = (comp_match_res != NULL ? &comp_match_res->match_for_lcd : NULL);
   strncmp_iw_mode mode = (lookup_name.completion_mode ()
                          ? strncmp_iw_mode::NORMAL
                          : strncmp_iw_mode::MATCH_PARAMS);
 
-  if (strncmp_iw_with_mode (symbol_search_name, name.c_str (), name.size (),
+  if (strncmp_iw_with_mode (symbol_search_name, name.data (), name.size (),
                            mode, language_minimal, match_for_lcd) == 0)
     {
       if (comp_match_res != NULL)
@@ -723,12 +713,12 @@ bool
 default_is_string_type_p (struct type *type)
 {
   type = check_typedef (type);
-  while (TYPE_CODE (type) == TYPE_CODE_REF)
+  while (type->code () == TYPE_CODE_REF)
     {
       type = TYPE_TARGET_TYPE (type);
       type = check_typedef (type);
     }
-  return (TYPE_CODE (type)  == TYPE_CODE_STRING);
+  return (type->code ()  == TYPE_CODE_STRING);
 }
 
 /* See language.h.  */
@@ -792,14 +782,12 @@ unk_lang_print_type (struct type *type, const char *varstring,
 }
 
 static void
-unk_lang_val_print (struct type *type,
-                   int embedded_offset, CORE_ADDR address,
-                   struct ui_file *stream, int recurse,
-                   struct value *val,
-                   const struct value_print_options *options)
+unk_lang_value_print_inner (struct value *val,
+                           struct ui_file *stream, int recurse,
+                           const struct value_print_options *options)
 {
   error (_("internal error - unimplemented "
-          "function unk_lang_val_print called."));
+          "function unk_lang_value_print_inner called."));
 }
 
 static void
@@ -859,7 +847,7 @@ const struct language_defn unknown_language_defn =
   unk_lang_emit_char,
   unk_lang_print_type,         /* Print a type using appropriate syntax */
   default_print_typedef,       /* Print a typedef using appropriate syntax */
-  unk_lang_val_print,          /* Print a value using appropriate syntax */
+  unk_lang_value_print_inner,  /* la_value_print_inner */
   unk_lang_value_print,                /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   unk_lang_trampoline,         /* Language specific skip_trampoline */
@@ -910,7 +898,7 @@ const struct language_defn auto_language_defn =
   unk_lang_emit_char,
   unk_lang_print_type,         /* Print a type using appropriate syntax */
   default_print_typedef,       /* Print a typedef using appropriate syntax */
-  unk_lang_val_print,          /* Print a value using appropriate syntax */
+  unk_lang_value_print_inner,  /* la_value_print_inner */
   unk_lang_value_print,                /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   unk_lang_trampoline,         /* Language specific skip_trampoline */
@@ -996,7 +984,7 @@ language_bool_type (const struct language_defn *la,
        {
          struct type *type = SYMBOL_TYPE (sym);
 
-         if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
+         if (type && type->code () == TYPE_CODE_BOOL)
            return type;
        }
     }
@@ -1014,7 +1002,7 @@ language_lookup_primitive_type_1 (const struct language_arch_info *lai,
 
   for (p = lai->primitive_type_vector; (*p) != NULL; p++)
     {
-      if (strcmp (TYPE_NAME (*p), name) == 0)
+      if (strcmp ((*p)->name (), name) == 0)
        return p;
     }
   return NULL;
@@ -1052,10 +1040,11 @@ language_alloc_type_symbol (enum language lang, struct type *type)
   gdbarch = TYPE_OWNER (type).gdbarch;
   symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
 
-  symbol->m_name = TYPE_NAME (type);
+  symbol->m_name = type->name ();
   symbol->set_language (lang, nullptr);
   symbol->owner.arch = gdbarch;
   SYMBOL_OBJFILE_OWNED (symbol) = 0;
+  SYMBOL_SECTION (symbol) = 0;
   SYMBOL_TYPE (symbol) = type;
   SYMBOL_DOMAIN (symbol) = VAR_DOMAIN;
   SYMBOL_ACLASS_INDEX (symbol) = LOC_TYPEDEF;
@@ -1151,15 +1140,15 @@ _initialize_language ()
 
   /* GDB commands for language specific stuff.  */
 
-  add_prefix_cmd ("check", no_class, set_check,
-                 _("Set the status of the type/range checker."),
-                 &setchecklist, "set check ", 0, &setlist);
+  add_basic_prefix_cmd ("check", no_class,
+                       _("Set the status of the type/range checker."),
+                       &setchecklist, "set check ", 0, &setlist);
   add_alias_cmd ("c", "check", no_class, 1, &setlist);
   add_alias_cmd ("ch", "check", no_class, 1, &setlist);
 
-  add_prefix_cmd ("check", no_class, show_check,
-                 _("Show the status of the type/range checker."),
-                 &showchecklist, "show check ", 0, &showlist);
+  add_show_prefix_cmd ("check", no_class,
+                      _("Show the status of the type/range checker."),
+                      &showchecklist, "show check ", 0, &showlist);
   add_alias_cmd ("c", "check", no_class, 1, &showlist);
   add_alias_cmd ("ch", "check", no_class, 1, &showlist);
 
This page took 0.028447 seconds and 4 git commands to generate.