aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@redhat.com>2016-08-25 16:26:24 -0400
committerSergio Durigan Junior <sergiodj@redhat.com>2016-09-01 14:53:51 -0400
commit049a857091cff98371b5688140832a3cf767153c (patch)
treed9c21fa009e7cac0b35a1dfd8f655b8c90f5ccf8 /gdb/gdbserver
parent424844864aa6f49c616b3bb74a0a5ba9bcb92e72 (diff)
downloadgdb-049a857091cff98371b5688140832a3cf767153c.zip
gdb-049a857091cff98371b5688140832a3cf767153c.tar.gz
gdb-049a857091cff98371b5688140832a3cf767153c.tar.bz2
Use target_continue{,_no_signal} instead of target_resume
This commit implements a new function, target_continue, on top of the target_resume function. Then, it replaces all calls to target_resume by calls to target_continue or to the already existing target_continue_no_signal. This is one of the (many) necessary steps needed to consolidate the target interface between GDB and gdbserver. In particular, I am interested in the impact this change will have on the unification of the fork_inferior function (which I have been working on). Tested on the BuildBot, no regressions introduced. gdb/gdbserver/ChangeLog: 2016-09-31 Sergio Durigan Junior <sergiodj@redhat.com> * server.c (start_inferior): New variable 'ptid'. Replace calls to the_target->resume by target_continue{,_no_signal}, depending on the case. * target.c (target_stop_and_wait): Call target_continue_no_signal instead of the_target->resume. (target_continue): New function. gdb/ChangeLog: 2016-09-31 Sergio Durigan Junior <sergiodj@redhat.com> * fork-child.c (startup_inferior): Replace calls to target_resume by target_continue{,_no_signal}, depending on the case. * linux-nat.c (cleanup_target_stop): Call target_continue_no_signal instead of target_resume. * procfs.c (procfs_wait): Likewise. * target.c (target_continue): New function. * target/target.h (target_continue): New prototype.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog9
-rw-r--r--gdb/gdbserver/server.c25
-rw-r--r--gdb/gdbserver/target.c19
3 files changed, 30 insertions, 23 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 4dc2e45..921a5d4 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,12 @@
+2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * server.c (start_inferior): New variable 'ptid'. Replace calls
+ to the_target->resume by target_continue{,_no_signal}, depending
+ on the case.
+ * target.c (target_stop_and_wait): Call target_continue_no_signal
+ instead of the_target->resume.
+ (target_continue): New function.
+
2016-08-31 Antoine Tremblay <antoine.tremblay@ericsson.com>
* linux-low.c (linux_wait_1): Move event switch after unsuspend_lwps.
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 6fbd61d..9c06443 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -258,12 +258,7 @@ start_inferior (char **argv)
if (wrapper_argv != NULL)
{
- struct thread_resume resume_info;
-
- memset (&resume_info, 0, sizeof (resume_info));
- resume_info.thread = pid_to_ptid (signal_pid);
- resume_info.kind = resume_continue;
- resume_info.sig = 0;
+ ptid_t ptid = pid_to_ptid (signal_pid);
last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
@@ -271,7 +266,7 @@ start_inferior (char **argv)
{
do
{
- (*the_target->resume) (&resume_info, 1);
+ target_continue_no_signal (ptid);
last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
if (last_status.kind != TARGET_WAITKIND_STOPPED)
@@ -3929,7 +3924,6 @@ process_serial_event (void)
if ((tracing && disconnected_tracing) || any_persistent_commands ())
{
- struct thread_resume resume_info;
struct process_info *process = find_process_pid (pid);
if (process == NULL)
@@ -3965,10 +3959,7 @@ process_serial_event (void)
process->gdb_detached = 1;
/* Detaching implicitly resumes all threads. */
- resume_info.thread = minus_one_ptid;
- resume_info.kind = resume_continue;
- resume_info.sig = 0;
- (*the_target->resume) (&resume_info, 1);
+ target_continue_no_signal (minus_one_ptid);
write_ok (own_buf);
break; /* from switch/case */
@@ -4428,7 +4419,7 @@ handle_target_event (int err, gdb_client_data client_data)
/* A thread stopped with a signal, but gdb isn't
connected to handle it. Pass it down to the
inferior, as if it wasn't being traced. */
- struct thread_resume resume_info;
+ enum gdb_signal signal;
if (debug_threads)
debug_printf ("GDB not connected; forwarding event %d for"
@@ -4436,13 +4427,11 @@ handle_target_event (int err, gdb_client_data client_data)
(int) last_status.kind,
target_pid_to_str (last_ptid));
- resume_info.thread = last_ptid;
- resume_info.kind = resume_continue;
if (last_status.kind == TARGET_WAITKIND_STOPPED)
- resume_info.sig = gdb_signal_to_host (last_status.value.sig);
+ signal = last_status.value.sig;
else
- resume_info.sig = 0;
- (*the_target->resume) (&resume_info, 1);
+ signal = GDB_SIGNAL_0;
+ target_continue (last_ptid, signal);
}
}
else
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index 42d22b4..8435dc2 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -248,12 +248,8 @@ target_stop_and_wait (ptid_t ptid)
{
struct target_waitstatus status;
int was_non_stop = non_stop;
- struct thread_resume resume_info;
- resume_info.thread = ptid;
- resume_info.kind = resume_stop;
- resume_info.sig = GDB_SIGNAL_0;
- (*the_target->resume) (&resume_info, 1);
+ target_continue_no_signal (ptid);
non_stop = 1;
mywait (ptid, &status, 0, 0);
@@ -273,6 +269,19 @@ target_continue_no_signal (ptid_t ptid)
(*the_target->resume) (&resume_info, 1);
}
+/* See target/target.h. */
+
+void
+target_continue (ptid_t ptid, enum gdb_signal signal)
+{
+ struct thread_resume resume_info;
+
+ resume_info.thread = ptid;
+ resume_info.kind = resume_continue;
+ resume_info.sig = gdb_signal_to_host (signal);
+ (*the_target->resume) (&resume_info, 1);
+}
+
int
start_non_stop (int nonstop)
{