Compare commits

..

No commits in common. "develop" and "add-libexpat-support" have entirely different histories.

13 changed files with 85 additions and 1266 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 76 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 72 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 76 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 72 KiB

View File

@ -13,8 +13,6 @@ BUILD_PACKAGES_DIR := "build/packages"
.PHONY: clean help download_packages build build-docker-image $(ALL_TARGETS) $(ALL_PACK_TARGETS)
.NOTPARALLEL: build pack
help:
@echo "Usage:"
@echo " make build"

162
README.md
View File

@ -1,150 +1,54 @@
<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>
# Repository of static gdb and gdbserver
<p align="center">
<i align="center">Frozen static builds of everyone's favorite debugger!🧊</i>
</p>
## **The statically compiled gdb / gdbserver binaries are avaliable to download under github 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-v16.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>
link: [gdb-static github releases](https://github.com/guyush1/gdb-static/releases)
## TL;DR
## For manual gdb/gdbserver compilation instructions, have a look at the compilation.md file
- **Download**: Get the latest release from the [releases page](https://github.com/guyush1/gdb-static/releases/latest).
## Compiling gdb using docker
## Introduction
This repository contains a dockerfile and build scripts to compile gdb and gdbserver statically for multiple architectures.
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.
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...
NOTE: You don't need to interact with the dockerfile directly, as the Makefile will take care of everything for you.
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:
### Building for a specific architecture
To build for a specific architecture, you can use the following command:
```bash
make build[-with-python]-<ARCH>
make build-<ARCH>
```
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:
For example, to build for arm:
```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/
└── artifacts/
└── <ARCH>/
└── ...
artifacts/
arm/
...
```
</details>
<details open>
<summary>
Building for all architectures
</summary> <br />
To build `gdb-static` for all supported architectures, run the following command:
### Building for all architectures
To build for all architectures, you can use the following command:
```bash
make build
```
The resulting binary will be placed in the `build/artifacts/` directory.
### Cleaning the build
</details>
<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
To clean the build, you can use the following command:
```bash
make clean
```

View File

@ -1,58 +1,49 @@
# Notes about this file - read before proceeding!
While we have already provided the gdb/gdbserver statically compiled binaries for you, some people might want to compile it without our build scripts, or compile a newer version of gdb in the future :).
The rest of the file contains a documentation of the compilation process, in order to help you out.
While i have already provided the gdb/gdbserver-15 statically compiled binaries for you, some people might want to compile it to a different architecture (without our build scripts), or compile a newer version of gdb in the future :). The rest of the file contains a documentation of the compilation process, in order to help you out.
NOTE: The compilation guide describes the compilation process in order to create a minimal-working version of gdb. Our build-scripts also provides further capabilites to gdb, such as python and xml support, which are not documented in this file.
## <VARAIBLES> in the script
## <VARAIBLES> In this file
Environment variables are denoted by <...> throughout this file.
Please note that when specifying a compilation dir throughout the compilation process (via the <COMPILATION_DIR_PATH> environment variable), DO NOT use relative pathing, or special bash characters such as `~`. Relative pathing / special bash characters will not get parsed correctly!
Instead, always use absolute paths.
When specifying the compilation dir throughout the compilation process (specified as <COMPILATION_DIR_PATH> in this file), DO NOT use relative pathing, or bash characters such as `~`. They will not get parsed correctly! Instead, use absolute paths only.
Examples to the <VARIABLES> throughout the script:
- <CROSS_COMPILER_C> - arm-linux-gnueabi-gcc
- <CROSS_COMPILER_CPP> - arm-linux-gnueabi-g++
- <HOST_NAME> - arm-linux-gnueabi
- <COMPILATION_DIR_PATH> - /home/username/projects/libgmp-x.y.z/build-arm/
<CROSS_COMPILER_C> - arm-linux-gnueabi-gcc
<CROSS_COMPILER_CPP> - arm-linux-gnueabi-g++
<HOST_NAME> - arm-linux-gnueabi
<COMPILATION_DIR_PATH> - /home/username/projects/libgmp-x.y.z/build-arm/
Environment info:
- glibc version: 2.39-0ubuntu8.3 (NOTE: When i compiled gdb using an older glibc, such as the one i had in my ubuntu-20.04 machine, i received a segfault in gdb, so the libc version is important!).
- glibc version: 2.39-0ubuntu8.3 (NOTE: When i compiled gdb-15 using an older glibc, such as the one i had in my ubuntu-20.04 machine, i received a segfault in gdb...).
# Compiling gdb statically to the host platform
## 1) Compiling iconv
While compiling iconv is not a must, the libc-provided iconv (a utility to convert between encodings) may fail on different architectures,
at least in my experience.
Thus, I recommended using a custom libiconv and compiling it into gdb.
at least in my experiance. Thus, I recommended using a custom libiconv and compiling it into gdb.
Download the source from https://github.com/roboticslibrary/libiconv.git
Make sure to check out to a stable tag (in my case - v1.17).
Work according to the following steps:
1. run `./gitsub.sh pull`
2. run `./autogen.sh` to create the configure script from configure.sh.
3. create a build dir (e.g build), and then cd into it.
4. run `../configure --enable-static`
5. run `cp -r ./include ./lib/.libs/`
6. run `mkdir ./lib/.libs/lib/`
7. run `cp ./lib/.libs/libiconv.a ./lib/.libs/lib/`
I) run `./gitsub.sh pull`
II) run `./autogen.sh` to create the configure script from configure.sh.
III) create a build dir (e.g build), and then cd into it.
IV) run `../configure --enable-static`
V) run `cp -r ./include ./lib/.libs/`
VI) run `mkdir ./lib/.libs/lib/`
VII) run `cp ./lib/.libs/libiconv.a ./lib/.libs/lib/`
## 2) Compiling gdb
Clone gdb from from my forked respository - https://github.com/guyush1/binutils-gdb/tree/gdb-static.
Make sure to check out to the **gdb-static** branch - this branch contains all of the changes i had to do to the build system in order for it to compile gdb statically.
Clone gdb from sourceware - https://sourceware.org/git/binutils-gdb.git.
I checked out to the 15.2 tag.
Work according to the following steps:
1. create a build dir.
2. run `../configure --enable-static --with-static-standard-libraries --disable-tui --disable-inprocess-agent --with-libiconv-prefix=<COMPILATION_DIR_PATH>/lib/.libs/ --with-libiconv-type=static`
3. run `make all-gdb -j$(nproc)` - for gdbserver, run `make all-gdbserver -j$(nproc)`.
I) Apply my patches (gdb_static.patch). If you are not on the exact tag i used (15.2) - you might need to apply them manually, and change some stuff.
II) create a build dir.
III) run `../configure --enable-static --with-static-standard-libraries --disable-tui --disable-inprocess-agent --with-libiconv-prefix=<COMPILATION_DIR_PATH>/lib/.libs/ --with-libiconv-type=static`
IV) run `make all-gdb -j$(nproc)` - for gdbserver, run `make all-gdbserver -j$(nproc)`.
gdb will sit under gdb/gdb.
gdbserver will sit under gdbserver/gdbserver.
@ -72,13 +63,13 @@ Download and extract the latest edition from https://gmplib.org/.
I used the 6.3.0 edition.
Work according to the following steps:
1. Create a build dir and cd into it.
2. run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --host=<HOST_NAME>`
3. run `make -j$(nproc)`
4. run `mkdir ./.libs/include/`
5. run `cp gmp.h ./.libs/include/`
6. run `mkdir ./.libs/lib`
7. run `cp ./.libs/libgmp.a ./.libs/lib`
I) Create a build dir and cd into it.
II) run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --host=<HOST_NAME>`
III) run `make -j$(nproc)`
IV) run `mkdir ./.libs/include/`
V) run `cp gmp.h ./.libs/include/`
VI) run `mkdir ./.libs/lib`
VII) run `cp ./.libs/libgmp.a ./.libs/lib`
## 3) Compiling libmpfr
@ -86,16 +77,15 @@ Download and extract the latest edition from https://www.mpfr.org/.
I used the 4.2.1 edition.
Work according to the following steps:
1. Create a build dir and cd into it.
2. run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --with-gmp-build=<COMPILATION_DIR_PATH> --host=<HOST_NAME>`
3. run `make -j$(nproc)`
4. run `mkdir ./src/.libs/lib`
5. run `cp ./src/.libs/libmpfr.a ./src/.libs/lib`
6. run `mkdir ./src/.libs/include`
7. run `cp ../src/mpfr.h ./src/.libs/include/`
I) Create a build dir and cd into it.
II) run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --with-gmp-build=<COMPILATION_DIR_PATH> --host=<HOST_NAME>`
III) run `make -j$(nproc)`
IV) run `mkdir ./src/.libs/lib`
V) run `cp ./src/.libs/libmpfr.a ./src/.libs/lib`
VI) run `mkdir ./src/.libs/include`
VII) run `cp ../src/mpfr.h ./src/.libs/include/`
## 4) Compiling gdb
Work according to the same process as described under the compilation to the host platform, aside from the configure script:
2. run `../configure --enable-static --with-static-standard-libraries --disable-tui --disable-inprocess-agent --with-libiconv-prefix=<COMPILATION_DIR_PATH>/lib/.libs/ --with-libiconv-type=static --with-gmp=<COMPILATION_DIR_PATH>/.libs/ --with-mpfr=<COMPILATION_DIR_PATH>/src/.libs/ CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --host=<HOST_NAME>`
III) run `../configure --enable-static --with-static-standard-libraries --disable-tui --disable-inprocess-agent --with-libiconv-prefix=<COMPILATION_DIR_PATH>/lib/.libs/ --with-libiconv-type=static --with-gmp=<COMPILATION_DIR_PATH>/.libs/ --with-mpfr=<COMPILATION_DIR_PATH>/src/.libs/ CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --host=<HOST_NAME>`

