[PATCH] D49111: [windows] LLDB shows the wrong values when register read is executed at a frame other than zero

Tatyana Krasnukha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 03:15:46 PDT 2018


tatyana-krasnukha added a comment.

Some code style notes



================
Comment at: source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp:52
 RegisterContextSP TargetThreadWindows::GetRegisterContext() {
-  if (!m_reg_context_sp)
-    m_reg_context_sp = CreateRegisterContextForFrameIndex(0);
+  if (m_reg_context_sp.get() == NULL)
+    m_reg_context_sp = CreateRegisterContextForFrame(NULL);
----------------
Smart pointer's `operator bool` is intended just for this case, no need in this change.


================
Comment at: source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp:53
+  if (m_reg_context_sp.get() == NULL)
+    m_reg_context_sp = CreateRegisterContextForFrame(NULL);
 
----------------
Please, use nullptr instead of NULL.


================
Comment at: source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp:68
+  if (concrete_frame_idx == 0) {
+    if (m_thread_reg_ctx_sp.get() == NULL) {
+      ArchSpec arch = HostInfo::GetArchitecture();
----------------
Revert to using `operator bool` also.


================
Comment at: source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp:92
+    Unwind *unwinder = GetUnwinder();
+    if (unwinder)
+      reg_ctx_sp = unwinder->CreateRegisterContextForFrame(frame);
----------------
Here you check plain pointer, don't cast it to bool - compare with nullptr.


================
Comment at: source/Plugins/Process/elf-core/ThreadElfCore.cpp:232
+    Unwind *unwinder = GetUnwinder();
+    if (unwinder)
+      reg_ctx_sp = unwinder->CreateRegisterContextForFrame(frame);
----------------
ditto


Repository:
  rL LLVM

https://reviews.llvm.org/D49111





More information about the llvm-commits mailing list