GNU Binutils with patches for OS216
Revision | 1e81a82ceb1c4e503e90c8b2d4441afef802df8c (tree) |
---|---|
Time | 2019-09-07 07:24:17 |
Author | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
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:
yyyy-mm-dd 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.
@@ -1036,6 +1036,9 @@ record_full_base_target::async (int enable) | ||
1036 | 1036 | beneath ()->async (enable); |
1037 | 1037 | } |
1038 | 1038 | |
1039 | +/* The PTID and STEP arguments last passed to | |
1040 | + record_full_target::resume. */ | |
1041 | +static ptid_t record_full_resume_ptid = null_ptid; | |
1039 | 1042 | static int record_full_resume_step = 0; |
1040 | 1043 | |
1041 | 1044 | /* True if we've been resumed, and so each record_full_wait call should |
@@ -1064,6 +1067,7 @@ static enum exec_direction_kind record_full_execution_dir = EXEC_FORWARD; | ||
1064 | 1067 | void |
1065 | 1068 | record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal) |
1066 | 1069 | { |
1070 | + record_full_resume_ptid = inferior_ptid; | |
1067 | 1071 | record_full_resume_step = step; |
1068 | 1072 | record_full_resumed = 1; |
1069 | 1073 | record_full_execution_dir = ::execution_direction; |
@@ -1190,7 +1194,8 @@ record_full_wait_1 (struct target_ops *ops, | ||
1190 | 1194 | /* This is not a single step. */ |
1191 | 1195 | ptid_t ret; |
1192 | 1196 | CORE_ADDR tmp_pc; |
1193 | - struct gdbarch *gdbarch = target_thread_architecture (inferior_ptid); | |
1197 | + struct gdbarch *gdbarch | |
1198 | + = target_thread_architecture (record_full_resume_ptid); | |
1194 | 1199 | |
1195 | 1200 | while (1) |
1196 | 1201 | { |