Setting breakpoints for. NET application debugging
In the software debugging process, the breakpoint function is crucial. Imagine how difficult it is to view the execution of a specific function if there is no breakpoint function.
. Net Applications compile intermediate code at cost during execution. That is to say, if the intermediate code is not compiled at cost, we cannot use the plug-in SOS of the BP program. DLL and sosex. DLL provides some useful extension commands to help us complete this task.
First, let's take a look at the application of the bpmd Command provided by SOS. dll.
! The bpmd command format is as follows:
0: 004>! Help bpmd
-------------------------------------------------------------------------------
! Bpmd [-nofuturemodule] <Module name> <Method Name>
! Bpmd-MD <methoddesc>
! Bpmd-list
! Bpmd-clear <pending breakpoint number>
! Bpmd-clearall
We can see from the above that bpmd supports setting assertions by function name or function address.
Note the following two points:
1: If it passes! To set a breakpoint, You need to include the namespace in the <Method Name> field, as shown in the following example:
! Bpmd consoleapplication test. ctest. Hello
Test Is the namespace.
2: If the breakpoint function is not compiled at the cost of code, bpmd will set the breakpoint when receiving the code that the breakpoint function is compiled at the cost, at the same time, if the module of the function where the breakpoint is to be set is not loaded, add the-nofuturemodule option to notify the bpdm module that it may not be loaded.
In addition, sosex. dll provides a particularly useful breakpoint setting function. You can set the breakpoint by specifying the source code line number. The command format is:
! Sosex. MBP <Source File> <line number> [column number> [Options] "command"
The functions of each field are as follows:
1: source file source code name
2: line number
3: column number
4: Options:
/1 set a breakpoint
/P: N: After skipping N times, set the breakpoint/P: 3 indicates that the breakpoint is set when the code is executed for 3rd Times.
5:/T: N: breakpoint on the specified Thread
6: "command" indicates the Command executed when a breakpoint is triggered.
2013-05-08 Cuiweican