[LLDB][ProcessELFCore] Add Description to ProcessELFCore/ELFThread stop reasons by Jlalond · Pull Request #110065 · llvm/llvm-project (original) (raw)

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

Changes

This fixes a functionality gap with GDB, where GDB will properly decode the stop reason and give the address for SIGSEGV. I also added descriptions to all stop reasons, following the same code path that the Native Linux Thread uses.


Full diff: https://github.com/llvm/llvm-project/pull/110065.diff

3 Files Affected:

diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index 7955594bf5d94c..468a3b8934e741 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -931,6 +931,7 @@ llvm::Error ProcessElfCore::parseLinuxNotes(llvm::ArrayRef notes) { return status.ToError(); thread_data.signo = siginfo.si_signo; thread_data.code = siginfo.si_code;

#include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" +#include "lldb/Target/UnixSignals.h" #include "lldb/Target/Unwind.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/LLDBLog.h" @@ -49,8 +50,8 @@ using namespace lldb_private; // Construct a Thread object with given data ThreadElfCore::ThreadElfCore(Process &process, const ThreadData &td) : Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp(),

ThreadElfCore::~ThreadElfCore() { DestroyThread(); }

@@ -241,7 +242,7 @@ bool ThreadElfCore::CalculateStopInfo() { return false;

SetStopInfo(StopInfo::CreateStopReasonWithSignal(

@@ -543,7 +544,8 @@ size_t ELFLinuxSigInfo::GetSize(const lldb_private::ArchSpec &arch) {

Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch) { Status error;

@@ -556,6 +558,34 @@ Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch) { si_signo = data.GetU32(&offset); si_errno = data.GetU32(&offset); si_code = data.GetU32(&offset);

+union ELFSigval {

-static_assert(sizeof(ELFLinuxSigInfo) == 12, +static_assert(sizeof(ELFLinuxSigInfo) == 32, "sizeof ELFLinuxSigInfo is not correct!");

// PRPSINFO structure's size differs based on architecture. @@ -144,7 +153,9 @@ struct ThreadData { lldb::tid_t tid; int signo = 0; int code = 0;

@@ -183,6 +194,7 @@ class ThreadElfCore : public lldb_private::Thread {

int m_signo; int m_code;