Use BLOCK_ENTRY_PC in place of most uses of BLOCK_START
[deliverable/binutils-gdb.git] / gdb / linespec.c
index b2deabe3af0a1adf9d4c4ea16ddd9babc79edadb..73fbe4af3be713281534f939e322af1d7e15547a 100644 (file)
@@ -1211,7 +1211,7 @@ find_methods (struct type *t, enum language t_lang, const char *name,
              std::vector<struct type *> *superclasses)
 {
   int ibase;
-  const char *class_name = type_name_no_tag (t);
+  const char *class_name = TYPE_NAME (t);
 
   /* Ignore this class if it doesn't have a name.  This is ugly, but
      unless we figure out how to get the physname without the name of
@@ -1501,8 +1501,6 @@ decode_line_2 (struct linespec_state *self,
   for (i = 0; i < result->size (); ++i)
     {
       const struct linespec_canonical_name *canonical;
-      struct decode_line_2_item *item;
-
       std::string displayform;
 
       canonical = &self->canonical_names[i];
@@ -1556,7 +1554,7 @@ decode_line_2 (struct linespec_state *self,
     {
       prompt = "> ";
     }
-  args = command_line_input (prompt, 0, "overload-choice");
+  args = command_line_input (prompt, "overload-choice");
 
   if (args == 0 || *args == 0)
     error_no_arg (_("one or more choice numbers"));
@@ -2196,6 +2194,7 @@ create_sals_line_offset (struct linespec_state *self,
 
            if (self->funfirstline)
              skip_prologue_sal (&intermediate_results[i]);
+           intermediate_results[i].symbol = sym;
            add_sal_to_sals (self, &values, &intermediate_results[i],
                             sym ? SYMBOL_NATURAL_NAME (sym) : NULL, 0);
          }
@@ -2224,6 +2223,7 @@ convert_address_location_to_sals (struct linespec_state *self,
   sal.pc = address;
   sal.section = find_pc_overlay (address);
   sal.explicit_pc = 1;
+  sal.symbol = find_pc_sect_containing_function (sal.pc, sal.section);
 
   std::vector<symtab_and_line> sals;
   add_sal_to_sals (self, &sals, &sal, core_addr_to_string (address), 1);
@@ -2283,7 +2283,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
                   && SYMBOL_CLASS (sym) == LOC_BLOCK)
                {
                  const CORE_ADDR addr
-                   = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
+                   = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
 
                  bound_minimal_symbol_d *elem;
                  for (int m = 0;
@@ -2292,10 +2292,25 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
                       ++m)
                    {
                      if (MSYMBOL_TYPE (elem->minsym) == mst_text_gnu_ifunc
-                         && BMSYMBOL_VALUE_ADDRESS (*elem) == addr)
+                         || MSYMBOL_TYPE (elem->minsym) == mst_data_gnu_ifunc)
                        {
-                         found_ifunc = true;
-                         break;
+                         CORE_ADDR msym_addr = BMSYMBOL_VALUE_ADDRESS (*elem);
+                         if (MSYMBOL_TYPE (elem->minsym) == mst_data_gnu_ifunc)
+                           {
+                             struct gdbarch *gdbarch
+                               = get_objfile_arch (elem->objfile);
+                             msym_addr
+                               = (gdbarch_convert_from_func_ptr_addr
+                                  (gdbarch,
+                                   msym_addr,
+                                   current_top_target ()));
+                           }
+
+                         if (msym_addr == addr)
+                           {
+                             found_ifunc = true;
+                             break;
+                           }
                        }
                    }
                }
@@ -3278,7 +3293,7 @@ decode_line_full (const struct event_location *location, int flags,
 
   if (select_mode == NULL)
     {
-      if (interp_ui_out (top_level_interpreter ())->is_mi_like_p ())
+      if (top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ())
        select_mode = multiple_symbols_all;
       else
        select_mode = multiple_symbols_select_mode ();
@@ -3682,7 +3697,7 @@ find_superclass_methods (std::vector<struct type *> &&superclasses,
     {
       std::vector<struct type *> new_supers;
 
-      for (struct type *t : superclasses)
+      for (type *t : superclasses)
        find_methods (t, name_lang, name, result_names, &new_supers);
 
       if (result_names->size () != old_len || new_supers.empty ())
@@ -4283,7 +4298,8 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
     {
       const char *msym_name = MSYMBOL_LINKAGE_NAME (msymbol);
 
-      if (MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc)
+      if (MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
+         || MSYMBOL_TYPE (msymbol) == mst_data_gnu_ifunc)
        want_start_sal = gnu_ifunc_resolve_name (msym_name, &func_addr);
       else
        want_start_sal = true;
@@ -4292,25 +4308,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
   symtab_and_line sal;
 
   if (is_function && want_start_sal)
-    {
-      sal = find_pc_sect_line (func_addr, NULL, 0);
-
-      if (self->funfirstline)
-       {
-         if (sal.symtab != NULL
-             && (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab))
-                 || SYMTAB_LANGUAGE (sal.symtab) == language_asm))
-           {
-             struct gdbarch *gdbarch = get_objfile_arch (objfile);
-
-             sal.pc = func_addr;
-             if (gdbarch_skip_entrypoint_p (gdbarch))
-               sal.pc = gdbarch_skip_entrypoint (gdbarch, sal.pc);
-           }
-         else
-           skip_prologue_sal (&sal);
-       }
-    }
+    sal = find_function_start_sal (func_addr, NULL, self->funfirstline);
   else
     {
       sal.objfile = objfile;
@@ -4466,7 +4464,7 @@ search_minsyms_for_name (struct collect_info *info,
         classification as the very first minsym in the list.  */
       classification = classify_mtype (MSYMBOL_TYPE (minsyms[0].minsym));
 
-      for (const struct bound_minimal_symbol &item : minsyms)
+      for (const bound_minimal_symbol &item : minsyms)
        {
          if (classify_mtype (MSYMBOL_TYPE (item.minsym)) != classification)
            break;
This page took 0.029378 seconds and 4 git commands to generate.