]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/contrib] Handle dot in spellcheck.sh
authorTom de Vries <tdevries@suse.de>
Mon, 21 Oct 2024 13:19:25 +0000 (15:19 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 21 Oct 2024 13:19:25 +0000 (15:19 +0200)
Add handling of '.' in gdb/contrib/spellcheck.sh.

While we're at, simplify the sed invocation by using a single s command
instead of 3 s commands.

Also introduce sed_join and grep_join.

Fix the following common misspellings:
...
bandwith -> bandwidth
emmitted -> emitted
immediatly -> immediately
suprize -> surprise
thru -> through
transfered -> transferred
...

Verified with shellcheck.

gdb/contrib/spellcheck.sh
gdb/remote.c
gdb/testsuite/gdb.base/bigcore.exp
gdb/testsuite/gdb.base/call-sc.exp
gdb/testsuite/gdb.base/structs.exp
gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
gdb/testsuite/gdb.mi/mi-memory-changed.exp
gdbserver/server.cc

index 08c745aa92dd3fb5d0041213d8c317f92f8c5b0b..1b3e88e259b7b4ae8f9448187fd971acf9af5cdd 100755 (executable)
@@ -73,8 +73,20 @@ join ()
 
 grep_or="|"
 sed_or="\|"
-grep_separator=$(join $grep_or "${grep_separators[@]}")
-sed_separator=$(join $sed_or "${sed_separators[@]}")
+
+grep_join ()
+{
+    local res
+    res=$(join $grep_or "$@")
+    echo "($res)"
+}
+
+sed_join ()
+{
+    local res
+    res=$(join $sed_or "$@")
+    echo "\($res\)"
+}
 
 usage ()
 {
@@ -201,26 +213,24 @@ find_files_matching_words ()
     local patfile
     patfile="$cache_dir/$cache_file2".$cache_id
 
+    local pat
     if [ -f "$patfile" ]; then
        pat=$(cat "$patfile")
     else
        rm -f "$cache_dir/$cache_file2".*
 
-       local pat
-       pat=""
-       for word in "${words[@]}"; do
-           if [ "$pat" = "" ]; then
-               pat="$word"
-           else
-               pat="$pat|$word"
-           fi
-       done
-       pat="($pat)"
+       pat=$(grep_join "${words[@]}")
 
-       local sep
-       sep=$grep_separator
+       local before after
+       before=$(grep_join \
+                    "^" \
+                    "${grep_separators[@]}")
+       after=$(grep_join \
+                   "${grep_separators[@]}" \
+                   "\." \
+                   "$")
 
-       pat="(^|$sep)$pat($sep|$)"
+       pat="$before$pat$after"
 
        echo "$pat" \
             > "$patfile"
@@ -238,10 +248,16 @@ find_files_matching_word ()
     pat="$1"
     shift
 
-    local sep
-    sep=$grep_separator
+    local before after
+    before=$(grep_join \
+                "^" \
+                "${grep_separators[@]}")
+    after=$(grep_join \
+               "${grep_separators[@]}" \
+               "\." \
+               "$")
 
-    pat="(^|$sep)$pat($sep|$)"
+    pat="$before$pat$after"
 
     grep -E \
        -l \
@@ -260,22 +276,20 @@ replace_word_in_file ()
     local file
     file="$3"
 
-    local sep
-    sep=$sed_separator
-
-    # Save separator.
-    sep="\($sep\)"
-
-    local repl1 repl2 repl3
-
-    repl1="s%$sep$word$sep%\1$replacement\2%g"
-
-    repl2="s%^$word$sep%$replacement\1%"
+    local before after
+    before=$(sed_join \
+                "^" \
+                "${sed_separators[@]}")
+    after=$(sed_join \
+               "${sed_separators[@]}" \
+               "\." \
+               "$")
 
-    repl3="s%$sep$word$%\1$replacement%"
+    local repl
+    repl="s%$before$word$after%\1$replacement\2%g"
 
     sed -i \
-       "$repl1;$repl2;$repl3" \
+       "$repl" \
        "$file"
 }
 
index fdd83ecbaccf5575c44776e6bbf31f927b948c30..b65a1c3094ae985b673368708e635b2f5ba5f08d 100644 (file)
@@ -9501,7 +9501,7 @@ remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
   strcat (rs->buf.data (), header);
   p = rs->buf.data () + strlen (header);
 
-  /* Compute a best guess of the number of bytes actually transfered.  */
+  /* Compute a best guess of the number of bytes actually transferred.  */
   if (packet_format == 'X')
     {
       /* Best guess at number of bytes that will fit.  */
index 6c64d402502281dd4802868c48635b37899fd5f1..5e09d2f7986d2bd25e81fe38f78968509ddca8c9 100644 (file)
@@ -25,7 +25,7 @@ require isnative
 # Can the system run this test (in particular support sparse
 # corefiles)?  On systems that lack sparse corefile support this test
 # consumes too many resources - gigabytes worth of disk space and
-# I/O bandwith.
+# I/O bandwidth.
 
 if { [istarget "*-*-*bsd*"]
      || [istarget "*-*-solaris*"] 
index 91a4e5b863ffc5051e7e04c0b428d9406266b85d..3a83d964dd9f5a060e28e6dcfd72cbd08d0d8357 100644 (file)
@@ -286,7 +286,7 @@ proc test_scalar_returns { } {
        }
        -re ".*${gdb_prompt} $" {
            if $return_value_unimplemented {
-               # What a suprize.  The architecture hasn't implemented
+               # What a surprise.  The architecture hasn't implemented
                # return_value, and hence has to fail.
                kfail "$test" gdb/1444
            } else {
index 7f1192d48e5ef604700f1e6f1b4624b8b13c081e..ab68da27efa24865d0ad732e05873115d48e115e 100644 (file)
@@ -376,7 +376,7 @@ proc test_struct_returns { n } {
        }
        -re ".*${gdb_prompt} $" {
            if $return_value_unimplemented {
-               # What a suprize.  The architecture hasn't implemented
+               # What a surprise.  The architecture hasn't implemented
                # return_value, and hence has to fail.
                kfail "$test" gdb/1444
            } else {
index aa1c263e8000c72edac83541094ef8a739c2352e..0819aaeec728e880ac1448586d5b2d5b1467a10f 100644 (file)
@@ -16,7 +16,7 @@
 # This test triggers the "separate debug info file has no debug info" warning by replacing
 # the build-id based .debug file with the stripped binary and then loading it to gdb.
 # It then also sets up local debuginfod server with the correct debug file to download
-# to make sure no warnings are emmitted.
+# to make sure no warnings are emitted.
 
 
 standard_testfile
index 486c4d794d4c8b97b2fc154e1e0c913985b5b810..6d9e504e241df1c01b35327b9648e0e023845fa5 100644 (file)
@@ -44,11 +44,11 @@ mi_gdb_test "-var-create var_c * C" \
 
 mi_gdb_test "-var-assign var_c 5" \
     "-var-assign var_c 5\r\n\\^done,value=\"5\"" \
-    "change C thru. varobj"
+    "change C through. varobj"
 
 mi_gdb_test  "-data-write-memory-bytes &C \"00\"" \
     {\^done} \
-    "change C thru. -data-write-memory-bytes"
+    "change C through. -data-write-memory-bytes"
 
 # Modify code section also triggers MI notification.
 
index 69ffb722be75b3f19933aaf6b9e3ea8b5c21867e..5190df4aed5f5e10b29acfd8430f594308a65bdf 100644 (file)
@@ -3735,7 +3735,7 @@ handle_status (char *own_buf)
     {
       for_each_thread (queue_stop_reply_callback);
 
-      /* The first is sent immediatly.  OK is sent if there is no
+      /* The first is sent immediately.  OK is sent if there is no
         stopped thread, which is the same handling of the vStopped
         packet (by design).  */
       notif_write_event (&notif_stop, cs.own_buf);