From 4b1063c76cb3960d898bd0595cb66de7830bb69f Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 3 Apr 2015 20:49:08 +0000 Subject: Fix FreeBSD crash after r233837 The FreeBSD debug register access is a little usual, but in any case different from Linux. As it stands it's not possible to share an implementation of DR_OFFSET, so revert that part of r233837 and provide a separate FreeBSD and Linux implementation. We'll still want a better fix, but this should restore basic functionality (and the buildbot). llvm-svn: 234048 --- .../source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp | 3 +++ lldb/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp | 5 +++++ lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64.h | 4 ---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp index 257e929b13a..34f2d185da8 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp @@ -62,6 +62,9 @@ struct UserArea DBG dbg; }; +#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. //--------------------------------------------------------------------------- diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp index 49346899b9c..c0993b47a12 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp @@ -73,6 +73,11 @@ struct UserArea 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. //--------------------------------------------------------------------------- diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64.h b/lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64.h index f3fd78c818c..f7e329233c8 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64.h +++ b/lldb/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. -- cgit v1.2.1