Skip to content

Commit 9e7d1ed

Browse files
authored
Merge pull request #30 from guyush1/external-python-gdb-lib
Compiling Pygments & dependencies in GDB
2 parents f7e97ca + 89f092e commit 9e7d1ed

File tree

6 files changed

+174
-3
lines changed

6 files changed

+174
-3
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
path = src/submodule_packages/binutils-gdb
77
url = [email protected]:guyush1/binutils-gdb.git
88
branch = gdb-static
9+
[submodule "src/submodule_packages/pygments"]
10+
path = src/submodule_packages/pygments
11+
url = [email protected]:pygments/pygments.git

src/compilation/build.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ function build_python() {
220220
# Parameters:
221221
# $1: python package directory
222222
# $2: target architecture
223+
# $3: gdb's python module directory parent
224+
# $4: pygment's toplevel source dir.
223225
#
224226
# Echoes:
225227
# The python build directory
@@ -229,6 +231,8 @@ function build_python() {
229231
# 1: failure
230232
local python_dir="$1"
231233
local target_arch="$2"
234+
local gdb_python_parent="$3"
235+
local pygments_source_dir="$4"
232236
local python_lib_dir="$(realpath "$python_dir/build-$target_arch")"
233237

234238
echo "$python_lib_dir"
@@ -257,6 +261,17 @@ function build_python() {
257261
--disable-ipv6 \
258262
--disable-shared
259263

264+
# Extract the regular standard library modules that are to be frozen and include the gdb and pygments custom libraries.
265+
export EXTRA_FROZEN_MODULES="$(printf "%s" "$(< ${script_dir}/frozen_python_modules.txt)" | tr $'\n' ";")"
266+
export EXTRA_FROZEN_MODULES="${EXTRA_FROZEN_MODULES};<gdb.**.*>: gdb = ${gdb_python_parent};<pygments.**.*>: pygments = ${pygments_source_dir}"
267+
>&2 echo "Frozen Modules: ${EXTRA_FROZEN_MODULES}"
268+
269+
# Regenerate frozen modules with gdb env varaible. Do it after the configure because we need
270+
# the `regen-frozen` makefile.
271+
>&2 python3.12 ../Tools/build/freeze_modules.py
272+
>&2 make regen-frozen
273+
274+
# Build python after configuring the project and regnerating frozen files.
260275
>&2 make -j $(nproc)
261276
if [[ $? -ne 0 ]]; then
262277
return 1
@@ -518,7 +533,9 @@ function build_gdb_with_dependencies() {
518533
set_ncurses_link_variables "$ncursesw_build_dir"
519534

520535
if [[ "$with_python" == "yes" ]]; then
521-
build_python "$packages_dir/cpython-static" "$target_arch"
536+
local gdb_python_dir="$packages_dir/binutils-gdb/gdb/python/lib/"
537+
local pygments_source_dir="$packages_dir/pygments/"
538+
local python_build_dir="$(build_python "$packages_dir/cpython-static" "$target_arch" "$gdb_python_dir" "$pygments_source_dir")"
522539
if [[ $? -ne 0 ]]; then
523540
return 1
524541
fi
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
abc
2+
_aix_support
3+
antigravity
4+
argparse
5+
ast
6+
base64
7+
bdb
8+
bisect
9+
calendar
10+
cmd
11+
codecs
12+
codeop
13+
code
14+
<collections.**.*>
15+
_collections_abc
16+
colorsys
17+
_compat_pickle
18+
compileall
19+
_compression
20+
<concurrent.**.*>
21+
configparser
22+
contextlib
23+
contextvars
24+
copy
25+
copyreg
26+
cProfile
27+
csv
28+
dataclasses
29+
datetime
30+
<dbm.**.*>
31+
decimal
32+
difflib
33+
dis
34+
<encodings.**.*>
35+
<ensurepip.**.*>
36+
enum
37+
filecmp
38+
fileinput
39+
fnmatch
40+
fractions
41+
ftplib
42+
functools
43+
__future__
44+
genericpath
45+
getopt
46+
getpass
47+
gettext
48+
glob
49+
graphlib
50+
gzip
51+
hashlib
52+
heapq
53+
hmac
54+
imaplib
55+
<importlib.**.*>
56+
inspect
57+
io
58+
ipaddress
59+
<json.**.*>
60+
keyword
61+
linecache
62+
locale
63+
<logging.**.*>
64+
lzma
65+
_markupbase
66+
mimetypes
67+
modulefinder
68+
<multiprocessing.**.*>
69+
netrc
70+
ntpath
71+
nturl2path
72+
numbers
73+
opcode
74+
operator
75+
optparse
76+
os
77+
_osx_support
78+
pathlib
79+
pdb
80+
<__phello__.**.*>
81+
pickle
82+
pickletools
83+
pkgutil
84+
platform
85+
plistlib
86+
poplib
87+
posixpath
88+
pprint
89+
profile
90+
pstats
91+
pty
92+
_py_abc
93+
pyclbr
94+
py_compile
95+
_pydatetime
96+
_pydecimal
97+
_pyio
98+
_pylong
99+
queue
100+
quopri
101+
random
102+
<re.**.*>
103+
reprlib
104+
rlcompleter
105+
sched
106+
selectors
107+
shelve
108+
shlex
109+
shutil
110+
signal
111+
smtplib
112+
socket
113+
socketserver
114+
statistics
115+
stat
116+
stringprep
117+
string
118+
_strptime
119+
struct
120+
subprocess
121+
symtable
122+
sysconfig
123+
tabnanny
124+
tempfile
125+
textwrap
126+
this
127+
_threading_local
128+
threading
129+
timeit
130+
tokenize
131+
token
132+
<tomllib.**.*>
133+
traceback
134+
tracemalloc
135+
trace
136+
tty
137+
types
138+
typing
139+
uuid
140+
warnings
141+
wave
142+
weakref
143+
_weakrefset
144+
webbrowser
145+
<wsgiref.**.*>
146+
zipapp
147+
<zipfile.**.*>
148+
<zoneinfo.**.*>
149+
<email.**.*>
150+
<urllib.**.*>
Submodule cpython-static updated 60 files

src/submodule_packages/pygments

Submodule pygments added at b583de4

0 commit comments

Comments
 (0)