[PATCH] dynamic printf

Stan Shebs stanshebs@earthlink.net
Tue Mar 13 23:20:00 GMT 2012


On 2/29/12 10:22 AM, Eli Zaretskii wrote:
>> Date: Tue, 28 Feb 2012 23:03:49 -0800
>> From: Stan Shebs<stanshebs@earthlink.net>
>>
>> This patch implements a "dynamic printf", which is basically a
>> breakpoint with a printf;continue as its command list - but with
>> additional features that make it more interesting.
> Thanks.  I cannot say I like the name, though: the "dynamic" part has
> no mnemonic value at all.

The idea is that it works like the "static" printf that has to be wired 
into the code, but can be added and removed on the fly - aka 
"dynamically".  I'm not wedded to the terminology though, what else 
would one call it?

>> +  add_cmd ("agent-printf", class_maintenance, agent_printf_command,
>> +	   _("Translate an expression into remote "
>> +	     "agent bytecode for evaluation."),
>> +	&maintenancelist);
> This new command seems to be undocumented.

Yes, thanks for catching that!
>> +  add_setshow_enum_cmd ("dprintf-style", class_support,
>> +			dprintf_style_enums,&dprintf_style, _("\
>> +Set the style of usage for dynamic printf."), _("\
>> +Show the style of usage for dynamic printf."), _("\
>> +Choose the style of usage for dynamic printf.\n\
> How about listing the available styles with one line of description
> for each one?

Yes, I forgot that part too...

>> +@item call
>> +@kindex dprintf-style call
>> +Handle the output by calling your program's @code{printf} function.
>> +(This expects @code{printf} to have been linked into the program.)
> And what happens if it isn't?
>

It should report an error.  I had in mind to add an option to specify 
the formatting function, but the patch was starting to get complicated.

Stan



More information about the Gdb-patches mailing list