WinDbg Command Learning 2

Source: Internet
Author: User

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]
 
  1. 0:000> da 0027eb3c
  2. 0027EB3C "Tencent Technology (Shenzhen) Com"
  3. 0027eb5c "Pany Limited"
  4. 0:000> ea 0027eb3c "Tencent Technology (Shenzhen) company Limited1"
  5. 0:000> da 0027eb3c
  6. 0027EB3C "Tencent Technology (Shenzhen) Com"
  7. 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

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.