Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Modify trace-status output to always output stop-notes.
@ 2012-10-10 11:18 Dmitry Kozlov
  2012-10-10 12:40 ` Abid, Hafiz
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dmitry Kozlov @ 2012-10-10 11:18 UTC (permalink / raw)
  To: gdb-patches, 'Stan_Shebs@mentor.com'; +Cc: Vladimir Prus, Yao Qi

[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

Hi,
accoriding to discussion in gdb mailing list I have added stop-notes as 
mandatory part of MI trace-status command. This makes processing of 
stop-notes on IDE side more uniform with trace-notes processing. 
Previously Yao mentioned that he implemented notifications that can be 
used to monitor trace-status, but putting stop-notes to trace-status 
looks more clear way because processing one extra trace-status parameter 
defferently from others.

Stan, is it ok?

Thank you

[-- Attachment #2: gdb-stop-notes.diff --]
[-- Type: text/x-patch, Size: 2398 bytes --]

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9196bc2..5ee6ceb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,8 +1,21 @@
+2012-10-10  Dmitry Kozlov  <ddk@codesourcery.com>
+
+	* gdbserver/traicepoint.c (cmd_qtstatus): Modify trace-status output to 
+	always output stop-notes.
+	* tracepoint.c (trace_status_mi):  Modify trace status MI command output to 
+	always output stop-notes.
+	(trace_save): Save stop-notes if any by tsave.
+	(parse_trace_status): Add parsing stop-notes.
+
 2012-10-04  Dmitry Kozlov  <ddk@codesourcery.com>
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 201a25b..60ba775 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -3657,7 +3657,7 @@ cmd_qtstatus (char *packet)
 	   "circular:%d;"
 	   "disconn:%d;"
 	   "starttime:%s;stoptime:%s;"
-	   "username:%s:;notes:%s:",
+	   "username:%s;notes:%s;stop-notes:%s",
 	   tracing ? 1 : 0,
 	   stop_reason_rsp, tracing_stop_tpnum,
 	   traceframe_count, traceframes_created,
@@ -3665,7 +3665,7 @@ cmd_qtstatus (char *packet)
 	   circular_trace_buffer,
 	   disconnected_tracing,
 	   plongest (tracing_start_time), plongest (tracing_stop_time),
-	   buf1, buf2);
+	   buf1, buf2, buf3);
 }
 
 static void
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 0e44316..5ca6404 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2164,6 +2164,7 @@ trace_status_mi (int on_stop)
 
   ui_out_field_string (uiout, "user-name", ts->user_name);
   ui_out_field_string (uiout, "notes", ts->notes);
+  ui_out_field_string (uiout, "stop-notes", ts->stop_desc);
 
   {
     char buf[100];
@@ -3062,6 +3063,13 @@ trace_save (const char *filename, int target_does_save)
 	  bin2hex ((gdb_byte *) ts->user_name, buf, 0);
 	  fprintf (fp, ";username:%s", buf);
     }
+  if (ts->stop_desc)
+    {
+	  char *buf = (char *) xmalloc (strlen (ts->stop_desc) * 2 + 1);
+
+	  bin2hex ((gdb_byte *) ts->stop_desc, buf, 0);
+	  fprintf (fp, ";stop-notes:%s", buf);
+   }
 
   fprintf (fp, "\n");
 
@@ -3991,6 +3999,14 @@ Status line: '%s'\n"), p, line);
 	  ts->notes[end] = '\0';
 	  p = p3;
 	}
+      else if (strncmp (p, "stop-notes", p1 - p) == 0)
+	{
+	  ++p1;
+	  ts->stop_desc= xmalloc (strlen (p) / 2);
+	  end = hex2bin (p1, ts->stop_desc, (p3 - p1) / 2);
+	  ts->stop_desc[end] = '\0';
+	  p = p3;
+	}
       else
 	{
 	  /* Silently skip unknown optional info.  */

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] Modify trace-status output to always output stop-notes.
  2012-10-10 11:18 [PATCH] Modify trace-status output to always output stop-notes Dmitry Kozlov
@ 2012-10-10 12:40 ` Abid, Hafiz
  2012-10-10 15:47   ` Dmitry Kozlov
  2012-10-10 23:14 ` Stan Shebs
  2012-10-11  0:10 ` Yao Qi
  2 siblings, 1 reply; 6+ messages in thread
From: Abid, Hafiz @ 2012-10-10 12:40 UTC (permalink / raw)
  To: Kozlov, Dmitry, gdb-patches, Shebs, Stan; +Cc: Prus, Vladimir, Qi, Yao

Just a small formatting nit.
+      else if (strncmp (p, "stop-notes", p1 - p) == 0)
+	{
+	  ++p1;
+	  ts->stop_desc= xmalloc (strlen (p) / 2);
A space is missing before =
+	  end = hex2bin (p1, ts->stop_desc, (p3 - p1) / 2);
+	  ts->stop_desc[end] = '\0';
+	  p = p3;
+	}

Regards,
Abid
--
Hafiz Abid Qadeer
Mentor Graphics
hafiz_abid@mentor.com
+44 161 926 1630

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Kozlov, Dmitry
> Sent: Wednesday, October 10, 2012 12:18 PM
> To: gdb-patches@sourceware.org; Shebs, Stan
> Cc: Prus, Vladimir; Qi, Yao
> Subject: [PATCH] Modify trace-status output to always output stop-
> notes.
> 
> Hi,
> accoriding to discussion in gdb mailing list I have added stop-notes as
> mandatory part of MI trace-status command. This makes processing of
> stop-notes on IDE side more uniform with trace-notes processing.
> Previously Yao mentioned that he implemented notifications that can be
> used to monitor trace-status, but putting stop-notes to trace-status
> looks more clear way because processing one extra trace-status
> parameter defferently from others.
> 
> Stan, is it ok?
> 
> Thank you


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Modify trace-status output to always output stop-notes.
  2012-10-10 12:40 ` Abid, Hafiz
