Skip to content

CodeQL

CodeQL #853

Workflow file for this run

---
# .github/workflows/codeql.yml: GHA CodeQL workflow for apple-gdb-1824
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches:
- master
- main
- dependabot/*
- codeql-*
- autofix*alert*
- alert*autofix*
- ruff_unsafe
pull_request:
# The branches below must be a subset of the branches above
branches:
- master
- main
- dependabot/*
- codeql-*
- autofix*alert*
- alert*autofix*
- ruff_unsafe
schedule:
- cron: '38 5 * * 2'
jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: 'ubuntu-latest'
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ['c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby']
# CodeQL supports the following languages:
# 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript',
# 'python', 'ruby', 'swift'
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript,
# TypeScript or both
# Learn more about CodeQL language support at:
# https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a
# config file.
# By default, queries listed here will override any specified in a
# config file.
# Prefix the list here with "+" to use these queries and those in the
# config file.
# For more details on CodeQL's query packs, refer to:
# https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Create builddirs
run: |
if test ! -d build; then \
(sync && mkdir build && sync); \
else \
(sync && stat build && sync); \
fi
if test ! -d /home/runner/work/apple-gdb-1824/build; then \
if test -w /home/runner/work/apple-gdb-1824; then \
(sync && mkdir -v /home/runner/work/apple-gdb-1824/build && sync); \
elif test -w /home/runner/work -o -w /home/runner -o -w /home; then \
(sync && mkdir -pv /home/runner/work/apple-gdb-1824/build && sync); \
else \
(sync && (stat /home/runner/work || stat /home/runner || stat /home)); \
echo "unable to make the necessary builddir due to unwriteable directories"; \
fi; \
else \
(sync && stat /home/runner/work/apple-gdb-1824/build && sync); \
fi
(cd src && sync && echo "now in $(pwd)..." && sync)
if test ${{ matrix.language }} != 'c-cpp'; then \
sleep 1; else echo "c-cpp"; fi
- name: Run sccache-cache only on non-release runs
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' && matrix.language == 'c-cpp'
uses: mozilla-actions/sccache-action@v0.0.6
env:
SCCACHE_GHA_ENABLED: "true"
- name: Dependencies
run: |
sudo apt-get -qq update
if test ${{ matrix.language }} == 'c-cpp'; then \
sudo apt-get -y install autopoint gobjc clang autogen curl \
guile-2.2 guile-2.2-dev guile-2.2-libs guile-3.0 guile-3.0-dev \
guile-3.0-libs libguile-ssh13 libiconv-hook1 libiconv-hook-dev \
win-iconv-mingw-w64-dev mingw-w64 mingw-w64-i686-dev wine libwine \
libwine-dev libtbb-dev crosshurd libdispatch0 libdispatch-dev \
libblocksruntime0 libblocksruntime-dev systemtap-sdt-dev \
libfl-dev libiberty-dev libmpfr-dev gettext libisl-dev \
gdb ddd texlive-binaries sharutils xutils-dev llvm libacl1-dev \
xterm binutils-dev bash gobjc-multilib libasprintf-dev \
libgettextpo-dev help2man docbook-utils splint valac-bin cxref \
libbsd-dev libkmod-dev libelf-dev libdmalloc-dev \
libbabeltrace-dev libkmer-dev; \
elif test ${{ matrix.language }} == 'java-kotlin'; then \
sudo apt-get -y install kotlin gradle libgradle-core-java \
libgradle-plugins-java libintellij-java-compatibility-java \
libjzlib-java gradle-propdeps-plugin junit junit5 \
libgradle-jflex-plugin-java gradle-apt-plugin; \
elif test ${{ matrix.language }} == 'javascript-typescript'; then \
sudo apt-get -y install node-optionator eslint uglifyjs \
libjs-modernizr node-babel-eslint npm wkhtmltopdf node-dompurify \
libjavascriptcoregtk-4.0-bin webkit2gtk-driver yamllint; \
elif test ${{ matrix.language }} == 'go'; then \
sudo apt-get -y install gccgo gccgo-multilib golang golang-go \
golang-src golang-ar-dev golang-honnef-go-tools-dev yamllint; \
elif test ${{ matrix.language }} == 'csharp'; then \
sudo apt-get -y install mono-csharp-shell dotnet-host mono-mcs nant \
nunit mono-xbuild yamllint monodoc-nunit-manual; \
elif test ${{ matrix.language }} == 'python'; then \
sudo apt-get -y install --fix-missing jython pylint pymacs python-tk \
tix flake8 python3-macholib yamllint black python3-pyls-black \
python3-pylsp-black python3-pyflakes python3-pylint-plugin-utils \
python3-pylint-common pyflakes3 python3-pytest-pylint \
python3-flake8 python3-pytest-flake8 python3-pep8-naming \
python3-mccabe python3-autopep8 python3-flake8-docstrings \
python3-flake8-blind-except python3-flake8-builtins \
python3-pylsp-flake8 python3-flake8-class-newline \
python3-flake8-quotes python3-flake8-import-order \
python3-flake8-comprehensions python3-flake8-deprecated; \
pip install pylint flake8 ruff black pyupgrade bandit; \
elif test ${{ matrix.language }} == 'ruby'; then \
sudo apt-get -y install ruby ruby-dev libruby rake ruby-full \
ruby-ffi ruby-build jruby-openssl mruby libmruby-dev; \
else \
sync && echo "unhandled language ${{ matrix.language }}" && sleep 1; \
fi
- name: "Install ktlint"
if: matrix.language == 'java-kotlin'
uses: nbadal/action-ktlint-setup@v1
- name: Syntax check (and similar stuff)
if: matrix.language != 'c-cpp' && matrix.language != 'java-kotlin'
run: |
if test ${{ matrix.language }} == 'ruby' && test -x "$(which ruby)"; then \
ruby -cwv src/gdb/testsuite/gdb.apple/gen-x86-prologues.rb || \
ruby -c src/gdb/testsuite/gdb.apple/gen-x86-prologues.rb; \
if test ! -w /var/lib/gems; then \
SUDO="sudo"; \
else \
SUDO="time"; \
fi; \
GEMCMD=""; \
for possiblegem in gem macgem jgem mgem chgem picogem trufflegem; do \
if test -x "$(which ${possiblegem})"; then
GEMCMD=${possiblegem}; break; \
fi; \
done; \
if test -z "$(which nitpick)" || test ! -x "$(which nitpick)"; then \
if test -n "${GEMCMD}"; then \
sync && echo "using ${GEMCMD} to try to install nitpick & deps"; \
"${SUDO}" ${GEMCMD} install ruby2ruby nitpick; \
else \
sync && echo "warning: unsure how to install nitpick"; \
fi; \
else \
sync && echo "found $(which nitpick)..."; \
fi; \
if test -x "$(which nitpick)"; then \
nitpick src/gdb/testsuite/gdb.apple/gen-x86-prologues.rb || \
which -a nitpick; \
else \
sync && echo "skipping nitpicking of ruby in testsuite"; \
fi; \
pushd src/gdb/ruby || exit; \
if test -z "$(which bundle)" || test ! -x "$(which bundle)"; then \
if test -n "${GEMCMD}"; then \
sync && echo "using ${GEMCMD} to attempt to install bundler"; \
"${SUDO}" ${GEMCMD} install bundler; \
else \
sync && echo "warning: unsure how to install bundler"; \
fi; \
else \
sync && echo "found $(which bundle)..."; \
fi; \
(bundle install && bundle check) || ruby -cwv Gemfile || \
ruby -c Gemfile; \
if test -x "$(which nitpick)"; then \
nitpick Gemfile || stat "$(which nitpick)"; \
else \
sync && echo "skipping nitpicking of Gemfile"; \
fi; \
(bundle clean && ls) || stat Gemfile || wc -l Gemfile || du Gemfile; \
if test -d vendor && test -r vendor && test -w vendor; then \
sync && stat vendor; \
(find vendor -name '*.rb' -delete || rm -rf vendor || rmdir vendor); \
fi; \
if test -d vendor && test -r vendor && test -w vendor && test -s vendor; then \
sync && ls vendor; \
(find vendor -name '*.gemspec' -delete || rm -rf vendor || rmdir vendor); \
fi; \
if test -d vendor && test -r vendor && test -w vendor; then \
sync && du vendor; \
(find vendor -name Gemfile -delete || rm -rf vendor || rmdir vendor); \
fi; \
sync && echo "leaving $(pwd)..."; \
popd || exit; \
elif test ${{ matrix.language }} == 'javascript-typescript' && test -x "$(which node)"; then \
(find . -name '*.js' -print0 | xargs -0 node -c) || \
find . -name '*.js' -print -exec node -c '{}' ';'; \
if test -x "$(which npx)"; then \
pushd src/texinfo/js || exit; \
(npx eslint -c build-aux/eslint.json info.js -f unix) || \
(npx tsc --allowJs --checkJS --noEmit --lib dom,es2017 info.js) || \
(npx uglifyjs info.js -o info.min.js --mangle --compress) || \
(npx modernizr -c build-aux/modernizr.json) || \
(npx esparse info.js info.js.json) || (npx esvalidate info.js); \
if test -e info.js && test ! -e info.js.json; then \
(npx esparse info.js info.js.json) || (npx esvalidate info.js) \
|| (if test -x "$(which jsc)"; then jsc info.js; \
else echo "warning: jsc is missing!" >&2 && exit 1; fi) \
|| (node -c info.js) || (stat info.js && wc -l info.js); \
elif test -r info.js.json && test -w /dev/stdout; then \
stat info.js.json || echo "info.js.json"; \
elif test -r info.min.js && test -x "$(which du)"; then \
stat info.min.js && du info.min.js; \
elif test -x "$(which yamllint)"; then \
pwd && (yamllint . || yamllint --version); \
else \
stat "$(which npx)" && npx --version; \
fi; \
sync && echo "Done with texinfo javascript."; \
popd || exit; \
fi; \
elif test ${{ matrix.language }} == 'go' && test -x "$(which go)"; then \
if test -x "$(which staticcheck)"; then \
sync && which -a staticcheck && sleep 1; \
(find . -name '*.go' -print0 | xargs -0 staticcheck) || \
statticcheck; \
elif test -x "$(which revive)"; then \
sync && which -a revive && sleep 1; \
(find . -name '*.go' -print0 | xargs -0 revive) || revive; \
elif test -x "$(which gocritic)"; then \
sync && which -a gocritic && sleep 1; \
(find . -name '*.go' -print0 | xargs -0 gocritic) || gocritic; \
elif test -x "$(which golangci-lint)"; then \
sync && which -a golangci-lint && sleep 1; \
golangci-lint run src/gdb/testsuite/gdb.go || \
golangci-lint config verify; \
elif test -x "$(which gofmt)"; then \
sync && echo "Found the following gofmt binaries:"; \
sync && which -a gofmt && sleep 1; \
find . -name '*.go' -print0 | xargs -0 gofmt; \
elif test -x "$(which actionlint)"; then \
sync && which actionlint && actionlint -verbose && sleep 1; \
elif test -x "$(which yamllint)"; then \
sync && which yamllint && yamllint . && sleep 1; \
else \
sync && echo "no linters found for go ($(which go))." && sleep 1; \
fi; \
elif test ${{ matrix.language }} == 'python' && test -x "$(which python)"; then \
sync && which -a pylint && which -a flake8 && which -a black; \
which -a ruff || which -a pyupgrade || which -a autopep8; \
(find . -name '*.py' -print0 | xargs -0 pylint) || \
stat "$(which pylint)"; \
sync && (flake8 || ruff check || (stat "$(which ruff)" && sleep 1)); \
if test -x "$(which yamllint)"; then \
yamllint .github/FUNDING.yml .github/dependabot.yml .yamllint.yml; \
if test -x "$(which bandit)"; then \
yamllint .github/workflows/bandit.yml || stat "$(which bandit)"; \
else \
sync && echo "skipping running yamllint on bandit workflow"; \
fi
else \
sync && echo "skipping yamllint..."; \
fi; \
if test -x "$(which autopep8)"; then \
sync && stat "$(which autopep8)" && autopep8 --version && sleep 1; \
else \
sync && echo "autopep8 missing or unusable; skipping..."; \
fi; \
elif test ${{ matrix.language }} == 'csharp' && test -x "$(which yamllint)"; then \
sync && which -a yamllint && sleep 1; \
yamllint .github/codeql/extensions/apple-gdb*csharp/codeql-pack.yml; \
stat "$(which csc)" || stat "$(which mcs)" || which -a dotnet; \
sync && echo "TODO: find a proper linter for csharp…" && sleep 1; \
else \
sync && echo "unhandled case for syntax check step!"; \
sync && echo "(matrix.language is ${{ matrix.language }})"; \
sync && sleep 1; \
fi
- name: Setup Gradle
if: matrix.language == 'java-kotlin'
uses: gradle/actions/setup-gradle@v4
- name: Run build with Gradle Wrapper
if: matrix.language == 'java-kotlin' && success()
run: |
(yes 2>/dev/null | ./gradlew build --scan) || ./gradlew build || \
./gradlew assemble || (pwd && stat ./gradlew)
sync && echo "done with top-level; next is jzlib..."
pushd src/zlib/contrib/java/jzlib-1.1.2 || exit
(yes 2>/dev/null | ./gradlew build --scan) || ./gradlew build || \
./gradlew assemble || (pwd && stat ./gradlew)
popd || exit
sync && echo "done with jzlib; next is testsuite..."
pushd src/gdb/testsuite/gdb.java || exit
(yes 2>/dev/null | ./gradlew build --scan) || ./gradlew build || \
./gradlew assemble || (pwd && stat ./gradlew)
popd || exit
sync && echo "done with attempts at using the gradle wrapper..."
# Getting autobuild to work for 'c-cpp' has been too difficult, so I am
# putting it back to "Disabled" again for now:
- name: Autobuild
if: matrix.language != 'c-cpp'
uses: github/codeql-action/autobuild@v3
- name: Manual build
if: matrix.language == 'c-cpp'
run: |
pushd .profile.d
test -e ./.profile_generic && source ./.profile_generic && \
(env | uniq | sort | uniq | grep -v "\*\*\*" | grep -v "PWD\=")
popd
if test -x "$(which sccache)"; then \
./configure --enable-silent-rules CC="sccache gcc" CXX="sccache g++" \
OBJC="sccache gcc" OBJCXX="sccache g++"; \
sync && stat -t src && sync; \
if test -z "${CC}"; then \
export CC="sccache gcc"; \
fi; \
if test -z "${CXX}"; then \
export CXX="sccache g++"; \
fi; \
if test -z "${OBJC}"; then \
export OBJC="sccache gcc"; \
fi; \
if test -z "${OBJCXX}"; then \
export OBJCXX="sccache g++"; \
fi; \
else \
./configure --enable-silent-rules; \
fi
make -ki -C libcheckpoint || \
make -ki -C libcheckpoint -f Makefile_orig || \
make -ki -C macsbug || make -ki -C macsbug/gdb_plugin_support || \
(if test -x "$(which ant)"; then ant; else echo "no usable ant"; fi)
cd src
if test -x "$(which sccache)"; then \
./configure --disable-werror --enable-silent-rules \
--disable-cgen-maint CC="sccache gcc" CXX="sccache g++" \
OBJC="sccache gcc" OBJCXX="sccache g++"; \
make configure-bfd V=0 CC="sccache gcc" CXX="sccache g++" \
OBJC="sccache gcc" OBJCXX="sccache g++"; \
sync && stat -t bfd && sync; \
else \
./configure --disable-werror --enable-silent-rules --disable-cgen-maint; \
make configure-bfd V=0; \
fi
make -C bfd headers V=0
if test ! -e bfd/bfd.h; then make -C bfd bfd.h; else stat bfd/bfd.h; fi
if test -e autogen/Makefile; then \
make -C autogen; \
elif test -d autogen; then \
ls autogen/Makefile*; \
else \
sync && echo "skipping autogen"; \
fi
sync && make -C bfd diststuff V=0 && sync
echo "make all-bfd" && (time make -j"$(nproc)" all-bfd V=0) && \
echo "done making all-bfd"
echo "make all-opcodes" && (time make -j"$(nproc)" all-opcodes V=0) && \
echo "done making all-opcodes"
echo "make configure-binutils" && (time make configure-binutils V=0) && \
echo "done making configure-binutils"
echo "make all-binutils" && (time make all-binutils V=0) && \
echo "done making all-binutils"
echo "make all-cgen" && (time make all-cgen) && \
echo "done making all-cgen"
echo "make all-libiberty" && (time make -j"$(nproc)" all-libiberty) && \
echo "done making all-libiberty"
echo "make all-intl" && (time make all-intl) && \
echo "done making all-intl"
echo "make all-etc" && (time make all-etc) && \
echo "done making all-etc"
echo "make all-libdecnumber" && (time make all-libdecnumber) && \
echo "done making all-libdecnumber"
echo "make all-mmalloc" && (time make all-mmalloc) && \
echo "done making all-mmalloc"
make configure-electric-fence
make configure-readline
for dir in libtool_gnu sim utils tcl expect dejagnu itcl tk libgui; do \
if test -e ${dir}/configure; then \
make configure-${dir} || \
(if test -e ${dir}/config.cache; then \
cat ${dir}/config.cache >&2 && exit 1; \
elif test -r ${dir}/config.status; then \
stat ${dir}/config.status && wc -l ${dir}/config.status; \
else ls ${dir}; fi); \
elif test -d ${dir}; then \
ls ${dir}/configure*; \
else \
sync && echo "skipping configuring in ${dir}"; \
fi; \
done
for dir in sim utils tcl expect dejagnu itcl tk libgui; do \
if test -e ${dir}/Makefile; then \
echo "doing make in ${dir}" && \
(time make -j"$(nproc)" -C ${dir}) && \
echo "done running make in ${dir}"; \
elif test -d ${dir}; then \
ls ${dir}/Makefile*; \
else \
sync && echo "skipping ${dir}"; \
fi; \
done
echo "make configure-gdb" && (time make configure-gdb) && \
echo "done making configure-gdb"
echo "make all-gdb" && (time make all-gdb) && \
echo "done making all-gdb"
echo "make check-libiberty" && make check-libiberty && \
echo "done making check-libiberty"
for dir in cgen sim expect dejagnu itcl libgui; do \
if test -e ${dir}/Makefile; then \
echo "make check-${dir}" && \
(time make check-${dir} V=0 RUNTESTFLAGS="-v") && \
echo "done making check-${dir}"; \
elif test -d ${dir}; \
then ls ${dir}/Makefile*; \
else \
sync && echo "skipping testing ${dir}"; \
fi; \
done
echo "make check-opcodes" && \
(time make -j"$(nproc)" check-opcodes V=0) && \
echo "done making check-opcodes"
echo "make check-intl" && (time make check-intl) && \
echo "done making check-intl"
echo "make check-utils" && (time make check-utils) && \
echo "done making check-utils"
- name: Debug failure
if: "${{ failure() }}"
run: |
find . -name config.log -print0 | xargs -0 cat | grep -i error | sort | uniq
(find / -name proc_service.h -print -perm +r -user "$(whoami)" 2>/dev/null) || sync
if test -d /usr/include && test -r /usr/include/proc_service.h; then \
cat /usr/include/proc_service.h || stat /usr/include/proc_service.h; \
elif test -r /usr/x86_64-linux-gnu/include/proc_service.h; then \
cat /usr/x86_64-linux-gnu/include/proc_service.h; \
fi
if test ${{ matrix.language }} == 'go'; then \
if test -x "$(which go)"; then \
stat "$(which go)" && go version && go env; \
else \
sync && echo "no usable 'go' binary found"; \
fi; \
fi
- name: Extra coverage build (C)
if: matrix.language == 'c-cpp' && success()
run: |
stat -t Makefile || wc -l Makefile || du Makefile
if test -x "$(which sccache)"; then \
if test -z "${CC}"; then \
export CC="sccache gcc"; \
fi; \
if test -z "${CXX}"; then \
export CXX="sccache g++"; \
fi; \
fi
make -ki -C libcheckpoint -f Makefile_orig \
RC_CFLAGS="-std=gnu89 -w -Wno-error" || stat -t libcheckpoint
make -ki -C macsbug || make -ki -C macsbug/gdb_plugin_support || \
stat -t macsbug
cd src
if test -z "$(which dejagnu)" || test ! -x "$(which dejagnu)"; then \
sudo apt-get -qq install dejagnu; \
elif test -r "$(which dejagnu)"; then \
sync && echo "dejagnu available as $(which dejagnu)"; \
fi
if test -x "$(which python)"; then \
sudo apt-get -qq install python3-macholib; \
elif test -x "$(which pip)"; then \
pip install macholib machobot ak-macholibre || \
pip install --upgrade pip; \
fi
if test -x "$(which rustc)" && test -x "$(which mig)"; then \
sudo apt-get -y install librust-mach-o-sys-dev; \
else \
sync && echo "skipping rust stuff..."; \
fi
case "$(uname -m)" in
ppc*|powerpc*|rs6000)
sudo apt-get -y install libpvec1 libpvec-dev libvecpf1 libvecpf-dev
;;
i*86|x86_64)
sudo apt-get -y install libc6-dev-amd64-cross libc6-dev-i386 \
libgcc-s1-amd64-cross
;;
*)
echo "no special dependencies for $(uname -m)..."
;;
esac
if test -d autogen && test -r autogen && test -w autogen; then \
pushd autogen; \
if test -x "$(which guile18-build)" && test -e ./configure; then \
sync && echo "running autogen configure script under $(which guile18-build)…"; \
guile18-build ./configure --disable-werror --enable-silent-rules \
--disable-option-checking CFLAGS="-w" || stat -t ./configure; \
elif test -x ./configure && test -r ./configure && test -w .; then \
./configure --disable-werror --enable-silent-rules \
--disable-option-checking --disable-dependency-tracking \
CFLAGS="-w" || stat -t ./configure; \
elif test -x ./config.status && test -r ./config.status && test -w .; then \
./config.status || stat -t ./config.status; \
elif test -f Makefile && test -r Makefile && test -w .; then \
make V=0 || stat -t Makefile; \
else \
pwd && ls; \
fi; \
popd; \
else \
sync && echo "warning: autogen appears to be missing (or inaccessible)?"; \
fi
# shellcheck disable=SC2001,SC2235
for subdir in autogen/agen5 autogen/autoopts autogen/columns autogen/compat autogen/getdefs autogen/snprintfv autogen/xml2ag bfd bfd/doc binutils dejagnu dejagnu/contrib/bluegnu2.0.3/example/calc dejagnu/example/calc electric-fence expect expect/example expect/testsuite gdb gdb/gdbserver gdb/gnulib gdb/gnulib/import gdb/multi-ice gdb/nlm gdb/rdi-share gdb/rem-multi_old gdb/testsuite gdb/testsuite/gdb.apple gdb/testsuite/gdb.apple/debug-in-ofile gdb/testsuite/gdb.apple/gused gdb/testsuite/gdb.apple/xcode gdb/testsuite/gdb.arch gdb/testsuite/gdb.base gdb/testsuite/gdb.btrace gdb/testsuite/gdb.cell gdb/testsuite/gdb.dwarf2 gdb/testsuite/gdb.gdbtk gdb/testsuite/gdb.guile gdb/testsuite/gdb.hp gdb/testsuite/gdb.hp/gdb.aCC gdb/testsuite/gdb.hp/gdb.base-hp gdb/testsuite/gdb.hp/gdb.compat gdb/testsuite/gdb.hp/gdb.defects gdb/testsuite/gdb.linespec gdb/testsuite/gdb.mi gdb/testsuite/gdb.modula2 gdb/testsuite/gdb.multi gdb/testsuite/gdb.opt gdb/testsuite/gdb.perf gdb/testsuite/gdb.python gdb/testsuite/gdb.reverse gdb/testsuite/gdb.server gdb/testsuite/gdb.stabs gdb/testsuite/gdb.threads gdb/testsuite/gdb.trace gdb/tui intl itcl/itcl/win itcl/itk/win libbacktrace libdecnumber libgui/src libiberty libiberty/testsuite libtool_gnu/libltdl libtool_gnu/tests/cdemo libtool_gnu/tests/demo libtool_gnu/tests/depdemo libtool_gnu/tests/depdemo/l1 libtool_gnu/tests/depdemo/l2 libtool_gnu/tests/depdemo/l3 libtool_gnu/tests/depdemo/l4 libtool_gnu/tests/f77demo libtool_gnu/tests/fcdemo libtool_gnu/tests/mdemo libtool_gnu/tests/mdemo2 libtool_gnu/tests/pdemo mmalloc opcodes readline readline/examples readline/examples/rlfe.dir sim/common sim/igen sim/testsuite/common tcl/unix tcl/unix/dltest tcl/win tk/unix tk/win utils/amd-udi/mondfe utils/amd-udi/montip utils/amd-udi/udi utils/decomment.tproj utils/misc/doschk utils/relpath.tproj utils/sparclite utils/spu utils/wince zlib zlib/contrib/minizip; do \
if test -e "${subdir}/Makefile" || test -x "${subdir}/configure"; then \
pushd "${subdir}"; \
if test ! -r Makefile && test -x ./configure; then \
sync && echo "configuring in ${subdir}"; \
./configure --disable-werror --enable-silent-rules \
--disable-option-checking CFLAGS="-w" || stat -t ./configure; \
elif test ! -e Makefile && test -x ./config.status; then \
sync && echo "checking with ./config.status in ${subdir}"; \
./config.status CFLAGS="-w" || stat -t ./config.status; \
else \
echo "assuming we are fully configured in ${subdir}"; \
fi
for srcfile in *.c; do \
sync && echo "attempting to use $(which make) to compile ${srcfile} in ${subdir}"; \
make "$(echo "${srcfile}" | sed "s/\.c/.o/g")" V=0 CFLAGS="-w" || \
stat -t "${srcfile}"; \
done; \
popd; \
elif test -d "${subdir}" && (test -r "${subdir}/Makefile.in" || test -r "${subdir}/Makefile.am" || test -r "${subdir}/Makefile.def" || test -r "${subdir}/Makefile.tpl"); then \
sync && echo "no unsuffixed Makefile in ${subdir}, but there are these w/suffixes:"; \
ls ${subdir}/Makefile* || echo "... $(ls ${subdir}/Makefile*)"; \
else \
sync && echo "skipping attempt to build more objfiles in ${subdir}"; \
fi; \
done
(time (find . -name '*.o' -exec cp -v {} . ";")) || \
echo "failed copying an object file"
- name: Extra coverage build (C), part 2
if: matrix.language == 'c-cpp' && success()
run: |
cd src
if test -z "${CC}"; then \
if test -x "$(which sccache)"; then \
export CC="sccache gcc"; \
elif test -x "$(which ccache)"; then \
export CC="ccache gcc"; \
else \
export CC="gcc"; \
fi; \
fi
FINAL_CPPFLAGS="-I."
for myincdir in .. include ../include bfd ../bfd gdb ../gdb libiberty ../libiberty tcl ../tcl tk ../tk zlib ../zlib; do \
if test -d "${myincdir}" && test -r "${myincdir}" && test -n "$(ls "${myincdir}"/*.h)"; then \
FINAL_CPPFLAGS="${FINAL_CPPFLAGS} -I${myincdir} -iquote ${myincdir}"; \
fi; \
done
sync && echo "FINAL_CPPFLAGS are ${FINAL_CPPFLAGS}"
# shellcheck disable=SC2001,SC2044,2086
for cfile in $(find . -name '*.c' -type f); do \
cobjfile="$(echo "${cfile}" | sed "s/\.c/.o/g")"; \
cfiledir="$(dirname "${cfile}")"; \
if test ! -e "${cobjfile}"; then \
echo "${CC} -c -w -Wno-error -Wfatal-errors ${FINAL_CPPFLAGS} -I\"${cfiledir}\" -iquote \"${cfiledir}\" -I\"${cfiledir}\"/.. -iquote \"${cfiledir}\"/.. ${cfile}"; \
${CC} -c -w -Wno-error -Wfatal-errors ${FINAL_CPPFLAGS} -I"${cfiledir}" -iquote "${cfiledir}" -I"${cfiledir}"/.. -iquote "${cfiledir}"/.. ${cfile} || \
stat -t "${cfile}" || echo "cfile is ${cfile}"; \
else \
sync && echo "objfile ${cobjfile} already exists for ${cfile}."; \
cp -v "${cobjfile}" "${cfiledir}" || cp -v "${cobjfile}" . || \
cp -v "${cobjfile}" .. || \
(if test -d /tmp && test -w /tmp; then \
cp -v "${cobjfile}" /tmp; fi) || \
stat -t "${cobjfile}"; \
fi; \
done
sync && echo "done with the \"Extra coverage build (C) part 2\" step"
- name: Extra coverage build (C++)
if: matrix.language == 'c-cpp' && success()
run: |
cd src
if test -x "$(which sccache)"; then \
if test -z "${CC}"; then \
export CC="sccache gcc"; \
fi; \
if test -z "${CXX}"; then \
export CXX="sccache g++"; \
fi; \
fi
if test -d gdb/testsuite; then \
pushd gdb/testsuite; \
if test -x ./configure; then \
sync && echo "attempting to configure gdb testsuite..."; \
./configure || stat -t ./configure; \
elif test -x ./config.status; then \
sync && echo "checking configuration status for gdb testsuite…"; \
./config.status || stat -t ./config.status; \
elif test -f Makefile; then \
sync && echo "attempting to use Makefile for gdb testsuite..."; \
make || stat -t Makefile; \
else \
pwd && ls; \
fi; \
popd; \
else \
sync && echo "warning: gdb testsuite appears to be missing?"; \
fi
# shellcheck disable=SC2001
for subdir in dejagnu/testsuite/libdejagnu gdb/testsuite/gdb.apple gdb/testsuite/gdb.apple/gused gdb/testsuite/gdb.apple/ld-r gdb/testsuite/gdb.btrace gdb/testsuite/gdb.c++ gdb/testsuite/gdb.cp gdb/testsuite/gdb.gdbtk gdb/testsuite/gdb.hp gdb/testsuite/gdb.linespec gdb/testsuite/gdb.mi gdb/testsuite/gdb.python gdb/testsuite/gdb.trace; do \
if test -e "${subdir}/Makefile" && test -r "${subdir}/Makefile"; then \
pushd "${subdir}"; \
if test -w . && test -w Makefile && test -n "$(wc -l Makefile)"; then \
test -s Makefile && touch Makefile; \
fi; \
for srcfile in *.cc; do \
echo "attempting to use $(which make) to compile ${srcfile} in ${subdir}"; \
make "$(echo "${srcfile}" | sed "s/\.cc/.o/g")" || stat -t "${srcfile}"; \
done; \
cp -v ./*.o .. || ls ./*.o || pwd; \
popd; \
elif test -d "${subdir}"; \
then ls ${subdir}/Makefile*; \
else \
echo "skipping attempt to build more objfiles in ${subdir}"; \
fi; \
done
# shellcheck disable=SC2044
for ccfile in $(find . -name '*.cc' -type f); do \
sync && echo "One last attempt at compiling ${ccfile}..."; \
(test -x "$(which sccache)" && sccache g++ -c "${ccfile}") || \
g++ -c -Wfatal-errors "${ccfile}" || \
g++ -c -w -Wfatal-errors -I. "${ccfile}" || \
g++ -c -w -Wno-error -Wfatal-errors -fpermissive -I. -I.. "${ccfile}" || \
stat -t "${ccfile}"; \
done
if test -e gdb/testsuite/gdb.apple/Makefile; then \
pushd gdb/testsuite/gdb.apple; \
sync && echo "Two last files to try making in gdb.apple testsuite…"; \
make file-statics-cpp.o || stat -t file-statics-cpp.cpp; \
make var-path-expr.o || stat -t var-path-expr.cpp; \
cp -v ./*.o .. || ls ./*.o || pwd; \
popd; \
elif test -d gdb/testsuite/gdb.apple; then \
sync && echo "skipping gdb/testsuite/gdb.apple; missing Makefile?"; \
else \
sync && echo "skipping gdb/testsuite/gdb.apple; missing subdir?"; \
fi
# shellcheck disable=SC2044
for cppfile in $(find . -name '*.cpp' -type f); do \
sync && echo "One last attempt at compiling ${cppfile}..."; \
(test -x "$(which sccache)" && sccache g++ -c "${cppfile}") || \
g++ -c -Wfatal-errors "${cppfile}" || \
g++ -c -w -Wfatal-errors -I. "${cppfile}" || \
g++ -c -w -Wno-error -Wfatal-errors -fpermissive -I. -I.. "${cppfile}" || \
stat -t "${cppfile}"; \
done
if test -e gdb/testsuite/gdb.base/Makefile && test -e gdb/testsuite/gdb.base/langs2.cxx; then \
pushd gdb/testsuite/gdb.base; \
sync && echo "1 last attempt at compiling langs2.cxx via Makefile…"; \
make langs2.o || stat -t langs2.cxx; \
cp -v ./*.o .. || ls ./*.o || pwd; \
popd; \
elif test -d gdb/testsuite/gdb.base; then \
sync && echo "skipping gdb/testsuite/gdb.base; missing a file?"; \
else \
sync && echo "skipping gdb/testsuite/gdb.base; missing subdir?"; \
fi
# shellcheck disable=SC2044
for cxxfile in $(find . -name '*.cxx' -type f); do \
sync && echo "One last attempt at compiling ${cxxfile}..."; \
(test -x "$(which sccache)" && sccache g++ -c "${cxxfile}") || \
g++ -c -Wfatal-errors "${cxxfile}" || \
g++ -c -w -Wfatal-errors -I. "${cxxfile}" || \
g++ -c -w -Wno-error -Wfatal-errors -fpermissive -I. -I.. "${cxxfile}" || \
stat -t "${cxxfile}"; \
done
if test -e mmalloc/Makefile; then \
pushd mmalloc; \
sync && echo "One last attempt at compiling mmallocplusplus.cp..."; \
make mmallocplusplus.o || \
(test -x "$(which sccache)" && sccache g++ -c mmallocplusplus.cp) || \
g++ -c mmallocplusplus.cp || stat -t mmallocplusplus.cp; \
cp -v ./*.o .. || ls ./*.o || pwd; \
popd; \
elif test -d mmalloc; then \
sync && echo "skipping mmalloc; missing Makefile?"; \
else \
sync && echo "skipping mmalloc; missing subdirectory?"; \
fi
- name: Extra coverage build (Java)
if: matrix.language == 'java-kotlin' && success()
run: |
pushd src/zlib/contrib/java/jzlib-1.1.2 || exit
mvn test || mvn test-compile || mvn generate-test-sources || \
mvn process-test-sources || mvn generate-test-resources || \
mvn process-test-resources || mvn process-test-classes || \
mvn pre-integration-test || mvn integration-test || \
mvn post-integration-test || mvn verify || stat pom.xml
popd
# shellcheck disable=SC2044
for javafile in $(find . -name '*.java' -type f); do \
sync && echo "One last attempt at compiling ${javafile}..."; \
javac "${javafile}" || stat "${javafile}"; \
done
if test -n "${javafile}"; then unset javafile; fi
which -a ktlint || (test -x "$(which locate)" && locate ktlint) || \
(test -x "$(which find)" && find / -name ktlint -perm +r -user "$(whoami)" 2>/dev/null) || \
(sync && echo "ktlint missing")
# shellcheck disable=SC2044
if test -x "$(which kotlin)"; then \
sync && echo "Time for kotlin (that is, $(which kotlin))..."; \
for kotlinfile in $(find . -name '*.kts' -type f); do \
sync && echo "One last attempt at compiling ${kotlinfile}..."; \
kotlin "${kotlinfile}" || ktlint "${kotlinfile}" || stat "${kotlinfile}"; \
done; \
else \
sync && echo "kotlin missing; skipping extra kotlin compilation attempts"; \
fi
- name: Clang static analysis
if: matrix.language == 'c-cpp' && success()
run: |
cd src
# shellcheck disable=SC2001
if test -x "$(which clang)"; then
for subdir in bfd binutils electric-fence gdb mmalloc utils/misc/doschk utils/spu; do \
if test -e ${subdir}/Makefile; then \
pushd "${subdir}"; \
for srcfile in *.c; do \
make "$(echo "${srcfile}" | sed "s/\.c/.plist/g")" || \
clang --analyze -w -Wno-error -Wfatal-errors -I. -I.. "${srcfile}" || \
stat -t "${srcfile}" || wc -l "${srcfile}"; \
done; \
popd; \
elif test -d "${subdir}"; then \
sync && echo "Makefiles in ${subdir} are:" && ls ${subdir}/Makefile*; \
else \
echo "skipping attempt to do static analysis w/clang in ${subdir}"; \
fi; \
done; \
else \
sync && echo "clang missing"; \
fi
if test -x "$(which purge)"; then \
purge || sudo purge; \
fi
sync && echo "done with clang static analysis"
- name: Check what might be slowing CodeQL down
run: |
if test -x "$(which java)"; then \
sync && java --version; \
sync && java --help; \
sync && java --help-extra; \
sync && java --validate-modules; \
else \
sudo apt-get install --fix-missing default-jre-headless; \
fi
sync && echo "ps aux" && sync && ps aux
if test -x "$(which purge)"; then \
which -a purge; \
purge || sudo purge; \
elif test -x "$(which sync)"; then \
which sync && sync && stat "$(which sync)"; \
if test ${{ matrix.language }} != 'c-cpp'; then \
sync && echo "...and synced." && sleep 1; \
fi; \
else \
sleep 1; \
fi
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
if: matrix.language == 'c-cpp' && success()
with:
# Artifact name:
name: gdb-static-analysis-plists-${{ github.sha }}
# A file, directory or wildcard pattern that describes what to upload:
path: |
**/clang_static_analysis/*.plist
**/CFE_S_A/*.plist
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
env:
SCCACHE_GHA_ENABLED: "true"