Skip to content
bata24Public
forked from hugsy/gef

About

GEF - GDB Enhanced Features - bata24's fork

Resources

Stars

693 stars

Watchers

9 watching

Forks

 
 

Latest commit

 

History

6,409 Commits

Folders and files

Repository files navigation

Table of Contents

What Is This?

This is a fork of GEF that includes three major improvements:

  1. Adds heuristic commands for kernel debugging without requiring a symbolized vmlinux (for qemu-system, supports Linux kernel 3.x-7.x).
  2. Expands support to many architectures (for qemu-user).
  3. Provides heap dump commands for multiple memory allocators.

Numerous other commands have been added and enhanced. Enjoy!

Setup

Supported Environment

  • Recommended: Ubuntu 24.04-26.04, Debian stable, and Arch Linux.
  • May work, but not recommended: Ubuntu 20.04-23.10.

Install

The installer has been refactored. I recommend re-installing. (2026-10-17)

  • Run the following command:

    # For various reasons, I recommend installing it as the root user
    wget -q https://raw.githubusercontent.com/bata24/gef/dev/install-uv.sh -O- | sudo sh
    
    # For non-root user
    wget -q https://raw.githubusercontent.com/bata24/gef/dev/install-uv.sh -O- | sh
    
    # Install GEF in a different directory
    wget -q https://raw.githubusercontent.com/bata24/gef/dev/install-uv.sh -O- | sudo env GEF_INSTALL_DIR="/path/to/gef" sh
    wget -q https://raw.githubusercontent.com/bata24/gef/dev/install-uv.sh -O- | env GEF_INSTALL_DIR="/path/to/gef" sh
    • Notes
      • By default, gef.py is installed to $HOME/.gef/gef.py.
      • The required Python packages are installed to $HOME/.gef/venv-gef.
      • The installer selects CPython matching GDB's Python major and minor version.
      • GEF queries the environment at startup; activation is not required.
      • An existing environment with a different Python version must be recreated before installation.
      • GEF's installation directory is registered in $HOME/.gdbinit.
      • For more installation options and non-root user's limitations, see docs/FAQ.md.
  • Or, quick trial (no installation):

    wget https://raw.githubusercontent.com/bata24/gef/dev/gef.py
    echo "source $(pwd)/gef.py" >> ~/.gdbinit
    • Notes
      • Most features work fine even without external tools.
      • Extra Python packages are optional; commands requiring them remain unavailable until installed.

Upgrade

python3 "$HOME/.gef/gef.py" --upgrade
  • Note
    • If you get errors after upgrading, it may be due to old config. Try renaming $HOME/.gef.rc.
    • Restart GDB after upgrading. Old gef.venv.conf and skip-venv-check files are no longer used.
    • If GDB's Python major or minor version changes, recreate venv-gef with a matching Python and reinstall its packages.

Uninstall

rm -rf "$HOME/.gef"
rm -f "$HOME/.gef.rc"
rm -rf /tmp/gef
sed -i -e '/from gef import/d' "$HOME/.gdbinit"

If you used GEF_INSTALL_DIR, remove that directory instead of $HOME/.gef.

Dependencies

Please refer to install-uv.sh for installation requirements.

Supported Modes

  • Standard debugging
  • Attaching to a running process
  • Attaching to a process in an isolated namespace (e.g., attaching from outside a Docker container)
  • Connecting to Gdbserver
  • Connecting to the GDB stub of Qemu-system
  • Connecting to the GDB stub of Qemu-user
  • Connecting to the GDB stub of Intel Pin
  • Connecting to the GDB stub of Intel SDE
  • Connecting to the GDB stub of Qiling framework
  • Connecting to the GDB stub of KGDB (requires GDB version 12 or later)
  • Connecting to the GDB stub of VMWare
  • Connecting to the GDB stub of Wine
  • Debugging with Record and replay (rr replay)

For a comprehensive list and additional details, see docs/SUPPORTED-MODE.md.

Added / Improved Features

For the usage and options of each command, see docs/COMMANDS.md.

Qemu-system/KGDB Cooperation

Memory Map

pagewalk, kvmmap
  • pagewalk: dumps page tables.
    • x64 (Supported: 4-Level/5-Level Paging)
    • x86 (Supported: PAE/Non-PAE)
    • ARM64 (Supported: Cortex-A only, EL0-EL3, Stage1-2)
      • ARM v8.7 base. 32bit mode is NOT supported.
      • Here is a sample of each level pagewalk from HITCON CTF 2018 super_hexagon.
      • Secure memory scanning is also supported, but you have to break in the secure world.
      • Pseudo memory map without detailed flags and permissions can be output even in the normal world (when OP-TEE).
    • ARM (Supported: Cortex-A only, LPAE/Non-LPAE, PL0/PL1/PL2)
      • ARM v7 base.
      • Secure memory scanning is also supported, and you don't have to break in the secure world (unlike ARM64).
    • RISCV64 / RISCV32
    • MIPS32 / MIPS64 (Supported: Linux only, 2-Level to 4-Level, 4KB/16KB/64KB page)
      • 64-bit PTE on MIPS32 (XPA, etc.) is NOT supported.
    • PPC32 / PPC64 (Supported: POWER Radix/Hash, G3/G4, e500, 44x, 4KB/64KB page)
      • POWER Hash, e500 and 44x are Linux only. G3/G4 shows only the pages in the hash table.
    • S390X (Supported: 2-Level to 5-Level, 4KB/1MB/2GB page)
      • The kernel and user address spaces overlap, so both are shown.
    • LOONGARCH64 (Supported: 2-Level to 5-Level, 4KB/16KB/64KB page, DMW)
    • SPARC32 (Supported: SRMMU, 4KB/256KB/16MB page)
  • kvmmap: prints kernel memory map.

Register

qreg, msr, cet, vbar, gdtinfo, idtinfo, read-system-register-for-qemu-arm, read-system-register-for-kgdb, switch-el
  • qreg: displays the register values from qemu-monitor (allows getting values like $cs even under qemu 2.x).
    • It is a shortcut for monitor info registers.
    • It also prints the details of each bit of the system register when x64/x86.
  • msr: reads/writes MSR (Model Specific Registers) value by embedding/executing dynamic assembly.
    • Supported on x64 and x86.
  • cet: displays Intel CET settings.
  • vbar: displays ARM/ARM64 vector table.
  • gdtinfo: pretty prints GDT entries. If userland, show sample entries.
  • idtinfo: pretty prints IDT entries. If userland, show sample entries.
  • read-system-register-for-qemu-arm: reads system register for old qemu-system-arm.
  • read-system-register-for-kgdb: reads system register for kgdb (x64/ARM64 only).
  • switch-el: switches EL (Exception Level).
    • Supported on ARM64.

Linux Basic

