zoukankan      html  css  js  c++  java
  • x/nfu-用gdb查看内存

    用gdb查看内存

    2007-12-08 12:43

    用gdb查看内存

    格式: x /nfu <addr>

    说明
    x 是 examine 的缩写

    n表示要显示的内存单元的个数

    f表示显示方式, 可取如下值
    x 按十六进制格式显示变量。
    d 按十进制格式显示变量。
    u 按十进制格式显示无符号整型。
    o 按八进制格式显示变量。
    t 按二进制格式显示变量。
    a 按十六进制格式显示变量。
    i 指令地址格式
    c 按字符格式显示变量。
    f 按浮点数格式显示变量。

    u表示一个地址单元的长度
    b表示单字节,
    h表示双字节,
    w表示四字节,
    g表示八字节


    Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
    t(binary), f(float), a(address), i(instruction), c(char) and s(string).
    Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes)

    举例
    x/3uh buf
    表示从内存地址buf读取内容,
    h表示以双字节为一个单位,
    3表示三个单位,
    u表示按十六进制显示

    详细例子:

    (gdb) list
    1       #include<stdio.h>
    2       int main()
    3       {
    4
    5               //char a[1];
    6               //a[0]='a';
    7               unsigned long long md5=14126471717450151013;
    8
    9               //printf("%d ",a[0]);
    10              return 0;
    (gdb) break 10
    Breakpoint 1 at 0x8048372: file test.c, line 10.
    (gdb) run
    Starting program: /data/compiler/g_platform/bradenwu/md5/test.out

    Breakpoint 1, main () at test.c:10
    10              return 0;
    (gdb) x/8xb md5
    0x8837f465:     Cannot access memory at address 0x8837f465
    (gdb) x/8xb &md5
    0xbfffefa0:     0x65    0xf4    0x37    0x88    0x2e    0x4f    0x0b   0xc4

  • 相关阅读:
    Codeforces 1528E Mashtali and Hagh Trees
    Codeforces Round #709 (Div. 1, based on Technocup 2021 Final Round)
    Codeforces 1517G Starry Night Camping
    Codeforces 1508E Tree Calendar
    Codeforces 1508D Swap Pass
    Codeforces 1511G Chips on a Board
    Codeforces 1511F Chainword
    Codeforces 1516E Baby Ehab Plays with Permutations
    CF1539A Contest Start 题解
    关于 manacher
  • 原文地址:https://www.cnblogs.com/LiuYanYGZ/p/5522065.html
Copyright © 2011-2022 走看看