microsoft / microsoft/debug-adapter-protocol
Proposal: remove requirement for exact instruction count for disassemble response
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 173
- Avg merge
- 7d 7h
- Merged PRs (30d)
- 2
Description
The spec requires debug adapters to return exactly the number of instructions requested.
/**
* Number of instructions to disassemble starting at the specified location
* and offset.
* An adapter must return exactly this number of instructions - any
* unavailable instructions should be replaced with an implementation-defined
* 'invalid instruction' value.
*/
instructionCount: number;
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the disassemble request definition and the instructionCount specification quoted in the issue, then review how the VS Code disassembly view interprets returned addresses. Define the expected response when fewer instructions are available and clarify the address rules; done means the protocol specification is unambiguous for both clients and debug adapters.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100