]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/contrib] Handle capitalized words in spellcheck.sh
authorTom de Vries <tdevries@suse.de>
Wed, 13 Nov 2024 21:38:19 +0000 (22:38 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 13 Nov 2024 21:38:19 +0000 (22:38 +0100)
The dictionary contains a few entries with capital letters:
...
$ grep -E '[A-Z]' .git/wikipedia-common-misspellings.txt | wc -l
143
...
but they don't look too interesting in the gdb context (for instance,
Habsbourg->Habsburg), so filter them out.

That leaves us with entries looking only like "foobat->foobar", so add
handling of capitalized words, such that we also rewrite "Foobat" to "Foobar".

Tested on aarch64-linux.  Verified with shellcheck.

Approved-by: Kevin Buettner <kevinb@redhat.com>
13 files changed:
gdb/amd64-linux-nat.c
gdb/amd64-tdep.c
gdb/contrib/spellcheck.sh
gdb/i386-linux-nat.c
gdb/linux-tdep.c
gdb/m2-exp.y
gdb/m32r-linux-nat.c
gdb/m68k-linux-nat.c
gdb/or1k-linux-nat.c
gdb/target.h
gdb/testsuite/gdb.arch/arc-decode-insn.S
gdb/testsuite/gdb.cp/static-print-quit.exp
gdb/tilegx-linux-nat.c

index 742fc81f83281af06168729d9c657ffc983b6517..c3b7a19b5cb9079cf0a2cf742f4af21a7241b6b6 100644 (file)
@@ -90,7 +90,7 @@ static int amd64_linux_gregset32_reg_offset[] =
 };
 \f
 
-/* Transfering the general-purpose registers between GDB, inferiors
+/* Transferring the general-purpose registers between GDB, inferiors
    and core files.  */
 
 /* See amd64_collect_native_gregset.  This linux specific version handles
@@ -178,7 +178,7 @@ fill_gregset (const struct regcache *regcache,
   amd64_linux_collect_native_gregset (regcache, gregsetp, regnum);
 }
 
-/* Transfering floating-point registers between GDB, inferiors and cores.  */
+/* Transferring floating-point registers between GDB, inferiors and cores.  */
 
 /* Fill GDB's register cache with the floating-point and SSE register
    values in *FPREGSETP.  */
index c17b5f7f6f35bb0504d0b8a51fbe41884a85d388..ba6532fcee7735c38d6a32ac28e68ba5e21218cc 100644 (file)
@@ -1227,7 +1227,7 @@ amd64_get_unused_input_int_reg (const struct amd64_insn *details)
 
   /* Avoid RAX.  */
   used_regs_mask |= 1 << EAX_REG_NUM;
-  /* Similarily avoid RDX, implicit operand in divides.  */
+  /* Similarly avoid RDX, implicit operand in divides.  */
   used_regs_mask |= 1 << EDX_REG_NUM;
   /* Avoid RSP.  */
   used_regs_mask |= 1 << ESP_REG_NUM;
index a95b325ffb3af0987d7fee2a8de41a8a4795eea9..02238857521956ef71f4bd6b4c7881e38e4ad367 100755 (executable)
@@ -218,8 +218,10 @@ output_local_dictionary ()
 
 output_dictionaries ()
 {
-    output_local_dictionary
-    cat "$dictionary"
+    (
+       output_local_dictionary
+       cat "$dictionary"
+    ) | grep -E -v "[A-Z]"
 }
 
 parse_dictionary ()
@@ -247,7 +249,14 @@ find_files_matching_words ()
     else
        rm -f "$cache_dir/$cache_file2".*
 
-       pat=$(grep_join "${words[@]}")
+       declare -a re_words
+       mapfile -t re_words \
+               < <(for f in "${words[@]}"; do
+                       echo "$f"
+                   done \
+                       | sed "s/^\(.\)/[\u\1\1]/")
+
+       pat=$(grep_join "${re_words[@]}")
 
        local before after
        before=$(grep_join \
@@ -283,6 +292,8 @@ find_files_matching_word ()
                "${grep_separators[@]}" \
                "${grep_post[@]}")
 
+    pat="(${pat@u}|$pat)"
+
     pat="$before$pat$after"
 
     grep -E \
@@ -310,11 +321,13 @@ replace_word_in_file ()
                "${sed_separators[@]}" \
                "${sed_post[@]}")
 
-    local repl
-    repl="s%$before$word$after%\1$replacement\2%g"
+    local repl1
+    local repl2
+    repl1="s%$before$word$after%\1$replacement\2%g"
+    repl2="s%$before${word@u}$after%\1${replacement@u}\2%g"
 
     sed -i \
-       "$repl" \
+       "$repl1;$repl2" \
        "$file"
 }
 
index 41c1113257c43b0efa751a44deed42b48f856ed5..d2cbe51e72b2fce721285055780837c6835dea5d 100644 (file)
@@ -137,7 +137,7 @@ store_register (const struct regcache *regcache, int regno)
 }
 \f
 
-/* Transfering the general-purpose registers between GDB, inferiors
+/* Transferring the general-purpose registers between GDB, inferiors
    and core files.  */
 
 /* Fill GDB's register array with the general-purpose register values
@@ -234,7 +234,7 @@ static void store_regs (const struct regcache *regcache, int tid, int regno) {}
 #endif
 \f
 
-/* Transfering floating-point registers between GDB, inferiors and cores.  */
+/* Transferring floating-point registers between GDB, inferiors and cores.  */
 
 /* Fill GDB's register array with the floating-point register values in
    *FPREGSETP.  */
