gdbserver: Remove traces of ancient Hc handling

Back in commit f0db101d98 ("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.
This commit is contained in:
Pedro Alves 2017-09-21 16:52:33 +01:00
parent 8fe09d7421
commit f557a88ab1
4 changed files with 20 additions and 16 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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);

View File

@ -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);