[Lldb-commits] [lldb] [lldb] Added a warning in case of instruction decode failure (PR #164413)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 21 14:00:27 PDT 2025
================
@@ -0,0 +1,32 @@
+"""
+Test the 'memory read' command when decoding instruction failures.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class MemoryReadTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def build_run_stop(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(
+ self, "// break here", lldb.SBFileSpec("main.c")
+ )
+
+ @skipIf(archs=no_match("^riscv.*"))
+ def test_memory_read(self):
+ """Test the 'memory read' command with instruction format."""
+ self.build_run_stop()
+
+ # asume that 0xffffffff is invalid instruction in RISC-V
+ # (lldb) memory read --format instruction `&my_insns[0]`
+ # expected message: failed to decode instructions at 0x
+ self.expect(
+ "memory read --format instruction --count 1 `&my_insns[0]`",
----------------
DavidSpickett wrote:
Does `my_insns` not do the same thing? Maybe we don't realise it's an array unless you do the indexing?
https://github.com/llvm/llvm-project/pull/164413
More information about the lldb-commits
mailing list