View File

@ -1,7 +0,0 @@
{
"name": "gdb-static",
"repository": {
"type": "git",
"url": "https://github.com/guyush1/gdb-static"
}
}

View File

@ -442,9 +442,6 @@ function build_gdb() {
../configure -C --enable-static --with-static-standard-libraries --disable-inprocess-agent \
--enable-tui "$python_flag" \
--with-expat --with-libexpat-type="static" \
--with-gdb-datadir="/usr/share/gdb" --with-separate-debug-dir="/usr/lib/debug" \
--with-system-gdbinit="/etc/gdb/gdbinit" --with-system-gdbinit-dir="/etc/gdb/gdbinit.d" \
--with-jit-reader-dir="/usr/lib/gdb" \
"--with-libiconv-prefix=$libiconv_prefix" --with-libiconv-type=static \
"--with-gmp=$libgmp_prefix" \
"--with-mpfr=$libmpfr_prefix" \

View File

@ -64,6 +64,11 @@ function download_package() {
local url="$1"
local output="$2"
if [[ -f "$output" ]]; then
>&2 echo "Skipping download: $output already exists"
return 0
fi
wget "$url" -O "$output"
if [[ $? -ne 0 ]]; then
>&2 echo "Error: failed to download $url"
@ -93,6 +98,11 @@ function extract_package() {
return 1
fi
if [[ -d "$output_dir" ]]; then
>&2 echo "Skipping extraction: $output_dir already exists"
return 0
fi
pushd "$temp_dir" > /dev/null
unpack_tarball "$tarball_realpath"
@ -103,10 +113,6 @@ function extract_package() {
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"
if [[ $? -ne 0 ]]; then
return 1

View File

@ -1,3 +1,4 @@
abc
_aix_support
antigravity
argparse
@ -7,6 +8,7 @@ bdb
bisect
calendar
cmd
codecs
codeop
code
<collections.**.*>
@ -52,6 +54,7 @@ hmac
imaplib
<importlib.**.*>
inspect
io
ipaddress
<json.**.*>
keyword

@ -1 +1 @@
Subproject commit 25f97ccb7ff1a9d7bd0e25535d749acf6e1a87be
Subproject commit 34012c42d0a2edaad66265c76e63104d8b4cd0b6

@ -1 +1 @@
Subproject commit f38630702ca74b512256880f5e80130a8733a0b5
Subproject commit 74ab74654b867a6e1c3b2af3ccf6b7b74b0e9a9b