Skip to content
Instructions for making a custom debugger and live C/assembly program editor
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
sample3
elfreader.py
readme.md
requirements.txt
sample1.c
sample2.c
tutorial1.py
tutorial2.py

readme.md

ptracedbg - Instructions for making a custom debugger and live C/assembly program editor.

These are the source files for this post and this post.

To run part 1

pip install -r requirements.txt
gcc -fPIC sample1.c
python -i tutorial1.py

Then run individual commands from the python interpreter such as

>>> safe_func_call(start + c_variables['test_function'])

To run part 2

gcc -rdynamic -fPIC -gdwarf-2 sample2.c -ldl
python -i tutorial2.py

Then try some commands

>>> find_section(mmap, process.getreg('rip'))
>>> run_c('printf("Hello world\n");')
>>> line_numbers()
>>> wait_for_count(2)
>>> save_state()
>>> wait_for_count(4)
>>> load_state()
>>> wait_for_count(4)

To run part 3

cd sample3
gcc -rdynamic -fPIC -gdwarf-2 sample3.c -ldl
gcc -shared -x c -o library.so -fPIC library.c
python -i tutorial3.py

Then try some commands

>>> reload_library()
>>> c_func_call("print_memory", starts["library.so"])
>>> run_c('((void (**)(void))primitives)[1]();')
>>> iter_()
>>> for _ in range(60):
...     run_loop()
You can’t perform that action at this time.