returnwellbeing / .myconfig

1 stars 1 forks source link

GDB #3

Open returnwellbeing opened 4 years ago

returnwellbeing commented 4 years ago

GDB with venv-python

that gdb's plugins are not working well on venv-python is well known issue. see https://github.com/hugsy/gef/issues/88 https://github.com/pypa/virtualenv/issues/644

Build Own GDB

# python is already in virtual-env
$ which python
# /home/test5/.mypython/pwn/bin/python
$ git clone https://github.com/bminor/binutils-gdb.git gdb
$ cd gdb
$ mkdir build
$ ../configure --with-python=$(which python3)
$ make -j$(nproc)

gdb will be created under build/gdb/

$ cd gdb
$ ./gdb

issue::gdb/data-directory

Python Exception <class 'ModuleNotFoundError'> No module named 'gdb': 
./gdb: warning: 
Could not load the Python gdb module from `/usr/local/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.

solution run gdb with -data-directory

./gdb -data-directory ./data-directory

Launch GDB

$cat mygdb

#!/bin/sh

GDBPATH=/home/test5/test.gdb/gdb/build/gdb
GEFPATH=/home/test5/test.gdb/gef/gef.py
$GDBPATH/gdb  --nh \
              -iex "source $GEFPATH" \
              -data-directory $GDBPATH/data-directory \
              --args $@
returnwellbeing commented 4 years ago

Plugin::GEF

layout

gef config context.layout "-legend regs code source stack memory args extra"'

tty

gef config context.redirect /dev/pts/0