[Lldb-commits] [lldb] r375244 - ProcessMinidump: Suppress reporting stop for signal '0'

Joseph Tremoulet via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 18 08:02:17 PDT 2019


Author: josepht
Date: Fri Oct 18 08:02:16 2019
New Revision: 375244

URL: http://llvm.org/viewvc/llvm-project?rev=375244&view=rev
Log:
ProcessMinidump: Suppress reporting stop for signal '0'

Summary:
The minidump exception stream can report an exception record with
signal 0.  If we try to create a stop reason with signal zero, processing
of the stop event won't find anything, and the debugger will hang.
So, simply early-out of RefreshStateAfterStop in this case.

Also set the UnixSignals object in DoLoadCore as is done for
ProcessElfCore.

Reviewers: labath, clayborg, jfb

Reviewed By: labath, clayborg

Subscribers: dexonsmith, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68096

Added:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_null_signal.yaml
Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
    lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=375244&r1=375243&r2=375244&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Fri Oct 18 08:02:16 2019
@@ -153,9 +153,9 @@ class MiniDumpNewTestCase(TestBase):
         self.assertTrue(eip.IsValid())
         self.assertEqual(pc, eip.GetValueAsUnsigned())
 
-    def test_snapshot_minidump(self):
+    def test_snapshot_minidump_dump_requested(self):
         """Test that if we load a snapshot minidump file (meaning the process
-        did not crash) there is no stop reason."""
+        did not crash) with exception code "DUMP_REQUESTED" there is no stop reason."""
         # target create -c linux-x86_64_not_crashed.dmp
         self.dbg.CreateTarget(None)
         self.target = self.dbg.GetSelectedTarget()
@@ -163,6 +163,17 @@ class MiniDumpNewTestCase(TestBase):
         self.check_state()
         self.assertEqual(self.process.GetNumThreads(), 1)
         thread = self.process.GetThreadAtIndex(0)
+        self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
+        stop_description = thread.GetStopDescription(256)
+        self.assertEqual(stop_description, "")
+
+    def test_snapshot_minidump_null_exn_code(self):
+        """Test that if we load a snapshot minidump file (meaning the process
+        did not crash) with exception code zero there is no stop reason."""
+        self.process_from_yaml("linux-x86_64_null_signal.yaml")
+        self.check_state()
+        self.assertEqual(self.process.GetNumThreads(), 1)
+        thread = self.process.GetThreadAtIndex(0)
         self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
         stop_description = thread.GetStopDescription(256)
         self.assertEqual(stop_description, "")

Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_null_signal.yaml
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_null_signal.yaml?rev=375244&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_null_signal.yaml (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_null_signal.yaml Fri Oct 18 08:02:16 2019
@@ -0,0 +1,25 @@
+--- !minidump
+Streams:
+  - Type:            ThreadList
+    Threads:
+      - Thread Id:       0x00002177
+        Context:         0000
+        Stack:
+          Start of Memory Range: 0x00007FFE2F689000
+          Content:         00000000
+  - Type:            Exception
+    Thread ID:       0x00002177
+    Exception Record:
+      Exception Code:  0x00000000
+      Exception Address: 0x0000000000400582
+    Thread Context:  0000
+  - Type:            SystemInfo
+    Processor Arch:  AMD64
+    Platform ID:     Linux
+  - Type:            LinuxProcStatus
+    Text:             |
+      Name:	busyloop
+      Umask:	0002
+      State:	t (tracing stop)
+      Pid:	8567
+...

Modified: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp?rev=375244&r1=375243&r2=375244&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp Fri Oct 18 08:02:16 2019
@@ -219,6 +219,9 @@ Status ProcessMinidump::DoLoadCore() {
 
   m_thread_list = m_minidump_parser->GetThreads();
   m_active_exception = m_minidump_parser->GetExceptionStream();
+
+  SetUnixSignals(UnixSignals::Create(GetArchitecture()));
+
   ReadModuleList();
 
   llvm::Optional<lldb::pid_t> pid = m_minidump_parser->GetPid();
@@ -238,6 +241,7 @@ uint32_t ProcessMinidump::GetPluginVersi
 Status ProcessMinidump::DoDestroy() { return Status(); }
 
 void ProcessMinidump::RefreshStateAfterStop() {
+
   if (!m_active_exception)
     return;
 
@@ -264,8 +268,15 @@ void ProcessMinidump::RefreshStateAfterS
   ArchSpec arch = GetArchitecture();
 
   if (arch.GetTriple().getOS() == llvm::Triple::Linux) {
+    uint32_t signo = m_active_exception->ExceptionRecord.ExceptionCode;
+
+    if (signo == 0) {
+      // No stop.
+      return;
+    }
+
     stop_info = StopInfo::CreateStopReasonWithSignal(
-        *stop_thread, m_active_exception->ExceptionRecord.ExceptionCode);
+        *stop_thread, signo);
   } else if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
     stop_info = StopInfoMachException::CreateStopReasonWithMachException(
         *stop_thread, m_active_exception->ExceptionRecord.ExceptionCode, 2,




More information about the lldb-commits mailing list