Hidden debugging functions of Visual Studio

Source: Internet
Author: User

Source: Microsoft Internet Development Support


Visual Studio is a powerful debugging tool. Many of its hidden functions are rarely used, but it can save a lot of time in specific scenarios. This article mainly introduces some hidden functions related to Visual Studio debugging, you are welcome to add.

 

Run to cursor)

Most people use Visual Studio to set a breakpoint at the beginning of the program when debugging the program, and then F10/F11 to the logic they want to view. If we need to carefully check the variables or execution paths of each step in this process, we can use the run to cursor function if we do not want to care about the logic of the preceding execution, you only need to move the cursor to the line of code you want to execute, CTRL + F10, and the program directly stops the line of code with the mouse cursor.

Conditional breakpoint)

Breakpoint is used by all users. It is believed that the conditional breakpoint is not unfamiliar with frequent debugging. The usage is as follows,

Looking at the right-click menu above, the hit count is estimated that many people will use it to specify the number of times when the hit reaches this breakpoint,

The next step is more advanced: filter. I believe many people have encountered interference by other threads when debugging multi-threaded programs. It's hard to break it down, step by step F10, suddenly another thread broke the previous hit. Which thread did I jump? It's hard to find it. Next, we need filter. Through filter, We can filter machines, processes, and threads that require break.

The next step is the when hit option. Many people use it to track variables and include them.

Export: The resumable export function is used less. In fact, in some scenarios, resumable export can save you a lot of money. For example, if you find a bug in a code segment, you can export the breakpoint as XML and attach it to the bug. The bug owner directly finds the corresponding version to import the breakpoint, run the program.

 

Data tips)

When debugging, place the mouse over the variable name to view the data that you care about. However, if a piece of logic needs to be executed repeatedly, such as debugging an algorithm, you can move the mouse over it, pin this variable next to the code, which is much less eye-catching than viewing it in the watch window.

In addition, these data tip can be imported and exported.

 

View disassembly code

Viewing the disassembly code is a hidden function in Visual Studio, which is rarely noticed. However, it is helpful for us to learn the assembly language or understand some specific compiler behaviors. This feature makes it much easier to understand the Assembly Language and source code.

This function is easy to use. We will introduce the program code qsort in the windbg U/UF/UB command. c. For example, open the program in Visual Studio and set the breakpoint. You can directly run the program through Visual Studio or attach it to a running program. When the breakpoint is triggered, right-click and select go
To disassembly,

The disassembly effect is as follows. Next, let's look at the swap method's assembly code. Is it easy to understand?

(2 ratings, average: 5.00)
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.