[Lldb-commits] [PATCH] D78588: [lldb/Core] Check that ArchSpec is valid.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 21 14:06:18 PDT 2020


JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, clayborg, labath.

A  reproducer replay hit an `llvm_unreachable` in Target.cpp because the architecture was not set and therefore the `ArchSpec` was invalid.

  Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode
  UNREACHABLE executed at /Users/jonas/llvm/llvm-project/lldb/source/Target/Platform.cpp:1922!

The unhandled case is `llvm::Triple::UnknownArch`. Alternatively we can add a case for it to the switch statement, but checking `IsValid` seemed more canonical.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D78588

Files:
  lldb/source/Target/Platform.cpp


Index: lldb/source/Target/Platform.cpp
===================================================================
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1822,6 +1822,9 @@
 size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
                                                  BreakpointSite *bp_site) {
   ArchSpec arch = target.GetArchitecture();
+  if (!arch.IsValid())
+    return 0;
+
   const uint8_t *trap_opcode = nullptr;
   size_t trap_opcode_size = 0;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78588.259098.patch
Type: text/x-patch
Size: 505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200421/de106ee7/attachment.bin>


More information about the lldb-commits mailing list