================
@@ -101,35 +101,67 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) {
target_arch, RegisterInfoPOSIX_arm64::eRegsetMaskDefault);
}
-static Status GetThreadContextHelper(lldb::thread_t thread_handle,
- PCONTEXT context_ptr,
- const DWORD control_flag) {
+static Status
+GetThreadContextHelper(lldb::thread_t thread_handle, DWORD context_flags,
+ PCONTEXT &context,
+ std::shared_ptr<DataBufferHeap> &context_buffer) {
Log *log = GetLog(WindowsLog::Registers);
Status error;
+ DWORD context_length = 0;
- memset(context_ptr, 0, sizeof(::CONTEXT));
- context_ptr->ContextFlags = control_flag;
- if (!::GetThreadContext(thread_handle, context_ptr)) {
+ if (InitializeContext(nullptr, context_flags, nullptr, &context_length)) {
+ error = Status::FromErrorString("InitializeContext succeeded
unexpectedly");
+ LLDB_LOG(log, "{0} {1}", __FUNCTION__, error);
+ return error;
+ }
+
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+ error = Status(GetLastError(), eErrorTypeWin32);
+ LLDB_LOG(log, "{0} InitializeContext failed with error {1}", __FUNCTION__,
----------------
DavidSpickett wrote:
I thought we had a log macro that put the function name in automatically.
Also:
"with unexpected error { }, expected ERROR_...."
Would be a bit better because this is meant to "fail" but in one specific way.
https://github.com/llvm/llvm-project/pull/197385
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits