summaryrefslogtreecommitdiff
path: root/gdb/minsyms.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-08 19:59:08 +0000
committerTom Tromey <tromey@redhat.com>2013-04-08 19:59:08 +0000
commit6aa27e60ba114f43a954ecbdce9d453820bb0c3b (patch)
treed166881d898a41b2349c36e4764c54dbc112bb4f /gdb/minsyms.c
parentfcb4486c32cb089362753f42c4e69ddb2aeee705 (diff)
downloadgdb-6aa27e60ba114f43a954ecbdce9d453820bb0c3b.tar.gz
* minsyms.h (struct bound_minimal_symbol): New.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol. Remove objfile argument. (lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc): Return bound_minimal_symbol. * minsyms.c (lookup_minimal_symbol_by_pc_1) (lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc): Return bound_minimal_symbol. (in_gnu_ifunc_stub): Update. (lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol. Remove 'objfile_p' argument. (lookup_solib_trampoline_symbol_by_pc): Update. * ada-tasks.c, amd64-windows-tdep.c, arm-tdep.c, arm-wince-tdep.c, block.c, blockframe.c, breakpoint.c, btrace.c, c-valprint.c, dwarf2loc.c, elfread.c, frame.c, frv-tdep.c, glibc-tdep.c, gnu-v2-abi.c, gnu-v3-abi.c, hppa-hpux-tdep.c, i386-tdep.c, ia64-tdep.c, infcall.c, infcmd.c, jit.c, linux-fork.c, m32c-tdep.c, m68hc11-tdep.c, maint.c, mips-tdep.c, p-valprint.c, parse.c, ppc-linux-tdep.c, ppc-sysv-tdep.c, printcmd.c, rs6000-tdep.c, sh64-tdep.c, stack.c, symtab.c, tui/tui-disasm.c: Update.
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r--gdb/minsyms.c57
1 files changed, 40 insertions, 17 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 900364aa524..6a94e112411 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -474,7 +474,7 @@ lookup_minimal_symbol_solib_trampoline (const char *name,
there are text and trampoline symbols at the same address.
Otherwise prefer mst_text symbols. */
-static struct minimal_symbol *
+static struct bound_minimal_symbol
lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc,
struct obj_section *section,
int want_trampoline)
@@ -485,6 +485,8 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc,
struct objfile *objfile;
struct minimal_symbol *msymbol;
struct minimal_symbol *best_symbol = NULL;
+ struct objfile *best_objfile = NULL;
+ struct bound_minimal_symbol result;
enum minimal_symbol_type want_type, other_type;
want_type = want_trampoline ? mst_solib_trampoline : mst_text;
@@ -690,14 +692,18 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc,
SYMBOL_VALUE_ADDRESS (&msymbol[hi]))))
{
best_symbol = &msymbol[hi];
+ best_objfile = objfile;
}
}
}
}
- return (best_symbol);
+
+ result.minsym = best_symbol;
+ result.objfile = best_objfile;
+ return result;
}
-struct minimal_symbol *
+struct bound_minimal_symbol
lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, struct obj_section *section)
{
if (section == NULL)
@@ -707,17 +713,31 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, struct obj_section *section)
debugging) always returns NULL making the call somewhat useless. */
section = find_pc_section (pc);
if (section == NULL)
- return NULL;
+ {
+ struct bound_minimal_symbol result;
+
+ memset (&result, 0, sizeof (result));
+ return result;
+ }
}
return lookup_minimal_symbol_by_pc_section_1 (pc, section, 0);
}
/* See minsyms.h. */
-struct minimal_symbol *
+struct bound_minimal_symbol
lookup_minimal_symbol_by_pc (CORE_ADDR pc)
{
- return lookup_minimal_symbol_by_pc_section (pc, NULL);
+ struct obj_section *section = find_pc_section (pc);
+
+ if (section == NULL)
+ {
+ struct bound_minimal_symbol result;
+
+ memset (&result, 0, sizeof (result));
+ return result;
+ }
+ return lookup_minimal_symbol_by_pc_section_1 (pc, section, 0);
}
/* Return non-zero iff PC is in an STT_GNU_IFUNC function resolver. */
@@ -725,9 +745,9 @@ lookup_minimal_symbol_by_pc (CORE_ADDR pc)
int
in_gnu_ifunc_stub (CORE_ADDR pc)
{
- struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
+ struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (pc);
- return msymbol && MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc;
+ return msymbol.minsym && MSYMBOL_TYPE (msymbol.minsym) == mst_text_gnu_ifunc;
}
/* See elf_gnu_ifunc_resolve_addr for its real implementation. */
@@ -785,10 +805,10 @@ const struct gnu_ifunc_fns *gnu_ifunc_fns_p = &stub_gnu_ifunc_fns;
/* See minsyms.h. */
-struct minimal_symbol *
-lookup_minimal_symbol_and_objfile (const char *name,
- struct objfile **objfile_p)
+struct bound_minimal_symbol
+lookup_minimal_symbol_and_objfile (const char *name)
{
+ struct bound_minimal_symbol result;
struct objfile *objfile;
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
@@ -802,13 +822,15 @@ lookup_minimal_symbol_and_objfile (const char *name,
{
if (strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0)
{
- *objfile_p = objfile;
- return msym;
+ result.minsym = msym;
+ result.objfile = objfile;
+ return result;
}
}
}
- return 0;
+ memset (&result, 0, sizeof (result));
+ return result;
}
@@ -1287,14 +1309,15 @@ static struct minimal_symbol *
lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc)
{
struct obj_section *section = find_pc_section (pc);
- struct minimal_symbol *msymbol;
+ struct bound_minimal_symbol msymbol;
if (section == NULL)
return NULL;
msymbol = lookup_minimal_symbol_by_pc_section_1 (pc, section, 1);
- if (msymbol != NULL && MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
- return msymbol;
+ if (msymbol.minsym != NULL
+ && MSYMBOL_TYPE (msymbol.minsym) == mst_solib_trampoline)
+ return msymbol.minsym;
return NULL;
}