From f557a88ab120b75ddcc507c03d565c28e5f88c16 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 21 Sep 2017 16:52:33 +0100 Subject: [PATCH] gdbserver: Remove traces of ancient Hc handling Back in commit f0db101d9897 ("gdbserver: don't pick a random thread if the current thread dies"), a couple years ago, the last references to set_desired_thread(0) [select the Hc thread] were removed, and all the remaining calls to set_desired_thread pass '1', meaning general thread. This means we can simplify set_desired_thread. gdb/gdbserver/ChangeLog: 2017-09-21 Pedro Alves * server.c (gdb_read_memory, handle_status, process_serial_event) (handle_serial_event, handle_target_event): Adjust to set_desired_thread prototype change. * target.c (set_desired_thread): Remove 'use_general' parameter and adjust. * target.h (set_desired_thread): Remove 'use_general' parameter. --- gdb/gdbserver/ChangeLog | 9 +++++++++ gdb/gdbserver/server.c | 16 ++++++++-------- gdb/gdbserver/target.c | 9 ++------- gdb/gdbserver/target.h | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index fe30e91c05..fa21333b97 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,12 @@ +2017-09-21 Pedro Alves + + * server.c (gdb_read_memory, handle_status, process_serial_event) + (handle_serial_event, handle_target_event): Adjust to + set_desired_thread prototype change. + * target.c (set_desired_thread): Remove 'use_general' parameter + and adjust. + * target.h (set_desired_thread): Remove 'use_general' parameter. + 2017-09-20 Tom Tromey * target.c (target_terminal::terminal_state): Define. diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index f4faff9d77..a5743b5481 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -969,7 +969,7 @@ gdb_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) res = prepare_to_access_memory (); if (res == 0) { - if (set_desired_thread (1)) + if (set_desired_thread ()) res = read_inferior_memory (memaddr, myaddr, len); else res = 1; @@ -996,7 +996,7 @@ gdb_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len) ret = prepare_to_access_memory (); if (ret == 0) { - if (set_desired_thread (1)) + if (set_desired_thread ()) ret = write_inferior_memory (memaddr, myaddr, len); else ret = EIO; @@ -3398,7 +3398,7 @@ handle_status (char *own_buf) /* GDB assumes the current thread is the thread we're reporting the status for. */ general_thread = thread->id; - set_desired_thread (1); + set_desired_thread (); gdb_assert (tp->last_status.kind != TARGET_WAITKIND_IGNORE); prepare_resume_reply (own_buf, tp->entry.id, &tp->last_status); @@ -4139,7 +4139,7 @@ process_serial_event (void) } general_thread = thread_id; - set_desired_thread (1); + set_desired_thread (); gdb_assert (current_thread != NULL); } else if (own_buf[1] == 'c') @@ -4172,7 +4172,7 @@ process_serial_event (void) { struct regcache *regcache; - if (!set_desired_thread (1)) + if (!set_desired_thread ()) write_enn (own_buf); else { @@ -4189,7 +4189,7 @@ process_serial_event (void) { struct regcache *regcache; - if (!set_desired_thread (1)) + if (!set_desired_thread ()) write_enn (own_buf); else { @@ -4420,7 +4420,7 @@ handle_serial_event (int err, gdb_client_data client_data) /* Be sure to not change the selected thread behind GDB's back. Important in the non-stop mode asynchronous protocol. */ - set_desired_thread (1); + set_desired_thread (); return 0; } @@ -4515,7 +4515,7 @@ handle_target_event (int err, gdb_client_data client_data) /* Be sure to not change the selected thread behind GDB's back. Important in the non-stop mode asynchronous protocol. */ - set_desired_thread (1); + set_desired_thread (); return 0; } diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index abd14b8775..7f5bed7ec7 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -24,14 +24,9 @@ struct target_ops *the_target; int -set_desired_thread (int use_general) +set_desired_thread () { - struct thread_info *found; - - if (use_general == 1) - found = find_thread_ptid (general_thread); - else - found = find_thread_ptid (cont_thread); + thread_info *found = find_thread_ptid (general_thread); current_thread = found; return (current_thread != NULL); diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index be8925802f..91cbde16e9 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -698,7 +698,7 @@ int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len); int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len); -int set_desired_thread (int id); +int set_desired_thread (); const char *target_pid_to_str (ptid_t);