struct aarch64_windows_per_inferior : public windows_per_inferior
{
aarch64_debug_reg_state dr_state;
+
+ void invalidate_thread_context (windows_thread_info *th) override;
};
struct aarch64_windows_nat_target final
{
CONTEXT *context = &th->context;
- context->ContextFlags = WindowsContext<decltype(context)>::all;
- CHECK (get_thread_context (th->h, context));
+ if (context->ContextFlags == 0)
+ {
+ context->ContextFlags = WindowsContext<decltype(context)>::all;
+ CHECK (get_thread_context (th->h, context));
+ }
+}
+
+/* See windows-nat.h. */
+
+void
+aarch64_windows_per_inferior::invalidate_thread_context (windows_thread_info *th)
+{
+ CONTEXT *context = &th->context;
+ context->ContextFlags = 0;
}
/* See windows-nat.h. */
the thread. */
bool debug_registers_changed = false;
- /* Nonzero if CONTEXT is invalidated and must be re-read from the
- inferior thread. */
- bool reload_context = false;
-
/* True if this thread is currently stopped at a software
breakpoint. This is used to offset the PC when needed. */
bool stopped_at_software_breakpoint = false;
case INVALIDATE_CONTEXT:
if (ptid.lwp () != current_event.dwThreadId)
th->suspend ();
- th->reload_context = true;
+ invalidate_thread_context (th);
break;
case DONT_SUSPEND:
- th->reload_context = true;
th->suspended = -1;
+ invalidate_thread_context (th);
break;
}
}
if (th == NULL)
return;
- if (th->reload_context)
- {
- fill_thread_context (th);
-
- th->reload_context = false;
- }
+ fill_thread_context (th);
if (r < 0)
for (r = 0; r < gdbarch_num_regs (regcache->arch()); r++)
*ourstatus = stop->status;
ptid_t ptid (windows_process->current_event.dwProcessId, thread_id);
- windows_thread_info *th
- = windows_process->thread_rec (ptid, INVALIDATE_CONTEXT);
- th->reload_context = true;
-
+ windows_process->thread_rec (ptid, INVALIDATE_CONTEXT);
return ptid;
}
void handle_unload_dll () override;
bool handle_access_violation (const EXCEPTION_RECORD *rec) override;
+ /* Invalidate the thread context. */
+ virtual void invalidate_thread_context (windows_thread_info *th) = 0;
+
int windows_initialization_done = 0;
std::vector<std::unique_ptr<windows_thread_info>> thread_list;
/* The function to use in order to determine whether a register is
a segment register or not. */
segment_register_p_ftype *segment_register_p = nullptr;
+
+ void invalidate_thread_context (windows_thread_info *th) override;
};
struct x86_windows_nat_target final : public x86_nat_target<windows_nat_target>
{
x86_windows_process.with_context (th, [&] (auto *context)
{
- context->ContextFlags = WindowsContext<decltype(context)>::all;
- CHECK (get_thread_context (th->h, context));
+ if (context->ContextFlags == 0)
+ {
+ context->ContextFlags = WindowsContext<decltype(context)>::all;
+ CHECK (get_thread_context (th->h, context));
+ }
+ });
+}
+
+/* See nat/windows-nat.h. */
+
+void
+x86_windows_per_inferior::invalidate_thread_context (windows_thread_info *th)
+{
+ x86_windows_process.with_context (th, [&] (auto *context)
+ {
+ context->ContextFlags = 0;
});
}
windows_thread_info *th, int r)
{
gdb_assert (r >= 0);
- gdb_assert (!th->reload_context);
char *context_ptr = x86_windows_process.with_context (th, [] (auto *context)
{