Skip to content

misc. updates

misc. updates #185

Workflow file for this run

# .github/workflows/codeql.yml: 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/*
pull_request:
# The branches below must be a subset of the branches above
branches:
- master
- main
- dependabot/*
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: ${{ (matrix.language == 'swift' && 'macos-latest') || '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 [ '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 only '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); else (sync && stat build); 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); \
elif test -w /home/runner/work -o -w /home/runner -o -w /home; then \
(sync && mkdir -pv /home/runner/work/apple-gdb-1824/build); \
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); \
fi
(cd src && sync && echo "now in $(pwd)..." && sync)
if test ${{ matrix.language }} != 'c-cpp'; then sleep 1; else true; fi
- name: Dependencies
if: matrix.language == 'c-cpp'
run: sudo apt-get -y install autopoint gobjc clang autogen 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
- name: Syntax check (and similar stuff)
if: matrix.language == 'ruby' || matrix.language == 'javascript-typescript'
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; \
pushd src/gdb/ruby || exit; \
if test -z "$(which bundle)" || test ! -x "$(which bundle)"; then \
if test ! -w /var/lib/gems; then \
SUDO="sudo"; \
else \
SUDO="time"; \
fi; \
if test -x "$(which gem)"; then \
"${SUDO}" gem install bundler; \
elif test -x "$(which macgem)"; then \
"${SUDO}" macgem install bundler; \
elif test -x "$(which jgem)"; then \
"${SUDO}" jgem install bundler; \
elif test -x "$(which mgem)"; then \
"${SUDO}" mgem install bundler; \
elif test -x "$(which chgem)"; then \
"${SUDO}" chgem install bundler; \
elif test -x "$(which picogem)"; then \
"${SUDO}" picogem install bundler; \
elif test -x "$(which trufflegem)"; then \
"${SUDO}" trufflegem install bundler; \
else \
echo "warning: unsure how to install bundler"; \
fi; \
else \
echo "found $(which bundle)..."; \
fi; \
(bundle install && bundle check) || ruby -cwv Gemfile || ruby -c Gemfile; \
(bundle clean && ls) || stat Gemfile || wc -l Gemfile || du Gemfile; \
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); \
sync && echo "Done with texinfo javascript."; \
popd || exit; \
fi; \
else \
echo "unhandled case for syntax check step (matrix.language is ${{ matrix.language }})"; \
fi
- name: Setup Gradle
if: matrix.language == 'java-kotlin'
uses: gradle/gradle-build-action@v2
- name: Run build with Gradle Wrapper
if: matrix.language == 'java-kotlin' && success()
run: |
./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
./gradlew build || ./gradlew assemble || (pwd && stat ./gradlew)
popd || exit
sync && echo "done with jzlib; next is testsuite..."
pushd src/gdb/testsuite/gdb.java || exit
./gradlew build || ./gradlew assemble || (pwd && stat ./gradlew)
popd || exit
sync && echo "done with attempts at using the gradle wrapper..."
# Can try bringing back autobuild for 'c-cpp' once darling has xcrun:
- name: Autobuild
if: matrix.language != 'c-cpp'
uses: github/codeql-action/autobuild@v3
- name: Manual build
if: matrix.language == 'c-cpp'
run: |
test -e ./.profile_generic && source ./.profile_generic && (env | uniq | sort | uniq)
./configure --enable-silent-rules
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; fi)
cd src
./configure --disable-werror --enable-silent-rules
make configure-bfd
make -C bfd headers
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 \
echo "skipping autogen"; \
fi
make -C bfd diststuff
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}; \
elif test -d ${dir}; then \
ls ${dir}/configure*; \
else \
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 \
echo "skipping ${dir}"; \
fi; \
done
make check-libiberty
for dir in sim itcl; do \
if test -e ${dir}/Makefile; then \
make check-${dir} V=0 RUNTESTFLAGS="-v"; \
elif test -d ${dir}; \
then ls ${dir}/Makefile*; \
else \
echo "skipping testing ${dir}"; \
fi; \
done
- name: Extra coverage build (C)
if: matrix.language == 'c-cpp' && success()
run: |
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 -d autogen && test -r autogen && test -w autogen; then \
pushd autogen; \
if test -x ./configure && test -r ./configure && test -w .; then \
./configure --disable-werror --enable-silent-rules --disable-option-checking 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 \
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 \
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 \
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 \
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 \
echo "no unsuffixed Makefile in ${subdir}, but there are these ones with suffixes:"; \
ls ${subdir}/Makefile* || echo "... $(ls ${subdir}/Makefile*)"; \
else \
echo "skipping attempting to build additional 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
FINAL_CPPFLAGS="-I."
for myincdir in .. include ../include bfd ../bfd gdb ../gdb libiberty ../libiberty; do \
if test -d "${myincdir}" && test -r "${myincdir}" && test -n "$(ls "${myincdir}"/*.h)"; then \
FINAL_CPPFLAGS="${FINAL_CPPFLAGS} -I${myincdir} -iquote ${myincdir}"; \
fi; \
done
echo "FINAL_CPPFLAGS are ${FINAL_CPPFLAGS}"
# shellcheck disable=SC2001,SC2044
for cfile in $(find . -name '*.c' -type f); do \
cobjfile="$(echo "${cfile}" | sed "s/\.c/.o/g")"; \
if test ! -e "${cobjfile}"; then \
echo "gcc -c -w -Wno-error -Wfatal-errors \"${FINAL_CPPFLAGS}\" \"${cfile}\""; \
gcc -c -w -Wno-error -Wfatal-errors "${FINAL_CPPFLAGS}" -I"$(dirname "${cfile}")" -iquote "$(dirname "${cfile}")" "${cfile}" || stat -t "${cfile}" || echo "cfile is ${cfile}"; \
else \
echo "object file ${cobjfile} already exists for ${cfile}."; \
cp -v "${cobjfile}" "$(dirname "${cfile}")" || cp -v "${cobjfile}" . || cp -v "${cobjfile}" .. || (if test -d /tmp && test -w /tmp; then cp -v "${cobjfile}" /tmp; fi) || stat -t "${cobjfile}"; \
fi; \
done
- name: Extra coverage build (C++)
if: matrix.language == 'c-cpp' && success()
run: |
cd src
if test -d gdb/testsuite; then \
pushd gdb/testsuite; \
if test -x ./configure; then \
./configure || stat -t ./configure; \
elif test -x ./config.status; then \
./config.status || stat -t ./config.status; \
elif test -f Makefile; then \
make || stat -t Makefile; \
else \
pwd && ls; \
fi; \
popd; \
else \
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 \
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 attempting to build additional objfiles in ${subdir}"; \
fi; \
done
# shellcheck disable=SC2044
for ccfile in $(find . -name '*.cc' -type f); do \
echo "One last attempt at compiling ${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; \
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; \
fi
# shellcheck disable=SC2044
for cppfile in $(find . -name '*.cpp' -type f); do \
echo "One last attempt at compiling ${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; \
make langs2.o || stat -t langs2.cxx; \
cp -v ./*.o .. || ls ./*.o || pwd; \
popd; \
fi
# shellcheck disable=SC2044
for cxxfile in $(find . -name '*.cxx' -type f); do \
echo "One last attempt at compiling ${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; \
make mmallocplusplus.o || stat -t mmallocplusplus.cp; \
cp -v ./*.o .. || ls ./*.o || pwd; \
popd; \
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 \
echo "One last attempt at compiling ${javafile}..."; \
javac "${javafile}" || stat "${javafile}"; \
done
if test -n "${javafile}"; then unset javafile; fi
# shellcheck disable=SC2044
if test -x "$(which kotlin)"; then \
for kotlinfile in $(find . -name '*.kts' -type f); do \
echo "One last attempt at compiling ${kotlinfile}..."; \
kotlin "${kotlinfile}" || stat "${kotlinfile}"; \
done; \
else \
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 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")" || stat -t "${srcfile}"; \
done; \
popd; \
elif test -d "${subdir}"; \
then ls ${subdir}/Makefile*; \
else \
echo "skipping attempting to do static analysis with clang in ${subdir}"; \
fi; \
done; \
else \
echo "clang missing"; \
fi
- name: Upload a Build Artifact
uses: actions/[email protected]
if: matrix.language == 'c-cpp' && success()
with:
# Artifact name
name: gdb-static-analysis-plists
# 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}}"