1 Commits

Author SHA1 Message Date
b4c559e7d4 gdb with python support integration
This commits enables gdb's python support. In order to make it work, we
had to create a python fork with some patches to the buildsystem, and
also had to patch gdb as well.
2024-12-06 12:52:51 +02:00
9 changed files with 30 additions and 63 deletions

View File

@ -1,19 +1,19 @@
name: gdb-static-release-pipeline
name: gdb-static-pipeline
on:
pull_request:
branches:
- '*'
push:
tags:
- 'v*'
# Use a non-parallel single job pipeline because artifacts weigh too much. Instead,
# simply build the files in the same job they are released.
jobs:
build_and_publish:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get install -y wget
@ -24,7 +24,14 @@ jobs:
- name: Pack
run: make pack
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: gdb-static
path: build/artifacts/gdb-static*.tar.gz
- name: Publish release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
files: build/artifacts/gdb-static*.tar.gz

View File

@ -1,24 +0,0 @@
name: gdb-static-pr-pipeline
on:
pull_request:
branches:
- '*'
jobs:
build:
strategy:
matrix:
architecture: ["x86_64", "arm", "aarch64", "powerpc", "mips", "mipsel"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get install -y wget
- name: Build
run: make build-${{ matrix.architecture }} -j$((`nproc`+1))

8
.gitmodules vendored
View File

@ -1,8 +0,0 @@
[submodule "cpython-static"]
path = src/submodule_packages/cpython-static
url = git@github.com:guyush1/cpython-static.git
branch = python3.12-static
[submodule "binutils-gdb-static"]
path = src/submodule_packages/binutils-gdb
url = git@github.com:guyush1/binutils-gdb.git
branch = gdb-static

View File

@ -1,8 +1,6 @@
ARCHS := x86_64 arm aarch64 powerpc mips mipsel
TARGETS := $(addprefix build-, $(ARCHS))
PACK_TARGETS := $(addprefix pack-, $(ARCHS))
SUBMODULE_PACKAGES := $(wildcard src/submodule_packages/*)
BUILD_PACKAGES_DIR := "build/packages"
.PHONY: clean help download_packages build build-docker-image $(TARGETS) $(PACK_TARGETS)
@ -25,28 +23,22 @@ build/build-docker-image.stamp: Dockerfile
build-docker-image: build/build-docker-image.stamp
build/download-packages.stamp: build/build-docker-image.stamp src/compilation/download_packages.sh
mkdir -p $(BUILD_PACKAGES_DIR)
build/download-packages.stamp: build/build-docker-image.stamp src/download_packages.sh
mkdir -p build/packages
docker run --user $(shell id -u):$(shell id -g) \
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
/app/gdb/src/compilation/download_packages.sh /app/gdb/$(BUILD_PACKAGES_DIR)/
/app/gdb/src/download_packages.sh /app/gdb/build/packages
touch build/download-packages.stamp
build/symlink-git-packages.stamp: $(SUBMODULE_PACKAGES)
mkdir -p $(BUILD_PACKAGES_DIR)
ln -sf $(addprefix /app/gdb/, $(SUBMODULE_PACKAGES)) $(BUILD_PACKAGES_DIR)/
symlink-git-packages: build/symlink-git-packages.stamp
download-packages: build/download-packages.stamp
build: $(TARGETS)
$(TARGETS): build-%: symlink-git-packages download-packages build-docker-image
$(TARGETS): build-%: download-packages build-docker-image
mkdir -p build
docker run --user $(shell id -u):$(shell id -g) \
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src
/app/gdb/src/build.sh $* /app/gdb/build/ /app/gdb/src
pack: $(PACK_TARGETS)
@ -55,10 +47,7 @@ $(PACK_TARGETS): pack-%: build-%
tar -czf "build/artifacts/gdb-static-$*.tar.gz" -C "build/artifacts/$*" .; \
fi
clean-git-packages:
git submodule foreach '[[ ! "$$sm_path" == src/submodule_packages/* ]] || git clean -xffd'
clean: clean-git-packages
clean:
rm -rf build
# Kill and remove all containers of image gdb-static
docker ps -a | grep -P "^[a-f0-9]+\s+gdb-static\s+" | awk '{print $$1}' | xargs docker rm -f 2>/dev/null || true

View File

@ -4,9 +4,6 @@
script_dir=$(dirname "$0")
source "$script_dir/utils.sh"
# Don't want random unknown things to fail in the build procecss!
set -e
function set_compliation_variables() {
# Set compilation variables such as which compiler to use.
#
@ -43,7 +40,7 @@ function set_compliation_variables() {
CROSS=mipsel-linux-gnu-
export HOST=mipsel-linux-gnu
elif [[ "$target_arch" == "x86_64" ]]; then
CROSS=x86_64-linux-gnu-
CROSS=""
export HOST=x86_64-linux-gnu
fi

View File

@ -2,7 +2,7 @@
# Include utils library
script_dir=$(dirname "$0")
source "$script_dir/utils.sh"
. "$script_dir/utils.sh"
# List of package URLs to download
SOURCE_URLS=(
@ -201,6 +201,14 @@ function download_gdb_packages() {
fi
done
if [[ ! -d gdb-static ]]; then
git clone https://github.com/guyush1/binutils-gdb.git --single-branch --branch gdb-static
fi
if [[ ! -d python3.12-static ]]; then
git clone https://github.com/guyush1/cpython-static.git --single-branch --branch python3.12-static
fi
fancy_title "Finished downloading GDB packages"
popd
}