kbase, kversion, kcmdline, kcurrent, kchecksec, kmagic, kpercpu, ks-selftest
  • kbase: displays the kernel base address.
  • kversion: displays the kernel version.
  • kcmdline: displays the kernel cmdline used at boot time.
  • kcurrent: displays current task address.
  • kchecksec: checks kernel security.
  • kmagic: displays useful addresses in the kernel.
  • kpercpu: resolves the per-cpu variables and the per-cpu areas.
  • ks-selftest: compares the results of kernel-address heuristic finders with kallsyms.

Virt/Phys/Page

v2p, p2v, xp, page, slab-virtual, pageinfo, highmem-dump
  • v2p/p2v: displays the transformation between virtual addresses and physical addresses.
  • xp: is a shortcut for physical memory dump.
  • page: displays the transformation between a struct page and its virtual/physical address.
    • There are shortcuts: virt2page, page2virt, phys2page and page2phys.
    • On RISC-V 32/64, it infers the page array from live slab pages without a symbolized vmlinux.
  • slab-virtual: displays the transformation between slab-meta and its slab-data/struct page address (for CONFIG_SLAB_VIRTUAL=y).
  • pageinfo: dumps struct page->{flags,page_type}.
  • highmem-dump: dumps HighMem mappings.

Linux Symbol/Type

ksymaddr-remote, ksymaddr-remote-apply, vmlinux-to-elf-apply, ktypes, ktypes-load, kload, kmod-load
  • ksymaddr-remote: displays kallsyms information from scanning kernel memory.
    • Supported kernel versions: 3.x to 7.x.
  • ksymaddr-remote-apply/vmlinux-to-elf-apply: applies kallsyms information obtained by ksymaddr-remote or vmlinux-to-elf to gdb.
    • Once you get a symbolized pseudo ELF file, you can reuse and apply it automatically even after rebooting qemu-system.
    • vmlinux-to-elf-apply and ksymaddr-remote-apply provide almost the same functionality.
      • vmlinux-to-elf-apply: Requires installation of external tools. Create vmlinux with symbols.
      • ksymaddr-remote-apply: Requires no external tools. Create a blank ELF with embedded symbols only.
  • ktypes: displays kernel type information from scanning kernel memory.
  • ktypes-load: loads kernel type information from scanning kernel memory.
  • kload: loads vmlinux without a load address.
    • It is useful if you have a vmlinux with debuginfo at hand.
  • kmod-load: loads the kernel module without a load address.
    • It is useful if you have a kernel module with debuginfo at hand.

Linux Task

ktask, ksched, kcred, kmem-task, kbt
  • ktask: displays each task's address.
    • It also displays the memory map of the userland process.
    • It also displays the register values saved on the kstack of the userland process.
    • It also displays the file descriptors of the userland process.
    • It also displays the signal handlers of the userland process.
    • It also displays the namespaces of the userland process.
    • It also displays the seccomp-filter.
  • ksched: dumps the scheduler state of each task (cpu, state, class, priority, policy).
  • kcred: dumps the credentials of each task.
  • kmem-task: dumps the userland memory of the specified process through its own page table, like x or telescope.
  • kbt: scans inactive tasks' kernel stacks from the saved stack pointer for text addresses.

Linux Advanced

kconfig, ksyscalls, ksysctl, kmod, kops, kcdev, kbdev, kfilesystems, kmount, kclock-source, kdmesg, kpipe, kpagecache, kbpf, ktimer, kpcidev, kipcs, kdevio, kdmabuf, kirq, knetdev, kworkqueue, kwalk, kpath, kvfs, ksock, kskb, klsm, knft, kio-uring, kuffd, krefs, kkeyring, kcfi-hash, kprocfs, kcgroup, kbinder, klocks
  • kconfig: dumps the kernel config if available.
  • ksyscalls: displays the system call table.
    • It also dumps the ia32/x32 syscall table under x64.
    • It also dumps the compat syscall table under ARM64.
  • ksysctl: dumps the sysctl parameters.
  • kmod: displays each module's address.
    • It also displays the symbols of each module.
  • kops: displays each operation's member.
  • kcdev: displays information for each character device.
  • kbdev: displays information for each block device.
    • If there are too many block devices, detection will not be successful.
    • This is because block devices are not managed in one place, so I use the list of bdev_cache obtained from the slub-dump results.
  • kfilesystems: dumps supported file systems.
  • kmount: dumps the mount tree of each mount namespace.
  • kclock-source: dumps the clocksource list.
  • kdmesg: dumps the ring buffer of the dmesg area.
  • kpipe: displays information for each pipe.
  • kpagecache: dumps file contents from the page cache.
  • kbpf: dumps the BPF information.
  • ktimer: dumps the timer.
  • kpcidev: dumps the PCI devices.
  • kipcs: dumps IPCs information (System V semaphore, message queue and shared memory).
  • kdevio: dumps I/O-port and I/O-memory information.
  • kdmabuf: dumps DMA-BUF information.
  • kirq: dumps irq information.
  • knetdev: displays net devices.
  • kworkqueue: dumps workqueue items and inspects embedded work_struct objects.
  • kwalk: dumps the entries held by the well-known kernel data structures.
  • kpath: reconstructs the pathname of a dentry, path, file or mount.
  • kvfs: displays the VFS object graph of a file descriptor or VFS object.
  • ksock: walks from a file descriptor (or a raw struct sock) through socket, sock and its skb queues.
  • kskb: parses a single sk_buff and shows its buffer layout, refcount and fragment information.
  • klsm: dumps the registered Linux Security Module hooks.
  • knft: dumps the nftables (netfilter) object graph.
  • kio-uring: displays the kernel-side io_uring object graph.
  • kuffd: displays the kernel-side userfaultfd object graph (registered ranges and the threads waiting on faults).
  • krefs: searches the kernel pointers that reference the specified address.
  • kkeyring: displays the keyrings referenced by tasks, or inspects an arbitrary struct key.
  • kcfi-hash: lists the functions that share a kCFI type hash with a call target.
  • kprocfs: displays the proc_dir_entry tree. It helps to find the entries a rootkit hides from /proc.
  • kcgroup: displays the cgroup hierarchies, the cgroups of each task and the settings of the main controllers.
  • kbinder: displays the binder_proc, thread, node, ref and transaction of Android binder.
  • klocks: lists task lock records and automatically resolves mutex/rwsem owners and waiters.

Linux Allocator