@ 2012-10-10 15:47   ` Dmitry Kozlov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Kozlov @ 2012-10-10 15:47 UTC (permalink / raw)
  To: Abid, Hafiz; +Cc: gdb-patches, Shebs, Stan, Prus, Vladimir, Qi, Yao

Hi Abid,
thank you for noting this,
I will repost patch with this change after collecting other's comments.

Regards,
Dmitry

On 10/10/2012 04:40 PM, Abid, Hafiz wrote:
> Just a small formatting nit.
> +      else if (strncmp (p, "stop-notes", p1 - p) == 0)
> +	{
> +	  ++p1;
> +	  ts->stop_desc= xmalloc (strlen (p) / 2);
> A space is missing before =
> +	  end = hex2bin (p1, ts->stop_desc, (p3 - p1) / 2);
> +	  ts->stop_desc[end] = '\0';
> +	  p = p3;
> +	}
>
> Regards,
> Abid
> --
> Hafiz Abid Qadeer
> Mentor Graphics
> hafiz_abid@mentor.com
> +44 161 926 1630
>
>> -----Original Message-----
>> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] On Behalf Of Kozlov, Dmitry
>> Sent: Wednesday, October 10, 2012 12:18 PM
>> To: gdb-patches@sourceware.org; Shebs, Stan
>> Cc: Prus, Vladimir; Qi, Yao
>> Subject: [PATCH] Modify trace-status output to always output stop-
>> notes.
>>
>> Hi,
>> accoriding to discussion in gdb mailing list I have added stop-notes as
>> mandatory part of MI trace-status command. This makes processing of
>> stop-notes on IDE side more uniform with trace-notes processing.
>> Previously Yao mentioned that he implemented notifications that can be
>> used to monitor trace-status, but putting stop-notes to trace-status
>> looks more clear way because processing one extra trace-status
>> parameter defferently from others.
>>
>> Stan, is it ok?
>>
>> Thank you


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Modify trace-status output to always output stop-notes.
  2012-10-10 11:18 [PATCH] Modify trace-status output to always output stop-notes Dmitry Kozlov
  2012-10-10 12:40 ` Abid, Hafiz
@ 2012-10-10 23:14 ` Stan Shebs
  2012-10-11  0:10 ` Yao Qi
  2 siblings, 0 replies; 6+ messages in thread
