zoukankan      html  css  js  c++  java
  • GDB常用功能

    执行时,常用-q去掉copyright等无用信息:

    gdb ./a.out -q

    Command   simple cmd Effect
    Starting and stopping
    quit   q Exit GDB
    run r Run your program(give command line  arguments here)
    kill k stop your program
    set args   before run, set running args
    BreakPoints
    break sum b sum set breakpoint at entry to function sum
    break *0x80483c3 b *0x80483c3 set breakpoint at address 0x80483c3
    delete 1 d 1 delete breakpoint 1
    delete d delete all breakpoint
    Execution
    stepi si execute one instruction
    stepi 4 si 4 execute 4 instructions
    nexti ni Like stepi, but process through function calls
    continue c resume execution
    finish f run until current function returns
    Examining code
    disas   Disassemble current function
    disas sum   Disassemble function sum
    disas 0x80483b7   Disassemble function around address 0x80483b7
    disas 0x80483b7 0x80483c7   Disassemble code within specified address range
    print /x $eip   Print program counter in hex
    Examining data
    print $eax p $eax

    Print contents of %eax in decimal

    print /x $eax  

    Print contents of %eax in hex

    print /t $eax  

    Print contents of %eax in binary

    print 0x100  

    Print decimal representation of 0x100 

    print /x 555

     

    Print hex representation of 555 

    print /x ($ebp+8) 

     

    Print contents of %ebp plus 8 in hex 

    print*(int*)0xbffff890 

     

    Printintegerataddress0xbffff890

    print *(int *) ($ebp+8) 

     

    Print integer at address %ebp + 8

    x/2w 0xbffff890 

     

    Examine two (4-byte) words starting at address 0xbffff890 

    x/20b sum 

     

    Examine first 20 bytes of function sum 

    Useful information
    info frame  

    Information about current stack frame 

    info registers  

    Values of all the registers

  • 相关阅读:
    Codeforces 798C. Mike and gcd problem 模拟构造 数组gcd大于1
    Codeforces 796C. Bank Hacking
    Codeforces 792B. Counting-out Rhyme
    gym 101164 H.Pub crawl 凸包
    hdu 6053 TrickGCD 筛法
    hdu 6041 I Curse Myself 无向图找环+优先队列
    bzoj 2243: [SDOI2011]染色 线段树区间合并+树链剖分
    codeforces gym 101164 K Cutting 字符串hash
    树链剖分求lca
    UESTC 1697 简单GCD问题(一) 筛法
  • 原文地址:https://www.cnblogs.com/qwertwwwe/p/5794969.html
Copyright © 2011-2022 走看看