diff options
author | Pedro Alves <pedro@palves.net> | 2022-03-29 13:32:48 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2022-04-14 20:22:56 +0100 |
commit | 8e347faf8f1556a0f1afc33bd53099ec5f2f8efe (patch) | |
tree | 09232d21bd7f8460d6fc9f399c4891d7f5c609de /gdbserver/target.cc | |
parent | 421490af33bfbfe8a8429f0e43fb3e9f8727476e (diff) | |
download | gdb-8e347faf8f1556a0f1afc33bd53099ec5f2f8efe.zip gdb-8e347faf8f1556a0f1afc33bd53099ec5f2f8efe.tar.gz gdb-8e347faf8f1556a0f1afc33bd53099ec5f2f8efe.tar.bz2 |
gdbserver: Eliminate prepare_to_access_memory
Given:
- The prepare_to_access_memory machinery was added for non-stop mode.
- Only Linux supports non-stop.
- Linux no longer needs the prepare_to_access_memory machinery. In
fact, after the previous patch,
linux_process_target::prepare_to_access_memory became a nop.
Thus, prepare_to_access_memory can go away, simplifying core GDBserver
code.
Change-Id: I93ac8bfe66bd61c3d1c4a0e7d419335163120ecf
Diffstat (limited to 'gdbserver/target.cc')
-rw-r--r-- | gdbserver/target.cc | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/gdbserver/target.cc b/gdbserver/target.cc index e9d1e1a..8832423 100644 --- a/gdbserver/target.cc +++ b/gdbserver/target.cc @@ -39,88 +39,6 @@ set_desired_thread () return (current_thread != NULL); } -/* The thread that was current before prepare_to_access_memory was - called. done_accessing_memory uses this to restore the previous - selected thread. */ -static ptid_t prev_general_thread; - -/* See target.h. */ - -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. */ - struct thread_info *stopped = NULL; - /* The current general thread, if found. */ - struct thread_info *current = NULL; - - /* Save the general thread value, since prepare_to_access_memory could change - it. */ - prev_general_thread = cs.general_thread; - - int res = the_target->prepare_to_access_memory (); - if (res != 0) - return res; - - for_each_thread (prev_general_thread.pid (), [&] (thread_info *thread) - { - if (mythread_alive (thread->id)) - { - if (stopped == NULL && the_target->supports_thread_stopped () - && target_thread_stopped (thread)) - stopped = thread; - - if (first == NULL) - first = thread; - - if (current == NULL && prev_general_thread == thread->id) - current = thread; - } - }); - - /* The thread we end up choosing. */ - struct thread_info *thread; - - /* Prefer a stopped thread. If none is found, try the current - thread. Otherwise, take the first thread in the process. If - none is found, undo the effects of - target->prepare_to_access_memory() and return error. */ - if (stopped != NULL) - thread = stopped; - else if (current != NULL) - thread = current; - else if (first != NULL) - thread = first; - else - { - done_accessing_memory (); - return 1; - } - - switch_to_thread (thread); - cs.general_thread = ptid_of (thread); - - return 0; -} - -/* See target.h. */ - -void -done_accessing_memory (void) -{ - client_state &cs = get_client_state (); - - the_target->done_accessing_memory (); - - /* Restore the previous selected thread. */ - cs.general_thread = prev_general_thread; - switch_to_thread (the_target, cs.general_thread); -} - int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) { @@ -373,18 +291,6 @@ process_stratum_target::post_create_inferior () /* Nop. */ } -int -process_stratum_target::prepare_to_access_memory () -{ - return 0; -} - -void -process_stratum_target::done_accessing_memory () -{ - /* Nop. */ -} - void process_stratum_target::look_up_symbols () { |