From 262b8dd7da7d508dc1638d710e183ccc71581e8c Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 23 Jul 2013 18:37:11 +0000 Subject: [PATCH] elf-core: Add helper function for parsing FreeBSD NT_PRSTATUS This avoids the use of the ELFPrStatus class, which returns to being used only for Linux. llvm-svn: 186976 --- .../Process/elf-core/ProcessElfCore.cpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index b507e98195e2..a79fec66e33a 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -435,6 +435,20 @@ struct ELFNote } }; +static void +ParseFreeBSDPrStatus(ThreadData *thread_data, DataExtractor &data, + ArchSpec &arch) +{ + lldb::offset_t offset; + size_t len; + + offset = 36; + thread_data->signo = data.GetU32(&offset); + offset = 48; + len = data.GetByteSize() - offset; + thread_data->gpregset = DataExtractor(data, offset, len); +} + static void ParseFreeBSDThrMisc(ThreadData *thread_data, DataExtractor &data) { @@ -507,11 +521,7 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader * { case NT_FREEBSD_PRSTATUS: have_prstatus = true; - prstatus.Parse(note_data, arch); - thread_data->signo = prstatus.pr_cursig; - header_size = ELFPrStatus::GetSize(arch); - len = note_data.GetByteSize() - header_size; - thread_data->gpregset = DataExtractor(note_data, header_size, len); + ParseFreeBSDPrStatus(thread_data, note_data, arch); break; case NT_FREEBSD_FPREGSET: thread_data->fpregset = note_data;