HowTo :: Install GEF (GDB Plug-in)

Introduction

Install GEF to supercharge your GDB debugging experience with syntax highlighting, automatic context display, and dozens of powerful commands.

What is GEF?

GEF (GDB Enhanced Features) is a powerful plugin that transforms GDB from a basic command-line debugger into a modern, user-friendly debugging powerhouse. It adds:

If you’ve used GDB and found it difficult to follow what’s happening, GEF solves that problem by showing you everything you need in an organized, colorful interface.

What You’ll Need

Step-by-Step Installation Guide

Step 1: Verify GDB Python Support

Before installing GEF, confirm your GDB was compiled with Python support:

1
gdb -nx -ex 'pi print(sys.version)' -ex quit

Expected output:

3.8.10 (default, Nov 14 2022, 12:59:47)
[GCC 9.4.0]

Step 2: Clone the GEF Repository

Navigate to /opt and clone the GEF repository. This location makes GEF available system-wide:

1
2
cd /opt
sudo git clone https://github.com/hugsy/gef.git

Step 3: Run the Installation Scripts

GEF provides convenient installation scripts that configure everything automatically:

1
2
sudo /opt/gef/scripts/gef.sh
sudo /opt/gef/scripts/gef-extras.sh

What these scripts do:

Step 4: Install Python Dependencies

Some GEF features require additional Python packages. Start GDB and check for missing dependencies:

1
gdb -q

In the GDB prompt, type:

gef➤  gef missing

This command lists any missing Python packages. Install them using pip:

1
pip install keystone-engine ropper capstone unicorn

Verification

To verify GEF is installed correctly, start GDB:

1
gdb -q

You should see colorful GEF startup banner:

1
GEF for linux ready, type `gef' to start, `gef config' to configure

Try running a simple program:

1
2
3
gdb -q /bin/ls
gef➤  break main
gef➤  run

You should see GEF’s enhanced context display showing registers, code, stack, and more.

Troubleshooting

Keeping GEF Updated

GEF is actively developed with new features and bug fixes. To update to the latest version:

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

Or manually pull the latest changes:

1
2
cd /opt/gef
sudo git pull

Next Steps

Now that you have GEF installed:

  1. Learn the basics: Read our Getting Started with GDB guide
  2. Explore GEF commands: Type gef help in GDB to see all available commands
  3. Configure GEF: Run gef config to customize colors, context layout, and features
  4. Try debugging: Practice with our Linux Syscalls in Assembly tutorial

See Also