================
@@ -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__,
----------------
ayushsahay1837 wrote:

> I thought we had a log macro that put the function name in automatically.

I might have missed it. I lightly reviewed the sources in 
_~/lldb/source/Plugins/Process_ but didn't find a macro like that. I'd really 
appreciate it if you could point me to it.

https://github.com/llvm/llvm-project/pull/197385
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to