Re: [RFA] Remove set debug lin-lwp-async, new ui_file.to_write_async_safe

Doug Evans
2011-05-10T20:51:47Z

[sorry for the resend]

Oh, btw, Heh, forgot ... testsuite run is in progress.
Will amend as necessary.

On Tue, May 10, 2011 at 1:46 PM, Doug Evans <dje@google.com> wrote:
>
> Hi.
>
> This patch does two things.
>
> 1) Remove debug_linux_nat_async, replacing all uses with debug_linux_nat.
>
> 2) Fix the debug printf in sigchld_handler.
>
> Adding to_write_async_safe (and the associated scaffolding) just
> for sigchld_handler may seem like a lot, but I *like* having a
> debug printf in sigchld_handler.  And given that it might be
> invoked more often now, I think we need to fix it and use a
> more signal-safe debug printer.
> I haven't added the higher level of abstraction (fprintf_unfiltered_async_safe
> or some such) and, e.g. the associated gettimeofday handling.
> That can be done later if it's useful enough.
>
> Pedro mentioned there being a lot more output because of this.
> I like what's there now, but I can imagine some tweaking may
> be needed.  I'd like to add some more debug printfs here,
> and I wouldn't mind having "set debug lin-lwp N" where N would
> specify a level of verbosity (0,1,2 at most probably).
>
> Ok to check in?
>
> 2011-05-10  Doug Evans  <dje@google.com>
>
>        * linux-nat.c (debug_linux_nat_async): Delete.
>        Replace all references to use debug_linux_nat instead.
>        (show_debug_linux_nat_async): Delete.
>        (sigchld_handler): Call ui_file_write_async_safe instead of
>        fprintf_unfiltered.
>        (_initialize_linux_nat): Remove `set debug lin-lwp-async'.
>        * ui-file.c (struct ui_file): New member to_write_async_safe.
>        (null_file_write_async_safe): New function.
>        (ui_file_write_async_safe): New function.
>        (set_ui_file_write_async_safe): New function.
>        (stdio_file_new): Initialize to_write_async_safe.
>        (stdio_file_write_async_safe): New function.
>        * ui-file.h (ui_file_write_async_safe_ftype): New typedef.
>        (set_ui_file_write_async_safe): Declare.
>        (ui_file_write_async_safe): Declare.
>
>        doc/
>        * gdb.texinfo (Completion): Update example.