aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-09-21 16:52:33 +0100
committerPedro Alves <palves@redhat.com>2017-09-21 16:52:33 +0100
commitf557a88ab120b75ddcc507c03d565c28e5f88c16 (patch)
treee44acbd5cb926b6e1002a8ef2b926873ae169ddb
parent8fe09d7421db51bc13c9228547d63e6315bd6bd0 (diff)
downloadgdb-f557a88ab120b75ddcc507c03d565c28e5f88c16.zip
gdb-f557a88ab120b75ddcc507c03d565c28e5f88c16.tar.gz
gdb-f557a88ab120b75ddcc507c03d565c28e5f88c16.tar.bz2
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 <palves@redhat.com> * 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.
-rw-r--r--gdb/gdbserver/ChangeLog9
-rw-r--r--gdb/gdbserver/server.c16
-rw-r--r--gdb/gdbserver/target.c9
-rw-r--r--gdb/gdbserver/target.h2
4 files changed, 20 insertions, 16 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index fe30e91..fa21333 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,12 @@
+2017-09-21 Pedro Alves <palves@redhat.com>
+
+ * 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 <tom@tromey.com>
* target.c (target_terminal::terminal_state): Define.
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index f4faff9..a5743b5 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 abd14b8..7f5bed7 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 be89258..91cbde1 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);