slub-dump, slab-dump, slob-dump, slub-tiny-dump, slab-contains, kmem-cache-alias, buddy-dump, buddy-contains, vmalloc-dump, kobj
  • slub-dump: dumps slub free-list.
    • Supported on x64/x86/ARM64/ARM + SLUB + no-symbol + kASLR, and RISC-V 64/32 + SLUB + no-symbol.
    • Supported regardless of whether CONFIG_SLAB_FREELIST_HARDENED is y or n.
    • Supported regardless of whether CONFIG_SLAB_VIRTUAL is y or n (x64 only).
    • It supports dumping partial pages (-v) and NUMA node pages (-vv).
    • Since page_to_virt is difficult to implement, it will heuristically determine the virtual address from the free-list.
    • It supports sheaf/barn mechanism for linux 6.18~.
  • slab-dump: dumps slab free-list.
    • Supported on x64/x86/ARM64/ARM + SLAB + no-symbol + kASLR, and RISC-V 64/32 + SLAB + no-symbol.
  • slob-dump: dumps slob free-list.
    • Supported on x64/x86/ARM64/ARM + SLOB + no-symbol + kASLR, and RISC-V 64/32 + SLOB + no-symbol.
  • slub-tiny-dump: dumps slub-tiny free-list.
    • Supported on x64/x86/ARM64/ARM + SLUB-TINY + no-symbol + kASLR, and RISC-V 64/32 + SLUB-TINY + no-symbol.
  • slab-contains: resolves the slab cache (kmem_cache) that a certain address (object) belongs to (for SLUB/SLUB-TINY/SLAB).
    • Supports RISC-V 32/64 without a symbolized vmlinux.
    • For SLUB/SLUB-TINY, if all chunks belonging to a certain page are in use, they will not be displayed by slub-dump/slub-tiny-dump command.
    • Even with such an address (object), this command may be able to resolve kmem_cache.
  • kmem-cache-alias: dumps kmem_cache alias name.
  • buddy-dump: dumps the zone of the page allocator (buddy allocator) free-list.
  • buddy-contains: resolves which buddy allocator block contains it.
  • vmalloc-dump: dumps vmalloc used-list and freed-list.
  • kobj: identifies an arbitrary kernel address.

Linux Dynamic Inspection

ktrace, thunk-tracer, usermodehelper-tracer, kmalloc-tracer, kmalloc-allocated-by, kuaf-watch, kpage-watch
  • ktrace: traces arguments and returns of the specified kernel functions.
  • thunk-tracer: collects and displays the thunk function addresses that are called automatically (x64/x86 only).
    • If this address comes from RW area, this is useful for getting RIP.
  • usermodehelper-tracer: collects and displays the information that is executed by call_usermodehelper_setup.
  • kmalloc-tracer: collects and displays information when kmalloc/kfree.
  • kmalloc-allocated-by: calls a predefined set of system calls and prints structures allocated by kmalloc or freed by kfree.
  • kuaf-watch: tracks the alloc/free/reuse lifecycle of a slab object (or an entire cache) for UAF analysis.
  • kpage-watch: tracks the alloc/free/slab lifecycle of a physical page (PFN) for cross-cache analysis.

TrustZone

xsm, wsm, bsm, optee-{break-ta,smc-service-dump,ta-dump,shm-list,bget-dump}
  • xsm: dumps secure memory when gdb is in normal world.
    • Supported on ARM64 and ARM.
  • wsm: writes the value to secure memory when gdb is in normal world.
    • Supported on ARM64 and ARM.
  • bsm: sets the breakpoint to secure memory when gdb is in normal world.
    • Supported on ARM64 and ARM.
  • optee-break-ta: sets the breakpoint to the offset of OPTEE-Trusted-App when gdb is in normal world.
    • Supported on ARM64 and ARM.
  • optee-smc-service-dump: dumps OPTEE SMC services.
    • Supported on ARM64.
  • optee-ta-dump: dumps the information of OPTEE-Trusted-Apps from the memory or specified host directory.
    • Supported on ARM64 and ARM.
  • optee-shm-list: shows the information of dynamic shared-memory buffers.
    • Supported on ARM64 and ARM.
  • optee-bget-dump: dumps bget allocator of OPTEE-Trusted-App.

SMM

smm-status, smm-dump
  • smm-status: displays the current SMM status and an SMRAM preview.
  • smm-dump: dumps the detected SMRAM range to a file.

Other

ksearch-code-ptr, kdiff, uefi-ovmf-info, qemu-device-info
  • ksearch-code-ptr: searches for the code pointer in kernel data area.
  • kdiff: compares kernel information (function pointers, etc.) at two points in time.
  • uefi-ovmf-info: dumps addresses of some important structures in each boot phase of UEFI when OVMF is used.
    • Supported on x64.
  • qemu-device-info: dumps device information for qemu-escape.

Heap Dump Features

Glibc

heap {arena,arenas,bins,bins-simple,calc-protected-fd,chunk,chunks,dump-image,extract-heap-addr,find-fake-fast,parse,snapshot,snapshot-compare,tcache-index-helper,timeline,top,tracer,try-calloc,try-free,try-malloc,try-realloc,visual-heap}
  • Glibc heap commands have been improved. Supports up to glibc 2.43.
    • It changes the color and prints a symbol if it exists.
    • They print bins information if the chunk is in free-list.
    • Thread arena is supported for all heap commands.
      • Use -a option.
    • It supports some new sub-commands.
      • heap arenas
      • heap bins-simple: displays the heap like pwndbg style.
      • heap parse: displays the heap in the style of Pwngdb/angelheap.
      • heap calc-protected-fd: calculates a valid value as protected fd.
      • heap dump-image: visualizes chunks on a heap as composition image.
      • heap extract-heap-addr: analyzes tcache-protected-fd introduced from glibc-2.32.
      • heap find-fake-fast: searches for a memory with a size-like value that can be linked to the fastbin free-list.
      • heap snapshot: takes a snapshot of the heap.
      • heap snapshot-compare: compares current heap with a previously saved heap-snapshot.
      • heap tcache-index-helper
      • heap timeline (x86/x64/ARM32/ARM64, glibc): records heap states at http://0.0.0.0:61234/.
      • heap top
      • heap tracer: has been integrated from heap-analysis-helper and rewritten.
      • heap try-malloc
      • heap try-free
        • You can also execute any command on the memory status after emulation is completed.
      • heap try-realloc
      • heap try-calloc
      • heap visual-heap: is a colorized heap viewer.

uClibc-ng

