Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,13 @@ bool ProcessFreeBSDKernel::DoUpdateThreadList(ThreadList &old_thread_list,
thread_desc += llvm::formatv(" (on CPU {0})", oncpu);
}

ThreadSP thread_sp{
new ThreadFreeBSDKernel(*this, tid, pcb_addr, thread_desc)};
new_thread_list.AddThread(thread_sp);
auto thread =
new ThreadFreeBSDKernel(*this, tid, pcb_addr, thread_desc);

if (tid == dumptid)
thread->SetIsCrashedThread(true);

new_thread_list.AddThread(static_cast<ThreadSP>(thread));
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "ThreadFreeBSDKernel.h"

#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Unwind.h"
#include "lldb/Utility/Log.h"

Expand Down Expand Up @@ -82,4 +83,12 @@ ThreadFreeBSDKernel::CreateRegisterContextForFrame(StackFrame *frame) {
return reg_ctx_sp;
}

bool ThreadFreeBSDKernel::CalculateStopInfo() { return false; }
bool ThreadFreeBSDKernel::CalculateStopInfo() {
if (m_is_crashed) {
// Set a stop reason for crashing threads only so that they get selected
// preferentially.
SetStopInfo(StopInfo::CreateStopReasonWithException(*this, "kernel panic"));
return true;
}
return false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ class ThreadFreeBSDKernel : public lldb_private::Thread {
m_thread_name.clear();
}

void SetIsCrashedThread(bool is_crashed) { m_is_crashed = is_crashed; }

protected:
bool CalculateStopInfo() override;

private:
std::string m_thread_name;
lldb::RegisterContextSP m_thread_reg_ctx_sp;
lldb::addr_t m_pcb_addr;
bool m_is_crashed = false;
};

#endif // LLDB_SOURCE_PLUGINS_PROCESS_FREEBSDKERNEL_THREADFREEBSDKERNEL_H
Loading