how to examine memory location when utilizing gdb

来源:互联网 发布:金蝶智慧记mac版 编辑:程序博客网 时间:2024/05/17 16:03

When debugging sometimes it’s important to examine the memory location to diagnose programs of abnormal behaviors.

How to fulfill it is via x /nfu addr commands

Here x is an acronym for examine, addr is an expression which can be evaluated to the corresponding memory location.

Now let depict the options

n is the repeat count, which specifies how much memory to display, pay attention that the quantity is affected by the unit specified by u option

f indicates the display format, which has the same role as in the print commands, that’s ‘x’ for hexadecimal, ‘d’ for decimal, ‘u’ for unsigned integer, ‘o’ for octal, ‘t’ for binary, ‘a’ for address, ‘c’ for ascii, ‘f’ for float, ‘s’ for string; plus ‘i’ for machine instructions. Default is ‘x’.

u specifies the unit size: b for byte, h for half-word (machine word, usually 32-bits, so it’s two bytes), w for word (four bytes), g for giant words, that’s eight bytes.

 

 

 

原创粉丝点击