-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disassembly: How can you determine the correct PC location #335
Comments
Is your question how do obtain disassembly around the current instruction? For the former, assuming you would like to put the instruction in the center of your text buffer of
If the later, you could either:
|
Ok thanks. I was really just trying to work out which instruction was current. But I think you answered with the fist part, combined with this :
Point being, if I ask for 100 instructions with an offset of -50 then the 51st instruction is the one matching the memory reference. Seems obvious now, thanks. |
In my DAP client, I want to display source code in one window and disassembly in another window, and have the correct source line highlighted in the source window and the exact instruction highlighted in the disassembly window. When stepping by instruction, the highlighted line moves in the disassembly window, and the code window may stay the same line.
This seems pretty simple on the face of it. The stack frame can tell me the current instruction pointer address, and the disassembly result can tell me address of each instruction. Then I can just compare until they match.
Except, unfortunately, I don't think I can. The StackFrame current instruction pointer is defined as a "memory references" but DisassembledInstruction is defined in terms of an "address" (and does not include a "memory reference"). As far as I know, these two things are not "the same" so there's no way to compare them. As a result, I don't think it's possible to determine the current "instruction" in the result of a disassemble request based on a given stack frame, which appears to make the "stepping granularity" of "instruction" somewhat non-functional.
Did I miss something? Is there a way to canonically determine which instruction in the disassembly is the current one for a given stack frame?
The text was updated successfully, but these errors were encountered: