-
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
Proposal: remove requirement for exact instruction count for disassemble response #234
Comments
Sorry to sort of hijack on this request, but if we're revisiting some of the disassembly stuff, I'd like to make a request: remove the requirement to supply I'm looking to implement disassembly in vimspector but I'm looking at a lot of UI work due to the requirement to specify a number of instructions to disassemble (or, I have to ask the user to specify how many instructions, but ... how would they know?). Given that the An alternative would be to have a Will need adapter authors' buy-in for it of course. I'm making an assumption that debuggers can provide this automatic "last" instruction for a function. It seems plausible to me. Let me know if I should open a new issue for that rather than hijacking this one. |
Hello, Another way, if you don't want these kind of numbers, is to fetch disassembly lines by a greater amount of chunks (maybe fixed). But, if you take GDB as an example, it may contains fragmented ranges of disassembly (example: 0x80000 - 0x400000 and 0x600000 - 0x800000). With your implementation, I won't be able to scroll from 0x80000 to 0x600000 since I will face a dead-range. With the current implementation, I will see placeholders. On my side, I would say that the |
I think As I understand it, I can see from the client-side why |
It turns out that returning the exact requested number is fundamentally required in order for clients to use this API. So I'm strongly against this change. Without the above requirement, it's not possible to work out which instruction relates to the requested memory reference. |
Skimming the original discussion #42 it's not clear to me why that requirement exists. I understand the case @puremourning brings up, but wouldn't it work to say that if the client asks for 100 instructions, and 75 are returned, then you reached the end of the available instructions? I see it as similar to the stacktrace request. |
I mean I guess it works if the adapter is required to return at least (-instructionOffset) instructions in the case of negative offset. (Otherwise requested instruction must be instruction 0 in the response) But tbh it's not that hard to just pad it like the spec says. |
I guess with a negative offset, you can run off both the front or the end of the valid range, and you either need the DA to pad the response and return the exact requested number, or you need a system for the response to tell the client whether frames are missing from the beginning or end (like a |
Agree. But given we already have a spec that says it should just be padded. And clients have been implemented based on that... why not just pad it. |
The spec requires debug adapters to return exactly the number of instructions requested.
This presents an issue when there are not enough instructions available. The DA is then required to return an "implementation-defined" invalid instruction. It is unclear how those instructions will be used, and why they are even necessary to return. Scrolling through invalid instructions does not provide any additional information to users.
Also what the addresses should be for the invalid instructions is not defined in the spec so it is unclear how the editor can interpret them. For example, the VS Code implementation of a disassembly view will attempt to do a binary search using the addresses, which requires that the invalid instructions obey certain rules to implement this. This may also result in having to return negative addresses which also does not really make sense for an instruction.
Removing the requirement to return exactly the number of requested instructions would better define the expected disassembled instructions for both the client and server.
The text was updated successfully, but these errors were encountered: