Skip to content

guyush1/gdb-static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gdb-static

Frozen static builds of everyone's favorite debugger!🧊

TL;DR

Introduction

Who doesn't love GDB? It's such a powerful tool, with such a great package.
But sometimes, you run into one of these problems:

  • You can't install GDB on your machine
  • You can't install an updated version of GDB on your machine
  • Some other strange embedded reasons...

This is where gdb-static comes in! We provide static builds of gdb (and gdbserver of course), so you can run them on any machine, without any dependencies!

Features
  • Static Builds: No dependencies, no installation, just download and run!
  • Musl Based: We use Musl in order to create distribution-independant binaries that can work anywhere.
  • Latest Versions: We keep our builds up-to-date with the latest versions of GDB.
  • Builtin Python (Optional): We provide builds with Python support built-in.
  • XML Support: Our builds come with XML support built-in, which is useful for some GDB commands.
  • Wide Architecture Support: We support a wide range of architectures:
    • aarch64
    • arm
    • mips
    • mipsel
    • powerpc
    • x86_64

Usage

To get started with gdb-static, simply download the build for your architecture from the releases page, extract the archive, and copy the binary to your desired platform.

You may choose to copy the gdb binary to the platform, or use gdbserver to debug remotely.

Build types

We provide two types of builds:

  1. Slim builds, that contains most of the features, beside the ones mentioned below.
  2. Full builds that contains all of the slim build features, and also contains:
    • Python support
    • Cross-architecture debugging.
      Note that in order to enable cross-architecture debugging, we have to disable the simulator feature, since not all targets have a simulator.

Slim builds are approximately ~10MB. Full builds are approximately ~70MB.
You can edit the full_build_conf.sh file to disable full build exclusive features.

Development

Note

Before building, make sure to initialize & sync the git submodules.

Alternatively, you can build gdb-static from source. To do so, follow the instructions below:

Pre-requisites
To be able to build `gdb-static`, you will need the following tools installed on your machine:

  • Docker
  • Docker buildx
  • Git
Building for a specific architecture

To build gdb-static for a specific architecture, run the following command:

make build-<ARCH>-[slim/full]

Where <ARCH> is the architecture you want to build for, and slim/full determines the build type (see here).

The resulting binary will be placed in the build/artifacts/ directory:

build/
└── artifacts/
    └── <ARCH>/
        └── ...
Building for all architectures

To build gdb-static for all supported architectures, run the following command:

make build

The resulting binary will be placed in the build/artifacts/ directory.

Adding a custom architecture

Adding a new architecture to the build system is straightforward. Follow these steps:

  • Add a cross compiler:
    Add a musl-based compiler to the ARCHS dictionary in src/docker_utils/download_musl_toolchains.py. You can find musl-based compilers here.
    If a musl-based compiler is not available for your architecture, you can instead install a compiler via apt in the Dockerfile. However, using a musl-based toolchain is highly recommended.
  • Update the Makefile:
    Add the new architecture to the ARCHS variable in the Makefile.
  • Modify build.sh:
    Locate the set_compilation_variables function in build.sh.
    • Add the new architecture to the supported_archs variable (in the same way as in the Makefile).
    • Add a new if branch to check for the new architecture, and within it, export the appropriate HOST variable using the compiler's target triple.

Contributing

  • Bug Report: If you see an error message or encounter an issue while using gdb-static, please create a bug report.

  • Feature Request: If you have an idea or if there is a capability that is missing and would make gdb-static more robust, please submit a feature request.

Contributors