This is the mail archive of the gdb-patches@sourceware.org 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: [PATCH] dynamic printf


On 2/29/12 1:14 AM, Andreas Schwab wrote:
Stan Shebs<stanshebs@earthlink.net> writes:

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.
How about:

break [LOCATION] [thread THREADNUM] [if CONDITION] [printf FORMAT,ARGS...]

Andreas.


I've been wondering whether that might be a better idea. An advantage of "dprintf" for the command line is that it can abbreviate to just "dp" and tab completion works, while the optional arguments to the break command don't have any way to abbreviate (although they probably could). That's not super-compelling, as by its nature a printf command entails typing in format string, double quotes and newlines and all, and in practice I expect a lot of these will tend to accumulate in script files.


Another consideration is how the collection looks in an info break command. If dynamic prints are a different kind of breakpoint, then you can (in theory) filter the breakpoint listing to a single category, but if they are just breakpoints with special commands, they'll continue to be in the big list.

My intuition isn't giving me a strong read on which approach users will like better. As the goal is at least partly to entice printf()+recompile users into using a GDB command instead, I think it needs to be among GDB's simpler commands. Maybe include both syntaxes, mapping down to same functionality?

Stan



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