This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 11/22] Change command stats reporting to use class

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);

   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.

Pedro Alves

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]