[Lldb-commits] [lldb] r201434 - Correct offset calculation for FreeBSD i386 core NT_PRSTATUS

Ed Maste emaste at freebsd.org
Fri Feb 14 13:29:05 PST 2014


Author: emaste
Date: Fri Feb 14 15:29:05 2014
New Revision: 201434

URL: http://llvm.org/viewvc/llvm-project?rev=201434&view=rev
Log:
Correct offset calculation for FreeBSD i386 core NT_PRSTATUS

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=201434&r1=201433&r2=201434&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Fri Feb 14 15:29:05 2014
@@ -374,8 +374,8 @@ ParseFreeBSDPrStatus(ThreadData *thread_
                      ArchSpec &arch)
 {
     lldb::offset_t offset = 0;
-    bool have_padding = (arch.GetMachine() == llvm::Triple::mips64 ||
-                         arch.GetMachine() == llvm::Triple::x86_64);
+    bool lp64 = (arch.GetMachine() == llvm::Triple::mips64 ||
+                 arch.GetMachine() == llvm::Triple::x86_64);
     int pr_version = data.GetU32(&offset);
 
     Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
@@ -385,12 +385,15 @@ ParseFreeBSDPrStatus(ThreadData *thread_
             log->Printf("FreeBSD PRSTATUS unexpected version %d", pr_version);
     }
 
-    if (have_padding)
-        offset += 4;
-    offset += 28;       // pr_statussz, pr_gregsetsz, pr_fpregsetsz, pr_osreldate
+    // Skip padding, pr_statussz, pr_gregsetsz, pr_fpregsetsz, pr_osreldate
+    if (lp64)
+        offset += 32;
+    else
+        offset += 16;
+
     thread_data->signo = data.GetU32(&offset); // pr_cursig
     offset += 4;        // pr_pid
-    if (have_padding)
+    if (lp64)
         offset += 4;
     
     size_t len = data.GetByteSize() - offset;





More information about the lldb-commits mailing list