[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
Thu Oct 1 10:43:17 PDT 2020


mgorny created this revision.
mgorny added reviewers: krytarowski, labath.
mgorny requested review of this revision.

Fix crash due to overeager assert on translating 32-bit to 64-bit
register constants.  Instead, just return an invalid register index
and let it be ignored just like native requests for unsupported
registers.

While at it, fill the missing translations.


https://reviews.llvm.org/D88682

Files:
  lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp


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:
@@ -385,8 +394,7 @@
   case lldb_dr7_i386:
     return lldb_dr0_x86_64 + regnum - lldb_dr0_i386;
   default:
-    assert(false && "Unhandled i386 register.");
-    return 0;
+    return -1;
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88682.295622.patch
Type: text/x-patch
Size: 975 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201001/3b3bf25f/attachment.bin>


More information about the lldb-commits mailing list