Create a deadlock Program
using System;using System.Threading;namespace ConsoleApplication1{ class Program { static void Main() { new Program().Test1(); } private void Test1() { lock (this) { Console.WriteLine("Enter Test1"); new Thread(() => { Thread.Sleep(2000); Test2(); }).Start(); Console.Re
One of the most useful commands for me to use WinDGB is the. shell Command.
Debugging Tools For Windows Help file:
The. shell Command can load a shell process and redirect its output to the debugger, or redirect it to a specified file.
So why do I think loading a shell process will be helpful for daily work? The simplest and most common function for loading shell processes is to search for strings. You may wonder why Ctrl + F is not used in debugger to search for strings? This will s
.
Settings on Windows 7 systems
Bcdedit/debug on
bcdedit/dbgsettings USB targetname:
Somename
bcdedit/set "{dbgsettings}" Busparams
x.y.z
where x, y, and z is the bus, device, and function numbers for the host controller. The bus, device, and function numbers must is in decimal format (for example,busparams
program. As a result, instances of strings with specific values have only one instance of the system (APP Domain).The string declared directly inside the code is maintained within a object[] by the CLR runtime.0 o'clock the generated string or the stitched string is not maintained in this mainstream array.The life span of the residing array is as long as the app domain it resides in. So the GC does not affect the string that resides in the array that is referenced by the GC.
The following
EnvironmentVirtual machine Win7 Pro x86vmware 12windbg x86Virtual Machine win7 ConfigurationAdministrator rights run Cmd.exe and then enter the following command: bcdedit/?bcdedit/enum osloaderbcdedit/copy {current}/d "Windows Vista copy" Bcdedit/debug ONBC Dedit/bootdebug Onbcdedit/dbgsettingsbcdedit/timeout 7Set up VMware's Pipeline virtual serial portTurn on the virtual machine settings, remove the printer, add a serial portWinDbg settingsCreate a WinDbg
Label:Next set the virtual machine boot mode, you can directly set the current virtual machine startup item to debug modeor create a new startup project directlybcdedit/dbgsettings {serial [baudrate:value][debugport:value] | 1394 [Channel:value] | usb}Bcdedit/dbgsettings serial baudrate:115200 debugport:1
// Debugenty is the name displayed when the boot is
bcdedit/displayorder {current} {ID
}/debug {id} onSet the WinDbg shortcut,-b-k com:pipe,port=\\
One,WinDbg view Memory command :When we analyze a problem in the debugger, we often need to look at the contents of different memory blocks to analyze the cause, and then verify that the assumptions made are correct. Because the state of each object is stored in memory, the contents of the memory are equivalent to the state of the object.The most common format for the D command is to display the data stored in an address based on the specified type in
' fffd6000 unfrozenThread operations that can be performed using this command include: thread switching, threading environment, thread time, and so onThread traversalis still the ~ command. In addition to being able to act as a list of threads command, it can also be used to traverse threads and execute specified commands. Simply use the wildcard character "*". Such as:
~*k
Displays all thread stack information (this command means that the k instruction is executed on all threads)
;initializecriticalsection (Gcritsecfirst); InitializeCriticalSection (gcritsecsecond); InitializeCriticalSection (gcritsecthird); _beginthreadex (NULL,0, thread1func, NULL,0, ThreadID); _beginthreadex (NULL,0, thread2func, NULL,0, ThreadID); while(1);return 0;} This is a classic deadlock, open two threads, a 123 in order to take the lock, a 321 order to lock, each other waiting for the other's lock and do not release their hands of the lock. (Here the lock also refers to CriticalSection)?
forme2164968 "K"
kd> da e2164969
e2164969 ""
kd> da e216496a
e216496a "E"
Kd> da e216496b
e216496b " "
kd> da e216496c
e216496c "R"
kd> da e216496d
e216496d ""
kd> da e216496e
e216496e "E"
kd> da e216496f
e216496f " "
kd> da e2164970
e2164970 " a " Kd> du e2164968
e2164968 "Keread 猍 Confucianism?.?.?.?."
Some often use commands that do not test individually:
Da according to ASCII string read
DB reads from single-byte and ASCII strings
DC reads according to 4-byte an
first, high CPU test 1. Sample Code Static voidMain (string[] args) {console.clear (); Console.WriteLine ("to the command line, switch to the WinDbg directory, and execute ADPLUS-HANG-PN highcpu.exe-o c:\\dumps"); Console.WriteLine ("If you want to stop, press CTRL + C to end the program"); Console.WriteLine ("===================================================="); while(true) {console.setcursorposition (0,3); Console.
Tags: fonts library fill hardware mic IDT for tools OneThe brothers who used to Vsiual studio might think that all debuggers should be like it for a preconceived reason, but when you install Debugging Tools for Windows, you will find two series of tools A range of 32-bit tools and a range of 64-bit tools. This is confusing because you don't have to think about 32-bit or 64-bit at all when we install Microsoft Visual Studio. If you are using one of the WINDB
The WinDbg of ASL code is erected through USB3.0:Target machine configuration:1. Obtain the same version of the OS check build Acpi.sys;2. Replace the Acpi.sys in the system (refer to: How to replace Windows system files );3. Reboot if the OS is not entered after the replacement:(1) In the BIOS setup interface, the system time is set to the Acpi.sys file signature time;(2) In the Advance option, select Disable driver signature into the OS.4. Turn off
Method 1:1> First Use DeviceTree.exe to view the specified filter-driven loadaddress2> re-use LordPE.EXE to view the entry point address of the specified filter driver file3> Compute Filter-driven driverentry function memory address driverentry function memory address = Load address + entry point addressesExample:1> Load Address = 0xfaabf0002> Entry Address = 0x34003> Windbg next breakpoint bu 0xfaabf000+0x3400Method 2:1> First View The specified fil
],[system.xml.schema.xmlschemaobject, System.xml]][]0000000195747e80 000007FEE679FD20 1 0 System.xml.schema.xmlschemaobjecttable+xmlschemaobjectentry[]0000000195747ed8 000007fee67a 1e60 1 0 system.xml.schema.xmlschemaobjecttable+valuescollection View Code!windex!windex is a very common command. This command will not only dig in the heap to find the type of data you need. The most useful thing is that it can be used to find an object in the heap that implements a interface and inherits an abstra
1. Set windbg tool memory tracking Gflags-i Memtest.exe +ust
2. Run for a period of time through the debugger WinDbg attach interrupt
The input command!heap-s output is similar:
0:001>!heap-s
3. Over time interrupt the input!heap-s again to see the growth of the obvious stack.
4. View stack situation!heap-stat h 00400000
5. View heap Details!heap-flt s 0xa4, that is, the details of the heap above
After you drag the dump into the WinDbg, enter it in the command input field. Load wow64exts return!SW Enter, will WinDbg dump, switch from 64-bit mode to 32-bit mode, otherwise see the call stack It's not helpful for us to analyze dump. Then you can use the other commands to analyze it. For example: Using the KB command, looking at all the thread's call stacks, finding the wrong thread, ~*KB, is looking at
Label:The following is a simple test program that basically includes all of the variable types, including static, constant, global, local, and new. #include using namespacestd; Const Char* Global_const_string ="Hello World";
intGlobal_int = -;
Static intGlobal_static_int = -;
intMain () {Static intLocal_static_int = -; intLocal_int = $; int* PValue =New int( -); coutGlobal_intLocal_static_intPValue; DeletePValue; System ("Pause"); return 0;
} In turn, we analyze the storage area to which each va
. Process. Process command to specify the process to use as the process context ( Set Process Context ). Process shows the eprocess of the current session, which shows that the current process is Test.exe[CPP]View PlainCopyPrint?
kd>.process
implicitprocessisnow821f5da0
kd>?@ $proc
evaluateexpression:-2111873632=821f5da0
kd>!process821f5da00
process821f5da0sessionid:0cid:06e8 peb:7ffde000parentcid:0620
DirBase:02b40380ObjectTable:e1
WinDbg live mode debugging.. Net managed code, using BP,BU,BM can't set breakpoints, maybe I won't. Under study, managed code has its own commands,! BPMD The fully qualified method name of the module nameSteps:1, find the process PID, with Windbg,attach2. Use the Anti-compilation tool (IL) to find the method name that requires a breakpoint, which requires a fully qualified name.3, according to the name, 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.