[Lldb-commits] [lldb] [lldb][riscv] Fix setting breakpoint for undecoded instruction (PR #90075)

via lldb-commits lldb-commits at lists.llvm.org
Mon May 27 08:37:29 PDT 2024


================
@@ -115,8 +148,23 @@ Status NativeProcessSoftwareSingleStep::SetupSoftwareSingleStepping(
   emulator_up->SetWriteMemCallback(&WriteMemoryCallback);
   emulator_up->SetWriteRegCallback(&WriteRegisterCallback);
 
-  if (!emulator_up->ReadInstruction())
-    return Status("Read instruction failed!");
+  if (!emulator_up->ReadInstruction()) {
+    // try to get at least the size of next instruction to set breakpoint.
+    auto instrSizeOpt = emulator_up->GetLastInstrSize();
+    if (!instrSizeOpt)
+      return Status("Read instruction failed!");
----------------
ita-sc wrote:

Well, in this MR this is a common code, and every other architecture now not implemented `GetLastInstrSize`, so it will fail with the same error, as it was before. For RISC-V we will generate the same error if we can not get the size of instruction (if we can not read memory or if an instruction is bigger than expected)

https://github.com/llvm/llvm-project/pull/90075


More information about the lldb-commits mailing list