[Lldb-commits] [PATCH] D14591: Implement register context for mini dump debugging

Adrian McCarthy via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 12 10:09:01 PST 2015

amccarth marked 3 inline comments as done.

Comment at: packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py:40
@@ +39,3 @@
+        thread = self.process.GetThreadAtIndex(0)
+        # The crash is in main, so there should be one frame on the stack.
+        self.assertEqual(thread.GetNumFrames(), 1)
zturner wrote:
> I remember us being able to get call stacks higher than main.  But now that I think about it I guess that's only true for live debugging since you have a physical copy of the module loaded in your process, and you can read it's EAT.  In any case, this assumption probably won't be true anymore once we understand PDBs and symbol servers.  Although at that point hopefully we'll have many more tests covering different scenarios.
Yes, I recognize that this will need to change when we have more debug info available. but it's sufficient for testing at this point.

Comment at: packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py:45
@@ +44,3 @@
+        pc = frame.GetPC()
+        eip = frame.FindRegister("eip")
+        self.assertTrue(eip.IsValid())
zturner wrote:
> Does this work if you change `eip` to `pc`?  If so that would allow this test to work in the presence of 64 bit.
Indeed, "pc" works, so I'll use that.

Comment at: source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.h:42-44
@@ -44,4 +41,5 @@
-    std::string m_thread_name;
     lldb::RegisterContextSP m_reg_context_sp;
+    class Data;
+    std::unique_ptr<Data> m_data;  // for WinAPI-specific data
zturner wrote:
> Why does this class need a separate `CONTEXT` than the one that is already stored in `m_reg_context_sp`?  It seems like now we're storing the `CONTEXT` twice.
Because the register context isn't created right away.  It's lazily created later by this object, so this object needs a handle to it.  Note that the CONTEXT in the Data is just a pointer, so it's not actually a second copy.

The process object pulls the original CONTEXT from the mini dump, and it creates this thread object.  This thread object will later be called to create the register context object, so it has to keep track of the CONTEXT in order to do that.


More information about the lldb-commits mailing list