Hidden debugging functions of Visual Studio

Source: Internet
Author: User

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,Conditional breakpointI believe it is no stranger to frequent debugging. The usage is as follows,

Right-click the menu above,Hit countIt is estimated that many people will also use it to specify the number of times the hit was disconnected when it reached the breakpoint,

Next we will be more advanced,FilterI believe many people have encountered interference by other threads when debugging multi-threaded programs. It's hard to break it down. One step at a time, F10, And suddenly another thread puts the previous breakpoint 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.

NextWhen hitOption. Many people use this estimation to track variables.

ExportYou can use fewer breakpoint export functions. 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 a program in Visual Studio and set a breakpoint. You can directly run the program through Visual Studio or attach it to a running program. When the breakpoint is triggered, right-click the program 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?

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.