From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org>
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH 2/2] gdb: add SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT
Date: Fri, 09 Dec 2022 10:42:39 -0700 [thread overview]
Message-ID: <87y1rgh3sg.fsf@tromey.com> (raw)
In-Reply-To: <73bdc6db114e7a511a2b91d9a9f5ac6f9f589881.1670348436.git.aburgess@redhat.com> (Andrew Burgess via Gdb-patches's message of "Tue, 6 Dec 2022 17:42:09 +0000")
>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
Andrew> After the previous commit converted symbol lookup debug to use the new
Andrew> debug scheme, this commit adds SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT.
Andrew> The previous commit updated 'set debug symbol-lookup' to use the new
Andrew> debug scheme, however SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT still does
Andrew> not exist. The reason for this is that 'set debug symbol-lookup'
Andrew> controls an integer variable, rather than a bool, and, depending on
Andrew> the value of this variable, different amounts of debug will be
Andrew> produced.
Andrew> Currently the *_SCOPED_DEBUG_ENTER_EXIT mechanism will only work for
Andrew> control variables of type bool, this is because the underlying
Andrew> scoped_debug_start_end class can only handle variables of type bool.
Andrew> This commit templates scoped_debug_start_end so that the class can
Andrew> accept either a 'bool &' or an invokable object, e.g. a lambda
Andrew> function, or a function pointer.
Andrew> The existing scoped_debug_start_end and scoped_debug_enter_exit macros
Andrew> in common-debug.h are updated to support scoped_debug_enter_exit being
Andrew> templated, however, nothing outside of common-debug.h needs to change.
Andrew> I've then added SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT in symtab.h, and
Andrew> added a couple of token uses in symtab.c. I didn't want to add too
Andrew> much in this first commit, this is really about updating
Andrew> common-debug.h to support this new ability.
This seems fine. I suppose inlining will make it not cost too much... ?
Andrew> +#define SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT \
Andrew> + scoped_debug_enter_exit ([&] () -> bool { \
Andrew> + return symbol_lookup_debug > 0; \
Andrew> + }, "symbol-lookup")
I wonder whether the [&] is needed here. I couldn't see what it is
capturing.
Tom
next prev parent reply other threads:[~2022-12-09 17:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 17:42 [PATCH 0/2] Convert symbol-lookup debug to new debug scheme Andrew Burgess
2022-12-06 17:42 ` [PATCH 1/2] gdb: convert 'set debug symbol-lookup' to new debug printing scheme Andrew Burgess
2022-12-09 17:41 ` Tom Tromey
2022-12-06 17:42 ` [PATCH 2/2] gdb: add SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT Andrew Burgess
2022-12-09 17:42 ` Tom Tromey [this message]
2022-12-09 17:48 ` Simon Marchi
2022-12-09 19:27 ` Andrew Burgess
2022-12-14 11:20 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y1rgh3sg.fsf@tromey.com \
--to=tom@tromey.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).