aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-11-20 13:23:26 +0000
committerPedro Alves <palves@redhat.com>2008-11-20 13:23:26 +0000
commit607cecd2d4e6f0533f7e28f18d088ff4ec1109dd (patch)
tree957ce889e9a03607aba49da13ad9454a9e22329d /gdb
parent78bc95e3ba62e558030ff978725cdbbb48564f96 (diff)
downloadgdb-607cecd2d4e6f0533f7e28f18d088ff4ec1109dd.zip
gdb-607cecd2d4e6f0533f7e28f18d088ff4ec1109dd.tar.gz
gdb-607cecd2d4e6f0533f7e28f18d088ff4ec1109dd.tar.bz2
* infrun.c (resume): If following a fork, reread the current
thread. Avoid dereferencing a possibly dangling pointer.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/infrun.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4eabe76..62b98fe 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-20 Pedro Alves <pedro@codesourcery.com>
+
+ * infrun.c (resume): If following a fork, reread the current
+ thread. Avoid dereferencing a possibly dangling pointer.
+
2008-11-19 Doug Evans <dje@google.com>
* inferior.h (proceed_to_finish): Delete, unused.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index f218fa0..93ee00b 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1053,6 +1053,10 @@ a command like `return' or `jump' to continue execution."));
pending_follow.kind = TARGET_WAITKIND_SPURIOUS;
if (follow_fork ())
should_resume = 0;
+
+ /* Following a child fork will change our notion of current
+ thread. */
+ tp = inferior_thread ();
break;
case TARGET_WAITKIND_EXECD:
@@ -1148,11 +1152,11 @@ a command like `return' or `jump' to continue execution."));
displaced_step_dump_bytes (gdb_stdlog, buf, sizeof (buf));
}
- target_resume (resume_ptid, step, sig);
-
/* Avoid confusing the next resume, if the next stop/resume
happens to apply to another thread. */
tp->stop_signal = TARGET_SIGNAL_0;
+
+ target_resume (resume_ptid, step, sig);
}
discard_cleanups (old_cleanups);