Compare commits
12 Commits
external-p
...
fix-releas
Author | SHA1 | Date | |
---|---|---|---|
45e3ba25cd | |||
0971bfc768 | |||
7d4a19c440 | |||
eef9ea9215 | |||
1d7b4ff428 | |||
386d09efd7 | |||
a5d4b7838e | |||
657600689c | |||
9e717db750 | |||
e97b65c6b9 | |||
d978ca9aaf | |||
9e7d1ed118 |
343
.github/assets/gdb-static_logo_dark.inkscape.svg
vendored
Normal file
343
.github/assets/gdb-static_logo_dark.inkscape.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 76 KiB |
193
.github/assets/gdb-static_logo_dark.svg
vendored
Normal file
193
.github/assets/gdb-static_logo_dark.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 72 KiB |
343
.github/assets/gdb-static_logo_light.inkscape.svg
vendored
Normal file
343
.github/assets/gdb-static_logo_light.inkscape.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 76 KiB |
193
.github/assets/gdb-static_logo_light.svg
vendored
Normal file
193
.github/assets/gdb-static_logo_light.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 72 KiB |
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -9,3 +9,6 @@
|
|||||||
[submodule "src/submodule_packages/pygments"]
|
[submodule "src/submodule_packages/pygments"]
|
||||||
path = src/submodule_packages/pygments
|
path = src/submodule_packages/pygments
|
||||||
url = git@github.com:pygments/pygments.git
|
url = git@github.com:pygments/pygments.git
|
||||||
|
[submodule "src/submodule_packages/libexpat"]
|
||||||
|
path = src/submodule_packages/libexpat
|
||||||
|
url = git@github.com:guyush1/libexpat.git
|
||||||
|
@ -19,6 +19,7 @@ RUN apt update && apt install -y \
|
|||||||
gcc-powerpc-linux-gnu \
|
gcc-powerpc-linux-gnu \
|
||||||
git \
|
git \
|
||||||
libncurses-dev \
|
libncurses-dev \
|
||||||
|
libtool \
|
||||||
m4 \
|
m4 \
|
||||||
make \
|
make \
|
||||||
patch \
|
patch \
|
||||||
|
2
Makefile
2
Makefile
@ -13,6 +13,8 @@ BUILD_PACKAGES_DIR := "build/packages"
|
|||||||
|
|
||||||
.PHONY: clean help download_packages build build-docker-image $(ALL_TARGETS) $(ALL_PACK_TARGETS)
|
.PHONY: clean help download_packages build build-docker-image $(ALL_TARGETS) $(ALL_PACK_TARGETS)
|
||||||
|
|
||||||
|
.NOTPARALLEL: build pack
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Usage:"
|
@echo "Usage:"
|
||||||
@echo " make build"
|
@echo " make build"
|
||||||
|
162
README.md
162
README.md
@ -1,54 +1,150 @@
|
|||||||
# Repository of static gdb and gdbserver
|
<h1 align="center">
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="./.github/assets/gdb-static_logo_dark.svg">
|
||||||
|
<source media="(prefers-color-scheme: light)" srcset="./.github/assets/gdb-static_logo_light.svg">
|
||||||
|
<img src="./.github/assets/gdb-static_logo_light.svg" alt="gdb-static" width="210px">
|
||||||
|
</picture>
|
||||||
|
</h1>
|
||||||
|
|
||||||
## **The statically compiled gdb / gdbserver binaries are avaliable to download under github releases!**
|
<p align="center">
|
||||||
|
<i align="center">Frozen static builds of everyone's favorite debugger!🧊</i>
|
||||||
|
</p>
|
||||||
|
|
||||||
link: [gdb-static github releases](https://github.com/guyush1/gdb-static/releases)
|
<h4 align="center">
|
||||||
|
<a href="https://github.com/guyush1/gdb-static/releases/latest">
|
||||||
|
<img src="https://img.shields.io/github/v/release/guyush1/gdb-static?style=flat-square" alt="release" style="height: 20px;">
|
||||||
|
<a href="https://github.com/guyush1/gdb-static/actions/workflows/pr-pipeline.yaml">
|
||||||
|
<img src="https://img.shields.io/github/actions/workflow/status/guyush1/gdb-static/pr-pipeline.yaml?style=flat-square&label=pipeline" alt="continuous integration" style="height: 20px;">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/guyush1/gdb-static/graphs/contributors">
|
||||||
|
<img src="https://img.shields.io/github/contributors-anon/guyush1/gdb-static?color=yellow&style=flat-square" alt="contributors" style="height: 20px;">
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<img src="https://img.shields.io/badge/GDB-v15.2-orange?logo=gnu&logoColor=white&style=flat-square" alt="gdb" style="height: 20px;">
|
||||||
|
<img src="https://img.shields.io/badge/Python-built--in-blue?logo=python&logoColor=white&style=flat-square" alt="python" style="height: 20px;">
|
||||||
|
</h4>
|
||||||
|
|
||||||
## For manual gdb/gdbserver compilation instructions, have a look at the compilation.md file
|
## TL;DR
|
||||||
|
|
||||||
## Compiling gdb using docker
|
- **Download**: Get the latest release from the [releases page](https://github.com/guyush1/gdb-static/releases/latest).
|
||||||
|
|
||||||
This repository contains a dockerfile and build scripts to compile gdb and gdbserver statically for multiple architectures.
|
## Introduction
|
||||||
Currently, the supported architectures are:
|
|
||||||
- x86_64
|
|
||||||
- arm
|
|
||||||
- aarch64
|
|
||||||
- powerpc (32bit)
|
|
||||||
You can easily expand it to support more architectures by adding the appropriate cross compilers to the dockerfile, and other build scripts.
|
|
||||||
|
|
||||||
NOTE: You don't need to interact with the dockerfile directly, as the Makefile will take care of everything for you.
|
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...
|
||||||
|
|
||||||
### Building for a specific architecture
|
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!
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>
|
||||||
|
Features
|
||||||
|
</summary> <br />
|
||||||
|
|
||||||
|
- **Static Builds**: No dependencies, no installation, just download and run!
|
||||||
|
- **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
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To get started with `gdb-static`, simply download the build for your architecture from the [releases page](https://github.com/guyush1/gdb-static/releases/latest), extract the archive, and copy the binary to your desired platform.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> We provide two types of builds:
|
||||||
|
> 1. Builds with Python support, which are approximately ~30 MB in size.
|
||||||
|
> 2. Slimmer builds without Python support, which are approximately ~7 MB in size.
|
||||||
|
|
||||||
|
You may choose to copy the `gdb` binary to the platform, or use `gdbserver` to debug remotely.
|
||||||
|
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>
|
||||||
|
Pre-requisites
|
||||||
|
</summary> <br />
|
||||||
|
To be able to build `gdb-static`, you will need the following tools installed on your machine:
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
- Docker
|
||||||
|
- Docker buildx
|
||||||
|
- Git
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>
|
||||||
|
Building for a specific architecture
|
||||||
|
</summary> <br />
|
||||||
|
|
||||||
|
To build `gdb-static` for a specific architecture, run the following command:
|
||||||
|
|
||||||
To build for a specific architecture, you can use the following command:
|
|
||||||
```bash
|
```bash
|
||||||
make build-<ARCH>
|
make build[-with-python]-<ARCH>
|
||||||
```
|
```
|
||||||
|
|
||||||
For example, to build for arm:
|
Where `<ARCH>` is the architecture you want to build for, and `-with-python` may be added in order to compile gdb with Python support.
|
||||||
|
|
||||||
|
The resulting binary will be placed in the `build/artifacts/` directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make build-arm
|
|
||||||
```
|
|
||||||
|
|
||||||
The resulting binaries will be placed under the `build/artifacts/` directory.
|
|
||||||
Each architecture will have its own directory under `build/artifacts/`. For example, the arm architecture will have the following directory structure:
|
|
||||||
```
|
|
||||||
build/
|
build/
|
||||||
artifacts/
|
└── artifacts/
|
||||||
arm/
|
└── <ARCH>/
|
||||||
...
|
└── ...
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building for all architectures
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>
|
||||||
|
Building for all architectures
|
||||||
|
</summary> <br />
|
||||||
|
|
||||||
|
To build `gdb-static` for all supported architectures, run the following command:
|
||||||
|
|
||||||
To build for all architectures, you can use the following command:
|
|
||||||
```bash
|
```bash
|
||||||
make build
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cleaning the build
|
The resulting binary will be placed in the `build/artifacts/` directory.
|
||||||
|
|
||||||
To clean the build, you can use the following command:
|
</details>
|
||||||
```bash
|
|
||||||
make clean
|
<a name="contributing_anchor"></a>
|
||||||
```
|
## Contributing
|
||||||
|
|
||||||
|
- Bug Report: If you see an error message or encounter an issue while using gdb-static, please create a [bug report](https://github.com/guyush1/gdb-static/issues/new?assignees=&labels=bug&title=%F0%9F%90%9B+Bug+Report%3A+).
|
||||||
|
|
||||||
|
- 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](https://github.com/guyush1/gdb-static/issues/new?assignees=&labels=enhancement&title=%F0%9F%9A%80+Feature+Request%3A+).
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
<!---
|
||||||
|
npx contributor-faces --exclude "*bot*" --limit 70 --repo "https://github.com/guyush1/gdb-static"
|
||||||
|
|
||||||
|
change the height and width for each of the contributors from 80 to 50.
|
||||||
|
--->
|
||||||
|
|
||||||
|
[//]: contributor-faces
|
||||||
|
<a href="https://github.com/guyush1"><img src="https://avatars.githubusercontent.com/u/82650790?v=4" title="guyush1" width="80" height="80"></a>
|
||||||
|
<a href="https://github.com/RoiKlevansky"><img src="https://avatars.githubusercontent.com/u/78471889?v=4" title="RoiKlevansky" width="80" height="80"></a>
|
||||||
|
<a href="https://github.com/roddyrap"><img src="https://avatars.githubusercontent.com/u/37045659?v=4" title="roddyrap" width="80" height="80"></a>
|
||||||
|
|
||||||
|
[//]: contributor-faces
|
||||||
|
7
package.json
Normal file
7
package.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "gdb-static",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/guyush1/gdb-static"
|
||||||
|
}
|
||||||
|
}
|
@ -57,15 +57,18 @@ function set_compliation_variables() {
|
|||||||
export LDFLAGS="-s"
|
export LDFLAGS="-s"
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_ncurses_link_variables() {
|
function set_up_lib_search_paths() {
|
||||||
# Set up ncurses library link variables
|
# Set up library-related linker search paths.
|
||||||
#
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
# $1: ncursesw build dir
|
# $1: ncursesw build dir
|
||||||
|
# $2: libexpat build dir
|
||||||
local ncursesw_build_dir="$1"
|
local ncursesw_build_dir="$1"
|
||||||
|
local libexpat_build_dir="$2"
|
||||||
|
|
||||||
# Allow tui mode by adding our custom built static ncursesw library to the linker search path.
|
# I) Allow tui mode by adding our custom built static ncursesw library to the linker search path.
|
||||||
export LDFLAGS="-L$ncursesw_build_dir/lib $LDFLAGS"
|
# II) Allow parsing xml files by adding libexpat library to the linker search path.
|
||||||
|
export LDFLAGS="-L$ncursesw_build_dir/lib -L$libexpat_build_dir/lib/.libs $LDFLAGS"
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_iconv() {
|
function build_iconv() {
|
||||||
@ -214,6 +217,56 @@ function build_ncurses() {
|
|||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function build_libexpat() {
|
||||||
|
# Build libexpat.
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# $1: libexpat package directory
|
||||||
|
# $2: target architecture
|
||||||
|
#
|
||||||
|
# Echoes:
|
||||||
|
# The libexpat build directory
|
||||||
|
#
|
||||||
|
# Returns:
|
||||||
|
# 0: success
|
||||||
|
# 1: failure
|
||||||
|
local libexpat_dir="$1"
|
||||||
|
local target_arch="$2"
|
||||||
|
local libexpat_build_dir="$(realpath "$libexpat_dir/build-$target_arch")"
|
||||||
|
|
||||||
|
echo "$libexpat_build_dir"
|
||||||
|
mkdir -p "$libexpat_build_dir"
|
||||||
|
|
||||||
|
if [[ -f "$libexpat_build_dir/lib/.libs/libexpat.a" ]]; then
|
||||||
|
>&2 echo "Skipping build: libexpat already built for $target_arch"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd "$libexpat_build_dir" > /dev/null
|
||||||
|
|
||||||
|
>&2 fancy_title "Building libexpat for $target_arch"
|
||||||
|
|
||||||
|
# Generate configure if it doesnt exist.
|
||||||
|
if [[ ! -f "$libexpat_build_dir/../expat/configure" ]]; then
|
||||||
|
>&2 ../expat/buildconf.sh ../expat/
|
||||||
|
fi
|
||||||
|
|
||||||
|
../expat/configure --enable-static "CC=$CC" "CXX=$CXX" "--host=$HOST" \
|
||||||
|
"CFLAGS=$CFLAGS" "CXXFLAGS=$CXXFLAGS" 1>&2
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
make -j$(nproc) 1>&2
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
>&2 fancy_title "Finished building libexpat for $target_arch"
|
||||||
|
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
function build_python() {
|
function build_python() {
|
||||||
# Build python.
|
# Build python.
|
||||||
#
|
#
|
||||||
@ -388,10 +441,11 @@ function build_gdb() {
|
|||||||
|
|
||||||
../configure -C --enable-static --with-static-standard-libraries --disable-inprocess-agent \
|
../configure -C --enable-static --with-static-standard-libraries --disable-inprocess-agent \
|
||||||
--enable-tui "$python_flag" \
|
--enable-tui "$python_flag" \
|
||||||
|
--with-expat --with-libexpat-type="static" \
|
||||||
"--with-libiconv-prefix=$libiconv_prefix" --with-libiconv-type=static \
|
"--with-libiconv-prefix=$libiconv_prefix" --with-libiconv-type=static \
|
||||||
"--with-gmp=$libgmp_prefix" \
|
"--with-gmp=$libgmp_prefix" \
|
||||||
"--with-mpfr=$libmpfr_prefix" \
|
"--with-mpfr=$libmpfr_prefix" \
|
||||||
"CC=$CC" "CXX=$CXX" "--host=$HOST" \
|
"CC=$CC" "CXX=$CXX" "LDFLAGS=$LDFLAGS" "--host=$HOST" \
|
||||||
"CFLAGS=$CFLAGS" "CXXFLAGS=$CXXFLAGS" 1>&2
|
"CFLAGS=$CFLAGS" "CXXFLAGS=$CXXFLAGS" 1>&2
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
return 1
|
return 1
|
||||||
@ -530,7 +584,13 @@ function build_gdb_with_dependencies() {
|
|||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
set_ncurses_link_variables "$ncursesw_build_dir"
|
|
||||||
|
libexpat_build_dir="$(build_libexpat "$packages_dir/libexpat" "$target_arch")"
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set_up_lib_search_paths "$ncursesw_build_dir" "$libexpat_build_dir"
|
||||||
|
|
||||||
if [[ "$with_python" == "yes" ]]; then
|
if [[ "$with_python" == "yes" ]]; then
|
||||||
local gdb_python_dir="$packages_dir/binutils-gdb/gdb/python/lib/"
|
local gdb_python_dir="$packages_dir/binutils-gdb/gdb/python/lib/"
|
||||||
|
@ -64,11 +64,6 @@ function download_package() {
|
|||||||
local url="$1"
|
local url="$1"
|
||||||
local output="$2"
|
local output="$2"
|
||||||
|
|
||||||
if [[ -f "$output" ]]; then
|
|
||||||
>&2 echo "Skipping download: $output already exists"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
wget "$url" -O "$output"
|
wget "$url" -O "$output"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
>&2 echo "Error: failed to download $url"
|
>&2 echo "Error: failed to download $url"
|
||||||
@ -98,11 +93,6 @@ function extract_package() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d "$output_dir" ]]; then
|
|
||||||
>&2 echo "Skipping extraction: $output_dir already exists"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
pushd "$temp_dir" > /dev/null
|
pushd "$temp_dir" > /dev/null
|
||||||
|
|
||||||
unpack_tarball "$tarball_realpath"
|
unpack_tarball "$tarball_realpath"
|
||||||
@ -113,6 +103,10 @@ function extract_package() {
|
|||||||
|
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
|
# Make sure output dir is empty, so we could move content into it.
|
||||||
|
# The directory might not exist, so we need to pass || true so that set -e won't fail us.
|
||||||
|
rm -rf "$output_dir" || true
|
||||||
|
|
||||||
mv "$temp_dir/$package_dir" "$output_dir"
|
mv "$temp_dir/$package_dir" "$output_dir"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
return 1
|
return 1
|
||||||
|
1
src/submodule_packages/libexpat
Submodule
1
src/submodule_packages/libexpat
Submodule
Submodule src/submodule_packages/libexpat added at 2691aff430
Reference in New Issue
Block a user