[RFC PATCH] gdb: add linux_nat_debug_printf macro

Simon Marchi simon.marchi@efficios.com
Wed Aug 19 03:44:22 GMT 2020


On 2020-08-18 11:39 p.m., Simon Marchi wrote:
> On 2020-08-18 10:56 p.m., Simon Marchi wrote:
>> I remember I tried it and didn't like it much.  Printing longer identifiers didn't
>> help readability.  And usually we have enough context to know what the debug
>> statement is about, especially with the [linux-nat] prefix.
> 
> Although when dealing with lambdas (which includes SCOPE_EXIT), it can be quite unhelpful:
> 
>   [infrun] operator(): ...
> 
> With __PRETTY_FUNCTION__ it's a bit better:
> 
>   [infrun] stop_all_threads()::<lambda()>: ...
> 
> For that reason, we should maybe consider using __PRETTY_FUNCTION__.

Ah, now I remember why I didn't like it.  It puts the full prototype of the function:

  [infrun] void handle_inferior_event(execution_control_state*): status->kind = stopped, signal = GDB_SIGNAL_TRAP

You can imagine that it can be quite long, so it adds quite a lot of noise.  We would
need something in between, like __PRETTY_FUNCTION__ but without the parameters.

Simon


More information about the Gdb-patches mailing list