Skip to content

Commit f67fa10

Browse files
authored
gdb: Make it easier to install a correct version of GDB inside the ossfuzz container (#77)
1 parent 5f97dbd commit f67fa10

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

ossfuzz.sh

+10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ SCRIPTDIR=${BUILD_ROOT}/scripts
3030
ZLIBDIR=/src/zlib
3131
OPENSSLDIR=/src/openssl
3232
NGHTTPDIR=/src/nghttp2
33+
GDBDIR=/src/gdb
3334

3435
echo "BUILD_ROOT: $BUILD_ROOT"
3536
echo "SRC: ${SRC:-undefined}"
@@ -46,6 +47,15 @@ export MAKEFLAGS+="-j$(nproc)"
4647
# Make an install directory
4748
export INSTALLDIR=/src/curl_install
4849

50+
# If necessary (i.e. this is inside the ossfuzz shell environment and
51+
# you've set the environment variable) then download and install GDB.
52+
# This installs to the default configure location.
53+
if [[ ${INSTALLGDB:-} == "yes" ]]
54+
then
55+
# Install GDB
56+
${SCRIPTDIR}/handle_x.sh gdb ${GDBDIR} system || exit 1
57+
fi
58+
4959
# Install zlib
5060
${SCRIPTDIR}/handle_x.sh zlib ${ZLIBDIR} ${INSTALLDIR} || exit 1
5161

scripts/download_gdb.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# If any commands fail, fail the script immediately.
4+
set -ex
5+
6+
wget https://ftp.gnu.org/gnu/gdb/gdb-13.2.tar.xz -O /tmp/gdb.tar.gz
7+
tar -xvf /tmp/gdb.tar.gz --directory /tmp
8+
9+
# Move the directory into the correct place
10+
mv -v /tmp/gdb-* "$1"

scripts/install_gdb.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# If any commands fail, fail the script immediately.
3+
set -ex
4+
5+
export CFLAGS=
6+
export CXXFLAGS=
7+
8+
SRCDIR=$1
9+
10+
pushd ${SRCDIR}
11+
12+
./configure
13+
make
14+
make install
15+
16+
popd

scripts/ossfuzzdeps.sh

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ apt-get install -y make \
88
autoconf \
99
automake \
1010
libtool \
11+
libgmp-dev \
1112
libssl-dev \
1213
zlib1g-dev \
1314
pkg-config \

0 commit comments

Comments
 (0)