]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Drop global decls at global level
authorTom de Vries <tdevries@suse.de>
Sat, 1 Aug 2026 13:26:19 +0000 (15:26 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 1 Aug 2026 13:26:19 +0000 (15:26 +0200)
While reviewing a patch I came across:
...
global srcdir
...

This is only required in a proc, so this is superfluous.

Delete similar cases using:
...
$ find gdb/testsuite/gdb.* -name *.exp | xargs sed -i '/^global /d'
...

Tested on x86_64-linux.

Approved-By: Luis Machado <luis.machado.foss@gmail.com>
25 files changed:
gdb/testsuite/gdb.arch/aarch64-mte.exp
gdb/testsuite/gdb.base/checkpoint.exp
gdb/testsuite/gdb.base/ctxobj.exp
gdb/testsuite/gdb.base/detach.exp
gdb/testsuite/gdb.base/miscexprs.exp
gdb/testsuite/gdb.base/pie-execl.exp
gdb/testsuite/gdb.base/wchar.exp
gdb/testsuite/gdb.base/write_mem.exp
gdb/testsuite/gdb.btrace/stepi.exp
gdb/testsuite/gdb.cp/converts.exp
gdb/testsuite/gdb.cp/ovldbreak.exp
gdb/testsuite/gdb.disasm/am33.exp
gdb/testsuite/gdb.disasm/mn10300.exp
gdb/testsuite/gdb.disasm/t13_otr.exp
gdb/testsuite/gdb.perf/disassemble.exp
gdb/testsuite/gdb.python/py-block.exp
gdb/testsuite/gdb.python/py-symbol.exp
gdb/testsuite/gdb.python/py-symtab.exp
gdb/testsuite/gdb.reverse/i386-avx-reverse.exp
gdb/testsuite/gdb.reverse/i386-precsave.exp
gdb/testsuite/gdb.reverse/i386-reverse.exp
gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
gdb/testsuite/gdb.server/unittest.exp
gdb/testsuite/gdb.threads/pthread_cond_wait.exp
gdb/testsuite/gdb.threads/schedlock.exp

index 72d4bba7253112c1de74d37bf1490b0c972893a3..17ec0866f366f432244d411ec7bbf76af9c923d2 100644 (file)
@@ -15,8 +15,6 @@
 
 # Test a binary that uses MTE and exercise various MTE-related scenarios.
 
-global hex
-global decimal
 
 # Return TAG in hex format with no leading zeroes.
 proc get_hex_tag { tag } {
index 828a633d4a46684536bf572c262194c6dbcf4447..23686f8fcf0477275cd906c7ef3c35667772331a 100644 (file)
@@ -41,7 +41,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
     return
 }
 
-global gdb_prompt
 
 #
 # This tests gdb checkpoint and restart.
index 3b1b12a9b18605541e2907d6e58794c102f3d03b..e03d6fc2b5cdf5a0070a3b11191763f0452f42f4 100644 (file)
@@ -65,7 +65,6 @@ gdb_test "break ctxobj-f.c:$bp_location" \
         "Breakpoint ${::decimal} at ${::hex}: .*" \
         "break in get_version functions"
 
-global expect_out
 set test "continue to get_version_1"
 gdb_test_multiple "continue" $test {
     -re "Breakpoint ($bkptno_num_re), get_version_1 \\(\\).*\r\n.*$gdb_prompt $" {
index b8b1ce91dde670224d213043af9e3f4bcd1f30c5..bd19cb166a5431a5d922825edf4c4533a23ea8f5 100644 (file)
@@ -41,7 +41,6 @@ proc do_detach_tests {} {
   gdb_test "detach" "Detaching from program: .*$escapedbinfile, .*" "detach, $pass"
 }
 
-global pass
 set pass "one"
 do_detach_tests
 
index fb921dccfe12023b7d181ac4d55d3ba702cac8c1..3190a18a79934ae6a3ffe214ccbb46bcd34b38bb 100644 (file)
@@ -62,7 +62,6 @@ gdb_test "cont" \
 
 gdb_test "up" " main .*" "up from marker1"
 
-global hex
 
 gdb_test "print &ibig.i\[0\]" " = \\(int \\*\\) $hex"
 
index cd4951f1be291b27a12bf77960b0ceb7ab635928..4bfd3078248731aad6d5cdf8a47ac03099b21278 100644 (file)
@@ -16,8 +16,6 @@
 # The problem was due to amd64_skip_prologue attempting to access inferior
 # memory before the PIE (Position Independent Executable) gets relocated.
 
-global inferior_spawn_id
-global gdb_spawn_id
 
 require {istarget *-linux*}
 require {!target_info exists noargs}
index d4c1a5fd87c61724ccbd5d9fc4725a6912f81262..b02f4a78336551cb716595079d440e3a95638639 100644 (file)
@@ -53,7 +53,6 @@ gdb_test_multiple $test $test {
 
 gdb_test "print repeat" "= L\"A\", '$cent' <repeats 21 times>, \"B.*"
 
-global hex
 gdb_test "print repeat_p" \
     "= $hex L\"A\", '$cent' <repeats 21 times>, \"B\""
 
index 2c9509dd658388d40699705429c42d3bcbb2de02..f5d86e7e427ea96a0bb8f6171ed0d38a0ccf4651 100644 (file)
@@ -18,7 +18,6 @@
 # Test for PR gdb/20948
 # Verify that invoking gdb with the --write argument works as expected
 
-global GDBFLAGS
 standard_testfile
 
 if {[build_executable $testfile.exp $testfile \
index 41d465e2e664999a59d4846bfd04bd3da2ccf320..86035f9cdc57b4f88ac067314bc0d4fdf7fdb005 100644 (file)
@@ -49,7 +49,6 @@ if {![runto_main]} {
     return -1
 }
 
-global gdb_prompt
 
 proc check_replay_at { insn } {
   gdb_test "info record" [multi_line \
index 60a732f87ee00765d2233ff46012a29d064479ad..54bdec425adff0962345671e96e338fc3a35d8c4 100644 (file)
@@ -56,7 +56,6 @@ gdb_test "p foo3_1 ((char *) 0, ta)" "Cannot resolve.*" \
     "check all parameters for badness"
 
 # Tests for null pointer conversion
-global gdb_prompt
 set nl {[\r\n]+}
 set t "null pointer conversion"
 gdb_test_multiple "p foo3_1 (0, 0)" $t {
index dce7d3b414b3cec84901fbaecd46c80a0cba9c2e..8179a10c71e616589767e611ed4c61950a5e3510 100644 (file)
@@ -22,7 +22,6 @@
 # overloaded member functions
 #
 
-global timeout
 set timeout 15
 #
 # test running programs
index 71bba6cef282504f2baa9dc157f09f6ba9ceff76..878b462754afa91e6dbb475c7bdfdcb8229959f1 100644 (file)
@@ -18,7 +18,6 @@
 
 require {istarget "mn10300*-*-*"}
 
-global exec_output
 
 set testfile "am33"
 set srcfile ${srcdir}/${subdir}/${testfile}.s
index 7fb6b0ecaeaed4728bc864b09a577447e7a0bd65..699905ec3b1c06c89c992b9165aa99ee0cd7faf8 100644 (file)
@@ -18,7 +18,6 @@
 
 require {istarget "mn10300*-*-*"}
 
-global exec_output
 
 set testfile "mn10300"
 set srcfile ${srcdir}/${subdir}/${testfile}.s
index 57e9179c05a91e247b6e91b5b4fac7e33657a030..8ee990ed07470a85c927ba3ee0db0a00d774e43e 100644 (file)
@@ -41,7 +41,6 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load $binfile
 
-global hex
 
 gdb_test "x /i start" "bra\t.\\+18 \\($hex\\)" \
        "bra .+18"
index 89037e9c377f1b4605ca2980c2bddde776d8efee..c9da08cab44df3539754e22df399c8cb9add9239 100644 (file)
@@ -19,7 +19,6 @@ load_lib perftest.exp
 
 require allow_perf_tests
 
-global GDB
 
 standard_testfile .c
 # Overwrite $binfile
index 30983ac35f259ed3a13b6389f6f885ae670bf13a..6ea77348279a8232e9b24bd7e67d9a5d32d2de9b 100644 (file)
@@ -30,7 +30,6 @@ if {![runto_main]} {
     return
 }
 
-global hex decimal
 gdb_breakpoint [gdb_get_line_number "Block break here."]
 gdb_continue_to_breakpoint "Block break here."
 
index 9d36b14567a98b5eef8e5779a98e4af3a6027915..4988a8bb3f2923b900b9036590e93edc720e9ab1 100644 (file)
@@ -93,7 +93,6 @@ if {![runto_main]} {
     return
 }
 
-global hex decimal
 
 gdb_breakpoint [gdb_get_line_number "Block break here."]
 gdb_continue_to_breakpoint "Block break here."
index b5dd0c26988e6e6936a69d9fc8b7e61ca8adbd39..5c6e13d4e75e60dbcf078192cf4d568a8a81f9c3 100644 (file)
@@ -32,7 +32,6 @@ if {![runto_main]} {
 
 set debug_types [debug_types]
 
-global hex decimal
 
 # Setup and get the symbol table.
 set line_no [gdb_get_line_number "Block break here."]
index 4fe64a775d84deee567c4c63a3f608a52150df59..5d65245db399fdaaa6b6a094b274eeb4fb289460 100644 (file)
@@ -143,8 +143,6 @@ proc record_full_function {function} {
 
 runto_main
 
-global hex
-global decimal
 
 # Record all the execution for vmov tests first.
 
index 4bde399bc4574915f0efcdbb628b7783ad36032d..8f6ad2283c0d9f60d298ea323cea88a13cac1967 100644 (file)
@@ -41,8 +41,6 @@ runto_main
 # Activate process record/replay
 gdb_test_no_output "record" "turn on process record"
 
-global hex
-global decimal
 
 gdb_test "break $end_of_main" \
     "Breakpoint $decimal at .*$srcfile, line $end_of_main\." \
index 2013a969f8caee98ca48f6128c44be413ab0c35d..fe404b2c5e2a6b50cbfb5d9fb4f4ff8a73f03273 100644 (file)
@@ -41,8 +41,6 @@ if {[supports_process_record]} {
     gdb_test_no_output "record" "turn on process record"
 }
 
-global hex
-global decimal
 
 gdb_test "step" "inc .eax.*" "step to inc eax 1st time"
 send_gdb "info reg eax\n"
index 3ed1d7e6fae26f7eb4c2b2cc8039e559e49657f6..7d250b47cf0e35c8b52de9b182e6765a6e13c48d 100644 (file)
@@ -48,8 +48,6 @@ if {[supports_process_record]} {
     gdb_test_no_output "record" "turn on process record"
 }
 
-global hex
-global decimal
 
 #sse_test
 
index 58116b0a25c3654275bc1affdaa21009ef308592..1a9e93a98efd375d530da5005eefc5f9711a1240 100644 (file)
@@ -21,7 +21,6 @@ standard_testfile
 
 require allow_gdbserver_tests
 
-global server_spawn_id
 
 set gdbserver [find_gdbserver]
 set gdbserver_command "$gdbserver --selftest"
index ae700b8715ca5f3af2fe797f7328df9554b9a93f..d1440820f95114915e66e3573bfbd436712b1ba3 100644 (file)
@@ -45,8 +45,6 @@ gdb_test "continue" \
 # occur in a single thread's backtrace, in the given order.
 #
 
-global hex
-global decimal
 
 #
 # This is a "backtrace break" ("btb"):
index 61a9d5ddef549ccfe5d83b58b518021314a16436..572e1f9a71586f67533b1ca2105ee52310816852 100644 (file)
@@ -157,7 +157,6 @@ gdb_test_no_output "set width 0"
 runto_main
 
 # See if scheduler locking is available on this target.
-global gdb_prompt
 gdb_test_multiple "set scheduler-locking off" "scheduler locking set to none" {
     -re "Target .* cannot support this command" {
        unsupported "target does not support scheduler locking"