This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] dynamic printf
- From: Tom Tromey <tromey at redhat dot com>
- To: Stan Shebs <stanshebs at earthlink dot net>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 14 Mar 2012 09:24:00 -0600
- Subject: Re: [PATCH] dynamic printf
- References: <4F4DCDD5.2040807@earthlink.net> <87ipien6me.fsf@fleche.redhat.com> <4F5FDD6B.3030507@earthlink.net>
>>>>> "Stan" == Stan Shebs <stanshebs@earthlink.net> writes:
Tom> I think you have to have a comma after the location. That is the only
Tom> reliable linespec terminator.
Stan> Hmmm. The format is a string though; would linespec parsing attempt
Stan> to proceed into that? How is "break <location> if foo" working these
Stan> days?
It is handled in multiple spots -- linespec.c:keep_name_info, but also
every language expression parser.
Probably linespec could be changed to make this syntax work, but I don't
see how the parsers could. E.g., the C parser will lex the printf
format string as a string token, then proceed to fail to parse, throwing
an exception.
That is, the case that breaks this is: dprintf *main "format".
This works, though, due to the fact that linespec uses
parse_to_comma_and_eval: dprintf *main, "format"
Stan> + struct agent_expr *cmd_bytecode;
Tom> Needs a comment.
Tom> Perhaps subclassing bp_location is also doable?
Stan> I'm not sure what you mean by this?
I thought it was possible to make a subclass of bp_location, arranging
for your breakpoint ops to override the appropriate allocation method.
Then only dprintf breakpoint locations would have the extra field.
I'm not totally sure, I haven't tried it.
Tom