[Lldb-commits] [lldb] [lldb] Added a warning in case of instruction decode failure (PR #164413)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 21 11:01:25 PDT 2025


================
@@ -157,7 +157,9 @@ static lldb::offset_t DumpInstructions(const DataExtractor &DE, Stream *s,
         exe_scope->CalculateExecutionContext(exe_ctx);
         disassembler_sp->GetInstructionList().Dump(
             s, show_address, show_bytes, show_control_flow_kind, &exe_ctx);
-      }
+      } else if (number_of_instructions)
+        s->Printf("warning: failed to decode instructions at 0x%" PRIx64 ".",
+                  addr);
----------------
JDevlieghere wrote:

Is there precedent for writing errors or warnings to this stream? Depending on how this method is used, this might be fine or it might result in something weird like `instruction = warnings: failed ...`. The print below just says "invalid target". Following that pattern also sidesteps the question of whether this is a warning or an error. 

FWIW, even if we always dump the stream to the `CommandReturnObject`, it may still be nice to separate this out so we can write it to the dedicated error or warning stream (so it gets prefixed correctly with color). But that's a bigger change than what you're doing here.

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


More information about the lldb-commits mailing list