-
Notifications
You must be signed in to change notification settings - Fork 319
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
Visual Studio Disassembly view out of sync (VSC-1557) #1399
Comments
Let me summarize the relevant code and discuss about it: const fetchSize = (args.instructionCount - instructions.length) * meanSizeOfInstruction;
const stepStartAddress = `(${args.memoryReference})+${startOffset}`;
let stepEndAddress = `(${args.memoryReference})+${startOffset}+${fetchSize}`;
if (args.endMemoryReference && instructions.length === 0) {
// On the first call, if we have an end memory address use it instead of
// the approx size
stepEndAddress = args.endMemoryReference;
oneIterationOnly = true;
}
const result = await sendDataDisassemble(
this.gdb,
stepStartAddress,
stepEndAddress
); The main issue with the alignment is that vscode disassemble request doesn't use the actual address you want when you right click and click to open disassemble view and uses some arbitrary memory reference In my tests I could not obtain such address from the request. If you in fact are sure that |
Hi, so VSC does an internal remapping based on the instructionOffset. From my understanding it sets the instructionOffset in order to display code prior to the one that the current focus point is. I am attaching a screenshot from the actual function from VSC that requests the disassembly data, The blue box shows where it will go into the esp-idf extension. The box at line 497 shows on how the instruction reference (that is a string) is mapped to the actual address (based on the instructionOffset). When it later goes into the render function it takes the reference and resolves it to the actual address. What lets the disassembly view end up in the wrong location. All this is based on the understanding, that the disassemble function knows on how to deal with the instructionOffset. The box on the right shows you the mapping entry for reference "0x420395e4" to address 0x4203965e. To answer your 2 questions: |
This issue has been marked as |
Same issue. |
OS
Windows
Operating System version
Microsoft Windows 11 Pro
Visual Studio Code version
1.96.2
ESP-IDF version
5.4
Python version
3.11.2
Doctor command output
report.txt
Extension
esp_idf_vsc_ext.log
Description
I am debugging an esp32-s3 application for M5stack cardputer. When opening the disassembly view, the active line in the disassembly view does not match the current instruction pointer.



I started debugging the problem in Visual Studio Code and ended in vscode-esp-idf-extension.
The problem is in
vscode-esp-idf-extension/src/cdtDebugAdapter/adapter/GDBDebugSession.ts
function:
protected async disassembleRequest(
response: DebugProtocol.DisassembleResponse,
args: CDTDisassembleArguments
) {
According to the debug adapter protocol:
https://microsoft.github.io/debug-adapter-protocol//specification.html
interface DisassembleArguments {
has:
/**
*/
instructionOffset?: number;
This argument is completely ignored by the disassembleRequest function.
In my particular debug session the value of instructionOffset = -50.
This leads to the disassembly view marking 0x420397ef in the view, whereas Registers.pc => 0x420395e1.
The mapping between these addresses happens in
private async loadDisassembledInstructions
found in the following Visual Studio Code source code file:
vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.ts
Debug Message
debug_console_output.txt
Other Steps to Reproduce
Repro: I opened one of my projects, set a hardware breakpoint on esp_log_writev in log_write.c from espressif and do start debugging.
When the breakpoint is hit, I open the disassembly view ( and start single step).
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: