Skip to content

Commit 2a493c7

Browse files
committed
Add Greg recommended invalid check, and string ref with max value
1 parent b0787fc commit 2a493c7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Status MinidumpFileBuilder::AddHeaderAndCalculateDirectories() {
7575
StopInfoSP stop_info_sp = thread_sp->GetStopInfo();
7676
if (stop_info_sp) {
7777
const StopReason &stop_reason = stop_info_sp->GetStopReason();
78-
if (stop_reason)
78+
if (stop_reason != lldb::eStopReasonInvalid)
7979
m_expected_directories++;
8080
}
8181
}
@@ -684,7 +684,9 @@ Status MinidumpFileBuilder::AddExceptions() {
684684
Status error;
685685
for (const ThreadSP &thread_sp : thread_list) {
686686
StopInfoSP stop_info_sp = thread_sp->GetStopInfo();
687-
if (!stop_info_sp)
687+
// If we don't have a stop info, or if it's invalid, skip.
688+
if (!stop_info_sp ||
689+
stop_info_sp->GetStopReason() == lldb::eStopReasonInvalid)
688690
continue;
689691

690692
constexpr size_t minidump_exception_size =

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,10 @@ void ProcessMinidump::RefreshStateAfterStop() {
279279
description = reinterpret_cast<const char *>(
280280
exception_stream.ExceptionRecord.ExceptionInformation);
281281

282-
stop_info = StopInfo::CreateStopReasonWithSignal(*stop_thread, signo,
283-
description);
282+
llvm::StringRef description_str(description,
283+
Exception::MaxParameterBytes);
284+
stop_info = StopInfo::CreateStopReasonWithSignal(
285+
*stop_thread, signo, description_str.str().c_str());
284286
} else if (arch.GetTriple().getVendor() == llvm::Triple::Apple) {
285287
stop_info = StopInfoMachException::CreateStopReasonWithMachException(
286288
*stop_thread, exception_stream.ExceptionRecord.ExceptionCode, 2,

0 commit comments

Comments
 (0)