This page looks best with JavaScript enabled

Installing GDB-gef on FreeBSD

 ·  🎃 kr0m

Gef is a set of commands and visual aids that make GDB much more attractive. It is very similar to peda but gef supports more architectures X86, ARM, MIPS, PowerPC and SPARC. This way, if we do firmware reversing, it will also serve us since most embedded systems have a MIPS or ARM microprocessor. It is very focused on reversing but it will also be of great help for debugging.

We install the necessary software, I am doing it under FreeBSD but in Gentoo it is very similar:

pkg install gdb py37-keystone-engine py37-unicorn py37-capstone py37-ropper

As a regular user, we install Gef:

fetch https://github.com/hugsy/gef/raw/master/gef.py
mv gef.py .gdbinit-gef.py
echo source ~/.gdbinit-gef.py » ~/.gdbinit

We start GDB:

gdb

GNU gdb (GDB) 9.2 [GDB v9.2 for FreeBSD]  
Copyright (C) 2020 Free Software Foundation, Inc.  
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>  
This is free software: you are free to change and redistribute it.  
There is NO WARRANTY, to the extent permitted by law.  
Type "show copying" and "show warranty" for details.  
This GDB was configured as "x86_64-portbld-freebsd12.1".  
Type "show configuration" for configuration details.  
For bug reporting instructions, please see:  
<http://www.gnu.org/software/gdb/bugs/>.  
Find the GDB manual and other documentation resources online at:  
    <http://www.gnu.org/software/gdb/documentation/>.  
  
For help, type "help".  
Type "apropos word" to search for commands related to "word".  
GEF for freebsd ready, type `gef' to start, `gef config' to configure  
80 commands loaded for GDB 9.2 [GDB v9.2 for FreeBSD] using Python engine 3.7  
gef➤

In a debug session, Gef looks like this:

To update it, it is as simple as running:

python ~/.gdbinit-gef.py --update

If you liked the article, you can treat me to a RedBull here