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 information. The debugger does not guess what data is stored on this address, because in most cases guessing is wrong. Therefore, the user is required to explicitly define the format in which to parse the data. The command format is as follows:
syntax:d [type][address Range] //d* command displays the contents of a given range of memory
d, DA, DB, DC, DD, DD, DF, DP, DQ, DU, DW, DW, Dyb, Dyd (Display Memory)
If you omit Range , the command starts at the end of the previous memory View command. This allows for continuous memory viewing.
1.da:ascii characters up to 48 characters per line. The display continues until it encounters the first null byte or all the characters specified by reaching the range value are already displayed. All non-printable characters, such as carriage returns and line breaks, are displayed as dot (.) numbers.
2.DB: Byte values and ASCII characters each display line contains the address of the first byte of the line followed by a 16-byte value. These byte values are followed by their corresponding ASCII values. The 8th and 9th 16 binary values are separated by a hyphen (-). All non-printable characters, such as carriage returns and line breaks, are displayed as dot (.) numbers.
3.DC: Double-character value (4 bytes) and ASCII characters. Each display line displays the address of the first data in the row, with a maximum of 8 16 binary values per line and their corresponding ASCII characters. The default display count is 32 DWORD (128 bytes).
4.dd: Double-character value (4 bytes) The default display count is 32 DWORD (128 bytes).
Example:
[CPP]
- 0:000> da 0027eb3c
- 0027EB3C "Tencent Technology (Shenzhen) Com"
- 0027eb5c "Pany Limited"
- 0:000> ea 0027eb3c "Tencent Technology (Shenzhen) company Limited1"
- 0:000> da 0027eb3c
- 0027EB3C "Tencent Technology (Shenzhen) Com"
- 0027eb5c "Pany Limited1"
Second, search for a value in memory: command s
The command s (for search) is a very useful command that can be used to find a known value within a debug target.
The parameters of this command include the type and value to be searched by the vegetarian.
S–d 0012ff40 L1024 c0000005
Where-D is a double-character DWORD, which is the type of search. Other types of examples are as follows:
- B–byte
- W–word
- D–dword
- Q–qword
- A–ascii string
- U–unicode string
Iii. what is included in each location of the view memory
When debugging, both the object and the stack contain a large number of pointers, and we cannot quickly guess the data they represent. Although we can easily separate the address of the kernel space from the address of the user-state space, it is not easy to separate an address representing the stack from the address of a heap. We can use a very useful extension command !address <your address> to solve this problem.
The parameter of the command is an address, and if no address parameter is specified, the extension command searches for and enumerates all memory areas and gives detailed information.
This is relatively simple to learn: we use !address directly-? You can find instructions for how to use it:
-summary Displays only summary information.
WinDbg Command Learning 2