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

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon May 19 21:19:12 PDT 2025


https://github.com/JDevlieghere commented:

As a general comment, the code is becoming quite complicated and I think it would help if we can break things up more. Looking at the protocol arguments we have and offset in bytes, an offset in instructions, and then an instruction count. If possible please try to mimic that logic in the structure of this function:

1. Take the address
2. Apply the byte offset
3. Compute the instruction offset and apply it (the logic to do that is complex and therefore this should be factored out into a helper function)
4. Get the number of instructions at the computed offset and create a list of SBInstructions to disassemble. You can use a default constructed SBInstruction for padding.  
5. Disassemble the list of SBInstructions

Looking at the code, I think that's doable, albeit maybe slightly less efficiently? 

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


More information about the lldb-commits mailing list