void handle_unload_dll () override;
bool handle_access_violation (const EXCEPTION_RECORD *rec) override;
+ void invalidate_context (windows_thread_info *th);
+
int windows_initialization_done = 0;
std::vector<std::unique_ptr<windows_thread_info>> thread_list;
return nullptr;
}
-/* See nat/windows-nat.h. */
+/* Invalidate TH's context. */
+
+void
+windows_per_inferior::invalidate_context (windows_thread_info *th)
+{
+#ifdef __x86_64__
+ if (windows_process.wow64_process)
+ th->wow64_context.ContextFlags = 0;
+ else
+#endif
+ th->context.ContextFlags = 0;
+}
windows_thread_info *
windows_per_inferior::thread_rec (ptid_t ptid,
case INVALIDATE_CONTEXT:
if (ptid.lwp () != current_event.dwThreadId)
th->suspend ();
- th->reload_context = true;
+ invalidate_context (th);
break;
case DONT_SUSPEND:
- th->reload_context = true;
th->suspended = -1;
+ invalidate_context (th);
break;
}
}
and supplies its value to the given regcache.
This function assumes that R is non-negative. A failed assertion
- is raised if that is not true.
-
- This function assumes that TH->RELOAD_CONTEXT is not set, meaning
- that the windows_thread_info has an up-to-date context. A failed
- assertion is raised if that assumption is violated. */
+ is raised if that is not true. */
static void
windows_fetch_one_register (struct regcache *regcache,
windows_thread_info *th, int r)
{
gdb_assert (r >= 0);
- gdb_assert (!th->reload_context);
char *context_ptr = windows_process.with_context (th, [] (auto *context)
{
if (th == NULL)
return;
- if (th->reload_context)
- {
- windows_process.with_context (th, [&] (auto *context)
- {
- context->ContextFlags = WindowsContext<decltype(context)>::all;
- CHECK (get_thread_context (th->h, context));
- });
-
- th->reload_context = false;
- }
+ windows_process.with_context (th, [&] (auto *context)
+ {
+ if (context->ContextFlags == 0)
+ {
+ context->ContextFlags = WindowsContext<decltype(context)>::all;
+ CHECK (get_thread_context (th->h, context));
+ }
+ });
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;
}