From bd9269f70c70b1218b0eb73a6f487d6ca481e5ac Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Thu, 11 Sep 2014 11:43:04 +0100 Subject: Introduce common/symbol.h This introduces common/symbol.h. This file declares a function that the shared code can use and that the clients must implement. It also changes some shared code to use these functions. gdb/ChangeLog: * common/symbol.h: New file. * Makefile.in (HFILES_NO_SRCDIR): Add common/symbol.h. * minsyms.c (find_minimal_symbol_address): New function. * common/agent.c: Include common/symbol.h. [!GDBSERVER]: Don't include objfiles.h. (agent_look_up_symbols): Use find_minimal_symbol_address. gdb/gdbserver/ChangeLog: * symbol.c: New file. * Makefile.in (SFILES): Add symbol.c. (OBS): Add symbol.o. --- gdb/minsyms.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gdb/minsyms.c') diff --git a/gdb/minsyms.c b/gdb/minsyms.c index fd7fcd9fa56..8eb7c85d3d8 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -50,6 +50,7 @@ #include "cp-support.h" #include "language.h" #include "cli/cli-utils.h" +#include "symbol.h" /* Accumulate the minimal symbols for each objfile in bunches of BUNCH_SIZE. At the end, copy them all into one newly allocated location on an objfile's @@ -299,6 +300,21 @@ lookup_bound_minimal_symbol (const char *name) return lookup_minimal_symbol (name, NULL, NULL); } +/* See common/symbol.h. */ + +int +find_minimal_symbol_address (const char *name, CORE_ADDR *addr, + struct objfile *objfile) +{ + struct bound_minimal_symbol sym + = lookup_minimal_symbol (name, NULL, objfile); + + if (sym.minsym != NULL) + *addr = BMSYMBOL_VALUE_ADDRESS (sym); + + return sym.minsym == NULL; +} + /* See minsyms.h. */ void -- cgit v1.2.1