-
Notifications
You must be signed in to change notification settings - Fork 240
Disassembly Debugging
Haneef Mohammed edited this page Jan 7, 2022
·
14 revisions
This is an experimental feature for both Cortex-Debug and VSCode but is functional to the extent of what is released
While in a debug session and in a paused state, you can invoke the disassembler and view the disassembly for that source code. This Disassembly
view is provided by Microsoft/VSCode and I would still consider it a work in progress but it has been functional thus far. Cortex-Debug provides the backend and VSCode provides the window/menus that you interact with. Here are the features thus far
- Trigger Disassembly either from the editor or in the
CALL STACK
window by right-clicking- It can disassemble an entire executable but it will only do it based on how far you scroll. It is more like on-demand disassembly.
- As of this writing, the source is being embedded into the assembly but source lines are repeated when there are multiple instructions for the same line. You can toggle 'Source code' embedding from the Command Palette. Hint: Create a keyboard shortcut
- You can arrange your windows such that the disassembly and source code windows are side by side
- You can single step in either of the windows. If the focus is in the disassembly window, it will do a step/next at an instruction level
- You can set breakpoints at any instruction just like you do for source files (in the gutter area). The UI to set conditions and hit counts are not yet enabled although our backend supports conditions
It is difficult to tell if the disassembly is actually accurate.
- Since arbitrary addresses are used to fetch instructions, we may not be getting the correct ones. Especially if the start address is in the middle of an instruction. We try multiple times to make sure that some known instructions are in the right location -- meaning all others will be as well.
- The address range may be beyond the limits of memory regions. We try to detect this and display a '??' just before the instruction to indicate that it might be suspicious.
- We are not sure how VSCode deals with multiple memory regions that are disjoint. You can have code in ROM, FLASH, external FLASH, SRAM, and all combinations of those memories. They are generally in disjoint address spaces. We know Cortex-Debug and GDB can handle it but not sure if VSCode can. Let us know if you are seeing a problem.