Skip to content

Commit

Permalink
Compiling Pygments & dependencies in GDB
Browse files Browse the repository at this point in the history
Added Pygments to build

This is in order to enable GDB syntax highlighting
  • Loading branch information
roddyrap committed Jan 8, 2025
1 parent f7e97ca commit bab62e8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
path = src/submodule_packages/binutils-gdb
url = [email protected]:guyush1/binutils-gdb.git
branch = gdb-static
[submodule "src/submodule_packages/pygments"]
path = src/submodule_packages/pygments
url = [email protected]:pygments/pygments.git
15 changes: 14 additions & 1 deletion src/compilation/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ function build_python() {
# Parameters:
# $1: python package directory
# $2: target architecture
# $3: gdb's python module directory parent
#
# Echoes:
# The python build directory
Expand All @@ -229,6 +230,8 @@ function build_python() {
# 1: failure
local python_dir="$1"
local target_arch="$2"
local gdb_python_parent="$3"
local pygments_parent="$4"
local python_lib_dir="$(realpath "$python_dir/build-$target_arch")"

echo "$python_lib_dir"
Expand Down Expand Up @@ -257,6 +260,14 @@ function build_python() {
--disable-ipv6 \
--disable-shared

# Regenerate frozen modules with gdb env varaible. Do it after the configure because we need
# the `regen-frozen` makefile.
export EXTRA_FROZEN_MODULES="<email.**.*>;<urllib.**.*>;<gdb.**.*>: gdb = ${gdb_python_parent};<pygments.**.*>: pygments = ${pygments_parent}"
>&2 echo "Frozen: ${EXTRA_FROZEN_MODULES}"
>&2 python3.12 ../Tools/build/freeze_modules.py
>&2 make regen-frozen

# Build python after configuring the project and regnerating frozen files.
>&2 make -j $(nproc)
if [[ $? -ne 0 ]]; then
return 1
Expand Down Expand Up @@ -518,7 +529,9 @@ function build_gdb_with_dependencies() {
set_ncurses_link_variables "$ncursesw_build_dir"

if [[ "$with_python" == "yes" ]]; then
build_python "$packages_dir/cpython-static" "$target_arch"
local gdb_python_dir="$packages_dir/binutils-gdb/gdb/python/lib/"
local pygments_parent="$packages_dir/pygments/"
local python_build_dir="$(build_python "$packages_dir/cpython-static" "$target_arch" "$gdb_python_dir" "$pygments_parent")"
if [[ $? -ne 0 ]]; then
return 1
fi
Expand Down
2 changes: 1 addition & 1 deletion src/submodule_packages/binutils-gdb
2 changes: 1 addition & 1 deletion src/submodule_packages/cpython-static
Submodule cpython-static updated 60 files
+0 −336 Lib/gdb/FrameDecorator.py
+0 −43 Lib/gdb/FrameIterator.py
+0 −310 Lib/gdb/__init__.py
+0 −14 Lib/gdb/command/__init__.py
+0 −784 Lib/gdb/command/explore.py
+0 −476 Lib/gdb/command/frame_filters.py
+0 −227 Lib/gdb/command/missing_debug.py
+0 −396 Lib/gdb/command/pretty_printers.py
+0 −65 Lib/gdb/command/prompt.py
+0 −126 Lib/gdb/command/type_printers.py
+0 −200 Lib/gdb/command/unwinders.py
+0 −271 Lib/gdb/command/xmethods.py
+0 −96 Lib/gdb/dap/__init__.py
+0 −443 Lib/gdb/dap/breakpoint.py
+0 −149 Lib/gdb/dap/bt.py
+0 −96 Lib/gdb/dap/disassemble.py
+0 −138 Lib/gdb/dap/evaluate.py
+0 −287 Lib/gdb/dap/events.py
+0 −149 Lib/gdb/dap/frames.py
+0 −82 Lib/gdb/dap/io.py
+0 −82 Lib/gdb/dap/launch.py
+0 −43 Lib/gdb/dap/locations.py
+0 −43 Lib/gdb/dap/memory.py
+0 −61 Lib/gdb/dap/modules.py
+0 −91 Lib/gdb/dap/next.py
+0 −22 Lib/gdb/dap/pause.py
+0 −164 Lib/gdb/dap/scopes.py
+0 −515 Lib/gdb/dap/server.py
+0 −105 Lib/gdb/dap/sources.py
+0 −216 Lib/gdb/dap/startup.py
+0 −25 Lib/gdb/dap/state.py
+0 −42 Lib/gdb/dap/threads.py
+0 −88 Lib/gdb/dap/typecheck.py
+0 −276 Lib/gdb/dap/varref.py
+0 −173 Lib/gdb/disassembler.py
+0 −273 Lib/gdb/frames.py
+0 −14 Lib/gdb/function/__init__.py
+0 −38 Lib/gdb/function/as_string.py
+0 −158 Lib/gdb/function/caller_is.py
+0 −105 Lib/gdb/function/strfns.py
+0 −185 Lib/gdb/missing_debug.py
+0 −14 Lib/gdb/printer/__init__.py
+0 −39 Lib/gdb/printer/bound_registers.py
+0 −403 Lib/gdb/printing.py
+0 −164 Lib/gdb/prompt.py
+0 −101 Lib/gdb/styling.py
+0 −183 Lib/gdb/types.py
+0 −140 Lib/gdb/unwinder.py
+0 −274 Lib/gdb/xmethod.py
+0 −294 Makefile.pre.in
+1 −1 Modules/Setup.stdlib.in
+0 −294 PCbuild/_freeze_module.vcxproj
+0 −147 PCbuild/_freeze_module.vcxproj.filters
+0 −157 Python/frozen.c
+1 −1 Tools/build/deepfreeze.py
+6 −5 Tools/build/freeze_modules.py
+6 −2 aclocal.m4
+4 −2 config.site-static
+4,230 −2,696 configure
+289 −285 pyconfig.h.in
1 change: 1 addition & 0 deletions src/submodule_packages/pygments
Submodule pygments added at b583de

0 comments on commit bab62e8

Please sign in to comment.