美文网首页
记录一下gdb调试的一些常用命令

记录一下gdb调试的一些常用命令

作者: zs0zrc | 来源:发表于2018-07-10 15:00 被阅读229次

gdb

基础调试命令
s step,si步入
n 执行下一条指令 ni步入
b 在某处下断点,可以用
b * adrress
b function_name
info b 查看断点信息
delete 删除所有断点
c 继续
r 执行
disas addr 查看addr处前后的反汇编代码
disas functions 参看fucntion函数的反汇编代码

显示内存数据

p 系列
p system/main 显示某个函数地址
p $esp 显示寄存器
p/x p/a p/b p/s。。。
p 0xff - 0xea 计算器
print &VarName 查看变量地址
p * 0xffffebac 查看某个地址处的值

x系列
命令格式:x/<n/f/u> <addr> 
n是一个正整数,表示需要显示的内存单元的个数
f 表示显示的格式(b字符,s字符串,i汇编指令,x十六进制,d十进制)
u 表示从当前地址往后请求的字节数 默认4byte,u参数可以用下面的字符来代替,b表示单字节,h表示双字节,w表示四字 节,g表示八字节
<addr>表示一个内存地址
x/xw addr 显示某个地址处开始的16进制内容,如果有符号表会加载符号表
x/x $esp 查看esp寄存器中的值
x/s addr 查看addr处的字符串
x/b addr 查看addr处的字符
x/i addr 查看addr处的反汇编结果

info系列
info register $ebp 查看寄存器ebp中的内容 (简写为 i r ebp)
i r eflags 查看状态寄存器
i r ss 查看段寄存器
i b 查看断点信息
i functions 查看所有的函数
disas addr 查看addr处前后的反汇编代码
stack 20 查看栈内20个值
show args 查看参数
vmmap 查看映射状况 peda带有
readelf 查看elf文件中各个段的起始地址 peda带有
parseheap 显示堆状况 peda带有

查找数据

find 查找字符串 peda带有
searchmem 查找字符串 peda带有
ropsearch "xor eax,eax;ret" 0x08048080 0x08050000 查找某段的rop peda带有
ropgadget 提供多个pop|ret可行结果 peda带有

Pwngdb插件

libc : Print the base address of libc
ld : Print the base address of ld
codebase : Print the base of code segment
heap : Print the base of heap
got : Print the Global Offset Table infomation
dyn : Print the Dynamic section infomation
findcall : Find some function call
bcall : Set the breakpoint at some function call
tls : Print the thread local storage address
at : Attach by process name
findsyscall : Find the syscall
fmtarg : Calculate the index of format string
You need to stop on printf which has vulnerability.
force : Calculate the nb in the house of force.
heapinfo :打印heap的一些信息
default is the arena of current thread
If tcache is enable, it would show infomation of tcache entry
heapinfoall : Print some infomation of heap (all threads)
arenainfo : Print some infomation of all arena
chunkptr : 打印chunk的信息 后面加chunk返回给用户的地址
printfastbin : 打印fastbin的链表信息
tracemalloc on : 追踪程序chunk的malloc和free
parseheap :解析堆的布局
magic : 打印出glibc中一些有用的信息
fp : show FILE structure
fp (Address of FILE)
fpchain: show linked list of FILE
orange : Test house of orange condition in the _IO_flush_lockp
orange (Address of FILE)
glibc version <= 2.23

pwndbg

top_chunk: 显示top chunk的信息
malloc_chunk address:打印出已被分配的chunk的信息
fastbins:显示fastbins链表信息
unsorted:显示unsortedbin 的信息
smallbins:显示smallbins的信息
largebins:显示largebins的信息
bins:显示所有bins的信息
mp:显示一些内存管理用到的全局变量
arena:显示分配区的信息

相关文章

  • gdb调试基本方法

    gdb调试基本方法 gdb调试常用命令 在GDB中运行程序 断点(BreakPoint) 观察点(WatchPoi...

  • Xcode debug Hotspot(一)——创建Xcode项

    概述 前面安装gdb调试hotspot里面,我记录了自己安装gdb调试hotspot的过程。后来我发现,使用gdb...

  • GDB学习笔记

    本文介绍使用gdb调试程序的常用命令。 简介 GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具。如果...

  • Framework基础:gdb调试大法

    在windows进行Android的gdb调试,调试native程序,记录一下。好处可以看trace之类的,了解程...

  • 记录一下gdb调试的一些常用命令

    gdb 显示内存数据 查找数据 Pwngdb插件 pwndbg

  • 2. gdb的使用

    参考链接1. GDB调试2. gdb调试方法3. gdb调试示例 1. 说说 gdb gdb 是一款 UNIX 系...

  • GDB调试记录

    gdb attach 15343 # 调试某个进程 GNU gdb (GDB) 7.12Copyrigh...

  • GDB调试一些小记录

    起因 最近在看PHP7的源码,想要看一下一个zval一个执行流程,此时需要用到gdb调试,然后按照相关的步骤进行每...

  • gdb thread

    先介绍一下GDB多线程调试的基本命令。 info threads显示当前可调试的所有线程,每个线程会有一个GDB为...

  • gcc常用命令

    gdb相关 gcc加-g才能使用gdb调试gdb -tui a.out打开调试界面run/stop/continu...

网友评论

      本文标题:记录一下gdb调试的一些常用命令

      本文链接:https://www.haomeiwen.com/subject/oewfpftx.html