summaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-12-06 12:49:55 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-12-14 10:56:47 +0000
commit2698da268bdd0b4a6815a15b41a42bac5f928ca7 (patch)
treeec64c7c492dff05d06e21431688b0a11a6c1b2d2 /gdb/symtab.c
parentb1e678d920e4468cfd69a40560ee24834f6bdce4 (diff)
downloadbinutils-gdb-2698da268bdd0b4a6815a15b41a42bac5f928ca7.tar.gz
gdb: add SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT
After the previous commit converted symbol-lookup debug to use the new debug scheme, this commit adds SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT. The previous commit didn't add SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT because symbol-lookup debug is controlled by an 'unsigned int' rather than a 'bool' control variable, we use the numeric value to offer different levels of verbosity for symbol-lookup debug. The *_SCOPED_DEBUG_ENTER_EXIT mechanism currently relies on capturing a reference to the bool control variable, and evaluating the variable both on entry, and at exit, this is done in the scoped_debug_start_end class (see gdbsupport/common-debug.h). This commit templates scoped_debug_start_end so that the class can accept either a 'bool &' or an invokable object, e.g. a lambda function, or a function pointer. The existing scoped_debug_start_end and scoped_debug_enter_exit macros in common-debug.h are updated to support scoped_debug_enter_exit being templated, however, nothing outside of common-debug.h needs to change. I've then added SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT in symtab.h, and added a couple of token uses in symtab.c. I didn't want to add too much in this first commit, this is really about updating common-debug.h to support this new functionality. Within symtab.h I created a couple of global functions that can be used to query the status of the symbol_lookup_debug control variable, these functions are then used within the two existing macros: symbol_lookup_debug_printf symbol_lookup_debug_printf_v and also in the new SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT macro.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 14d81f5468d..a7a54159b6d 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1950,6 +1950,8 @@ lookup_symbol_in_language (const char *name, const struct block *block,
const domain_enum domain, enum language lang,
struct field_of_this_result *is_a_field_of_this)
{
+ SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT;
+
demangle_result_storage storage;
const char *modified_name = demangle_for_lookup (name, lang, storage);
@@ -2072,6 +2074,8 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
const domain_enum domain, enum language language,
struct field_of_this_result *is_a_field_of_this)
{
+ SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT;
+
struct block_symbol result;
const struct language_defn *langdef;