aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorLancelot SIX <lsix@lancelotsix.com>2021-03-26 16:46:57 +0000
committerLancelot SIX <lsix@lancelotsix.com>2021-03-26 23:42:33 +0000
commitefe1ecd834133e0b1947b410b018076a2a6dbe6c (patch)
tree90331d06482115e517129e4536140d56a3d56df6 /gdb
parentf4655dee7749516dd9f4867a58e2910a7c9610c8 (diff)
downloadgdb-efe1ecd834133e0b1947b410b018076a2a6dbe6c.zip
gdb-efe1ecd834133e0b1947b410b018076a2a6dbe6c.tar.gz
gdb-efe1ecd834133e0b1947b410b018076a2a6dbe6c.tar.bz2
gdb-add-index.sh: Remove use of non posix 'local'
While working on gdb-add-index.sh, it appeared that it uses the non POSIX 'local' keyword. Instead of using local to allow variable shadowing, I rename the local one to avoid name conflicts altogether. This commit gets rid of the following shellcheck warning: In gdb-add-index.sh line 63: local file="$1" ^--------^ SC2039: In POSIX sh, 'local' is undefined. gdb/ChangeLog: * contrib/gdb-add-index.sh: Avoid variable shadowing and get rid of 'local'.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rwxr-xr-xgdb/contrib/gdb-add-index.sh25
2 files changed, 17 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f62af51..c3063b8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-26 Lancelot Six <lsix@lancelotsix.com>
+
+ * contrib/gdb-add-index.sh: Avoid variable shadowing and get
+ rid of 'local'.
+
2021-03-26 Tom Tromey <tom@tromey.com>
* symtab.c (struct output_source_filename_data): Add 'output'
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index 60287b9..2ac3fdd 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -60,13 +60,13 @@ fi
set_files ()
{
- local file="$1"
+ fpath="$1"
- index4="${file}.gdb-index"
- index5="${file}.debug_names"
- debugstr="${file}.debug_str"
- debugstrmerge="${file}.debug_str.merge"
- debugstrerr="${file}.debug_str.err"
+ index4="${fpath}.gdb-index"
+ index5="${fpath}.debug_names"
+ debugstr="${fpath}.debug_str"
+ debugstrmerge="${fpath}.debug_str.merge"
+ debugstrerr="${fpath}.debug_str.err"
}
tmp_files=
@@ -99,13 +99,12 @@ status=0
handle_file ()
{
- local file
- file="$1"
+ fpath="$1"
- set_files "$file"
+ set_files "$fpath"
if test -f "$index4" -a -f "$index5"; then
- echo "$myname: Both index types were created for $file" 1>&2
+ echo "$myname: Both index types were created for $fpath" 1>&2
status=1
elif test -f "$index4" -o -f "$index5"; then
if test -f "$index4"; then
@@ -118,7 +117,7 @@ handle_file ()
debugstradd=false
debugstrupdate=false
if test -s "$debugstr"; then
- if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$file" \
+ if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$fpath" \
/dev/null 2>$debugstrerr; then
cat >&2 $debugstrerr
exit 1
@@ -142,11 +141,11 @@ handle_file ()
if $debugstrupdate; then \
echo --update-section .debug_str="$debugstrmerge"; \
fi) \
- "$file" "$file"
+ "$fpath" "$fpath"
status=$?
else
- echo "$myname: No index was created for $file" 1>&2
+ echo "$myname: No index was created for $fpath" 1>&2
echo "$myname: [Was there no debuginfo? Was there already an index?]" \
1>&2
fi