[Lldb-commits] [PATCH] D88682: [lldb] [Process/NetBSD] Fix crash on unsupported i386 regs

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 2 01:34:21 PDT 2020

labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Yes, looks good. It might not be unreasonable to add asserts to these functions too, as I don't think we should ever have a register that doesn't belong to any register set.

Comment at: lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp:408-431
+    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)
Could you also remove all of these else's while you're in there, as per <http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return>.



More information about the lldb-commits mailing list