[PATCH 06/16] push remote_traceframe_number into struct remote_state

Tom Tromey
2013-06-28T17:40:47Z

This moves the global remote_traceframe_number into remote_state.

* remote.c (struct remote_state) <remote_traceframe_number>:
New field.
(remote_traceframe_number): Remove.
(new_remote_state, remote_open_1, set_remote_traceframe)
(remote_trace_find): Update.
---
gdb/remote.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 6d9478f..3ef99df 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -376,6 +376,10 @@ struct remote_state
TID member will be -1 for all or -2 for not sent yet. */
ptid_t general_thread;
ptid_t continue_thread;
+
+ /* This is the traceframe which we last selected on the remote system.
+ It will be -1 if no traceframe is selected. */
+ int remote_traceframe_number;
};

/* Private data that we'll store in (struct thread_info)->private. */
@@ -421,6 +425,7 @@ new_remote_state (void)

result->buf_size = 400;
result->buf = xmalloc (result->buf_size);
+ result->remote_traceframe_number = -1;

return result;
}
@@ -1442,10 +1447,6 @@ static ptid_t magic_null_ptid;
static ptid_t not_sent_ptid;
static ptid_t any_thread_ptid;

-/* This is the traceframe which we last selected on the remote system.
- It will be -1 if no traceframe is selected. */
-static int remote_traceframe_number = -1;
-
/* Find out if the stub attached to PID (and hence GDB should offer to
detach instead of killing it when bailing out). */

@@ -4346,7 +4347,7 @@ remote_open_1 (char *name, int from_tty,

rs->general_thread = not_sent_ptid;
rs->continue_thread = not_sent_ptid;
- remote_traceframe_number = -1;
+ rs->remote_traceframe_number = -1;

/* Probe for ability to use "ThreadInfo" query, as required. */
use_threadinfo_query = 1;
@@ -6296,12 +6297,13 @@ static void
set_remote_traceframe (void)
{
int newnum;
+ struct remote_state *rs = get_remote_state ();

- if (remote_traceframe_number == get_traceframe_number ())
+ if (rs->remote_traceframe_number == get_traceframe_number ())
return;

/* Avoid recursion, remote_trace_find calls us again. */
- remote_traceframe_number = get_traceframe_number ();
+ rs->remote_traceframe_number = get_traceframe_number ();

newnum = target_trace_find (tfind_number,
get_traceframe_number (), 0, 0, NULL);
@@ -11008,7 +11010,7 @@ remote_trace_find (enum trace_find_type type, int num,
if (tpp)
*tpp = target_tracept;

- remote_traceframe_number = target_frameno;
+ rs->remote_traceframe_number = target_frameno;
return target_frameno;
}

--
1.8.1.4