[Lldb-commits] [PATCH] Fix debug register offset on FreeBSD
Chaoren Lin
chaorenl at google.com
Thu Apr 2 11:32:09 PDT 2015
Hi emaste,
As per emaste's comment here: http://reviews.llvm.org/D8685.
http://reviews.llvm.org/D8806
Files:
source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
source/Plugins/Process/Utility/RegisterInfos_x86_64.h
Index: source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
@@ -47,21 +47,24 @@
} GPR;
struct DBG {
- uint64_t dr[16]; /* debug registers */
- /* Index 0-3: debug address registers */
- /* Index 4-5: reserved */
- /* Index 6: debug status */
- /* Index 7: debug control */
- /* Index 8-15: reserved */
+ uint64_t dr[16]; /* debug registers */
+ /* Index 0-3: debug address registers */
+ /* Index 4-5: reserved */
+ /* Index 6: debug status */
+ /* Index 7: debug control */
+ /* Index 8-15: reserved */
};
struct UserArea
{
GPR gpr;
FPR fpr;
- DBG dbg;
};
+// Debug register implementation on FreeBSD is different from Linux.
+#define DR_OFFSET(reg_index) \
+ (LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
+
//---------------------------------------------------------------------------
// Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 structure.
//---------------------------------------------------------------------------
Index: source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
@@ -73,6 +73,10 @@
uint64_t fault_address; // Control register CR3.
};
+#define DR_OFFSET(reg_index) \
+ (LLVM_EXTENSION offsetof(UserArea, dbg) + \
+ LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
+
//---------------------------------------------------------------------------
// Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 structure.
//---------------------------------------------------------------------------
Index: source/Plugins/Process/Utility/RegisterInfos_x86_64.h
===================================================================
--- source/Plugins/Process/Utility/RegisterInfos_x86_64.h
+++ source/Plugins/Process/Utility/RegisterInfos_x86_64.h
@@ -27,10 +27,6 @@
LLVM_EXTENSION offsetof(XSAVE, ymmh[reg_index]) + \
(32 * reg_index))
-#define DR_OFFSET(reg_index) \
- (LLVM_EXTENSION offsetof(UserArea, dbg) + \
- LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
-
#ifdef DECLARE_REGISTER_INFOS_X86_64_STRUCT
// Number of bytes needed to represent a FPR.
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8806.23172.patch
Type: text/x-patch
Size: 2722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150402/20d4fb3f/attachment.bin>
More information about the lldb-commits
mailing list