aboutsummaryrefslogtreecommitdiff
path: root/gdb/contrib
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-11-27 21:15:26 +0100
committerTom de Vries <tdevries@suse.de>2023-11-27 21:15:26 +0100
commitf1b8ee6f2b4381bc46a0ad4c233b6eddc1e135b5 (patch)
tree58ca510a8f8ee934d9dd893c182b9a2b1143f831 /gdb/contrib
parent0da23004a064e7149373b484fa671f2a2105ec9b (diff)
downloadgdb-f1b8ee6f2b4381bc46a0ad4c233b6eddc1e135b5.zip
gdb-f1b8ee6f2b4381bc46a0ad4c233b6eddc1e135b5.tar.gz
gdb-f1b8ee6f2b4381bc46a0ad4c233b6eddc1e135b5.tar.bz2
[gdb/testsuite] Add boards/cc-with-index-cache.exp
We have a target board cc-with-gdb-index that uses the gdb-add-index script to add a .gdb_index index to an exec. There is however an alternative way of adding a .gdb_index: the index-cache. Add a new target board cc-with-index-cache. This is not superfluous for two reasons: - there is functionality that gdb-add-index doesn't support, but the index-cache does: the index-cache can add an index to an exec with a .gnu_debugaltlink (note that when using the cc-with-gdb-index board this case is quietly ignored), and - using the index-cache is excercised in only a few test-cases, and having this target board extends the test coverage to the entire test suite. This is for instance relevant because the index-cache is written by a worker thread in the background, so we can check more thoroughly for data races (see PR symtab/30837). Tested on x86_64-linux. Shell script changes checked with shellcheck. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/contrib')
-rwxr-xr-xgdb/contrib/cc-with-tweaks.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh
index 62d3bcf..abf22ca 100755
--- a/gdb/contrib/cc-with-tweaks.sh
+++ b/gdb/contrib/cc-with-tweaks.sh
@@ -43,6 +43,7 @@
# -z compress using dwz
# -m compress using dwz -m
# -i make an index (.gdb_index)
+# -c make an index (currently .gdb_index) in a cache dir
# -n make a dwarf5 index (.debug_names)
# -p create .dwp files (Fission), you need to also use gcc option -gsplit-dwarf
# -l creates separate debuginfo files linked to using .gnu_debuglink
@@ -85,6 +86,7 @@ output_file=a.out
want_index=false
index_options=""
+want_index_cache=false
want_dwz=false
want_multi=false
want_dwp=false
@@ -97,6 +99,7 @@ while [ $# -gt 0 ]; do
-z) want_dwz=true ;;
-i) want_index=true ;;
-n) want_index=true; index_options=-dwarf-5;;
+ -c) want_index_cache=true ;;
-m) want_multi=true ;;
-p) want_dwp=true ;;
-l) want_gnu_debuglink=true ;;
@@ -209,6 +212,15 @@ if [ "$want_index" = true ]; then
[ $rc != 0 ] && exit $rc
fi
+if [ "$want_index_cache" = true ]; then
+ $GDB -q -batch \
+ -ex "set index-cache directory $INDEX_CACHE_DIR" \
+ -ex "set index-cache enabled on" \
+ -ex "file $output_file"
+ rc=$?
+ [ $rc != 0 ] && exit $rc
+fi
+
if [ "$want_dwz" = true ] || [ "$want_multi" = true ]; then
# Require dwz version with PR dwz/24468 fixed.
dwz_version_major_required=0