This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix a bug on uploading tsv
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Mon, 3 Sep 2012 23:30:50 +0800
- Subject: [PATCH] Fix a bug on uploading tsv
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