From: Yao Qi <yao@codesourcery.com>
To: Dmitry Kozlov <dmitry_kozlov@mentor.com>
Cc: <gdb-patches@sourceware.org>,
"'Stan_Shebs@mentor.com'" <Stan_Shebs@mentor.com>,
Vladimir Prus <vladimir@codesourcery.com>
Subject: Re: [PATCH] Extend tsave: save start time, stop time, user and notes
Date: Mon, 08 Oct 2012 12:48:00 -0000 [thread overview]
Message-ID: <5072CB78.8030908@codesourcery.com> (raw)
In-Reply-To: <506C4719.3030900@mentor.com>
On 10/03/2012 10:09 PM, Dmitry Kozlov wrote:
In general, I think it is useful to include these attributes in
tracefile saved by command 'tsave'.
> 2012-10-03 Dmitry Kozlov<ddk@mentor.com>
>
> * tracepoint.c (trace_save): Add saving starttime, stoptime, user and notes.
>
> diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
> index 0f94150..f7e96eb 100644
> --- a/gdb/tracepoint.c
> +++ b/gdb/tracepoint.c
> @@ -3036,6 +3036,24 @@ trace_save (const char *filename, int target_does_save)
> fprintf (fp, ";disconn:%x", ts->disconnected_tracing);
> if (ts->circular_buffer)
> fprintf (fp, ";circular:%x", ts->circular_buffer);
> + if (ts->start_time)
> + fprintf (fp, ";starttime:%ld%06ld", (long int) (ts->start_time / 1000000), (long int) (ts->start_time % 1000000));
This line is too long...
> + if (ts->stop_time)
> + fprintf (fp, ";stoptime:%ld%06ld", (long int) (ts->stop_time / 1000000), (long int) (ts->stop_time % 1000000));
and this line.
> + if (ts->notes)
ts->notes will never be NULL, because GDBserver will always send
"notes:" in qTStatus packet (See gdbserver/tracepoint.c:cmd_qtstatus),
but other stubs may don't include "notes:" in qTStatus packet, so we
may do the check here like this,
if (ts->notes && ts->notes[0] != 0)
> + {
> + char *buf = (char *) alloca (strlen (ts->notes) * 2 + 1);
We need a blank line here. Looks 'alloca' is not encouraged to use, and
it should be replaced with xmalloc/xfree.
[PATCH] Replace potentially unsafe alloca with xmalloc/xfree in
value_concat
http://sourceware.org/ml/gdb-patches/2012-09/msg00274.html
> + bin2hex ((gdb_byte *) ts->notes, buf, 0);
> + fprintf (fp, ";notes:%s", buf);
> +
> + }
> + if (ts->user_name)
> + {
> + char *buf = (char *) alloca (strlen (ts->user_name) * 2 + 1);
Likewise.
> + bin2hex ((gdb_byte *) ts->user_name, buf, 0);
> + fprintf (fp, ";username:%s", buf);
> +
> + }
> fprintf (fp, "\n");
>
> /* Note that we want to upload tracepoints and save those, rather
Logically, this patch depends on your previous patch
PATCH fix start-time and stop-time in trace-status
http://sourceware.org/ml/gdb-patches/2012-09/msg00621.html
otherwise, we generate start-time and stop-time in trace file in decimal
format, while gdb still interprets it as hex.
--
Yao
next prev parent reply other threads:[~2012-10-08 12:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-03 14:09 Dmitry Kozlov
2012-10-08 12:48 ` Yao Qi [this message]
2012-10-08 19:14 ` Dmitry Kozlov
2012-10-11 15:53 ` Dmitry Kozlov
2012-10-11 17:10 ` Pedro Alves
2012-10-12 8:44 ` Dmitry Kozlov
2012-10-12 8:46 ` Dmitry Kozlov
2012-10-16 16:36 ` Pedro Alves
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=5072CB78.8030908@codesourcery.com \
--to=yao@codesourcery.com \
--cc=Stan_Shebs@mentor.com \
--cc=dmitry_kozlov@mentor.com \
--cc=gdb-patches@sourceware.org \
--cc=vladimir@codesourcery.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