[gdb/contrib] Handle capitalized words in spellcheck.sh

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>
This commit is contained in:
Tom de Vries 2024-11-13 22:38:19 +01:00
parent 74b9033e6f
commit 5cb0406bb6
13 changed files with 36 additions and 23 deletions

View File

@ -90,7 +90,7 @@ static int amd64_linux_gregset32_reg_offset[] =
};
/* 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. */

View 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;

View File

@ -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"
}

View File

@ -137,7 +137,7 @@ store_register (const struct regcache *regcache, int regno)
}
/* 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
/* 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
/* 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.

View 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);

View 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()"));

View File

@ -66,7 +66,7 @@ static int regmap[] = {
/* 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)
/* 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

View File

@ -300,7 +300,7 @@ static void store_regs (const struct regcache *regcache, int tid, int regno)
#endif
/* 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])

View 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. */

View 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;

View 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

View 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"

View 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. */