VS debugging skills

Source: Internet
Author: User
Start debugging from the "debug" menu, select "start", "Statement by statement", or "process by process ".

Start debugging from the "debug" menu, select "start", "Statement by statement", or "process by process ". -Or-in the source window, right-click a line in the executable code and select "Run To cursor" from the shortcut menu ". If "start" is selected, the application starts and runs until the breakpoint. The execution can be interrupted at any time to check,

Start debugging

  1. Select Start, statement-by-statement, or process-by-process from the Debug menu ".

    -Or-

  2. In the source window, right-click a line in the executable code and select "Run To cursor" from the shortcut menu ".

If "start" is selected, the application starts and runs until the breakpoint. The execution can be interrupted at any time to check the value, modify the variable, or check the program status. For more information, see interrupted execution.

If you select "Statement-by-statement" or "process-by-process", the application is started and executed, and then interrupted on the first line.

If you select "Run To cursor", the application starts and continues to run to the breakpoint or cursor position, depending on whether the breakpoint is in front or the cursor is in front. You can set the cursor position in the source window. In some cases, no interruption occurs. This means that the code that never reaches the set cursor is executed.


The "debug" menu provides three code-based commands:

  • Statement by statement

  • Process by Process

  • Jump out

The difference between statement-by-Statement and process-by-process is that they process function calls differently. Both commands instruct the debugger to execute the next line of code. If a row contains a function call, "Statement by statement" only executes the call itself, and then stops at the first line of code in the function. Execute the entire function one by one and stop it in the first line outside the function. To view the function call content, use "Statement by statement ". To avoid performing a function in one step, use "process by process ".

On nested function calls, "Statement by statement" will go into and execute the deepest nested function in one step. If you use "Statement-by-statement" for calls similar to Func1 (Func2 (), the debugger enters and executes the function Func2 in one step.

In the local code, if you want to enter and execute specific nested functions in a single step, use the "single-step execution of specific functions" command in the shortcut menu.

When you want to return a function that is inside the function call, use "Jump out ". "Jump Out" will always execute the code until the function returns, and then interrupt at the return point in the called function.

See http://msdn.microsoft.com/zh-cn/library/a3cwf295 (v = vs.90). aspx

In the Disassembly window, this function is available only when address-level debugging is enabled on the "debug" node in the "options" dialog box. However, it is unavailable for script or SQL debugging.

The Disassembly window displays the assembly code corresponding to the instruction created by the compiler. If you are debugging hosted Code, these assembly commands correspond to the Local Code created by the real-time (JIT) compiler, rather than the Microsoft intermediate language (MSIL) generated by the Visual Studio compiler ).
In addition to assembly instructions, the Disassembly window displays the following optional information:
The memory address of each instruction is for the local application, which is the actual memory address. For Visual Basic, C #, or hosted code, this is the offset from the beginning of the function.
The source code derived from the assembly code.
Code byte-the byte representation of the actual computer or MSIL command.
The symbol name of the memory address.
The line number corresponding to the source code.
An assembly language instruction is composed of a mnemonic operator (abbreviation of a command name) and a symbol representing a variable, register, and constant. Each machine language instruction is represented by an assembly language mnemonic. Usually there is one or more variables, registers, or constants following it.
If you cannot read the assembly language but want to make full use of the "disassembly" window, please refer to a good book on assembly language programming. Assembly Language Programming is beyond the scope of our brief introduction to the "disassembly" window.
Assembly language code depends largely on the Processor register (for managed code, it depends on the Common Language Runtime register ), you will find it useful to use the Disassembly window and register window in collaboration, allowing you to check the register content.
You may be willing to use the assembly language, but never want to or need to view the original, digital form of machine code commands. However, you can use the "Memory" window or select "code Byte" from the shortcut menu of the "disassembly" window to view it.

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.