This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 11/22] Change command stats reporting to use class
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Sun, 9 Oct 2016 18:01:48 +0100
- Subject: Re: [RFA 11/22] Change command stats reporting to use class
- Authentication-results: sourceware.org; auth=none
- References: <1474949330-4307-1-git-send-email-tom@tromey.com> <1474949330-4307-12-git-send-email-tom@tromey.com>
On 09/27/2016 05:08 AM, Tom Tromey wrote:
> This removes make_command_stats_cleanup in favor of an RAII class.
> The patch is reasonably straightforward, but keeping the same
> semantics required reindenting much of captured_main.
Did you try splitting the reindented code to a separate
function instead? Like:
-captured_main ()
+captured_main_1 ()
{
... existing code, except the command stats business
}
captured_main ()
{
#ifdef HAVE_SBRK
/* Set this before constructing scoped_command_stats. */
lim_at_start = (char *) sbrk (0);
#endif
{
scoped_command_stats stat_reporter (0);
captured_main_1 (...);
}
/* NOTE: cagney/1999-11-07: There is probably no reason for not
moving this loop and the code found in captured_command_loop()
into the command_loop() proper. The main thing holding back that
change - SET_TOP_LEVEL() - has been eliminated. */
while (1)
{
catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL);
}
}
I imagine that results in a much smaller diff, and probably
clearer code.
Once someone fixes that NOTE, then we can even remove the extra
scope around scoped_command_stats. Or if we fixed that NOTE
before this patch, then we wouldn't need the separate function
nor the reindenting at all.
Thanks,
Pedro Alves