41.10. Memory Windows

The next three windows are typically used for low-level debugging when all other alternatives have been exhausted. Stepping into memory locations, using a disassembler, or looking at registry values requires a lot of background knowledge and patience to analyze and make use of the information that is presented. There are only very rare cases while developing managed code when you would be required to perform debugging at such a low level.

41.10.1. Memory Windows 1–4

The four memory windows can be used to view the raw contents of memory at a particular address. Where the Watch, Autos, and Locals windows provide a way of looking at the content of variables, which are stored at specific locations in memory, the Memory window shows you the big picture of what is stored in memory.

Each of the four Memory windows can examine different memory addresses to simplify debugging your application. Figure 41-12 shows an example of the information that can be seen using this window. The scrollbar on the right of the window can be used to navigate forward or backward through the memory addresses to view information contained in neighboring addresses.

Figure 41.12. Figure 41-12

41.10.2. Disassembly

Interesting debates arise periodically over the relative performance of two different code blocks. Occasionally this discussion devolves to talking about which MSIL instructions are used, and why one code block is faster because it generates one fewer instruction. Clearly, if you are calling that code block millions of times, disassembly might give your application a significant benefit. However, more often than not, a bit of high-level refactoring saves much more time and involves much less arguing. Figure 41-13 shows the Disassembly window for a LinkLabel click — the runtime is about to construct a new Customer object. You can see MSIL instructions that make up this action.

Figure 41.13. Figure 41-13

You can see from Figure 41-13 that a breakpoint has been set on the call to the constructor and that the execution point is at this breakpoint. While still in this window you can step through the lines of MSIL and review what instructions are being executed.

41.10.3. Registers

Using the Disassembly window to step through MSIL instructions can become very difficult to follow as different information is loaded, moved, and compared using a series of registers. The Registers window, shown in Figure 41-14, enables the contents of the various registers to be monitored. Changes in a register value are highlighted in red, making it easy to see what happens as each line is stepped through in the Disassembly window.

Figure 41.14. Figure 41-14

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.104.183