Hacking: The Art of Exploitation 读书笔记(一)代码调试技巧
2017-02-25 18:01
711 查看
GDB 相关
-q 不打印版本信息
功能:
set disassemble-flavor intel /att 设置汇编语法
list:打印代码
disassemble:反汇编
break:设置断点
run:运行
查看内存 x
进制:o x u t
列出附近几条存储信息:x/2
显示方式:b h w g
(gdb) x/8xb $eip
0x8048384 <main+16>: 0xc7 0x45 0xfc 0x00 0x00 0x00 0x00 0x83
info register xxx:打印寄存器信息
x/i $eip
x/3i $sip
x/3i $eip -4
(gdb) print $ebp - 4
$1 = (void *) 0xbffff804
x/xw $1
print $1
info frame: 打印栈帧 (stack frame) 信息
nexti:单步执行
bt: 回溯栈
bt full: 包括 stack frame 中的变量值
代码调试:
objdump -M intel -D a.out | grep -A20 main.:
打印从 main 函数开始20行内的汇编指令,使用 Intel 语法
bc -ql
运行命令行计算器
检查 malloc( ) 函数内存分配结果代码复用:
-q 不打印版本信息
功能:
set disassemble-flavor intel /att 设置汇编语法
list:打印代码
disassemble:反汇编
break:设置断点
run:运行
查看内存 x
进制:o x u t
列出附近几条存储信息:x/2
显示方式:b h w g
(gdb) x/8xb $eip
0x8048384 <main+16>: 0xc7 0x45 0xfc 0x00 0x00 0x00 0x00 0x83
info register xxx:打印寄存器信息
x/i $eip
x/3i $sip
x/3i $eip -4
(gdb) print $ebp - 4
$1 = (void *) 0xbffff804
x/xw $1
print $1
info frame: 打印栈帧 (stack frame) 信息
nexti:单步执行
bt: 回溯栈
bt full: 包括 stack frame 中的变量值
代码调试:
objdump -M intel -D a.out | grep -A20 main.:
打印从 main 函数开始20行内的汇编指令,使用 Intel 语法
bc -ql
运行命令行计算器
检查 malloc( ) 函数内存分配结果代码复用:
void *errorchecked_malloc(unsigned int size){ void *ptr; ptr = malloc(size); if(ptr == NULL){ fprint(stderr, “Error: could not allocate heap memory. \n”); exit(-1); } return ptr; } // test char *sentence = (char *)errorchecked_malloc(20);
相关文章推荐
- Hacking: The Art of Exploitation 读书笔记(二)C文件I/O
- Hacking: The Art of Exploitation
- Hacking: The Art of Exploitation
- The art of exploitation - Chapter 4
- The Art of Unix中文版读书笔记
- The Art of Exploitation 2nd Edition (Jon Erickson), Official LiveCD ISO
- 《The Art of Agile Development》读书笔记
- The art of computer programming Donald E. Knuth volumn one third edition读书笔记2-1
- 读书笔记:《The Art of Software Testing》第四章—于无声处听惊雷
- 读书笔记之《The Art of Readable Code》Part 2
- Vision and Art ,The Biology of Seeing 读书笔记
- 读书笔记之《The Art of Readable Code》Part 3
- The art of computer programming Donald E. Knuth volumn one third edition读书笔记1
- 2012-01-03 读书笔记 The art of computing programming
- The art of software testing 阅读笔记(一)
- The Art of Computer Programming
- The Art of Computer Programming
- 两本小书的命运 --- 记《Effective STL》和《The Art Of Deception》两本书的出版翻译过程 (潘爱民)
- Guru of the Week 条款20:代码的复杂性(第一部分)
- The Art of Computer Programming(TAOCP)