[Lldb-commits] [PATCH] D88682: [lldb] [Process/NetBSD] Fix crash on unsupported i386 regs
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 2 01:25:10 PDT 2020
mgorny updated this revision to Diff 295753.
mgorny edited the summary of this revision.
mgorny added a comment.
Herald added a subscriber: pengfei.
Ok, replaced with a few more assorted fixes ;-).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88682/new/
https://reviews.llvm.org/D88682
Files:
lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
lldb/source/Plugins/Process/Utility/lldb-x86-register-enums.h
Index: lldb/source/Plugins/Process/Utility/lldb-x86-register-enums.h
===================================================================
--- lldb/source/Plugins/Process/Utility/lldb-x86-register-enums.h
+++ lldb/source/Plugins/Process/Utility/lldb-x86-register-enums.h
@@ -106,7 +106,7 @@
lldb_bnd1_i386,
lldb_bnd2_i386,
lldb_bnd3_i386,
- k_last_mpxr = lldb_bnd3_i386,
+ k_last_mpxr_i386 = lldb_bnd3_i386,
k_first_mpxc_i386,
lldb_bndcfgu_i386 = k_first_mpxc_i386,
Index: lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
===================================================================
--- lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
@@ -375,6 +375,15 @@
case lldb_ymm6_i386:
case lldb_ymm7_i386:
return lldb_ymm0_x86_64 + regnum - lldb_ymm0_i386;
+ case lldb_bnd0_i386:
+ case lldb_bnd1_i386:
+ case lldb_bnd2_i386:
+ case lldb_bnd3_i386:
+ return lldb_bnd0_x86_64 + regnum - lldb_bnd0_i386;
+ case lldb_bndcfgu_i386:
+ return lldb_bndcfgu_x86_64;
+ case lldb_bndstatus_i386:
+ return lldb_bndstatus_x86_64;
case lldb_dr0_i386:
case lldb_dr1_i386:
case lldb_dr2_i386:
@@ -386,7 +395,7 @@
return lldb_dr0_x86_64 + regnum - lldb_dr0_i386;
default:
assert(false && "Unhandled i386 register.");
- return 0;
+ return -1;
}
}
@@ -394,28 +403,32 @@
int reg_num) const {
switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
case llvm::Triple::x86:
- if (reg_num <= k_last_gpr_i386)
+ if (reg_num >= k_first_gpr_i386 && reg_num <= k_last_gpr_i386)
return GPRegSet;
- else if (reg_num <= k_last_fpr_i386)
+ else if (reg_num >= k_first_fpr_i386 && reg_num <= k_last_fpr_i386)
return FPRegSet;
- else if (reg_num <= k_last_avx_i386)
+ else if (reg_num >= k_first_avx_i386 && reg_num <= k_last_avx_i386)
return XStateRegSet; // AVX
- else if (reg_num <= lldb_dr7_i386)
+ else if (reg_num >= k_first_mpxr_i386 && reg_num <= k_last_mpxr_i386)
+ return -1; // MPXR
+ else if (reg_num >= k_first_mpxr_i386 && reg_num <= k_last_mpxc_i386)
+ return -1; // MPXC
+ else if (reg_num >= k_first_dbr_i386 && reg_num <= k_last_dbr_i386)
return DBRegSet; // DBR
else
return -1;
case llvm::Triple::x86_64:
- if (reg_num <= k_last_gpr_x86_64)
+ if (reg_num >= k_first_gpr_x86_64 && reg_num <= k_last_gpr_x86_64)
return GPRegSet;
- else if (reg_num <= k_last_fpr_x86_64)
+ else if (reg_num >= k_first_fpr_x86_64 && reg_num <= k_last_fpr_x86_64)
return FPRegSet;
- else if (reg_num <= k_last_avx_x86_64)
+ else if (reg_num >= k_first_avx_x86_64 && reg_num <= k_last_avx_x86_64)
return XStateRegSet; // AVX
- else if (reg_num <= k_last_mpxr_x86_64)
+ else if (reg_num >= k_first_mpxr_x86_64 && reg_num <= k_last_mpxr_x86_64)
return -1; // MPXR
- else if (reg_num <= k_last_mpxc_x86_64)
+ else if (reg_num >= k_first_mpxr_x86_64 && reg_num <= k_last_mpxc_x86_64)
return -1; // MPXC
- else if (reg_num <= lldb_dr7_x86_64)
+ else if (reg_num >= k_first_dbr_x86_64 && reg_num <= k_last_dbr_x86_64)
return DBRegSet; // DBR
else
return -1;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88682.295753.patch
Type: text/x-patch
Size: 3324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201002/f73bb18c/attachment.bin>
More information about the lldb-commits
mailing list