aykevl created this revision.
aykevl added reviewers: labath, clayborg.
Herald added subscribers: lldb-commits, Jim, dylanmckay.
Herald added a project: LLDB.

I believe the actual opcode does not matter because the AVR architecture is a 
Harvard architecture that does not support writing to program memory. 
Therefore, debuggers and emulators provide hardware breakpoints. But for some 
reason, this opcode must be defined or else LLDB will crash with an assertion 
error.

---

I would like to add a test case for this, but I'm not quite sure how to do 
that. It appears that to trigger the crash (fixed by this patch), there needs 
to be a `gdb-remote`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74255

Files:
  lldb/source/Target/Platform.cpp


Index: lldb/source/Target/Platform.cpp
===================================================================
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1855,6 +1855,12 @@
     }
   } break;
 
+  case llvm::Triple::avr: {
+    static const uint8_t g_hex_opcode[] = {0x98, 0x95};
+    trap_opcode = g_hex_opcode;
+    trap_opcode_size = sizeof(g_hex_opcode);
+  } break;
+
   case llvm::Triple::mips:
   case llvm::Triple::mips64: {
     static const uint8_t g_hex_opcode[] = {0x00, 0x00, 0x00, 0x0d};


Index: lldb/source/Target/Platform.cpp
===================================================================
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1855,6 +1855,12 @@
     }
   } break;
 
+  case llvm::Triple::avr: {
+    static const uint8_t g_hex_opcode[] = {0x98, 0x95};
+    trap_opcode = g_hex_opcode;
+    trap_opcode_size = sizeof(g_hex_opcode);
+  } break;
+
   case llvm::Triple::mips:
   case llvm::Triple::mips64: {
     static const uint8_t g_hex_opcode[] = {0x00, 0x00, 0x00, 0x0d};
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to