[Lldb-commits] [PATCH] D101086: [lldb] [Process/elf-core] Fix reading FPRs from FreeBSD/i386 cores

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 22 10:23:56 PDT 2021


mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste.
Herald added subscribers: pengfei, arichardson.
mgorny requested review of this revision.

The FreeBSD coredumps from i386 systems contain only FSAVE-style
NT_FPREGSET.  Since we do not really support reading that kind of data
anymore, just use NT_X86_XSTATE to get FXSAVE-style data when available.


https://reviews.llvm.org/D101086

Files:
  lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
  lldb/test/Shell/Register/Core/x86-32-freebsd-fp.test


Index: lldb/test/Shell/Register/Core/x86-32-freebsd-fp.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/Register/Core/x86-32-freebsd-fp.test
@@ -0,0 +1,3 @@
+# RUN: %lldb -b -s %s -c %p/Inputs/x86-32-freebsd.core | FileCheck %p/Inputs/x86-fp.check
+
+register read --all
Index: lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
===================================================================
--- lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
+++ lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
@@ -96,6 +96,9 @@
                         llvm::ArrayRef<RegsetDesc> RegsetDescs);
 
 constexpr RegsetDesc FPR_Desc[] = {
+    // FreeBSD/i386 core NT_FPREGSET is x87 FSAVE result but the XSAVE dump
+    // starts with FXSAVE struct, so use that instead if available.
+    {llvm::Triple::FreeBSD, llvm::Triple::x86, llvm::ELF::NT_X86_XSTATE},
     {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, llvm::ELF::NT_FPREGSET},
     // In a i386 core file NT_FPREGSET is present, but it's not the result
     // of the FXSAVE instruction like in 64 bit files.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101086.339705.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210422/70db5f7c/attachment-0001.bin>


More information about the lldb-commits mailing list