aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2012-01-20 09:42:44 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2012-01-20 09:42:44 +0000
commite714e1bf77429248e080fee199c87376a8649184 (patch)
tree6d061758ba7fd610a4b282f01a3bde7c78a01fab /gdb/remote.c
parent618d666674ca5ab37b3632bf719afa27703f6a72 (diff)
downloadgdb-e714e1bf77429248e080fee199c87376a8649184.zip
gdb-e714e1bf77429248e080fee199c87376a8649184.tar.gz
gdb-e714e1bf77429248e080fee199c87376a8649184.tar.bz2
2012-01-20 Pedro Alves <palves@redhat.com>
Ulrich Weigand <ulrich.weigand@linaro.org> * inferior.h (struct inferior): Add fake_pid_p. * inferior.c (exit_inferior_1): Clear fake_pid_p. * remote.c (remote_start_remote): Set fake_pid_p if we have to use magic_null_ptid since the remote side doesn't provide a real PID.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c42
1 files changed, 32 insertions, 10 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 60d7ecd..3a9e2f6 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3253,6 +3253,10 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
if (!non_stop)
{
+ ptid_t ptid;
+ int fake_pid_p = 0;
+ struct inferior *inf;
+
if (rs->buf[0] == 'W' || rs->buf[0] == 'X')
{
if (!extended_p)
@@ -3272,19 +3276,37 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
/* Let the stub know that we want it to return the thread. */
set_continue_thread (minus_one_ptid);
- /* Without this, some commands which require an active target
- (such as kill) won't work. This variable serves (at least)
- double duty as both the pid of the target process (if it has
- such), and as a flag indicating that a target is active.
- These functions should be split out into seperate variables,
- especially since GDB will someday have a notion of debugging
- several processes. */
- inferior_ptid = magic_null_ptid;
+ inferior_ptid = minus_one_ptid;
/* Now, if we have thread information, update inferior_ptid. */
- inferior_ptid = remote_current_thread (inferior_ptid);
+ ptid = remote_current_thread (inferior_ptid);
+ if (!ptid_equal (ptid, minus_one_ptid))
+ {
+ if (ptid_get_pid (ptid) == -1)
+ {
+ ptid = ptid_build (ptid_get_pid (magic_null_ptid),
+ ptid_get_lwp (ptid),
+ ptid_get_tid (ptid));
+ fake_pid_p = 1;
+ }
+
+ inferior_ptid = ptid;
+ }
+ else
+ {
+ /* Without this, some commands which require an active
+ target (such as kill) won't work. This variable serves
+ (at least) double duty as both the pid of the target
+ process (if it has such), and as a flag indicating that a
+ target is active. These functions should be split out
+ into seperate variables, especially since GDB will
+ someday have a notion of debugging several processes. */
+ inferior_ptid = magic_null_ptid;
+ fake_pid_p = 1;
+ }
- remote_add_inferior (ptid_get_pid (inferior_ptid), -1);
+ inf = remote_add_inferior (ptid_get_pid (inferior_ptid), -1);
+ inf->fake_pid_p = fake_pid_p;
/* Always add the main thread. */
add_thread_silent (inferior_ptid);