uclibc-ng-{heap-dump,visual-heap,top,arena,chunk,chunks,parse,bins-simple,dump-image,snapshot,snapshot-compare}
  • uclibc-ng-heap-dump: dumps uClibc-ng heap chunks.
    • Based on uClibc-ng malloc-standard, without an architecture restriction.
      • Tested on x64, x86, ARM, ARM64, MIPS, PPC, RISC-V, Alpha, SPARC64 and OR1K.
      • Without the __malloc_state symbol, architectures other than x64/x86 need --malloc_state.
    • Use -s for builds with Safe-Linking (e.g. uClibc-ng 1.0.54 and 1.0.58).
      • The shift follows PAGE_SHIFT of the build (e.g. 13 on Alpha, 16 on ARM64 with 64KB pages).
    • How to test (x64):
      • Download and extract x86-64--uclibc--stable-2025.08-1.tar.bz2 from https://toolchains.bootlin.com/
      • Add /PATH/TO/x86_64-buildroot-linux-uclibc/bin to $PATH, then build as x86_64-linux-gcc test.c.
      • Fix interpreter by patchelf --set-interpreter /PATH/TO/x86_64-buildroot-linux-uclibc/sysroot/lib/ld64-uClibc.so.0 a.out.
  • uclibc-ng-visual-heap: is a colorized heap viewer for uClibc-ng.
  • uclibc-ng-top, uclibc-ng-arena, uclibc-ng-chunk, uclibc-ng-chunks, uclibc-ng-parse, uclibc-ng-bins-simple, uclibc-ng-dump-image, uclibc-ng-snapshot, uclibc-ng-snapshot-compare: are ports of the same-name heap sub-commands.
    • uclibc-ng-arena displays malloc_state, which also holds the parameters that glibc keeps in mp_.
    • -s means Safe-Linking decoding as in uclibc-ng-heap-dump, so --skip-size of uclibc-ng-bins-simple and -p of uclibc-ng-dump-image replace the glibc -s.
    • Snapshots have the same format as heap snapshot, so heap snapshot-compare can also compare them.

Chromium/V8

partition-alloc-dump, v8, cage, v8-list-maps, v8-dump-space
  • partition-alloc-dump: dumps Partition-Alloc free-list for chromium.
    • This command is reserved for the implementation of the latest version of Chromium.
      • Currently tested: v160.x (x64) / 1742397 / 473f38565a3a1d796d7bf99ff39152800c81213f
    • Supported on Linux x64, x86, ARM64 and ARM32.
    • Prebuilt sources: official Chromium (Linux x64 / Android ARM32, ARM64) and Debian (all four architectures). Android heap parsing is unverified.
    • It will try heuristic search if the binary has no symbol.
    • How to test:
  • v8: displays v8 (Chromium and d8) tagged object.
    • It also loads more commands from latest gdbinit for v8.
  • cage: displays v8 (Chromium and d8) ubercage.
  • v8-list-maps: lists v8 (Chromium and d8) built-in maps.
  • v8-dump-space: dumps v8 (Chromium and d8) heap objects in each space.

Other

