aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2020-01-10 20:05:41 +0000
committerPedro Alves <palves@redhat.com>2020-01-10 20:05:41 +0000
commitec506636cc0c56d4229b00d5e439c0610970f84d (patch)
tree3d01f04f7b4fb3ed19797d16503b07d80c094f2a /gdb/target.h
parent873657b9e824943ae44c12966c29cbbcd21c986f (diff)
downloadbinutils-ec506636cc0c56d4229b00d5e439c0610970f84d.zip
binutils-ec506636cc0c56d4229b00d5e439c0610970f84d.tar.gz
binutils-ec506636cc0c56d4229b00d5e439c0610970f84d.tar.bz2
Don't rely on inferior_ptid in record_full_wait
The multi-target patch sets inferior_ptid to null_ptid before handling a target event, and thus before calling target_wait, in order to catch places in target_ops::wait implementations that are incorrectly relying on inferior_ptid (which could otherwise be a ptid of a different target, for example). That caught this instance in record-full.c. Fix it by saving the last resumed ptid, and then using it in record_full_wait_1, just like how the last "step" argument passed to record_full_target::resume is handled too. gdb/ChangeLog: 2020-01-10 Pedro Alves <palves@redhat.com> * record-full.c (record_full_resume_ptid): New global. (record_full_target::resume): Set it. (record_full_wait_1): Use record_full_resume_ptid instead of inferior_ptid.
Diffstat (limited to 'gdb/target.h')
-rw-r--r--gdb/target.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/target.h b/gdb/target.h
index a8e551c..1ec7b90 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -478,6 +478,13 @@ struct target_ops
TARGET_DEFAULT_NORETURN (noprocess ());
virtual void commit_resume ()
TARGET_DEFAULT_IGNORE ();
+ /* See target_wait's description. Note that implementations of
+ this method must not assume that inferior_ptid on entry is
+ pointing at the thread or inferior that ends up reporting an
+ event. The reported event could be for some other thread in
+ the current inferior or even for a different process of the
+ current target. inferior_ptid may also be null_ptid on
+ entry. */
virtual ptid_t wait (ptid_t, struct target_waitstatus *,
int TARGET_DEBUG_PRINTER (target_debug_print_options))
TARGET_DEFAULT_FUNC (default_target_wait);