[Lldb-commits] [lldb] b6c0edb - [lldb] [Process/elf-core] Fix reading FPRs from FreeBSD/i386 cores
Michał Górny via lldb-commits
lldb-commits at lists.llvm.org
Wed May 12 02:51:47 PDT 2021
Author: Michał Górny
Date: 2021-05-12T11:51:37+02:00
New Revision: b6c0edb9792c1a216961aefb63783ab4b986e823
URL: https://github.com/llvm/llvm-project/commit/b6c0edb9792c1a216961aefb63783ab4b986e823
DIFF: https://github.com/llvm/llvm-project/commit/b6c0edb9792c1a216961aefb63783ab4b986e823.diff
LOG: [lldb] [Process/elf-core] Fix reading FPRs from FreeBSD/i386 cores
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.
Differential Revision: https://reviews.llvm.org/D101086
Added:
lldb/test/Shell/Register/Core/x86-32-freebsd-fp.test
Modified:
lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
lldb/test/Shell/Register/Core/x86-32-freebsd-addr.test
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
index b048d39dbc527..ce07dfc38f808 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
@@ -96,6 +96,9 @@ DataExtractor getRegset(llvm::ArrayRef<CoreNote> Notes,
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.
diff --git a/lldb/test/Shell/Register/Core/x86-32-freebsd-addr.test b/lldb/test/Shell/Register/Core/x86-32-freebsd-addr.test
index c5a705f481a0b..06479a43d4fcd 100644
--- a/lldb/test/Shell/Register/Core/x86-32-freebsd-addr.test
+++ b/lldb/test/Shell/Register/Core/x86-32-freebsd-addr.test
@@ -10,4 +10,7 @@ register read --all
# CHECK-DAG: ds = 0x0000003b
# CHECK-DAG: es = 0x0000003b
-# TODO: fix reading fp registers
+# CHECK-DAG: fiseg = 0x00000000
+# CHECK-DAG: fioff = 0x00401c52
+# CHECK-DAG: foseg = 0x00000000
+# CHECK-DAG: fooff = 0xffffd8b8
diff --git a/lldb/test/Shell/Register/Core/x86-32-freebsd-fp.test b/lldb/test/Shell/Register/Core/x86-32-freebsd-fp.test
new file mode 100644
index 0000000000000..6001c0f1f2993
--- /dev/null
+++ b/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
More information about the lldb-commits
mailing list