(lldb) di -s 0x18 -c 40 --features zknd
error: Failed to disassemble memory at 0x00000018.
(lldb) di -s 0x18 -c 40 --features zbadextension
'zbadextension' is not a recognized feature for this target (ignoring feature)
“Failed to disassemble” could be not great error reporting for “could not read memory”.
Also double check that that 0x18 from the object file does in fact end up at 0x18 in the loaded program. dis main would be a way to do the disassembly without needing the literal address.
Apologies; I overly minimised the details when keeping the snippets brief. The rest of the disassembly is complete and matches the objdump output until it quietly terminates at the undisassembled instruction:
@tomg the features flag will give you what you want, but it uses the format that the LLVM disassembler takes for the features string. Try --features +zbadextension . This replaces the automatic extensions that lldb turns on, including compressed, so if you want them try +c,+zbadextension .
My team has recently added built attribute support for lldb disassembly for RISC-V and Hexagon. We’ll be upstreaming it soon, and people can use that framework to add support for their extensions.
@DavidSpickett we noticed the same thing when adding support for the Xqci extension - the RISC-V disassembler spits out an error instead of a warning when it sees instructions that it can’t disassemble. This gets a bit comical when you are disassembling a range with bytes turned on. You see bytes for the good instructions, and errors for the bad instructions.
With the 20.1.1 release the behavior with the (uncompressed) aes32dsi instruction was quietly halting when disassembly fails. This wasn’t as helpful as giving an explicit error, since it left open the possibility that it was a limit to the context being disassembled, bad symbol range, required options like --count, --force, etc.
Is the behavior you just showed where it continues through the unrecognized instructions implemented after 20.1.1 or is it specific to compressed instruction handling?
That’s the default behavior for our downstream 20.0. It’s not correct, but it’s better than what you’re seeing. We need to make sure upstream moves to at least what we’ve got downstream, and better yet would be to make it print something like “unknown opcode” instead of throwing an error.