From: Stan Shebs @ 2012-10-10 23:14 UTC (permalink / raw)
  To: gdb-patches

On 10/10/12 4:17 AM, Dmitry Kozlov wrote:
> Hi,
> accoriding to discussion in gdb mailing list I have added stop-notes 
> as mandatory part of MI trace-status command. This makes processing of 
> stop-notes on IDE side more uniform with trace-notes processing. 
> Previously Yao mentioned that he implemented notifications that can be 
> used to monitor trace-status, but putting stop-notes to trace-status 
> looks more clear way because processing one extra trace-status 
> parameter defferently from others.
>
> Stan, is it ok?

Yes, this just needs a couple tweaks:

+	* gdbserver/traicepoint.c (cmd_qtstatus): Modify trace-status output to


Extra 'i' ...plus gdbserver has its own ChangeLog where this piece of the entry should go.

@@ -2164,6 +2164,7 @@ trace_status_mi (int on_stop)
  
    ui_out_field_string (uiout, "user-name", ts->user_name);
    ui_out_field_string (uiout, "notes", ts->notes);
+  ui_out_field_string (uiout, "stop-notes", ts->stop_desc);


It would be useful to add a brief note to the effect that this is unconditional for the MI command, so that some future version of ourselves doesn't assume that there is a missing if-statement.

We really should have a testsuite test for this.  Yao's recently-added mi-* tests in gdb.trace look like they would be good candidates to crib from.

Stan
stan@codesourcery.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Modify trace-status output to always output stop-notes.
  2012-10-10 11:18 [PATCH] Modify trace-status output to always output stop-notes Dmitry Kozlov
  2012-10-10 12:40 ` Abid, Hafiz
  2012-10-10 23:14 ` Stan Shebs
@ 2012-10-11  0:10 ` Yao Qi
  2012-10-11 15:51   ` Dmitry Kozlov
  2 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2012-10-11  0:10 UTC (permalink / raw)
  To: Dmitry Kozlov; +Cc: gdb-patches, 'Stan_Shebs@mentor.com', Vladimir Prus

On 10/10/2012 07:17 PM, Dmitry Kozlov wrote:
> +  if (ts->stop_desc)
> +    {
> +	  char *buf = (char *) xmalloc (strlen (ts->stop_desc) * 2 + 1);
> +
> +	  bin2hex ((gdb_byte *) ts->stop_desc, buf, 0);
> +	  fprintf (fp, ";stop-notes:%s", buf);
> +   }

Besides Stan's comments, the indentation here looks strange to me, and
BUF is not xfree'ed.

-- 
Yao


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Modify trace-status output to always output stop-notes.
  2012-10-11  0:10 ` Yao Qi
@ 2012-10-11 15:51   ` Dmitry Kozlov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Kozlov @ 2012-10-11 15:51 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches, 'Stan_Shebs@mentor.com', Vladimir Prus

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

Hi Yao,
thank you for review, here is revised patch.

Dmitry

On 10/11/2012 04:10 AM, Yao Qi wrote:
> On 10/10/2012 07:17 PM, Dmitry Kozlov wrote:
>> +  if (ts->stop_desc)
>> +    {
>> +      char *buf = (char *) xmalloc (strlen (ts->stop_desc) * 2 + 1);
>> +
>> +      bin2hex ((gdb_byte *) ts->stop_desc, buf, 0);
>> +      fprintf (fp, ";stop-notes:%s", buf);
>> +   }
>
> Besides Stan's comments, the indentation here looks strange to me, and
> BUF is not xfree'ed.
>


