Debug Disassembly Window

 Summary

When C programs are compiled, it is quite common for several lines of assembly code to be generated for an individual line of C code. Having multiple lines of assembly for each line of user, generated source code presents debugging challenges for the user. Entering breakpoints and single step commands in the source code window does not provide a mechanism for examining the underlying assembly code. The Debug Disassembly Window gives the user access to debugging in assembly language for project written in C. The Debug Disassembly Window allows the user to perform all the normal debug operations including single stepping and setting breakpoints on the individual assembly instructions generated from C code.

Opening the Debug Disassembly Window

openingDDW.png

In order for the debug disassembly window to open, the project must be in a debug session.
To open the Debug Disassembly Window first pause the debug session then select Window -> Debugging -> Disassembly.

opened.png

The Debug Disassembly Window will open up in a new editor window tab. The Disassembly window will display the disassembly of the function pointed to by the Program Counter. The assembly language will be interspersed with the original C source code.

bothopen.png

Moving the Disassembly Window can allow both the disassembly and original source code to be viewed together. The image on the right displays two green lines for the single program counter value. Both green lines point to the same line of executable code.

Selecting C or Assembly Code to Debug

You will select whether you want to debug in the Source Code Window or Debug Disassembly Window. “Left Click” in either the C file or the Debug Disassembly window to select the file to debug.

The window tabs will let you know which window is the active debug window. When a file has been selected the “tab” will appear in a light blue shade.

activewindow.png

Stepping Through the Assembly Code

If the Debug Disassembly window is selected the “step into” function will only execute one line of assembly code. Each "step into" will move the green bar in the disassembly window one line of assembly code. Using assembly code may take several “step into”'s before the green arrow in the C file window moves.

You can switch back and forth from the disassembly window to the source code window at any time by simply clicking in the window in which you wish to debug

Breakpoints in the Disassembly Window

When working with the C files the line breakpoint can be used. When working in the Debug Disassembly window “LINE BREAKPOINTS CANNOT" be set. Address breakpoints must be used to stop the code on a line of code in the debug Disassembly window.
To set an Address Breakpoint in the debug disassembly window, left click on the line number. When the breakpoint is set you will notice the address breakpoint icon in the line number margin.

leftclick.png
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.