[Lldb-commits] [lldb] [lldb-dap] fix disassembly request instruction offset handling (PR #140486)

Ely Ronnen via lldb-commits lldb-commits at lists.llvm.org
Tue May 20 14:22:04 PDT 2025


================
@@ -56,100 +54,204 @@ DisassembleRequestHandler::Run(const DisassembleArguments &args) const {
     }
   }
 
+  int64_t instructionOffset = args.instructionOffset.value_or(0);
+  if (instructionOffset > 0) {
+    lldb::SBInstructionList forward_insts = dap.target.ReadInstructions(
+        addr, instructionOffset + 1, flavor_string.c_str());
+    if (forward_insts.GetSize() != static_cast<size_t>(instructionOffset + 1)) {
+      return llvm::make_error<DAPError>(
+          "Failed to disassemble instructions after " +
+          std::to_string(instructionOffset) +
+          " instructions from the given address.");
----------------
eronnen wrote:

Makes sense, I can always pad with invalid instructions if there are not enough instructions

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


More information about the lldb-commits mailing list