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;
 


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;
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to