From: Tom Tromey <tromey@redhat.com>
To: Hui Zhu <teawater@gmail.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>,
Stan Shebs <stan@codesourcery.com>
Subject: Re: [PATCH] tracepoint: add new trace command "printf"[0] gdb
Date: Fri, 11 Feb 2011 18:45:00 -0000 [thread overview]
Message-ID: <m3wrl6l8an.fsf@fleche.redhat.com> (raw)
In-Reply-To: <AANLkTinOejC4S1cwA_uxdjWbpveLvR7C==mJMSSrw-aH@mail.gmail.com> (Hui Zhu's message of "Fri, 4 Feb 2011 23:59:02 +0800")
>>>>> ">" == Hui Zhu <teawater@gmail.com> writes:
>> + gen_expr (expr, &pc, aexpr, &value);
>> +
>> +
>> + if (value.optimized_out)
There's no need to have 2 blank lines here.
This function and some other new ones have no documentation.
>> + {"printf", 0, 0, 0, 0}, /* 0x31 */
[...]
>> + aop_printf = 0x31,
If you add a new AX expression, you must update agentexpr.texi.
I think any AX addition should also require a corresponding addition to
gdbserver.
>> +typedef void (printf_callback) (char *fbuf, char **expp,
>> + struct bp_location *loc,
>> + struct agent_expr *aexpr);
From what I can see, the `loc' and `aexpr' arguments are passed through
string_printf without interpretation.
In a case like this it is customary to just add a single `void *data'
argument and have the caller and callback agree on the type. Here, that
type would be an instance of a struct wrapping the two values.
This definition should not be here.
>> static void
>> +ui_printf (char *arg, struct ui_file *stream)
>> +{
>> + string_printf (arg, stream, NULL, NULL, NULL);
>> +}
There's no reason to keep ui_printf around, just inline this into the 2
callers.
>> +extern void printf_command (char *arg, int from_tty);
>> +typedef void (printf_callback) (char **expp, struct bp_location *loc,
>> + struct agent_expr *aexpr);
>> +extern void string_printf (char *arg, struct ui_file *stream,
>> + printf_callback callback, struct bp_location *loc,
>> + struct agent_expr *aexpr);
These should be in some appropriate header, not tracepoint.c.
>> + /* The agent expr include expr for arguments, format string, 1 byte
>> + * for aop_printf, 1 byte for the number of arguments, 1 byte for
>> + * size of format string, 1 byte for blank after format string
>> + * and 1 byte for aop_end. */
Wrong comment format, no leading "*"s.
This new feature needs a documentation patch and probably also a patch
to NEWS.
From what I can tell from the patch, the idea here is to add a printf to
a tracepoint's actions, with the printf evaluated on the remote side. I
guess that is an ok idea, though I don't use this stuff enough to really
have an opinion.
I think it would be good for other maintainers to speak up now. If it
is left to me, I will allow this if you fix up the problems and write
the documentation.
Tom
next prev parent reply other threads:[~2011-02-11 18:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-03 16:29 Hui Zhu
2011-01-03 19:21 ` Doug Evans
2011-01-04 4:34 ` Hui Zhu
2011-01-04 6:19 ` Doug Evans
2011-01-04 12:07 ` Hui Zhu
2011-01-05 17:24 ` Doug Evans
2011-01-05 18:18 ` Michael Snyder
2011-01-06 6:42 ` Hui Zhu
2011-01-05 20:51 ` Stan Shebs
2011-01-06 6:43 ` Hui Zhu
2011-01-28 5:54 ` Hui Zhu
2011-02-04 15:59 ` Hui Zhu
2011-02-11 3:49 ` Hui Zhu
2011-02-11 18:45 ` Tom Tromey [this message]
2011-02-17 8:16 ` Hui Zhu
2011-02-21 8:18 ` Hui Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3wrl6l8an.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=stan@codesourcery.com \
--cc=teawater@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox