[Lldb-commits] [lldb] r186976 - elf-core: Add helper function for parsing FreeBSD NT_PRSTATUS

Ed Maste emaste at freebsd.org
Tue Jul 23 11:37:12 PDT 2013


Author: emaste
Date: Tue Jul 23 13:37:11 2013
New Revision: 186976

URL: http://llvm.org/viewvc/llvm-project?rev=186976&view=rev
Log:
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.


Modified:
    lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp

Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=186976&r1=186975&r2=186976&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Tue Jul 23 13:37:11 2013
@@ -436,6 +436,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)
 {
     lldb::offset_t offset = 0;
@@ -507,11 +521,7 @@ ProcessElfCore::ParseThreadContextsFromN
             {
                 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;





More information about the lldb-commits mailing list