@@ -304,7 +304,7 @@ store_fpregs (const struct regcache *regcache, int tid, int regno)
 #endif
 \f
 
-/* Transfering floating-point and SSE registers to and from GDB.  */
+/* Transferring floating-point and SSE registers to and from GDB.  */
 
 /* Fetch all registers covered by the PTRACE_GETREGSET request from
    process/thread TID and store their values in GDB's register array.
index 65ec221ef48d940427a63330602102d6dd607aa5..d3452059ce23ea33ef5b7832cb847621f7c168df 100644 (file)
@@ -2104,7 +2104,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
   if (!note_data)
     return NULL;
 
-  /* Auxillary vector.  */
+  /* Auxiliary vector.  */
   std::optional<gdb::byte_vector> auxv =
     target_read_alloc (current_inferior ()->top_target (),
                       TARGET_OBJECT_AUXV, NULL);
index 2887ad2be21a01f0bc54f385c19fa790ff9e729b..0201f84cfa542f635562660862aa6dce6da982be 100644 (file)
@@ -961,7 +961,7 @@ yylex (void)
 
        case LOC_LABEL:
        case LOC_UNRESOLVED:
-         error (_("internal:  Unforseen case in m2lex()"));
+         error (_("internal:  Unforeseen case in m2lex()"));
 
        default:
          error (_("unhandled token in m2lex()"));
index 08a4db1d39a60c4aedec77ea4940767a46f526e2..bb8667539b56e66a0e5163dcdaec8eac2f9cd444 100644 (file)
@@ -66,7 +66,7 @@ static int regmap[] = {
 \f
 
 
-/* Transfering the general-purpose registers between GDB, inferiors
+/* Transferring the general-purpose registers between GDB, inferiors
    and core files.  */
 
 /* Fill GDB's register array with the general-purpose register values
@@ -176,7 +176,7 @@ store_regs (const struct regcache *regcache, int tid, int regno)
 \f
 
 
-/* Transfering floating-point registers between GDB, inferiors and cores.  
+/* Transferring floating-point registers between GDB, inferiors and cores.
    Since M32R has no floating-point registers, these functions do nothing.  */
 
 void
index 49cd49193bbc70bd6e7ae484bba8ce2800549d1e..7ea5847a2a66647e0a76fe99b97bb2cbc93944cb 100644 (file)
@@ -300,7 +300,7 @@ static void store_regs (const struct regcache *regcache, int tid, int regno)
 #endif
 
 \f
-/* Transfering floating-point registers between GDB, inferiors and cores.  */
+/* Transferring floating-point registers between GDB, inferiors and cores.  */
 
 /* What is the address of fpN within the floating-point register set F?  */
 #define FPREG_ADDR(f, n) (&(f)->fpregs[(n) * 3])
index 21392245f4844beb0ed1dcfdf6cf7dedd9b74db3..e6cc9c702931421b4c578d02fc3dd09aa21a4155 100644 (file)
@@ -106,7 +106,7 @@ fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
     regcache->raw_collect (OR1K_NPC_REGNUM, regp + 32);
 }
 
-/* Transfering floating-point registers between GDB, inferiors and cores.
+/* Transferring floating-point registers between GDB, inferiors and cores.
    Since OpenRISC floating-point registers are the same as GPRs these do
    nothing.  */
 
index 6da58c7e179a443f6503d75f6572045575233369..d8729913b3baeecfb46b27bf44102d118d541544 100644 (file)
@@ -1651,7 +1651,7 @@ struct memory_write_request
     : begin (begin_), end (end_), data (data_), baton (baton_)
   {}
 
-  /* Begining address that must be written.  */
+  /* Beginning address that must be written.  */
   ULONGEST begin;
   /* Past-the-end address.  */
   ULONGEST end;
index ea37455d890c052129e14aa9222f6076a3796ce9..6b37d545c31bc06494b0859d9de8501c04abaeb2 100644 (file)
@@ -394,7 +394,7 @@ start_branch_tests:
 
 #ifdef TEST_B
 .Lb_target:
-    ; Artifical nop, so that first b will not branch to itself.
+    ; Artificial nop, so that first b will not branch to itself.
     nop_s
     ; b s25
     .set b_s25_target, @.Lb_target
index 109bf8dc336eb709941731272f0e3e88825d2eb6..72364390cebbbc590d56b48adde8f71831a56a8d 100644 (file)
@@ -55,7 +55,7 @@ gdb_test_multiple "" $test {
 
 gdb_test "q" ".*"
 
-# Now the obstack is uninitialized.  Excercise it.
+# Now the obstack is uninitialized.  Exercise it.
 
 gdb_test_no_output "set pagination off"
 gdb_test "print c" ".*" "first print"
index 440a5cc89ce929be3f9a07fe3c98d024bd7c4fc0..5755e7078e75ac0b731e17703d9671595324d030 100644 (file)
@@ -72,7 +72,7 @@ static const int regmap[] =
   56, 58
 };
 
-/* Transfering the general-purpose registers between GDB, inferiors
+/* Transferring the general-purpose registers between GDB, inferiors
    and core files.  */
 
 /* Fill GDB's register array with the general-purpose register values
@@ -105,7 +105,7 @@ fill_gregset (const struct regcache* regcache,
       regcache->raw_collect (i, regp + regmap[i]);
 }
 
-/* Transfering floating-point registers between GDB, inferiors and cores.  */
+/* Transferring floating-point registers between GDB, inferiors and cores.  */
 
 /* Fill GDB's register array with the floating-point register values in
    *FPREGSETP.  */