diff options
-rw-r--r-- | gdb/cp-namespace.c | 17 | ||||
-rw-r--r-- | gdb/symtab.c | 13 | ||||
-rw-r--r-- | gdb/symtab.h | 7 |
3 files changed, 20 insertions, 17 deletions
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 544ebcf..e5ef54d 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -539,23 +539,6 @@ cp_lookup_symbol_via_imports (const char *scope, return {}; } -/* Helper function that searches an array of symbols for one named NAME. */ - -static struct symbol * -search_symbol_list (const char *name, int num, - struct symbol **syms) -{ - int i; - - /* Maybe we should store a dictionary in here instead. */ - for (i = 0; i < num; ++i) - { - if (strcmp (name, syms[i]->natural_name ()) == 0) - return syms[i]; - } - return NULL; -} - /* Search for symbols whose name match NAME in the given SCOPE. if BLOCK is a function, we'll search first through the template parameters and function type. Afterwards (or if BLOCK is not a function) diff --git a/gdb/symtab.c b/gdb/symtab.c index 5e65b89..9aa7064 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -372,6 +372,19 @@ from_scripting_domain (int val) /* See symtab.h. */ +struct symbol * +search_symbol_list (const char *name, int num, struct symbol **syms) +{ + for (int i = 0; i < num; ++i) + { + if (strcmp (name, syms[i]->natural_name ()) == 0) + return syms[i]; + } + return nullptr; +} + +/* See symtab.h. */ + CORE_ADDR linetable_entry::pc (const struct objfile *objfile) const { diff --git a/gdb/symtab.h b/gdb/symtab.h index d5fe90a..3d766fd 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2980,4 +2980,11 @@ extern void info_sources_worker (struct ui_out *uiout, std::optional<CORE_ADDR> find_epilogue_using_linetable (CORE_ADDR func_addr); +/* Search an array of symbols for one named NAME. Name comparison is + done using strcmp -- i.e., this is only useful for simple names. + Returns the symbol, if found, or nullptr if not. */ + +extern struct symbol *search_symbol_list (const char *name, int num, + struct symbol **syms); + #endif /* !defined(SYMTAB_H) */ |