public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix a bug on uploading tsv
@ 2012-09-03 15:32 Yao Qi
  2012-09-03 15:43 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2012-09-03 15:32 UTC (permalink / raw)
  To: gdb-patches

Hi,
When writing a test case to 'tsv changed notification', I find when GDB
re-connects (connects again after disconnect) to remote target, only one
tsv is uploaded, and the rest tsv in target are not uploaded.  This patch
is to fix this bug.

This patch is to remove incorrectly checking condition '!cur_tpoint' in
function cmd_qtsv.  cur_tpoint is set to non-NULL after calling cmd_qtfp,
that is to say, target tracepoints are uploaded to GDB.  However, we upload
TSV first and upload tracepoints second in GDB, as we can see in
remote.c:remote_start_remote,

  /* Possibly the target has been engaged in a trace run started
     previously; find out where things are at.  */
  if (remote_get_trace_status (current_trace_status ()) != -1)
    {
      struct uploaded_tp *uploaded_tps = NULL;
      struct uploaded_tsv *uploaded_tsvs = NULL;

      if (current_trace_status ()->running)
	printf_filtered (_("Trace is already running on the target.\n"));

      /* Get trace state variables first, they may be checked when
	 parsing uploaded commands.  */

      remote_upload_trace_state_variables (&uploaded_tsvs);

      merge_uploaded_trace_state_variables (&uploaded_tsvs);

      remote_upload_tracepoints (&uploaded_tps);

      merge_uploaded_tracepoints (&uploaded_tps);
    }

So it is wrong to check condition '!cur_tpoint' because 'cur_tpoint'
is always NULL when calling cmd_qtsv, and we should remove it.
Regression tested on x86_64-linux.  OK?

gdb/gdbserver:

2012-09-03  Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (cmd_qtsv): Adjust debug message.
	Remove an incorrect condition checking.
---
 gdb/gdbserver/tracepoint.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 9d62bb6..3e0a7ce 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -3873,15 +3873,9 @@ cmd_qtfv (char *packet)
 static void
 cmd_qtsv (char *packet)
 {
-  trace_debug ("Returning first trace state variable definition");
+  trace_debug ("Returning additional trace state variable definition");
 
-  if (!cur_tpoint)
-    {
-      /* This case would normally never occur, but be prepared for
-	 GDB misbehavior.  */
-      strcpy (packet, "l");
-    }
-  else if (cur_tsv)
+  if (cur_tsv)
     {
       cur_tsv = cur_tsv->next;
       if (cur_tsv)
-- 
1.7.7.6

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

* Re: [PATCH] Fix a bug on uploading tsv
  2012-09-03 15:32 [PATCH] Fix a bug on uploading tsv Yao Qi
@ 2012-09-03 15:43 ` Pedro Alves
  2012-09-04  1:48   ` Yao Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2012-09-03 15:43 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On 09/03/2012 04:30 PM, Yao Qi wrote:

> gdb/gdbserver:
> 
> 2012-09-03  Yao Qi  <yao@codesourcery.com>
> 
> 	* tracepoint.c (cmd_qtsv): Adjust debug message.
> 	Remove an incorrect condition checking.

OK, thanks.

Note that "incorrect" is a more of a _why_ than a _what_.
A _what_ entry would be something like:

2012-09-03  Yao Qi  <yao@codesourcery.com>

 	Remove an incorrect condition check.

 	* tracepoint.c (cmd_qtsv): Adjust debug message.
	Don't check CUR_TPOINT.

-- 
Pedro Alves

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

* Re: [PATCH] Fix a bug on uploading tsv
  2012-09-03 15:43 ` Pedro Alves
@ 2012-09-04  1:48   ` Yao Qi
  0 siblings, 0 replies; 3+ messages in thread
From: Yao Qi @ 2012-09-04  1:48 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On 09/03/2012 11:43 PM, Pedro Alves wrote:
> OK, thanks.
>
> Note that "incorrect" is a more of a_why_  than a_what_.
> A_what_  entry would be something like:

Agreed.  Patch is committed with the changelog entry you suggested.

-- 
Yao

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

end of thread, other threads:[~2012-09-04  1:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-03 15:32 [PATCH] Fix a bug on uploading tsv Yao Qi
2012-09-03 15:43 ` Pedro Alves
2012-09-04  1:48   ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).