diff options
author | Stan Cox <scox@redhat.com> | 2018-06-04 10:20:49 -0400 |
---|---|---|
committer | Stan Cox <scox@redhat.com> | 2018-06-04 10:20:49 -0400 |
commit | c12a5089640109567e2e06f0c5d2d1bf4fb3f5eb (patch) | |
tree | e898e2fded595ab6342d3a3283cd4e3b5f8bd838 /gdb/gdbserver/target.c | |
parent | 23081219bfe58dd07b1e0a110728d7195155d0e2 (diff) | |
download | gdb-c12a5089640109567e2e06f0c5d2d1bf4fb3f5eb.zip gdb-c12a5089640109567e2e06f0c5d2d1bf4fb3f5eb.tar.gz gdb-c12a5089640109567e2e06f0c5d2d1bf4fb3f5eb.tar.bz2 |
Add client_state struct.
Collect per client specific global data items into struct client_state,
which is similar in purpose to remote.c::remote_state.
gdbserver/ChangeLog
* server.h (struct client_state): New.
* server.c (cont_thread, general_thread, multi_process)
(report_fork_events, report_vfork_events, report_exec_events)
(report_thread_events, swbreak_feature, hwbreak_feature)
(vCont_supported, disable_randomization, pass_signals)
(program_signals, program_signals_p, last_status, last_ptid, own_buf):
Moved to client_state.
* remote-utils.c (remote_debug, noack_mode)
(transport_is_reliable): Moved to client_state.
* tracepoint.c (current_traceframe): Moved to client_state.
Update all callers.
* server.c, remote-utils.c, tracepoint.c, fork-child.c,
linux-low.c, remote-utils.h, target.c: Use client_state.
Diffstat (limited to 'gdb/gdbserver/target.c')
-rw-r--r-- | gdb/gdbserver/target.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index fe40b94..c276329 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -26,7 +26,8 @@ struct target_ops *the_target; int set_desired_thread () { - thread_info *found = find_thread_ptid (general_thread); + client_state &cs = get_client_state (); + thread_info *found = find_thread_ptid (cs.general_thread); current_thread = found; return (current_thread != NULL); @@ -42,6 +43,8 @@ static ptid_t prev_general_thread; int prepare_to_access_memory (void) { + client_state &cs = get_client_state (); + /* The first thread found. */ struct thread_info *first = NULL; /* The first stopped thread found. */ @@ -51,7 +54,7 @@ prepare_to_access_memory (void) /* Save the general thread value, since prepare_to_access_memory could change it. */ - prev_general_thread = general_thread; + prev_general_thread = cs.general_thread; if (the_target->prepare_to_access_memory != NULL) { @@ -98,7 +101,7 @@ prepare_to_access_memory (void) } current_thread = thread; - general_thread = ptid_of (thread); + cs.general_thread = ptid_of (thread); return 0; } @@ -108,12 +111,14 @@ prepare_to_access_memory (void) void done_accessing_memory (void) { + client_state &cs = get_client_state (); + if (the_target->done_accessing_memory != NULL) the_target->done_accessing_memory (); /* Restore the previous selected thread. */ - general_thread = prev_general_thread; - switch_to_thread (general_thread); + cs.general_thread = prev_general_thread; + switch_to_thread (cs.general_thread); } int |