gdb

gdbinit配置

可以从网上或自己编写 .gdbinit 配置文件, 从网上找到一份配置

config one

地址 https://github.com/gdbinit/Gdbinit 安装: git clone git@github.com:gdbinit/Gdbinit.git cp Gdbinit/gdbinit ~/.gdbinit

config two

wget https://raw.githubusercontent.com/gdbinit/Gdbinit/master/gdbinit cp gdbinit ~/.gdbinit

gef

gef

A few of GEF features include:

1、One single GDB script
Entirely OS Agnostic, NO dependencies: GEF is battery-included and is installable instantly
Fast limiting the number of dependencies and optimizing code to make the commands as fast as possible
2、Provides a great variety of commands to drastically change your experience in GDB.
Easily extensible to create other commands by providing more comprehensible layout to GDB Python API.
3、Full Python3 support (Python2 support was dropped - see gef-legacy).
4、Built around an architecture abstraction layer, so all commands work in any GDB-supported architecture such as x86-32/64, ARMv5/6/7, AARCH64, SPARC, MIPS, PowerPC, etc.
5、Suited for real-life debugging, exploit development, just as much as for CTFs

gef install

# via the install script
#下载 `gef.sh` 并执行
wget -q -O- https://github.com/hugsy/gef/raw/master/gef.sh | sh

# manually
# 下载 `gef.py`, 并将其 `source` 写入 `.gdbinit`
wget -q -O ~/.gdbinit-gef.py https://github.com/hugsy/gef/raw/master/gef.py
echo source ~/.gdbinit-gef.py >> ~/.gdbinit

可见 gef.sh 的工作其实就是将 gef.py下载下来, 并将环境变量写入 .gdbinit

gef start error

$ gdb -q vuln

warning: ~/.gdbinit.local: No such file or directory
GEF for linux ready, type `gef' to start, `gef config' to configure
96 commands loaded for GDB 10.1.90.20210103-git using Python engine 3.9
Reading symbols from vuln...
(No debugging symbols found in vuln)
Python Exception <class 'UnicodeEncodeError'> 'ascii' codec can't encode character '\u27a4' in position 12: ordinal not in range(128):

解决方案: $ sed -i ’s/\u27a4 />/g’ ~/.gdbinit-gef.py

$ gdb -q vuln

warning: ~/.gdbinit.local: No such file or directory
GEF for linux ready, type `gef' to start, `gef config' to configure
96 commands loaded for GDB 10.1.90.20210103-git using Python engine 3.9
Reading symbols from vuln...
(No debugging symbols found in vuln)
gef>

helpme

引用