{tcmalloc,musl,go,tlsf,hoard,mimalloc,scalloc,snmalloc,ssmalloc,jemalloc,sfmalloc,rpmalloc,tbbmalloc,zig,mesh,streamflow,supermalloc,dlmalloc,scudo,mozjemalloc,bmalloc,libpas,zend,obmalloc,newlib}-heap-dump
  • tcmalloc-heap-dump: dumps TCMalloc (gperftools, formerly google-perftools, v0.1~) free-list.
    • How to test:
      • Run your test program with LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libtcmalloc.so ./a.out.
  • musl-heap-dump: dumps Musl-Libc v0.5.0~ heap chunks (mallocng of v1.2.1~, and the legacy malloc).
    • How to test:
      • Get and extract the upstream source from https://musl.libc.org/
      • Build with ./configure && make install.
        • For the legacy malloc, use v1.2.0 or earlier, or build with ./configure --with-malloc=oldmalloc && make install.
      • Then build with /usr/local/musl/bin/musl-gcc test.c.
  • go-heap-dump: dumps Go Language v1.7~ mheap.
  • tlsf-heap-dump: dumps TLSF (Two-Level Segregated Fit) v2.2.0 (2006/06/30) ~ v2.4.6 (2009/09/10) free-list (x64 only).
    • How to test (x64):
      • Get and extract the upstream source from http://www.gii.upv.es/tlsf/
      • Build with cd TLSF-2.4.6/src && make && cd ../examples && make then use test1 etc.
  • hoard-heap-dump: dumps Hoard v3.10 (2013/10/18) ~ v3.2 (2025/12/31) free-list (x64 only).
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/emeryberger/Hoard
      • Build with cd Hoard/src && make.
      • Run your test program with LD_PRELOAD=/PATH/TO/libhoard.so ./a.out.
  • mimalloc-heap-dump: dumps mimalloc free-list (x64 only).
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/microsoft/mimalloc
      • Build with mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make.
      • Run your test program with LD_PRELOAD=/PATH/TO/libmimalloc.so ./a.out.
  • scalloc-heap-dump: dumps scalloc free-list (x64 only).
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/cksystemsgroup/scalloc
      • Fix the bug with sed -i -e 's/\(strncat(.*\), 1);/\1, 2);/' src/log.h.
      • Build with gyp --depth . scalloc.gyp && make.
      • Enable overcommit with echo 1 > /proc/sys/vm/overcommit_memory.
      • Run your test program with LD_PRELOAD=/PATH/TO/libscalloc.so ./a.out.
  • snmalloc-heap-dump: dumps snmalloc free-list.
    • Use -r to display remote message links and the retained tail.
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/microsoft/snmalloc
      • Build with mkdir build && cd build && cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug && ninja.
      • Run your test program with LD_PRELOAD=/PATH/TO/libsnmallocshim.so ./a.out.
  • ssmalloc-heap-dump: dumps ssmalloc free-list (x64 only).
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/Naruil/SSMalloc
      • Patch new_delete.cpp because the original source uses dynamic exception specifications, which are rejected by C++17 and later:
        • sed -i -e 's/ throw *(std::bad_alloc)//g' -e 's/^void operator delete(void \*ptr)$/void operator delete(void *ptr) noexcept/' -e 's/^void operator delete\[\](void \*ptr)$/void operator delete[](void *ptr) noexcept/' new_delete.cpp
      • Build with make
      • Run your test program with LD_PRELOAD=/PATH/TO/libssmalloc.so ./a.out.
  • jemalloc-heap-dump: dumps jemalloc v3.0~ arenas, slabs and tcache (x64 only).
    • How to test (x64):
      • Install libjemalloc2 (e.g. apt install libjemalloc2), or get and extract the upstream source from https://github.com/jemalloc/jemalloc/releases
      • Build with ./configure && make build_lib_shared.
      • Run your test program with LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 ./a.out (or /PATH/TO/lib/libjemalloc.so.2).
  • sfmalloc-heap-dump: dumps sfmalloc free-list (x64 only).
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/jeffhammond/sfmalloc
      • Build with cd sfmalloc && make CXX='g++ -std=gnu++03' DEFS='-D_REENTRANT -include stddef.h'.
      • Run your test program with LD_PRELOAD=/PATH/TO/libsfmalloc.so ./a.out.
  • rpmalloc-heap-dump: dumps rpmalloc free-list.
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/mjansson/rpmalloc
      • Build with cd rpmalloc && git switch main && python3 configure.py && ninja.
      • Run your test program with LD_PRELOAD=/PATH/TO/bin/linux/release/librpmalloc.so ./a.out.
  • tbbmalloc-heap-dump: dumps tbbmalloc free-list.
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/uxlfoundation/oneTBB
      • Build with mkdir build && cd build && cmake .. && make.
      • Run your test program with LD_PRELOAD=/PATH/TO/libtbbmalloc_proxy.so ./a.out.
  • zig-heap-dump: dumps Zig Language heap.
  • mesh-heap-dump: dumps Mesh free-list (x64/ARM64 only).
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/plasma-umass/Mesh
      • Build with make build BAZEL_CONFIG='--config=modern-amd64 --linkopt=-fuse-ld=bfd'.
        • The default gold linker is no longer provided by recent binutils, so the bfd linker is used.
        • To include debug symbols: make build BAZEL_CONFIG='--config=modern-amd64 --linkopt=-fuse-ld=bfd --copt=-g'.
      • Run your test program with LD_PRELOAD=/PATH/TO/bazel-bin/src/libmesh.so ./a.out.
  • streamflow-heap-dump: dumps StreamFlow free-list (x64/x86/PPC64 only).
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/scotts/streamflow
      • Create an empty numa.h with cd streamflow && touch numa.h, because only the NUMA build uses libnuma.
      • Build with make libstreamflow.so CXX='g++ -std=gnu++98 -include stddef.h' GCC_OPT='-O3 -ggdb -fpermissive -I. -fno-builtin'.
        • The original source is rejected by recent compilers, so the old C++ standard and -fpermissive are used.
        • Without -fno-builtin, GCC may turn malloc() + memset() in calloc() into a recursive calloc() call.
      • Run your test program with LD_PRELOAD=/PATH/TO/libstreamflow.so ./a.out.
        • Common commands such as /bin/ls do not work. When realloc() of StreamFlow shrinks an object, it copies the old size into the new object, so they abort with buffer overflow detected (or corrupt the heap if _FORTIFY_SOURCE is disabled).
  • supermalloc-heap-dump: dumps SuperMalloc free-list (x64 only).
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/kuszmaul/SuperMalloc
      • Build with cd SuperMalloc/release && make.
      • Run your test program with LD_PRELOAD=/PATH/TO/release/lib/libsupermalloc.so ./a.out.
  • dlmalloc-heap-dump: dumps dlmalloc (Doug Lea's malloc) v2.8.x free-list.
    • How to test (x64):
      • Get the upstream source from https://gee.cs.oswego.edu/pub/misc/malloc.c
      • Build with gcc -O2 -g -fno-builtin -shared -fPIC malloc.c -o libdlmalloc.so.
        • Without -fno-builtin (and _FORTIFY_SOURCE), GCC may turn malloc() + memset() in calloc() into a recursive calloc() call.
      • Run your test program with LD_PRELOAD=/PATH/TO/libdlmalloc.so ./a.out.
  • scudo-heap-dump: dumps Scudo (the standalone allocator of LLVM 11~) free-list.
    • How to test (x64):
      • Get and extract the upstream source from https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/compiler-rt-21.1.8.src.tar.xz
      • Build with cd compiler-rt-21.1.8.src/lib/scudo/standalone && clang++ -std=c++17 -O2 -fPIC -shared -ftls-model=initial-exec -nostdinc++ -nostdlib++ -fno-exceptions -fno-rtti -I . -I include *.cpp -o libscudo.so.
      • Or use libclang_rt.scudo_standalone-x86_64.so of the distribution (e.g. libclang-rt-21-dev of Ubuntu).
      • Run your test program with LD_PRELOAD=/PATH/TO/libscudo.so ./a.out.
  • mozjemalloc-heap-dump: dumps mozjemalloc (the allocator of Firefox 58~) arenas, runs, large and huge allocations.
    • How to test (x64):
  • bmalloc-heap-dump: dumps the old WebKit bmalloc (before it was replaced by mimalloc in 2026/01) free lists and per-thread Cache objects.
    • How to test:
      • bmalloc is part of WebKit, so check out the last commit that still has the old allocator and build it alone: git clone --filter=blob:none --sparse https://github.com/WebKit/WebKit.git && cd WebKit, git checkout 0a23246677 && git sparse-checkout set Source/bmalloc && cd Source/bmalloc.
      • Compile its core as a freestanding library with libpas disabled (GCC needs -O2, not -O0/-O1): for f in $(ls bmalloc/*.cpp | grep -vE 'TZone|mbmalloc|Zone'); do clang++ -std=c++20 -O2 -g -mcx16 -Ibmalloc -I. -DBENABLE_LIBPAS=0 -DBUSE_LIBPAS=0 -c $f -o $f.o; done.
      • Build the test program (g_config is normally provided by WTF, so -DBMALLOC_STANDALONE defines it here): clang++ -std=c++20 -O0 -g -mcx16 -Ibmalloc -I. -DBENABLE_LIBPAS=0 -DBUSE_LIBPAS=0 -DBMALLOC_STANDALONE /PATH/TO/tests/test.cpp bmalloc/*.o -lpthread -ldl -latomic.
      • Run gdb ./a.out.
  • libpas-heap-dump: dumps libpas (the WebKit allocator that replaced the old bmalloc), the per-thread caches, the small size-class free objects and the large free ranges.
    • How to test:
      • libpas is part of WebKit; a release branch works too (webkitglib/2.50 .. webkitglib/2.54, or main): git clone --filter=blob:none --sparse https://github.com/WebKit/WebKit.git && cd WebKit, git sparse-checkout set Source/bmalloc.
      • Build libpas with the bmalloc glue as a static library (clang; GCC also works with -latomic): cd Source/bmalloc, then for every libpas/src/libpas/*.c and bmalloc/*.cpp named in CMakeLists.txt except Zone.cpp (Darwin only): clang++ -std=c++20 -O2 -g -Ibmalloc -I. -Ilibpas/src/libpas -D_GNU_SOURCE -DPAS_BMALLOC=1 -DNDEBUG -DBUILDING_bmalloc -c <file> (compile the .c files the same way), and ar rcs libbmalloc.a *.o.
      • Build the test program against it: clang++ -O0 -g /PATH/TO/tests/test.cpp libbmalloc.a -lpthread -latomic.
      • Run gdb ./a.out.
  • zend-heap-dump: dumps Zend MM (the PHP allocator of PHP 7.0~) free lists, chunks and huge blocks.
    • How to test:
      • Install php-cli (e.g. apt install php-cli), or get and extract the upstream source from https://www.php.net/downloads and build with ./configure --disable-all --enable-cli && make (the binary is sapi/cli/php).
      • Save the following as test.php. It allocates 100 strings of 0x100 bytes and frees half of them. <?php $a=[];for($i=0;$i<100;$i++)$a[]=str_repeat("A",0x100);for($i=0;$i<100;$i+=2)unset($a[$i]);echo 1;
      • Run gdb --args php -n test.php, catch syscall write then run.
  • obmalloc-heap-dump: dumps obmalloc (pymalloc, the small object allocator of CPython) arenas, pools and free blocks.
    • How to test:
      • Install python3 (e.g. apt install python3), or get and extract the upstream source from https://www.python.org/downloads/source/ and build with ./configure && make python.
      • Save the following as test.py. It allocates 1000 bytes objects of 0x40 bytes and frees half of them. import os,signal;a=[b"A"*n for n in [0x40]*1000];del a[::2];os.kill(os.getpid(),signal.SIGTRAP)
      • Run gdb --args python3 test.py then run.
  • newlib-heap-dump: dumps the free chunks of newlib (the C library for bare-metal and embedded systems), for both the default malloc (based on dlmalloc 2.6.4) and the nano malloc.
    • How to test:
      • Get and extract the Arm GNU Toolchain for arm-none-eabi from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads.
      • Save the following 2 lines as test.c. It allocates 100 chunks of 0x40 bytes and frees half of them. #include <stdlib.h> int main(){void*a[100];for(int i=0;i<100;i++)a[i]=malloc(64);for(int i=1;i<100;i+=2)free(a[i]);__builtin_trap();}
      • Build with arm-none-eabi-gcc --specs=rdimon.specs -g test.c (add --specs=nano.specs for the nano malloc).
      • Run qemu-arm -g 1234 ./a.out and gdb-multiarch ./a.out -ex 'target remote :1234' then c.

Qemu-user Cooperation

For the supported architectures, see docs/QEMU-USER-SUPPORTED-ARCH.md.

si, ni, c
  • si/ni: are wrappers for native si/ni if OpenRISC 1000 or CRIS.
    • On OpenRISC 1000 architecture, branch operations don't work well, so GEF uses breakpoints to simulate.
    • On CRIS architecture, stepi/nexti commands don't work well, so GEF uses breakpoints to simulate.
    • If you want to use native si/ni, use the full form stepi/nexti.
  • c: is the wrapper for native c if gdb is connected to qemu-user or Intel Pin.
    • When connecting to gdb stub of qemu-user or Intel Pin, gdb does not trap SIGINT during continue.
    • If you want to trap, you need to issue SIGTRAP on the qemu-user or pin side, but switching screens is annoying.
    • This command realizes a pseudo SIGTRAP trap by trapping SIGINT on the Python side and throwing SIGTRAP back to qemu-user or Intel Pin.
    • It works only for local qemu-user or Intel Pin.
    • If you want to use native c, use the full form continue.

Debugging Support

Context

context, registers, telescope
  • context (improved)
    • It supports automatic display of system call arguments when calling a system call.
    • It supports new commands: context on, context off.
    • It supports automatic display of address and value when accessing memory.
    • It supports smart symbol printing for C++ function.
      • ex: std::map<int, std::map<int, int>> will be replaced by std::map<...>.
      • command: gef config context.smart_cpp_function_name true or smart-cpp-function-name (latter is used to toggle).
  • registers (improved)
    • It also shows raw values of the flag register, the current ring, the exception level, the secure state, etc.
  • telescope (improved)
    • It displays ordinal numbers as well as offsets.
    • It displays if there are canaries and return addresses in the target area.
    • It supports blacklist address features (to avoid dying when touching the address mapped to the serial device).
    • It also shows the symbol if available.
    • It supports some new options: --is-addr, --is-not-addr, --perm, --is-zero, --is-not-zero, --mask-hits, --no-mask-hits, --tag, --frame-split, --uniq, --interval, --depth, --phys, --list-head, --slab-contains, --slab-contains-unaligned.

Breakpoint

break-rva, command-break, main-break, load-break, regdump-break, multi-break, break-if-taken, break-if-not-taken
  • break-rva: sets a breakpoint at relative offset from codebase.
  • command-break: sets a breakpoint which executes user defined command if hit.
  • main-break: sets a breakpoint at main with or without symbols, then continue.
    • This is useful when you just want to run to main using qemu-user or pin, or debugging no-symbol ELF.
  • load-break: breaks if something is loaded.
  • regdump-break: sets a breakpoint which dumps specified registers if hit.
  • multi-break: sets multiple breakpoints easily.
  • break-if-taken/break-if-not-taken: sets a breakpoint which breaks if branch is taken (or not taken).

Basic Command Extension

up, down, time, multi-line, stepi-for-kgdb
  • up/down: are wrappers for native up/down.
    • It shows also backtrace.
  • time: measures the time of the GDB command.
  • multi-line: executes multiple GDB commands in sequence.
  • stepi-for-kgdb: is wrapper for AArch64 KGDB that avoids stepping into pending IRQ handlers.

Execution

exec-until, call-trace, xuntil, strings-continue, xskip
  • exec-until: executes until specified operation.
    • Supports the following patterns: call, jmp, syscall, ret, indirect-branch (x64/x86 only), all-branch (call || jmp || ret), memory-access, specified-keyword-regex, specified-condition (expressions using register or memory values), user-code, libc-code, secure-world, region-change.
  • call-trace: traces call, ret, and syscall instructions.
  • xuntil: executes until specified address.
    • It is slightly easier to use than the original until command.
  • strings-continue: single-steps and prints ASCII strings referenced by general-purpose registers.
  • xskip: skips instructions easily.

Assemble

ii, dasm, asm-list
  • ii: is a shortcut for x/50i $pc with opcode bytes.
    • It prints the value if it is memory access operation.
  • dasm: disassembles the code by capstone.
  • asm-list: lists instructions. (x64/x86 only)

Context Extension

extra, comment, smart-cpp-function-name
  • extra: manages user specified command to execute when each step.
  • comment: manages user specified temporary comment.
  • smart-cpp-function-name: toggles context.smart_cpp_function_name setting.

Syscall

mprotect, hijack-fd, call-syscall, mmap, munmap, kill-threads, syscall-search, xtap
  • mprotect (improved)
    • Rewritten to use call-syscall.
  • hijack-fd (improved)
    • It supports more architectures.
  • call-syscall: calls system call with specified values.
  • mmap: allocates a new memory by call-syscall.
  • munmap: unmaps a memory by call-syscall.
  • kill-threads: kills specific or all threads (for pthread).
  • syscall-search: searches for system call by regex.
  • xtap: taps read/write syscalls on specific file descriptors and hexdumps the transferred data.

Emulation

unicorn-emulate, unicorn-emulate-script, angr, future-calls
  • unicorn-emulate (improved)
    • It reads and writes correctly to the address pointed to by $fs/$gs.
    • It supports a new mode to stop after executing N instructions (-g).
    • It shows changed memories.
    • It supports replacing the GOT of string functions using avx2 or NEON, which unicorn does not support, with slower original functions.
  • unicorn-emulate-script: generates and runs a standalone script that emulates the binary by Unicorn-Engine.
  • angr: finds simple constraints by angr.
  • future-calls: displays future function calls from the current function.

Other

ropper, format-string-helper, add-symbol-temporary, seccomp, onegadget, rp, follow
  • ropper (improved)
    • It does not reset autocomplete settings after calling imported ropper.
  • format-string-helper (improved)
    • It supports more printf-like functions.
  • add-symbol-temporary: adds symbol information from command-line.
  • seccomp: invokes ceccomp or seccomp-tools.
  • onegadget: invokes one_gadget.
  • rp: invokes rp++ with commonly used options.
  • follow: changes follow-fork-mode setting.

Process Information

General

proc-info, elf-info, fds, proc-dump
  • proc-info (improved)
    • It displays some additional information.
  • elf-info (improved)
    • It displays Program Header and Section Header.
    • It supports parsing from memory.
    • It supports parsing remote binary (if download feature is available).
  • fds: shows opened file descriptors.
  • proc-dump: dumps each file under /proc/PID/.

Base Address

tls, fsbase, gsbase, libc, ld, heapbase, codebase
  • tls: pretty prints TLS area. Requires glibc.
  • fsbase/gsbase: pretty prints $fs_base, $gs_base.
  • libc/ld/heapbase/codebase: displays each of the base address.

Memory/Section

vmmap, xinfo
  • vmmap (improved)
    • It displays the memory map information even when connecting to gdb stub of qemu-user.
    • It also supports Intel Pin.
    • It also supports Intel SDE.
    • It is redirected to kvmmap when connecting to gdb stub of qemu-system.
    • It supports detection and coloring of Writable, ReadOnly, None and RWX regions.
    • It shows the area each register points to.
  • xinfo (improved)
    • It shows more information.
    • It also supports kernel debugging.

Trivial Information

pid, tid, filename, auxv, argv, envp, dumpargs, vdso, vvar, errno
  • pid/tid: prints pid and tid.
  • filename: prints filename.
  • auxv: pretty prints ELF auxiliary vector.
    • Supported also under qemu-user.
  • argv/envp: pretty prints argv and envp.
  • dumpargs: dumps arguments of current function.
  • vdso: disassembles the text area of vdso smartly.
  • vvar: dumps the area of vvar.
    • This area is mapped to userland, but cannot be accessed from gdb.
    • Therefore, it executes the assembly code and retrieves the contents.
  • errno: displays errno list or specified errno.

Complex Structure Information

got, got-all, dwarf-exception-handler, dynamic, link-map, dtor-dump, iouring-dump, stdio-dump, fpchain, unwind-info, cpp-vtable
  • got (improved)
    • It displays not only GOT address but also PLT address.
    • It scans .plt.sec section if Intel CET is enabled.
    • It can also display the GOT of the library.
    • It can also display type, offset, reloc_arg, section and permission.
  • got-all: shows got entries for all libraries.
  • dwarf-exception-handler: dumps the DWARF exception handler information.
  • dynamic: dumps the _DYNAMIC area.
  • link-map: dumps useful members of link_map with iterating.
  • dtor-dump: dumps some destructor functions list.
  • iouring-dump: dumps the area of iouring (x64 only).
    • This area is mapped to userland, but cannot be accessed from gdb.
    • Therefore, it executes the assembly code and retrieves the contents.
  • stdio-dump: dumps members of stdin/stdout/stderr.
  • fpchain: dumps chains from __IO_list_all.
  • unwind-info: shows the effective DWARF unwind rules at the current or specified PC.
  • cpp-vtable: dumps C++ virtual tables and RTTI from an object or base subobject.

Security

checksec, canary, capability, ptr-mangle, ptr-demangle, search-mangled-ptr, mte-tags, sighands
  • checksec (improved)
    • It shows additional information.
      • Static or Dynamic or Static-PIE
      • Stripped or not
      • Debuginfo or not
      • Intel CET IBT/SHSTK
      • ARMv8 PAC, ARMv8 MTE
      • RPATH, RUNPATH
      • Clang CFI/SafeStack
      • System-ASLR, GDB ASLR setting
    • It supports parsing remote binary (if download feature is available).
  • canary (improved)
    • It displays all canary positions in memory.
  • capability: shows the capabilities of the debugging process.
  • ptr-mangle: shows the mangled value that will be mangled by PTR_MANGLE.
  • ptr-demangle: shows the demangled value of the value mangled by PTR_MANGLE.
  • search-mangled-ptr: searches for the mangled value from RW memory.
  • mte-tags: displays the MTE tags for the specified address.
    • Supported on ARM64.
  • sighands: displays the signal dispositions of the current process.

Symbol

magic, symbols
  • magic: displays useful addresses in glibc etc.
  • symbols: lists all symbols with coloring.

Type

types, dt
  • types: lists all types with compaction.
  • dt: makes it easier to use ptype /ox TYPE and p ((TYPE*) ADDRESS)[0].
    • This command is designed for several purposes.
      1. When displaying very large struct, you may want to go through a pager because the results will not fit on one screen. However, using a pager, the color information disappears. This command calls the pager with preserving colors.
      2. When ptype /ox TYPE, interpreting member type recursively often result is too long and difficult to read. This command keeps result compact by displaying only top-level members.
      3. When p ((TYPE*) ADDRESS)[0] for large struct, the setting of max-value-size is too small to display. This command adjusts it automatically.
      4. When debugging a binary written in the Golang, the offset information of the type is not displayed. This command also displays the offset.
      5. When debugging a binary written in the Golang, the p ((TYPE*) ADDRESS)[0] command will be broken. This is because the Golang helper script is automatically loaded and overwrites the behavior of p command. This command creates the display results on the Python side, so we can display it without any problems.

Memory

Search

search-pattern, strings, search-cfi-gadgets, find-syscall
  • search-pattern (improved)
    • It is supported under qemu-system (in short, it works without /proc/self/maps)
    • It supports some new options: --hex, --hex-regex, --aligned, --perm, --interval, --limit, --max-region-size, --phys.
    • It also searches for UTF-16 string if target string is ASCII.
  • strings: searches for ASCII string from specific location.
  • search-cfi-gadgets: searches for CFI-valid (for CET IBT) and controllable generally gadgets in the executable area.
  • find-syscall: searches the syscall gadget.

View

hexdump, hexdump-flexible, json, xs, xc, sigreturn, ucontext, jmpbuf
  • hexdump (improved)
    • It supports physical memory if under qemu-system.
    • It will retry with adjusting read size if reading memory fails.
    • By default, the same line is omitted.
  • hexdump-flexible: displays the hexdump with user defined format.
  • json: pretty prints json.
  • xs: dumps string like x/s command, but with hex-string style.
  • xc: dumps address like x/x command, but with coloring at some intervals.
  • sigreturn: displays stack values for sigreturn syscall.
  • ucontext: displays the register state saved in a ucontext_t or mcontext_t.
  • jmpbuf: displays the registers saved in a jmp_buf or sigjmp_buf of glibc, with PTR_MANGLE decoded.

Compare

memcmp
  • memcmp: compares the contents of the address A and B, whether virtual or physical.

Patch

patch, memset, memcpy, memswap, meminsert
  • patch (improved)
    • It supports physical memory if under qemu-system.
    • Added some new modes: patch hex, patch pattern, patch nop, patch inf, patch trap, patch ret, patch syscall, patch history, patch revert, patch range-replace, patch undo, patch redo.
    • nop command has been integrated into patch as sub-command.
  • memset: sets the value to the memory range, whether virtual or physical.
  • memcpy: copies the contents from the address A to B, whether virtual or physical.
  • memswap: swaps the contents of the address A and B, whether virtual or physical.
  • meminsert: inserts the contents of the address A to B, whether virtual or physical.

Calculation

hash, crc, base-n-decode, base-n-encode, morse-decode, morse-encode, strlen, is-mem-zero, seq-length
  • hash: calculates various (450+) hashes, or show known-collisions.
  • crc: calculates various CRCs.
  • base-n-decode/base-n-encode: decodes/encodes various baseN.
  • morse-decode/morse-encode: decodes/encodes morse code.
  • strlen: detects the length of the string.
  • is-mem-zero: checks the contents of address range are all 0x00 or 0xff.
  • seq-length: detects consecutive length of the same sequence.

Dump/Load

smart-memory-dump, load-file, load-file-mmap
  • smart-memory-dump: dumps all regions of the memory to each file.
  • load-file: loads the file into memory.
  • load-file-mmap: loads the file into memory that allocated by mmap.

Investigation

binwalk-memory, filetype-memory, lsix, peek-pageframe, peek-pageflags, vdump, freq-analysis, stack-recover
  • binwalk-memory: scans memory by binwalk.
  • filetype-memory: scans memory by file and magika.
  • lsix: shows images in the terminal by imagemagick.
    • If you have pillow and pyzbar installed, a barcode detection option is also available.
  • peek-pageframe: reads page frame data.
  • peek-pageflags: reads page flags of a page frame.
  • vdump: visualizes memory data like an image.
  • freq-analysis: visualizes the frequency of occurrence of each byte.
  • stack-recover: heuristically recovers the call chain from the stack when bt is unusable.

Register

View

sysreg, pac-keys, fpu, mmx, sse, avx, avx512, cpuid
  • sysreg: pretty prints system registers.
    • It shows info registers results, excluding general registers.
  • pac-keys: pretty prints ARM64 PAC keys.
    • Supported on ARM64.
  • fpu/mmx/sse/avx/avx512: pretty prints FPU/MMX/SSE/AVX/AVX512 registers.
  • cpuid: shows the result of cpuid(eax=0,1,2...).

Modify

edit-flags, xmmset, mmxset
  • edit-flags (improved)
    • It displays the meaning of each bit if -v option is provided.
  • xmmset: sets the value to xmm/ymm/zmm register simply.
  • mmxset: sets the value to mm register simply.

Misc

Conversion

u2d, unsigned, convert, addressify, cpp-mangle, cpp-demangle
  • u2d: shows cast/convert u64 <-> double/float.
  • unsigned: shows unsigned value.
  • convert: shows various conversion.
  • addressify: converts reverse-order hex values to address.
  • cpp-mangle/cpp-demangle: mangles/demangles a C++ name by the Itanium C++ ABI.

Search

constgrep
  • constgrep: invokes grep under /usr/include/.

Show Example

ret2dl-hint, srop-hint
  • ret2dl-hint: shows the structure used by return-to-dl-resolve as hint.
  • srop-hint: shows the code for sigreturn-oriented-programming as hint.

Calculation

distance, crc32rev
  • distance: calculates the offset from its base address.
  • crc32rev: performs CRC32 reverse calculation limited to ASCII character range.

Diff

saveo, diffo
  • saveo/diffo: saves and diffs the command outputs.

Qemu-system

qemu-system-memory-region-dump
  • qemu-system-memory-region-dump: dumps memory regions for qemu-system.

GEF Maintenance

theme, reset-cache, tmux-setup, gef version, gef status, gef reset-breakpoint, gef arch-list, gef pyobj-list, gef avail-comm-list, gef set-arch, gef check-update, gef dump-commands, history
  • theme (improved)
    • Supports many colors.
  • reset-cache (improved)
    • It has been integrated into gef as sub-command.
    • The cache structure within GEF has changed significantly. This command corresponds to them.
  • tmux-setup (improved)
    • It has been integrated into gef as sub-command.
    • screen is no longer supported.
    • tmux settings are predefined and cannot be customized.
    • If you want to customize it, edit dev/tmux/tmux_setup.py and run source /path/to/tmux_setup.py.
    • If you're a zellij user, you can use dev/zellij/zellij-wrapper.py. Run this script before starting gdb or zellij.
  • gef version: shows software versions that GEF uses.
  • gef status: shows architecture information used in GEF.
  • gef reset-breakpoint: shows and resets all breakpoints.
  • gef arch-list: displays defined architecture information.
  • gef pyobj-list: displays defined global Python objects.
  • gef avail-comm-list: displays a list of commands which are available or not for the current architecture and gdb execution mode.
  • gef set-arch: sets a specific architecture to GEF.
  • gef check-update: checks for GEF updates.
  • gef dump-commands: dumps GEF command documentation as Markdown.
  • history: shows gdb command history easily.

Other

gef help, etc.
  • The category is introduced in gef help.
  • Combined into one file (from gef-extras). The following are moved from gef-extras.
    • current-stack-frame, xref-telescope, bytearray, and bincompare.
    • This is because a single file is more attractive for me than ease of maintenance.
  • The system-call table used by syscall-args is moved from gef-extras.
    • It was updated up to Linux kernel 7.x for each architecture.
  • Removed some features that I don't use: $, ida-interact, gef-remote, pie, pcustom, ksymaddr, trace-run, shellcode.
  • Many bug fixes / formatting improvements / usability enhancements (made it easy for me to use).

FAQ

Links

About

GEF - GDB Enhanced Features - bata24's fork

Resources

Stars

693 stars

Watchers

9 watching

Forks

Used by

Contributors

Languages