elf_backend_init_file_header
[deliverable/binutils-gdb.git] / gdb / objc-lang.c
index 22c12fff3bcc3bde24f097806bab84909f3424fe..946a0a1faed286bdec06d929b4cc8dbde97a97b2 100644 (file)
@@ -75,7 +75,7 @@ struct objc_method {
   CORE_ADDR imp;
 };
 
-static const struct objfile_data *objc_objfile_data;
+static const struct objfile_key<unsigned int> objc_objfile_data;
 
 /* Lookup a structure type named "struct NAME", visible in lexical
    block BLOCK.  If NOERR is nonzero, return zero if NAME is not
@@ -401,7 +401,6 @@ extern const struct language_defn objc_language_defn = {
   c_language_arch_info,
   default_print_array_index,
   default_pass_by_reference,
-  default_get_string,
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -409,7 +408,8 @@ extern const struct language_defn objc_language_defn = {
   &default_varobj_ops,
   NULL,
   NULL,
-  LANG_MAGIC
+  c_is_string_type_p,
+  "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
 /*
@@ -491,7 +491,7 @@ end_msglist (struct parser_state *ps)
   selname_chain = sel->next;
   msglist_len = sel->msglist_len;
   msglist_sel = sel->msglist_sel;
-  selid = lookup_child_selector (parse_gdbarch (ps), p);
+  selid = lookup_child_selector (ps->gdbarch (), p);
   if (!selid)
     error (_("Can't find selector \"%s\""), p);
   write_exp_elt_longcst (ps, selid);
@@ -605,9 +605,9 @@ info_selectors_command (const char *regexp, int from_tty)
     }
 
   /* First time thru is JUST to get max length and count.  */
-  for (objfile *objfile : all_objfiles (current_program_space))
+  for (objfile *objfile : current_program_space->objfiles ())
     {
-      for (minimal_symbol *msymbol : objfile_msymbols (objfile))
+      for (minimal_symbol *msymbol : objfile->msymbols ())
        {
          QUIT;
          name = MSYMBOL_NATURAL_NAME (msymbol);
@@ -645,9 +645,9 @@ info_selectors_command (const char *regexp, int from_tty)
 
       sym_arr = XALLOCAVEC (struct symbol *, matches);
       matches = 0;
-      for (objfile *objfile : all_objfiles (current_program_space))
+      for (objfile *objfile : current_program_space->objfiles ())
        {
-         for (minimal_symbol *msymbol : objfile_msymbols (objfile))
+         for (minimal_symbol *msymbol : objfile->msymbols ())
            {
              QUIT;
              name = MSYMBOL_NATURAL_NAME (msymbol);
@@ -759,9 +759,9 @@ info_classes_command (const char *regexp, int from_tty)
     }
 
   /* First time thru is JUST to get max length and count.  */
-  for (objfile *objfile : all_objfiles (current_program_space))
+  for (objfile *objfile : current_program_space->objfiles ())
     {
-      for (minimal_symbol *msymbol : objfile_msymbols (objfile))
+      for (minimal_symbol *msymbol : objfile->msymbols ())
        {
          QUIT;
          name = MSYMBOL_NATURAL_NAME (msymbol);
@@ -786,9 +786,9 @@ info_classes_command (const char *regexp, int from_tty)
                       regexp ? regexp : "*");
       sym_arr = XALLOCAVEC (struct symbol *, matches);
       matches = 0;
-      for (objfile *objfile : all_objfiles (current_program_space))
+      for (objfile *objfile : current_program_space->objfiles ())
        {
-         for (minimal_symbol *msymbol : objfile_msymbols (objfile))
+         for (minimal_symbol *msymbol : objfile->msymbols ())
            {
              QUIT;
              name = MSYMBOL_NATURAL_NAME (msymbol);
@@ -992,7 +992,7 @@ find_methods (char type, const char *theclass, const char *category,
 
   gdb_assert (symbol_names != NULL);
 
-  for (objfile *objfile : all_objfiles (current_program_space))
+  for (objfile *objfile : current_program_space->objfiles ())
     {
       unsigned int *objc_csym;
 
@@ -1003,12 +1003,12 @@ find_methods (char type, const char *theclass, const char *category,
 
       unsigned int objfile_csym = 0;
 
-      objc_csym = (unsigned int *) objfile_data (objfile, objc_objfile_data);
+      objc_csym = objc_objfile_data.get (objfile);
       if (objc_csym != NULL && *objc_csym == 0)
        /* There are no ObjC symbols in this objfile.  Skip it entirely.  */
        continue;
 
-      for (minimal_symbol *msymbol : objfile_msymbols (objfile))
+      for (minimal_symbol *msymbol : objfile->msymbols ())
        {
          QUIT;
 
@@ -1055,18 +1055,14 @@ find_methods (char type, const char *theclass, const char *category,
        }
 
       if (objc_csym == NULL)
-       {
-         objc_csym = XOBNEW (&objfile->objfile_obstack, unsigned int);
-         *objc_csym = objfile_csym;
-         set_objfile_data (objfile, objc_objfile_data, objc_csym);
-       }
+       objc_csym = objc_objfile_data.emplace (objfile, objfile_csym);
       else
        /* Count of ObjC methods in this objfile should be constant.  */
        gdb_assert (*objc_csym == objfile_csym);
     }
 }
 
-/* Uniquify a VEC of strings.  */
+/* Uniquify a vector of strings.  */
 
 static void
 uniquify_strings (std::vector<const char *> *strings)
@@ -1297,18 +1293,17 @@ find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *),
                             CORE_ADDR pc, 
                             CORE_ADDR *new_pc)
 {
-  TRY
+  try
     {
       if (f (pc, new_pc) == 0)
        return 1;
     }
-  CATCH (ex, RETURN_MASK_ALL)
+  catch (const gdb_exception &ex)
     {
       exception_fprintf (gdb_stderr, ex,
                         "Unable to determine target of "
                         "Objective-C method call (ignoring):\n");
     }
-  END_CATCH
 
   return 0;
 }
@@ -1576,9 +1571,3 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
     return 1;
   return 0;
 }
-
-void
-_initialize_objc_lang (void)
-{
-  objc_objfile_data = register_objfile_data ();
-}
This page took 0.027716 seconds and 4 git commands to generate.