This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] add -s option to make -break-insert support dprintf
- From: Hui Zhu <teawater at gmail dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Pedro Alves <palves at redhat dot com>, Eli Zaretskii <eliz at gnu dot org>, Hui Zhu <hui_zhu at mentor dot com>, gdb-patches ml <gdb-patches at sourceware dot org>, Marc Khouzam <marc dot khouzam at ericsson dot com>
- Date: Mon, 15 Apr 2013 21:33:38 +0800
- Subject: Re: [PATCH] add -s option to make -break-insert support dprintf
- References: <515451EA dot 1000200 at mentor dot com> <83y5d7wpvq dot fsf at gnu dot org> <CANFwon23qn_SVjcUWUZ2Z2Y5Euqg8efiwMvXkxTRtA9-2Ttk3Q at mail dot gmail dot com> <516454DA dot 9040109 at redhat dot com> <CANFwon1aDoyCYrsNeUpkmh6ARFJmT8B4JdFqYcc6GLdo=cgqig at mail dot gmail dot com> <87ppxzhfqy dot fsf at fleche dot redhat dot com>
On Sat, Apr 13, 2013 at 12:32 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes:
>
> Hui> + [ -s "@var{template},@var{expression}[,@var{expression}@dots{}]" ]
> Hui> + [ @var{location} ]
>
> Hui> +@item -s "@var{template},@var{expression}[,@var{expression}@dots{}]"
> Hui> +Set a dynamic printf breakpoint, described in @ref{Dynamic Printf}.
> Hui> +The @var{template} and @var{expression} should be within double
> Hui> +quotes and be escaped by being preceded with a backslash.
>
> MI already defines a quoting approach and allows multiple arguments.
> In fact one of its selling points is that it doesn't have to be as
> free-form as the CLI -- it can be more predictable for programs to use.
>
> So, I think the above approach is not that great.
> It adds a second layer of parsing to MI, I guess just to work around
> internal deficiencies in gdb.
>
> It seems like you could use positional arguments instead:
>
> -break-insert -s FORMAT LOCATION ARG ARG ARG ...
>
>
> I don't really understand the part about how the expressions should be
> in double quotes. The test suite doesn't do that:
>
> +mi_gdb_test "5-break-insert -s \"\\\"arg=%d, g=%d\\\\n\\\", arg, g\" $dp_location1" \
>
> I suggest just dropping that text. I think it probably means that the
> argument should be properly quoted for MI, but that is redundant.
>
> Tom
This design is because the MI inferior will auto convert the format
string of argument of mi command. But dprintf need format sting keep
the original of the format string. So I use the current format.
Thanks,
Hui