Skip to content

Commit b8dbc58

Browse files
author
git apple-llvm automerger
committed
Merge commit 'c1d66611ecdd' from apple/master into swift/master-next
2 parents 0171b01 + c1d6661 commit b8dbc58

File tree

3 files changed

+50
-3
lines changed

3 files changed

+50
-3
lines changed

lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ def test_stack_info_in_minidump(self):
153153
self.assertTrue(eip.IsValid())
154154
self.assertEqual(pc, eip.GetValueAsUnsigned())
155155

156-
def test_snapshot_minidump(self):
156+
def test_snapshot_minidump_dump_requested(self):
157157
"""Test that if we load a snapshot minidump file (meaning the process
158-
did not crash) there is no stop reason."""
158+
did not crash) with exception code "DUMP_REQUESTED" there is no stop reason."""
159159
# target create -c linux-x86_64_not_crashed.dmp
160160
self.dbg.CreateTarget(None)
161161
self.target = self.dbg.GetSelectedTarget()
@@ -167,6 +167,17 @@ def test_snapshot_minidump(self):
167167
stop_description = thread.GetStopDescription(256)
168168
self.assertEqual(stop_description, "")
169169

170+
def test_snapshot_minidump_null_exn_code(self):
171+
"""Test that if we load a snapshot minidump file (meaning the process
172+
did not crash) with exception code zero there is no stop reason."""
173+
self.process_from_yaml("linux-x86_64_null_signal.yaml")
174+
self.check_state()
175+
self.assertEqual(self.process.GetNumThreads(), 1)
176+
thread = self.process.GetThreadAtIndex(0)
177+
self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
178+
stop_description = thread.GetStopDescription(256)
179+
self.assertEqual(stop_description, "")
180+
170181
def check_register_unsigned(self, set, name, expected):
171182
reg_value = set.GetChildMemberWithName(name)
172183
self.assertTrue(reg_value.IsValid(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--- !minidump
2+
Streams:
3+
- Type: ThreadList
4+
Threads:
5+
- Thread Id: 0x00002177
6+
Context: 0000
7+
Stack:
8+
Start of Memory Range: 0x00007FFE2F689000
9+
Content: 00000000
10+
- Type: Exception
11+
Thread ID: 0x00002177
12+
Exception Record:
13+
Exception Code: 0x00000000
14+
Exception Address: 0x0000000000400582
15+
Thread Context: 0000
16+
- Type: SystemInfo
17+
Processor Arch: AMD64
18+
Platform ID: Linux
19+
- Type: LinuxProcStatus
20+
Text: |
21+
Name: busyloop
22+
Umask: 0002
23+
State: t (tracing stop)
24+
Pid: 8567
25+
...

lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ Status ProcessMinidump::DoLoadCore() {
219219

220220
m_thread_list = m_minidump_parser->GetThreads();
221221
m_active_exception = m_minidump_parser->GetExceptionStream();
222+
223+
SetUnixSignals(UnixSignals::Create(GetArchitecture()));
224+
222225
ReadModuleList();
223226

224227
llvm::Optional<lldb::pid_t> pid = m_minidump_parser->GetPid();
@@ -238,6 +241,7 @@ uint32_t ProcessMinidump::GetPluginVersion() { return 1; }
238241
Status ProcessMinidump::DoDestroy() { return Status(); }
239242

240243
void ProcessMinidump::RefreshStateAfterStop() {
244+
241245
if (!m_active_exception)
242246
return;
243247

@@ -264,8 +268,15 @@ void ProcessMinidump::RefreshStateAfterStop() {
264268
ArchSpec arch = GetArchitecture();
265269

266270
if (arch.GetTriple().getOS() == llvm::Triple::Linux) {
271+
uint32_t signo = m_active_exception->ExceptionRecord.ExceptionCode;
272+
273+
if (signo == 0) {
274+
// No stop.
275+
return;
276+
}
277+
267278
stop_info = StopInfo::CreateStopReasonWithSignal(
268-
*stop_thread, m_active_exception->ExceptionRecord.ExceptionCode);
279+
*stop_thread, signo);
269280
} else if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
270281
stop_info = StopInfoMachException::CreateStopReasonWithMachException(
271282
*stop_thread, m_active_exception->ExceptionRecord.ExceptionCode, 2,

0 commit comments

Comments
 (0)