aboutsummaryrefslogtreecommitdiff
path: root/gdb/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/contrib')
-rw-r--r--gdb/contrib/ari/create-web-ari-in-src.sh4
-rwxr-xr-xgdb/contrib/ari/gdb_ari.sh6
-rw-r--r--gdb/contrib/ari/gdb_find.sh2
-rw-r--r--gdb/contrib/ari/update-web-ari.sh8
-rwxr-xr-xgdb/contrib/cc-with-tweaks.sh7
-rw-r--r--gdb/contrib/codespell-dictionary.txt1
-rw-r--r--gdb/contrib/codespell-ignore-words.txt1
-rwxr-xr-xgdb/contrib/codespell-log.sh95
-rw-r--r--gdb/contrib/expect-read1.c2
-rwxr-xr-xgdb/contrib/expect-read1.sh2
-rwxr-xr-xgdb/contrib/gdb-add-index.sh2
-rwxr-xr-xgdb/contrib/license-check-new-files.sh149
-rw-r--r--gdb/contrib/setup.cfg15
-rw-r--r--gdb/contrib/test_pubnames_and_indexes.py2
-rwxr-xr-xgdb/contrib/words.sh2
15 files changed, 280 insertions, 18 deletions
diff --git a/gdb/contrib/ari/create-web-ari-in-src.sh b/gdb/contrib/ari/create-web-ari-in-src.sh
index 64d3c73..b479ce5 100644
--- a/gdb/contrib/ari/create-web-ari-in-src.sh
+++ b/gdb/contrib/ari/create-web-ari-in-src.sh
@@ -2,7 +2,7 @@
# GDB script to create web ARI page directly from within gdb/ari directory.
#
-# Copyright (C) 2012-2024 Free Software Foundation, Inc.
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -50,7 +50,7 @@ if [ -z "${tempdir}" ] ; then
fi
fi
-# Default location of generate index.hmtl web page.
+# Default location of generated index.html web page.
if [ -z "${webdir}" ] ; then
# Use 'branch' subdir name if Tag contains branch
if [ -f "${srcdir}/gdb/CVS/Tag" ] ; then
diff --git a/gdb/contrib/ari/gdb_ari.sh b/gdb/contrib/ari/gdb_ari.sh
index 5ed7d61..e10bbe0 100755
--- a/gdb/contrib/ari/gdb_ari.sh
+++ b/gdb/contrib/ari/gdb_ari.sh
@@ -2,7 +2,7 @@
# GDB script to list of problems using awk.
#
-# Copyright (C) 2002-2024 Free Software Foundation, Inc.
+# Copyright (C) 2002-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -60,7 +60,7 @@ Options:
-Werror Treat all problems as errors.
-Wall Report all problems.
-Wari Report problems that should be fixed in new code.
- -WCATEGORY Report problems in the specifed category. The category
+ -WCATEGORY Report problems in the specified category. The category
can be prefixed with "no-". Valid categories
are: ${all}
EOF
@@ -159,7 +159,7 @@ BEGIN {
PWD = "'`pwd`'"
}
-# Print the error message for BUG. Append SUPLEMENT if non-empty.
+# Print the error message for BUG. Append SUPPLEMENT if non-empty.
function print_bug(file,line,prefix,category,bug,doc,supplement, suffix,idx) {
if (print_idx) {
idx = bug ": "
diff --git a/gdb/contrib/ari/gdb_find.sh b/gdb/contrib/ari/gdb_find.sh
index f0aa6d1..b6bd3f9 100644
--- a/gdb/contrib/ari/gdb_find.sh
+++ b/gdb/contrib/ari/gdb_find.sh
@@ -2,7 +2,7 @@
# GDB script to create list of files to check using gdb_ari.sh.
#
-# Copyright (C) 2003-2024 Free Software Foundation, Inc.
+# Copyright (C) 2003-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/contrib/ari/update-web-ari.sh b/gdb/contrib/ari/update-web-ari.sh
index 75ab029..b9ef184 100644
--- a/gdb/contrib/ari/update-web-ari.sh
+++ b/gdb/contrib/ari/update-web-ari.sh
@@ -2,7 +2,7 @@
# GDB script to create GDB ARI web page.
#
-# Copyright (C) 2001-2024 Free Software Foundation, Inc.
+# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
@@ -176,7 +176,7 @@ fi
# THIS HAS SUFFERED BIT ROT
if ${check_indent_p} && test -d "${srcdir}"
then
- printf "Analizing file indentation:" 1>&2
+ printf "Analyzing file indentation:" 1>&2
( cd "${srcdir}" && /bin/sh ${aridir}/gdb_find.sh ${project} | while read f
do
if /bin/sh ${aridir}/gdb_indent.sh < ${f} 2>/dev/null | cmp -s - ${f}
@@ -550,7 +550,7 @@ function print_heading (nb_file, where, bug_i) {
for (bug_i = 1; bug_i <= nr_bug; bug_i++) {
bug = i2bug[bug_i];
printf "<th>"
- # The title names are offset by one. Otherwize, when the browser
+ # The title names are offset by one. Otherwise, when the browser
# jumps to the name it leaves out half the relevant column.
#printf "<a name=\",%s\">&nbsp;</a>", bug
printf "<a name=\",%s\">&nbsp;</a>", i2bug[bug_i-1]
@@ -851,7 +851,7 @@ EOF
print_toc 0 -1 deprecate Deprecate <<EOF
Mechanisms that are a candidate for being made obsolete. Once core
GDB no longer depends on these mechanisms and/or there is a
-replacement available, these mechanims can be deprecated (adding the
+replacement available, these mechanisms can be deprecated (adding the
deprecated prefix) obsoleted (put into category obsolete) or deleted.
See obsolete and deprecated.
EOF
diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh
index 4214b92..930ba5c 100755
--- a/gdb/contrib/cc-with-tweaks.sh
+++ b/gdb/contrib/cc-with-tweaks.sh
@@ -2,7 +2,7 @@
# Wrapper around gcc to tweak the output in various ways when running
# the testsuite.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -42,6 +42,7 @@
# -Z invoke objcopy --compress-debug-sections
# -z compress using dwz
# -m compress using dwz -m
+# -5 compress using dwz -m -5
# -i make an index (.gdb_index)
# -c make an index (currently .gdb_index) in a cache dir
# -n make a dwarf5 index (.debug_names)
@@ -88,6 +89,7 @@ want_index=false
index_options=""
want_index_cache=false
want_dwz=false
+dwz_5flag=
want_multi=false
want_dwp=false
want_objcopy_compress=false
@@ -101,6 +103,7 @@ while [ $# -gt 0 ]; do
-n) want_index=true; index_options=-dwarf-5;;
-c) want_index_cache=true ;;
-m) want_multi=true ;;
+ -5) want_multi=true; dwz_5flag=-5 ;;
-p) want_dwp=true ;;
-l) want_gnu_debuglink=true ;;
*) break ;;
@@ -269,7 +272,7 @@ elif [ "$want_multi" = true ]; then
rm -f "$dwz_file"
cp "$output_file" "${output_file}.alt"
- $DWZ -m "$dwz_file" "$output_file" "${output_file}.alt" > /dev/null
+ $DWZ $dwz_5flag -m "$dwz_file" "$output_file" "${output_file}.alt" > /dev/null
rm -f "${output_file}.alt"
# Validate dwz's work by checking if the expected output file exists.
diff --git a/gdb/contrib/codespell-dictionary.txt b/gdb/contrib/codespell-dictionary.txt
new file mode 100644
index 0000000..09bc309
--- /dev/null
+++ b/gdb/contrib/codespell-dictionary.txt
@@ -0,0 +1 @@
+gdbsever->gdbserver
diff --git a/gdb/contrib/codespell-ignore-words.txt b/gdb/contrib/codespell-ignore-words.txt
index 2d6e13a..881b1d2 100644
--- a/gdb/contrib/codespell-ignore-words.txt
+++ b/gdb/contrib/codespell-ignore-words.txt
@@ -1,2 +1,3 @@
configury
SME
+Synopsys
diff --git a/gdb/contrib/codespell-log.sh b/gdb/contrib/codespell-log.sh
new file mode 100755
index 0000000..10780f8
--- /dev/null
+++ b/gdb/contrib/codespell-log.sh
@@ -0,0 +1,95 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Script to be used as pre-commit commit-msg hook to spell-check the commit
+# log using codespell.
+#
+# Using codespell directly as a pre-commit commit-msg hook has the drawback
+# that:
+# - if codespell fails, the commit fails
+# - if the commit log mentions a typo correction, it'll require a
+# codespell:ignore annotation.
+#
+# This script works around these problems by treating codespell output as a
+# hint, and ignoring codespell exit status.
+#
+# Implementation note: rather than using codespell directly, this script uses
+# pre-commit to call codespell, because it allows us to control the codespell
+# version that is used.
+
+# Exit on error.
+set -e
+
+# Initialize temporary file names.
+cfg=""
+output=""
+
+cleanup()
+{
+ for f in "$cfg" "$output"; do
+ if [ "$f" != "" ]; then
+ rm -f "$f"
+ fi
+ done
+}
+
+# Schedule cleanup.
+trap cleanup EXIT
+
+# Create temporary files.
+cfg=$(mktemp)
+output=$(mktemp)
+
+gen_cfg ()
+{
+ cat > "$1" <<EOF
+repos:
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ name: codespell-log-internal
+ stages: [manual]
+ args: [--config, gdb/contrib/setup.cfg]
+EOF
+}
+
+# Generate pre-commit configuration file.
+gen_cfg "$cfg"
+
+# Setup pre-commit command to run.
+cmd=(pre-commit \
+ run \
+ -c "$cfg" \
+ codespell \
+ --hook-stage manual \
+ --files "$@")
+
+# Run pre-commit command.
+if "${cmd[@]}" \
+ > "$output" \
+ 2>&1; then
+ # Command succeeded quietly, we're done.
+ exit 0
+fi
+
+# Command failed quietly, now show the output.
+#
+# Simply doing "cat $output" doesn't produce colored output, so we just
+# run the command again, that should be fast enough.
+#
+# Ignore codespell exit status.
+"${cmd[@]}" || true
diff --git a/gdb/contrib/expect-read1.c b/gdb/contrib/expect-read1.c
index 454ecda..bb7317b 100644
--- a/gdb/contrib/expect-read1.c
+++ b/gdb/contrib/expect-read1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2024 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/contrib/expect-read1.sh b/gdb/contrib/expect-read1.sh
index 82c638c..e8589a2 100755
--- a/gdb/contrib/expect-read1.sh
+++ b/gdb/contrib/expect-read1.sh
@@ -1,7 +1,7 @@
#! /bin/sh
# runtest wrapper to reliably reproduce racy incomplete reads in the testsuite.
-# Copyright (C) 2013-2024 Free Software Foundation, Inc.
+# Copyright (C) 2013-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index b299f83..d2c523f 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -2,7 +2,7 @@
# Add a .gdb_index section to a file.
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
diff --git a/gdb/contrib/license-check-new-files.sh b/gdb/contrib/license-check-new-files.sh
new file mode 100755
index 0000000..710afa1
--- /dev/null
+++ b/gdb/contrib/license-check-new-files.sh
@@ -0,0 +1,149 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of GDB.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This program requires the python modules GitPython (git) and scancode-toolkit.
+# It builds a list of all the newly added files to the repository and scans
+# each file for a license, printing it to the terminal. If "--skip" is used,
+# it will only output non-"common" licenses, e.g., omitting "GPL-3.0-or-later".
+# This makes it a little bit easier to detect any possible new licenses.
+#
+# Example:
+# bash$ cd /path/to/binutils-gdb/gdb
+# bash$ ./contrib/license-check-new-files.sh -s gdb-15-branchpoint gdb-16-branchpoint
+# Scanning directories gdb*/...
+# gdb/contrib/common-misspellings.txt: no longer in repo?
+# gdb/contrib/spellcheck.sh: no longer in repo?
+# gdbsupport/unordered_dense.h: MIT
+
+import os
+import sys
+import argparse
+from pathlib import PurePath
+from git import Repo
+from scancode import api
+
+# A list of "common" licenses. If "--skip" is used, any file
+# with a license in this list will be omitted from the output.
+COMMON_LICENSES = ["GPL-2.0-or-later", "GPL-3.0-or-later"]
+
+# Default list of directories to scan. Default scans are limited to
+# gdb-specific git directories because much of the rest of binutils-gdb
+# is actually owned by other projects/packages.
+DEFAULT_SCAN_DIRS = "gdb*"
+
+
+# Get the commit object associated with the string commit CSTR
+# from the git repository REPO.
+#
+# Returns the object or prints an error and exits.
+def get_commit(repo, cstr):
+ try:
+ return repo.commit(cstr)
+ except:
+ print(f'unknown commit "{cstr}"')
+ sys.exit(2)
+
+
+# Uses scancode-toolkit package to scan FILE's licenses.
+# Returns the full license dict from scancode on success or
+# propagates any exceptions.
+def get_licenses_for_file(file):
+ return api.get_licenses(file)
+
+
+# Helper function to print FILE to the terminal if skipping
+# common licenses.
+def skip_print_file(skip, file):
+ if skip:
+ print(f"{file}: ", end="")
+
+
+def main(argv):
+ parser = argparse.ArgumentParser()
+ parser.add_argument("from_commit")
+ parser.add_argument("to_commit")
+ parser.add_argument(
+ "-s", "--skip", help="skip common licenses in output", action="store_true"
+ )
+ parser.add_argument(
+ "-p",
+ "--paths",
+ help=f'paths to scan (default is "{DEFAULT_SCAN_DIRS}")',
+ type=str,
+ default=DEFAULT_SCAN_DIRS,
+ )
+ args = parser.parse_args()
+
+ # Commit boundaries to search for new files
+ from_commit = args.from_commit
+ to_commit = args.to_commit
+
+ # Get the list of new files from git. Try the current directory,
+ # looping up to the root attempting to find a valid git repository.
+ path = PurePath(os.getcwd())
+ paths = list(path.parents)
+ paths.insert(0, path)
+ for dir in paths:
+ try:
+ repo = Repo(dir)
+ break
+ except:
+ pass
+
+ if dir == path.parents[-1]:
+ print(f'not a git repository (or any parent up to mount point "{dir}")')
+ sys.exit(2)
+
+ # Get from/to commits
+ fc = get_commit(repo, from_commit)
+ tc = get_commit(repo, to_commit)
+
+ # Loop over new files
+ paths = [str(dir) for dir in args.paths.split(",")]
+ print(f'Scanning directories {",".join(f"{s}/" for s in paths)}...')
+ for file in fc.diff(tc, paths=paths).iter_change_type("A"):
+ filename = file.a_path
+ if not args.skip:
+ print(f"checking licenses for {filename}... ", end="", flush=True)
+ try:
+ f = dir.joinpath(dir, filename).as_posix()
+ lic = get_licenses_for_file(f)
+ if len(lic["license_clues"]) > 1:
+ print("multiple licenses detected")
+ elif (
+ not args.skip
+ or lic["detected_license_expression_spdx"] not in COMMON_LICENSES
+ ):
+ skip_print_file(args.skip, filename)
+ print(f"{lic['detected_license_expression_spdx']}")
+ except OSError:
+ # Likely hit a file that was added to the repo and subsequently removed.
+ skip_print_file(args.skip, filename)
+ print("no longer in repo?")
+ except KeyboardInterrupt:
+ print("interrupted")
+ break
+ except Exception as e:
+ # If scanning fails, there is little we can do but print an error.
+ skip_print_file(args.skip, filename)
+ print(e)
+
+
+if __name__ == "__main__":
+ main(sys.argv)
diff --git a/gdb/contrib/setup.cfg b/gdb/contrib/setup.cfg
index 71459fe..5541a01 100644
--- a/gdb/contrib/setup.cfg
+++ b/gdb/contrib/setup.cfg
@@ -1,6 +1,19 @@
[codespell]
# Skip ChangeLogs and generated files.
-skip = */ChangeLog*,*/configure,gdbsupport/Makefile.in
+skip = */ChangeLog*,*/configure,gdbsupport/Makefile.in,*.dat,*.eps,gdb/features/*.c,gdb/ada-casefold.h,gdb/copying.c,gdb/gdbarch-gen.h,gdb/gdbarch-gen.c,gdb/target-delegates-gen.c
ignore-words = gdb/contrib/codespell-ignore-words.txt
+dictionary = gdb/contrib/codespell-dictionary.txt,-
+
+# Ignore all URLs.
+uri-ignore-words-list = *
+
+# This codespell issue (
+# https://github.com/codespell-project/codespell/issues/3381 ) reports the
+# need to have support for ignoring blocks of code.
+# A suggestion there is to use ignore-multiline-regex, which does work, but
+# has a bug: using -w drops all newlines in the updated files (
+# https://github.com/codespell-project/codespell/issues/3642 ).
+# Consequently, disabled. To be enabled when the bug is fixed.
+#ignore-multiline-regex = codespell:ignore-begin.*codespell:ignore-end
diff --git a/gdb/contrib/test_pubnames_and_indexes.py b/gdb/contrib/test_pubnames_and_indexes.py
index a3f5c92..7a3dec6 100644
--- a/gdb/contrib/test_pubnames_and_indexes.py
+++ b/gdb/contrib/test_pubnames_and_indexes.py
@@ -1,6 +1,6 @@
#! /usr/bin/env python3
-# Copyright (C) 2011-2024 Free Software Foundation, Inc.
+# Copyright (C) 2011-2025 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
diff --git a/gdb/contrib/words.sh b/gdb/contrib/words.sh
index 90b1bd9..a4bb2c7 100755
--- a/gdb/contrib/words.sh
+++ b/gdb/contrib/words.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2019-2024 Free Software Foundation, Inc.
+# Copyright (C) 2019-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or