[-- Attachment #2: gdb-stop-notes_v2.diff --]
[-- Type: text/x-patch, Size: 3417 bytes --]

commit d9cc6813eccfc2afa35be6b201a222a44c657b55
Author: Dmitry Kozlov <dmitry_kozlov@mentor.com>
Date:   Wed Oct 10 14:56:52 2012 +0400

    Modify trace-status output to always output stop-notes.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9196bc2..f34f04e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,8 +1,19 @@
+2012-10-10  Dmitry Kozlov  <ddk@codesourcery.com>
+
+	* tracepoint.c (trace_status_mi):  Modify trace status MI command output to 
+	always output stop-notes.
+	(trace_save): Save stop-notes if any by tsave.
+	(parse_trace_status): Add parsing stop-notes.
+
 2012-10-04  Dmitry Kozlov  <ddk@codesourcery.com>
 
 	* tracepoint.c (trace_save): Add saving starttime, stoptime, user and notes.
 
-2012-10-04  Dmitry Kozlov  <ddk@mentor.com>
+2012-10-04  Dmitry Kozlov  <ddk@codesourcery.com>
+
+	* tracepoint.c (trace_save): Add saving starttime, stoptime, user and notes.
+
+2012-10-04  Dmitry Kozlov  <ddk@codesourcery.com>
 
 	* tracepoint.c (trace_status_command): Fix type of printf arg.
 	(trace_status_mi): Likewise.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 8bfbe9c..a23bb6d 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-11 Dmitry Kozlov <ddk@codesourcery.com>
+
+	* gdbserver/tracepoint.c (cmd_qtstatus): Modify trace-status output to
+	always output stop-notes.
+
 2012-10-01  Andrew Burgess  <aburgess@broadcom.com>
 
 	* server.c (handle_search_memory_1): Include access length in
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 201a25b..60ba775 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -3657,7 +3657,7 @@ cmd_qtstatus (char *packet)
 	   "circular:%d;"
 	   "disconn:%d;"
 	   "starttime:%s;stoptime:%s;"
-	   "username:%s:;notes:%s:",
+	   "username:%s;notes:%s;stop-notes:%s",
 	   tracing ? 1 : 0,
 	   stop_reason_rsp, tracing_stop_tpnum,
 	   traceframe_count, traceframes_created,
@@ -3665,7 +3665,7 @@ cmd_qtstatus (char *packet)
 	   circular_trace_buffer,
 	   disconnected_tracing,
 	   plongest (tracing_start_time), plongest (tracing_stop_time),
-	   buf1, buf2);
+	   buf1, buf2, buf3);
 }
 
 static void
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 959ede5..507ca41 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2164,6 +2164,8 @@ trace_status_mi (int on_stop)
 
   ui_out_field_string (uiout, "user-name", ts->user_name);
   ui_out_field_string (uiout, "notes", ts->notes);
+  // Always output stop-notes to MI to unify IDE processing of start and stop notes
+  ui_out_field_string (uiout, "stop-notes", ts->stop_desc);
 
   {
     char buf[100];
@@ -3065,6 +3067,14 @@ trace_save (const char *filename, int target_does_save)
 	  fprintf (fp, ";username:%s", buf);
 	  xfree (buf);
     }
+  if (ts->stop_desc)
+    {
+	  char *buf = (char *) xmalloc (strlen (ts->stop_desc) * 2 + 1);
+
+	  bin2hex ((gdb_byte *) ts->stop_desc, buf, 0);
+	  fprintf (fp, ";stop-notes:%s", buf);
+	  xfree (buf);
+    }
 
   fprintf (fp, "\n");
 
@@ -3994,6 +4004,14 @@ Status line: '%s'\n"), p, line);
 	  ts->notes[end] = '\0';
 	  p = p3;
 	}
+      else if (strncmp (p, "stop-notes", p1 - p) == 0)
+	{
+	  ++p1;
+	  ts->stop_desc = xmalloc (strlen (p) / 2);
+	  end = hex2bin (p1, ts->stop_desc, (p3 - p1) / 2);
+	  ts->stop_desc[end] = '\0';
+	  p = p3;
+	}
       else
 	{
 	  /* Silently skip unknown optional info.  */

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-11 15:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-10 11:18 [PATCH] Modify trace-status output to always output stop-notes Dmitry Kozlov
2012-10-10 12:40 ` Abid, Hafiz
2012-10-10 15:47   ` Dmitry Kozlov
2012-10-10 23:14 ` Stan Shebs
2012-10-11  0:10 ` Yao Qi
2012-10-11 15:51   ` Dmitry Kozlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox