Factor out the common code in lookup_{static,global}_symbol
authorChristian Biesinger <cbiesinger@google.com>
Sat, 3 Aug 2019 00:59:37 +0000 (19:59 -0500)
committerChristian Biesinger <cbiesinger@google.com>
Mon, 26 Aug 2019 21:24:33 +0000 (16:24 -0500)
commit9aa5520697ee3b65bfbb705c21c2dfb2c0dee12e
treec08437ec87d4c527179d8aba096b6ba5cdbd71eb
parent5c31b35808e467d39d05ffa95428e22bb10fd72d
Factor out the common code in lookup_{static,global}_symbol

The two functions are extremely similar; this factors out their code into
a shared _internal function.

gdb/ChangeLog:

2019-08-26  Christian Biesinger  <cbiesinger@google.com>

* symtab.c (lookup_static_symbol): Call the new function (and move
it down to be next to lookup_global_symbol).
(struct global_sym_lookup_data): Add block_enum member and rename to...
(struct global_or_static_sym_lookup_data): ...this.
(lookup_symbol_global_iterator_cb): Pass block_index instead of
GLOBAL_BLOCK to lookup_symbol_in_objfile and rename to...
(lookup_symbol_global_or_static_iterator_cb): ...this.
(lookup_global_or_static_symbol): New function.
(lookup_global_symbol): Call new function.
gdb/ChangeLog
gdb/symtab.c