commit 4ce80946bb684913900b5e4db3c627b2acd91399 Author: Dmitry Kozlov Date: Fri Oct 12 11:32:25 2012 +0400 Extend tsave to save trace start time, stop time and notes. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 27ad6ab..3e2a818 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2012-10-12 Dmitry Kozlov + * tracepoint.c (trace_save): Add saving starttime, stoptime, user and notes. + +2012-10-12 Dmitry Kozlov + * tracepoint.c (trace_status_command): Fix type of printf arg to prevent improper type conversion. (trace_status_mi): Likewise. diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 1577ad3..8f4f18c 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -3018,10 +3018,11 @@ trace_save (const char *filename, int target_does_save) (ts->running ? '1' : '0'), stop_reason_names[ts->stop_reason]); if (ts->stop_reason == tracepoint_error) { - char *buf = (char *) alloca (strlen (ts->stop_desc) * 2 + 1); + char *buf = xmalloc (strlen (ts->stop_desc) * 2 + 1); bin2hex ((gdb_byte *) ts->stop_desc, buf, 0); fprintf (fp, ":%s", buf); + xfree (buf); } fprintf (fp, ":%x", ts->stopping_tracepoint); if (ts->traceframe_count >= 0) @@ -3036,6 +3037,33 @@ 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:%s", + phex_nz (ts->start_time, sizeof (ts->start_time))); + } + if (ts->stop_time) + { + fprintf (fp, ";stoptime:%s", + phex_nz (ts->stop_time, sizeof (ts->stop_time))); + } + if (ts->notes && ts->notes[0] != 0) + { + char *buf = xmalloc (strlen (ts->notes) * 2 + 1); + + bin2hex ((gdb_byte *) ts->notes, buf, 0); + fprintf (fp, ";notes:%s", buf); + xfree (buf); + } + if (ts->user_name && ts->user_name[0] != 0) + { + char *buf = xmalloc (strlen (ts->user_name) * 2 + 1); + + bin2hex ((gdb_byte *) ts->user_name, buf, 0); + fprintf (fp, ";username:%s", buf); + xfree (buf); + } + fprintf (fp, "\n"); /* Note that we want to upload tracepoints and save those, rather