Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC 1/5] [pre-commit] Add indent-exp
@ 2026-09-04  9:38 Tom de Vries
  2026-09-04  9:38 ` [RFC 2/5] [gdb/testsuite] Make lib/gdb.exp emacs indent compatible Tom de Vries
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tom de Vries @ 2026-09-04  9:38 UTC (permalink / raw)
  To: gdb-patches

There's a long-term goal to start using tclfmt [1] to format .exp and .tcl
files.

A less impactful approach is to have consistent indentation.

Add a hook indent-exp that uses emacs indent-region.

It uses a new script ./gdb/contrib/emacs-indent.sh which we demonstrate here
using the largest .exp file (12433 lines):
...
$ time ./gdb/contrib/emacs-indent.sh tcl-mode gdb/testsuite/lib/gdb.exp

real	0m1.041s
user	0m0.998s
sys	0m0.045s
...

The first change is here where we replace 7 spaces with a tab:
...
 proc load_lib { file } {
     array set known_global {}
     foreach varname [info globals] {
-       set known_globals($varname) 1
+	set known_globals($varname) 1
     }
...

Less desirable changes are when emacs messes with indentation inside strings:
...
 	    for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn)
-		if (dyn->d_tag == DT_DEBUG)
-		    r_debug = (struct r_debug *) dyn->d_un.d_ptr;
+	    if (dyn->d_tag == DT_DEBUG)
+	    r_debug = (struct r_debug *) dyn->d_un.d_ptr;
...

The script is fast enough when checking a few files in a new commit, but very
slow when checking all files:
...
$ pre-commit run indent-exp --hook-stage manual --all-files -v
indent-exp..............................................................Failed
- hook id: indent-exp
- duration: 89.18s
- files were modified by this hook
...

It's using the manual stage, both because it's slow and because users need to
provide the emacs dependency.

I tried to make ./gdb/contrib/emacs-indent.sh generic enough to be also usable
for other modes, for instance sh-mode for shell scripts.

The script has a kludge to stop emacs from changing this:
...
    # Try this command:
    #     foo \
    #         arg1 \
    #         arg2
...
into:
...
    # Try this command:
    #     foo \
        #         arg1 \
        #         arg2
...
by adding a '#' after the trailing backslash:
...
    # Try this command:
    #     foo \#
    #         arg1 \#
    #         arg2
...

There might be a way to address this using some emacs customization instead.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=33724
---
 .pre-commit-config.yaml     |  9 +++-
 gdb/contrib/emacs-indent.sh | 85 +++++++++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100755 gdb/contrib/emacs-indent.sh

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 0b4285e6c82..096887ef86f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -100,7 +100,7 @@ repos:
     hooks:
       - id: tclint
         args: [--trust-plugins]
-        files: '^gdb/testsuite/.*\.(exp|tcl)$'
+        files: &gdb_exp_tcl_files '^gdb/testsuite/.*\.(exp|tcl)$'
 
   # Yaml hooks.
   - repo: https://github.com/adrienverge/yamllint.git
@@ -169,6 +169,13 @@ repos:
         args: [--config-check]
         additional_dependencies: ["pyyaml"]
         files: *pre_commit_config_file
+      - id: &id7 indent-exp
+        name: *id7
+        language: unsupported_script
+        entry: gdb/contrib/emacs-indent.sh
+        args: [tcl-mode]
+        files: *gdb_exp_tcl_files
+        stages: [manual]
 
 # Local Variables:
 # indent-tabs-mode: nil
diff --git a/gdb/contrib/emacs-indent.sh b/gdb/contrib/emacs-indent.sh
new file mode 100755
index 00000000000..71411103aed
--- /dev/null
+++ b/gdb/contrib/emacs-indent.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+mode="$1"
+shift
+
+if [ "$mode" = "" ]; then
+    echo "Missing mode argument"
+    exit 1
+fi
+
+if [ $# -eq 0 ]; then
+    echo "No files"
+    exit 1
+fi
+
+if ! emacs --version > /dev/null; then
+    echo "Please install emacs"
+    exit 1
+fi
+
+files=()
+for f in "$@"; do
+    case "$mode" in
+	tcl-mode)
+	    case "$f" in
+		# Imported.
+		gdb/testsuite/lib/ton.tcl)
+		    continue
+		    ;;
+	    esac
+	    ;;
+    esac
+
+    files=("${files[@]}" "$f")
+done
+
+if [ ${#files[@]} -eq 0 ]; then
+    exit
+fi
+
+tmp=""
+
+cleanup()
+{
+    if [ "$tmp" != "" ]; then
+	rm -f "$tmp"
+    fi
+}
+
+# Schedule cleanup.
+trap cleanup EXIT
+
+# Get temporary file.
+tmp=$(mktemp) || exit 1
+
+if [ "$mode" = "tcl-mode" ]; then
+    # Kludge: Hide backslashes at end of comment from emacs tcl-mode, by
+    # appending '#'.
+    sed \
+	-i \
+	's%^\([ \t]*#.*\)\\$%\1\\#%' \
+	"${files[@]}" \
+	|| exit 1
+fi
+
+script="
+(dolist
+ (f command-line-args-left)
+ (with-current-buffer
+  (find-file-noselect f)
+  ($mode)
+  (indent-region (point-min) (point-max))
+  (save-buffer)
+  (kill-buffer)))"
+
+if ! emacs \
+     -batch \
+     --eval="$script" \
+     "${files[@]}" \
+     > "$tmp" \
+     2>&1; then
+    # Output is verbose, only show on error.
+    cat "$tmp"
+    exit 1
+fi

base-commit: 5f20ce97686ac7ee28cba3f0af0a237a1e878148
-- 
2.51.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFC 2/5] [gdb/testsuite] Make lib/gdb.exp emacs indent compatible
  2026-09-04  9:38 [RFC 1/5] [pre-commit] Add indent-exp Tom de Vries
@ 2026-09-04  9:38 ` Tom de Vries
  2026-09-04  9:38 ` [RFC 3/5] [gdb/testsuite] Update regexp in string_to_regexp Tom de Vries
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2026-09-04  9:38 UTC (permalink / raw)
  To: gdb-patches

There are cases in gdb/testsuite/lib/gdb.exp where we have inline C sources.

Say we start out by writing something like this:
...
set src {
  int main (int argc) {
    if (argc == 3)
      return 0;
  }
}
...

When editing with emacs, and using tcl-mode, auto indent will change this to:
...
set src {
    int main (int argc) {
	if (argc == 3)
	return 0;
    }
}
...

The 2 vs 4 spacing is fine, but removing indentation is not.  We can fix this
by adding braces:
...
set src {
    int main (int argc) {
	if (argc == 3) {
	    return 0;
	}
    }
}
...

But that approach breaks down when we have a for loop.  Auto indent gives us:
...
set src {
    int main (int argc) {
	for (int i = 0; i < 1) {
				argc++;
			    }
	return argc;
    }
}
...

This can be fixed with a trick: adding an if:
...
set src {
    int main (int argc) {
	for (int i = 0; i < 1) if (1) {
	    argc++;
	}
	return argc;
    }
}
...

Use these methods to make the inline sources in lib/gdb.exp compatible with
emacs auto indent.

Note: this does not yet use emacs indentation.
---
 gdb/testsuite/lib/gdb.exp | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index ea8bffc9e89..d4a471ff7c4 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3134,6 +3134,9 @@ gdb_caching_proc allow_dlmopen_tests {} {
 	    return 42;
 	}
     }
+
+    # Note: we use a "for ... if (1) ..." trick to make emacs tcl-mode indent
+    # the for loop as if it was an if.
     set src {
 	#define _GNU_SOURCE
 	#include <dlfcn.h>
@@ -3155,9 +3158,11 @@ gdb_caching_proc allow_dlmopen_tests {} {
 
 	    r_debug = 0;
 	    /* Taken from /usr/include/link.h.  */
-	    for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn)
-		if (dyn->d_tag == DT_DEBUG)
+	    for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) if (1) {
+		if (dyn->d_tag == DT_DEBUG) {
 		    r_debug = (struct r_debug *) dyn->d_un.d_ptr;
+		}
+	    }
 
 	    if (!r_debug) {
 		printf ("r_debug not found.\n");
@@ -11487,14 +11492,16 @@ gdb_caching_proc have_avx {} {
 	int main() {
 	  unsigned int eax, ebx, ecx, edx;
 
-	if (!x86_cpuid (1, &eax, &ebx, &ecx, &edx))
+	if (!x86_cpuid (1, &eax, &ebx, &ecx, &edx)) {
 	  return 0;
+	}
 
-	if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE))
+	if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) {
 	  return 1;
-	else
+	} else {
 	  return 0;
 	}
+	}
     }
     set compile_flags "incdir=${srcdir}/.."
     if {![gdb_simple_compile $me $src executable $compile_flags]} {
@@ -11532,14 +11539,16 @@ gdb_caching_proc have_avx2 {} {
 	    int main() {
 	      unsigned int eax, ebx, ecx, edx;
 
-	    if (!x86_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx))
-	      return 0;
+	    if (!x86_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx)) {
+		return 0;
+	    }
 
-	    if ((ebx & bit_AVX2) == bit_AVX2)
+	    if ((ebx & bit_AVX2) == bit_AVX2) {
 	      return 1;
-	    else
+	    } else {
 	      return 0;
 	    }
+	    }
 	}
 	set compile_flags "incdir=${srcdir}/.."
 	if {![gdb_simple_compile $me $src executable $compile_flags]} {
@@ -11642,8 +11651,9 @@ gdb_caching_proc has_hw_wp_support {} {
 	int main (void) {
 	    volatile int local;
 	    local = 1;
-	    if (local == 1)
+	    if (local == 1) {
 		return 1;
+	    }
 	    return 0;
 	}
     }
-- 
2.51.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFC 3/5] [gdb/testsuite] Update regexp in string_to_regexp
  2026-09-04  9:38 [RFC 1/5] [pre-commit] Add indent-exp Tom de Vries
  2026-09-04  9:38 ` [RFC 2/5] [gdb/testsuite] Make lib/gdb.exp emacs indent compatible Tom de Vries
@ 2026-09-04  9:38 ` Tom de Vries
  2026-09-04  9:38 ` [RFC 4/5] [gdb/testsuite] Reformat lib/gdb.exp Tom de Vries
  2026-09-04  9:38 ` [RFC 5/5] [gdb/testsuite] Reformat gdb.ada Tom de Vries
  3 siblings, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2026-09-04  9:38 UTC (permalink / raw)
  To: gdb-patches

There are two similar regexps, in string_to_regexp and with_gdb_prompt:
...
    regsub -all {[]?*+.|(){}^$\[\\]} $str {\\&} result
    regsub -all {[]*+.|()^$\[\\]} $prompt {\\&} prompt
...

In both cases, emacs tcl-mode has problems with it: auto indent doesn't
continue at column 4, but is reset to column 0.

The first regexp is basically one big bracket expression containing the chars:
...
  ] ? * + . | ( ) { } ^ $ \[ \\
...

There are a couple of ways that a ']' can be enclosed in a bracket
expression [1]:
- make it the first char
- escape using backslash
- make it a collating element

The first solution was chosen, but confuses tcl-mode.

Fix this by adding a backslash.

[1] https://www.tcl-lang.org/man/tcl8.6/TclCmd/re_syntax.htm#M30
---
 gdb/testsuite/lib/gdb-utils.exp | 4 +++-
 gdb/testsuite/lib/gdb.exp       | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index cabeb7aa1ed..874de79e6d8 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -36,7 +36,9 @@ proc gdb_init_commands {} {
 
 proc string_to_regexp {str} {
     set result $str
-    regsub -all {[]?*+.|(){}^$\[\\]} $str {\\&} result
+    # We use a backslash to escape the closing square bracket, even if it's
+    # the first character, to unconfuse emacs tcl-mode.
+    regsub -all {[\]?*+.|(){}^$\[\\]} $str {\\&} result
     return $result
 }
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d4a471ff7c4..b0a4cc1b39f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3650,7 +3650,9 @@ proc with_gdb_prompt { prompt body } {
     # we start recording both forms separately instead of just $gdb_prompt.
     # The testsuite is pretty-much hardwired to interpret $gdb_prompt as the
     # regexp form.
-    regsub -all {[]*+.|()^$\[\\]} $prompt {\\&} prompt
+    # We use a backslash to escape the closing square bracket, even if it's
+    # the first character, to unconfuse emacs tcl-mode.
+    regsub -all {[\]*+.|()^$\[\\]} $prompt {\\&} prompt
 
     set saved $gdb_prompt
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFC 4/5] [gdb/testsuite] Reformat lib/gdb.exp
  2026-09-04  9:38 [RFC 1/5] [pre-commit] Add indent-exp Tom de Vries
  2026-09-04  9:38 ` [RFC 2/5] [gdb/testsuite] Make lib/gdb.exp emacs indent compatible Tom de Vries
  2026-09-04  9:38 ` [RFC 3/5] [gdb/testsuite] Update regexp in string_to_regexp Tom de Vries
@ 2026-09-04  9:38 ` Tom de Vries
  2026-09-04  9:38 ` [RFC 5/5] [gdb/testsuite] Reformat gdb.ada Tom de Vries
  3 siblings, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2026-09-04  9:38 UTC (permalink / raw)
  To: gdb-patches

Reformat gdb/testsuite/lib/gdb.exp using:
...
$ pre-commit run \
    --hook-stage manual \
    indent-exp \
    --files gdb/testsuite/lib/gdb.exp
...
---
 gdb/testsuite/lib/gdb.exp | 484 +++++++++++++++++++-------------------
 1 file changed, 242 insertions(+), 242 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index b0a4cc1b39f..2cf54437acf 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -145,15 +145,15 @@ rename load_lib saved_load_lib
 proc load_lib { file } {
     array set known_global {}
     foreach varname [info globals] {
-       set known_globals($varname) 1
+	set known_globals($varname) 1
     }
 
     set code [catch {saved_load_lib $file} result]
 
     foreach varname [info globals] {
-       if { ![info exists known_globals($varname)] } {
-	   gdb_persistent_global_no_decl $varname
-       }
+	if { ![info exists known_globals($varname)] } {
+	    gdb_persistent_global_no_decl $varname
+	}
     }
 
     if {$code == 1} {
@@ -619,10 +619,10 @@ proc gdb_run_cmd { {inferior_args {}} } {
 	}
     }
     send_gdb "run $inferior_args\n"
-# This doesn't work quite right yet.
-# Use -notransfer here so that test cases (like chng-sym.exp)
-# may test for additional start-up messages.
-   gdb_expect 60 {
+    # This doesn't work quite right yet.
+    # Use -notransfer here so that test cases (like chng-sym.exp)
+    # may test for additional start-up messages.
+    gdb_expect 60 {
 	-re "The program .* has been started already.*y or n. $" {
 	    send_gdb "y\n" answer
 	    exp_continue
@@ -787,16 +787,16 @@ proc gdb_breakpoint { linespec args } {
 	-re "$break_message \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
 	-re "$break_message \[0-9\]* at .*$gdb_prompt $" {}
 	-re "$break_message \[0-9\]* \\(.*\\) pending.*$gdb_prompt $" {
-		if {$pending_response == "n"} {
-			if { $print_fail } {
-				fail $gdb_test_name
-			}
-			return 0
+	    if {$pending_response == "n"} {
+		if { $print_fail } {
+		    fail $gdb_test_name
 		}
+		return 0
+	    }
 	}
 	-re "Make breakpoint pending.*y or \\\[n\\\]. $" {
-		send_gdb "$pending_response\n"
-		exp_continue
+	    send_gdb "$pending_response\n"
+	    exp_continue
 	}
 	-re "$gdb_prompt $" {
 	    if { $print_fail } {
@@ -1267,7 +1267,7 @@ proc gdb_test_multiple { command message args } {
 
     if {$use_gdb_stub
 	&& [regexp -nocase {^\s*(r|run|star|start|at|att|atta|attac|attach)\M} \
-	    $command]} {
+		$command]} {
 	error "gdbserver does not support $command without extended-remote"
     }
 
@@ -1532,11 +1532,11 @@ proc gdb_test_multiple { command message args } {
     }
 
     if {$line_by_line} {
-       append code {
-	   -re "\r\n\[^\r\n\]*(?=\r\n)" {
-	       exp_continue
-	   }
-       }
+	append code {
+	    -re "\r\n\[^\r\n\]*(?=\r\n)" {
+		exp_continue
+	    }
+	}
     }
 
     # Now patterns that apply to any spawn id specified.
@@ -2672,7 +2672,7 @@ proc gdb_file_cmd { arg {kill_flag 1} } {
 	-re "$gdb_prompt $" {
 	    perror "Couldn't load $basename into GDB."
 	    return -1
-	    }
+	}
 	timeout {
 	    perror "Couldn't load $basename into GDB (timeout)."
 	    return -1
@@ -3812,7 +3812,7 @@ proc get_largest_timeout {} {
 
     set tmt 0
     if {[info exists timeout]} {
-      set tmt $timeout
+	set tmt $timeout
     }
     if { [info exists gtimeout] && $gtimeout > $tmt } {
 	set tmt $gtimeout
@@ -3913,7 +3913,7 @@ gdb_caching_proc supports_memtag {} {
 
     gdb_test_multiple "memory-tag check" "" {
 	-re "Memory tagging not supported or disabled by the current architecture\..*$gdb_prompt $" {
-	  return 0
+	    return 0
 	}
 	-re "Argument required \\(address or pointer\\).*$gdb_prompt $" {
 	    return 1
@@ -4366,7 +4366,7 @@ gdb_caching_proc allow_altivec_tests {} {
 	    set allow_vmx_tests 1
 	}
 	default {
-	  warning "\n$me: default case taken"
+	    warning "\n$me: default case taken"
 	    set allow_vmx_tests 0
 	}
     }
@@ -4386,11 +4386,11 @@ gdb_caching_proc allow_power_isa_3_1_tests {} {
     # Compile a test program containing ISA 3.1 instructions.
     set src {
 	int main() {
-	asm volatile ("pnop"); // marker
-		asm volatile ("nop");
-		return 0;
-	    }
+	    asm volatile ("pnop"); // marker
+	    asm volatile ("nop");
+	    return 0;
 	}
+    }
 
     if {![gdb_simple_compile $me $src executable ]} {
 	return 0
@@ -4482,7 +4482,7 @@ gdb_caching_proc allow_vsx_tests {} {
 	    set allow_vsx_tests 1
 	}
 	default {
-	  warning "\n$me: default case taken"
+	    warning "\n$me: default case taken"
 	    set allow_vsx_tests 0
 	}
     }
@@ -4729,23 +4729,23 @@ gdb_caching_proc allow_lam_tests {} {
 
     # Compile a test program.
     set src {
-      #define _GNU_SOURCE
-      #include <unistd.h>
-      #include <sys/syscall.h>
-      #include <assert.h>
-      #include <errno.h>
-      #include <asm/prctl.h>
+	#define _GNU_SOURCE
+	#include <unistd.h>
+	#include <sys/syscall.h>
+	#include <assert.h>
+	#include <errno.h>
+	#include <asm/prctl.h>
 
-      int configure_lam ()
-      {
-	errno = 0;
-	syscall (SYS_arch_prctl, ARCH_ENABLE_TAGGED_ADDR, 6);
-	assert_perror (errno);
-	return errno;
-      }
+	int configure_lam ()
+	{
+	    errno = 0;
+	    syscall (SYS_arch_prctl, ARCH_ENABLE_TAGGED_ADDR, 6);
+	    assert_perror (errno);
+	    return errno;
+	}
 
-      int
-      main () { return configure_lam (); }
+	int
+	main () { return configure_lam (); }
     }
 
     if {![gdb_simple_compile $me $src executable ""]} {
@@ -4898,8 +4898,8 @@ gdb_caching_proc allow_btrace_ptw_tests {} {
 	int
 	main ()
 	{
-	  _ptwrite32 (0x42);
-	  return 0;
+	    _ptwrite32 (0x42);
+	    return 0;
 	}
     }
 
@@ -4937,15 +4937,15 @@ gdb_caching_proc allow_btrace_ptw_tests {} {
 
 	gdb_test_multiple "maintenance btrace packet-history 0,1000" \
 	    "$me: check decoding support" {
-	    -re  "ptw" {
-		verbose -log "$me:  ptwrite decoding support detected."
-		set allow_btrace_ptw_tests 1
-	    }
-	    -re -wrap "" {
-		verbose -log "$me:  ptwrite decoding support not detected."
-		set allow_btrace_ptw_tests 0
+		-re  "ptw" {
+		    verbose -log "$me:  ptwrite decoding support detected."
+		    set allow_btrace_ptw_tests 1
+		}
+		-re -wrap "" {
+		    verbose -log "$me:  ptwrite decoding support not detected."
+		    set allow_btrace_ptw_tests 0
+		}
 	    }
-	}
     }
 
     gdb_exit
@@ -4968,7 +4968,7 @@ gdb_caching_proc allow_btrace_pt_event_trace_tests {} {
 	int
 	main ()
 	{
-	  return 0;
+	    return 0;
 	}
     }
 
@@ -5051,7 +5051,7 @@ gdb_caching_proc allow_aarch64_sve_tests {} {
 	    set allow_sve_tests 1
 	}
 	default {
-	  warning "\n$me: default case taken"
+	    warning "\n$me: default case taken"
 	    set allow_sve_tests 0
 	}
     }
@@ -5112,12 +5112,12 @@ gdb_caching_proc aarch64_initialize_sve_information { } {
 
     # Go through the data and extract the supported SVE vector lengths.
     set vl_count [get_valueof "" "supported_vl_count" "0" \
-			      "fetch value of supported_vl_count"]
+		      "fetch value of supported_vl_count"]
     verbose -log "Found $vl_count supported SVE vector length values"
 
     for {set vl_index 0} {$vl_index < $vl_count} {incr vl_index} {
 	set test_vl [get_valueof "" "supported_vl\[$vl_index\]" "0" \
-				 "fetch value of supported_vl\[$vl_index\]"]
+			 "fetch value of supported_vl\[$vl_index\]"]
 
 	# Mark this vector length as supported.
 	if {$test_vl != 0} {
@@ -5210,7 +5210,7 @@ gdb_caching_proc allow_aarch64_sme_tests {} {
 	    set allow_sme_tests 1
 	}
 	default {
-	  warning "\n$me: default case taken"
+	    warning "\n$me: default case taken"
 	    set allow_sme_tests 0
 	}
     }
@@ -5271,12 +5271,12 @@ gdb_caching_proc aarch64_initialize_sme_information { } {
 
     # Go through the data and extract the supported SME vector lengths.
     set svl_count [get_valueof "" "supported_svl_count" "0" \
-			       "fetch value of supported_svl_count"]
+		       "fetch value of supported_svl_count"]
     verbose -log "Found $svl_count supported SME vector length values"
 
     for {set svl_index 0} {$svl_index < $svl_count} {incr svl_index} {
 	set test_svl [get_valueof "" "supported_svl\[$svl_index\]" "0" \
-				  "fetch value of supported_svl\[$svl_index\]"]
+			  "fetch value of supported_svl\[$svl_index\]"]
 
 	# Mark this streaming vector length as supported.
 	if {$test_svl != 0} {
@@ -5370,7 +5370,7 @@ gdb_caching_proc allow_aarch64_fpmr_tests {} {
 	    set allow_fpmr_tests 1
 	}
 	default {
-	  warning "\n$me: default case taken"
+	    warning "\n$me: default case taken"
 	    set allow_fpmr_tests 0
 	}
     }
@@ -5424,7 +5424,7 @@ gdb_caching_proc allow_aarch64_lrcpc3_tests {} {
     gdb_load $obj
     gdb_run_cmd
     gdb_expect {
-    -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
+	-re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
 	    verbose -log "\n$me: lrcpc3 support detected"
 	    set allow_lrcpc3_tests 1
 	}
@@ -5463,7 +5463,7 @@ gdb_caching_proc allow_aarch64_cssc_tests {} {
     }
 
     if {![gdb_simple_compile $me $src executable $compile_flags]} {
-	    return 0
+	return 0
     }
 
     # Compilation succeeded so now run it via gdb.
@@ -5481,7 +5481,7 @@ gdb_caching_proc allow_aarch64_cssc_tests {} {
 	    set allow_cssc_tests 1
 	}
 	default {
-	  warning "\n$me: default case taken"
+	    warning "\n$me: default case taken"
 	    set allow_cssc_tests 0
 	}
     }
@@ -5508,9 +5508,9 @@ gdb_caching_proc allow_aarch64_lse128_tests {} {
 
     # Compile a test program reading LSE128.
     set src {
-    #include <stdint.h>
+	#include <stdint.h>
 
-    int main() {
+	int main() {
 	    __attribute__((aligned(16))) uint64_t mem[2] = { 0x0, 0x1 };
 	    uint64_t *ptr = mem;
 	    __asm__ volatile ("ldclrp x0, x1, [%0]\n" :: "r"(ptr) : "x0", "x1", "memory");
@@ -5519,7 +5519,7 @@ gdb_caching_proc allow_aarch64_lse128_tests {} {
     }
 
     if {![gdb_simple_compile $me $src executable $compile_flags]} {
-	    return 0
+	return 0
     }
 
     # Compilation succeeded so now run it via gdb.
@@ -5537,7 +5537,7 @@ gdb_caching_proc allow_aarch64_lse128_tests {} {
 	    set allow_lse128_tests 1
 	}
 	default {
-	  warning "\n$me: default case taken"
+	    warning "\n$me: default case taken"
 	    set allow_lse128_tests 0
 	}
     }
@@ -5599,7 +5599,7 @@ gdb_caching_proc allow_aarch64_mops_tests {} {
 	    set allow_mops_tests 1
 	}
 	default {
-	  warning "\n$me: default case taken"
+	    warning "\n$me: default case taken"
 	    set allow_mops_tests 0
 	}
     }
@@ -5955,13 +5955,13 @@ proc is_any_target {args} {
 # check for skipping respective tests.
 
 proc use_gdb_stub {} {
-  global use_gdb_stub
+    global use_gdb_stub
 
-  if {[info exists use_gdb_stub]} {
-     return $use_gdb_stub
-  }
+    if {[info exists use_gdb_stub]} {
+	return $use_gdb_stub
+    }
 
-  return [target_info exists use_gdb_stub]
+    return [target_info exists use_gdb_stub]
 }
 
 # Return 1 if the current remote target is an instance of our GDBserver, 0
@@ -6399,7 +6399,7 @@ proc escape_for_host { str } {
     if { [is_remote host] } {
 	set map {
 	    {$} {\\$}
-       }
+	}
     } else {
 	set map {
 	    {$} {\$}
@@ -6783,7 +6783,7 @@ proc gdb_compile {source dest type options} {
 			|| [istarget *-*-pe*])} {
 		lappend source "${shlib_name}.a"
 	    } else {
-	       lappend source $shlib_name
+		lappend source $shlib_name
 	    }
 	    if { $shlib_found == 0 } {
 		set shlib_found 1
@@ -6852,7 +6852,7 @@ proc gdb_compile {source dest type options} {
 
 	} elseif { $opt == "dwarf5" } {
 	    if {[test_compiler_info {gcc-*}] \
-		|| [test_compiler_info {clang-*}]} {
+		    || [test_compiler_info {clang-*}]} {
 		lappend new_options "additional_flags=-gdwarf-5"
 	    } else {
 		error "No idea how to force DWARF-5 in this compiler"
@@ -7017,16 +7017,16 @@ proc gdb_compile {source dest type options} {
 	lappend options "$flag"
     }
 
-  set macros [lsearch -exact $options macros]
-  if {$macros != -1} {
-      if { [test_compiler_info "clang-*"] } {
-	  set flag "additional_flags=-fdebug-macro"
-      } else {
-	  set flag "additional_flags=-g3"
-      }
+    set macros [lsearch -exact $options macros]
+    if {$macros != -1} {
+	if { [test_compiler_info "clang-*"] } {
+	    set flag "additional_flags=-fdebug-macro"
+	} else {
+	    set flag "additional_flags=-g3"
+	}
 
-      set options [lreplace $options $macros $macros $flag]
-  }
+	set options [lreplace $options $macros $macros $flag]
+    }
 
     if { $type == "executable" } {
 	if { ([istarget "*-*-mingw*"]
@@ -7154,8 +7154,8 @@ proc gdb_compile {source dest type options} {
 
     cond_wrap [expr {$pie != -1 || $nopie != -1}] \
 	with_PIE_multilib_flags_filtered {
-	set result [target_compile $source $dest $type $options]
-    }
+	    set result [target_compile $source $dest $type $options]
+	}
 
     # Prune uninteresting compiler (and linker) output.
     regsub "Creating library file: \[^\r\n\]*\[\r\n\]+" $result "" result
@@ -7263,17 +7263,17 @@ proc gdb_compile_shlib_1 {sources dest options} {
 	}
 	"gcc-*" {
 	    if { [istarget "powerpc*-*-aix*"]
-		   || [istarget "rs6000*-*-aix*"]
-		   || [istarget "*-*-cygwin*"]
-		   || [istarget "*-*-mingw*"]
-		   || [istarget "*-*-pe*"] } {
+		 || [istarget "rs6000*-*-aix*"]
+		 || [istarget "*-*-cygwin*"]
+		 || [istarget "*-*-mingw*"]
+		 || [istarget "*-*-pe*"] } {
 		lappend obj_options "additional_flags=-fPIC"
 	    } else {
 		lappend obj_options "additional_flags=-fpic"
 	    }
 	}
 	"icc-*" {
-		lappend obj_options "additional_flags=-fpic"
+	    lappend obj_options "additional_flags=-fpic"
 	}
 	default {
 	    # don't know what the compiler is...
@@ -7560,7 +7560,7 @@ proc gdb_expect { args } {
     }
 
     set code [catch \
-	{uplevel remote_expect host $tmt $expcode} string]
+		  {uplevel remote_expect host $tmt $expcode} string]
 
     if {$code == 1} {
 	global errorInfo errorCode
@@ -8084,10 +8084,10 @@ proc exec_symbol_file { binfile } {
 # to BINFILE2, but some targets require multiple binary files.
 proc gdb_rename_execfile { binfile1 binfile2 } {
     file rename -force [exec_target_file ${binfile1}] \
-		       [exec_target_file ${binfile2}]
+	[exec_target_file ${binfile2}]
     if { [exec_target_file ${binfile1}] != [exec_symbol_file ${binfile1}] } {
 	file rename -force [exec_symbol_file ${binfile1}] \
-			   [exec_symbol_file ${binfile2}]
+	    [exec_symbol_file ${binfile2}]
     }
 }
 
@@ -8660,7 +8660,7 @@ proc standard_output_file_with_gdb_instance {basename} {
     set count $gdb_instances
 
     if {$count == 0} {
-      return [standard_output_file $basename]
+	return [standard_output_file $basename]
     }
     return [standard_output_file ${basename}.${count}]
 }
@@ -9121,87 +9121,87 @@ proc gdb_get_line_number { text { file "" } } {
 #	is accepted.
 
 proc gdb_continue_to_end {{mssg ""} {command continue} {allow_extra 0}} {
-  global inferior_exited_re use_gdb_stub
-
-  if {$mssg == ""} {
-      set text "continue until exit"
-  } else {
-      set text "continue until exit at $mssg"
-  }
-
-  if {$allow_extra} {
-      set extra ".*"
-  } elseif {[istarget *-*-cygwin*] || [istarget *-*-mingw*]} {
-      # On Windows, even on supposedly single-threaded programs, we
-      # may see thread exit output when running to end, for threads
-      # spawned by the runtime.  E.g.:
-      #
-      #  (gdb) continue
-      #  Continuing.
-      #  [Thread 14364.0x21d4 exited with code 0]
-      #  [Thread 14364.0x4374 exited with code 0]
-      #  [Thread 14364.0x3aec exited with code 0]
-      #  [Thread 14364.0x3368 exited with code 0]
-      #  [Inferior 1 (process 14364) exited normally]
-      #
-      set extra "(\\\[Thread \[^\r\n\]+ exited with code $::decimal\\\]\r\n)*"
-  } else {
-      set extra ""
-  }
-
-  # By default, we don't rely on exit() behavior of remote stubs --
-  # it's common for exit() to be implemented as a simple infinite
-  # loop, or a forced crash/reset.  For native targets, by default, we
-  # assume process exit is reported as such.  If a non-reliable target
-  # is used, we set a breakpoint at exit, and continue to that.
-  if { [target_info exists exit_is_reliable] } {
-      set exit_is_reliable [target_info exit_is_reliable]
-  } else {
-      set exit_is_reliable [expr {! $use_gdb_stub}]
-  }
-
-  if { ! $exit_is_reliable } {
-    if {![gdb_breakpoint "exit"]} {
-      return 0
-    }
-    gdb_test $command "Continuing..*Breakpoint .*exit.*" \
-	$text
-  } else {
-    # Continue until we exit.  Should not stop again.
-    # Don't bother to check the output of the program, that may be
-    # extremely tough for some remote systems.
-    gdb_test $command \
-      "Continuing.\[\r\n0-9\]+${extra}(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\
-	$text
-  }
+    global inferior_exited_re use_gdb_stub
+
+    if {$mssg == ""} {
+	set text "continue until exit"
+    } else {
+	set text "continue until exit at $mssg"
+    }
+
+    if {$allow_extra} {
+	set extra ".*"
+    } elseif {[istarget *-*-cygwin*] || [istarget *-*-mingw*]} {
+	# On Windows, even on supposedly single-threaded programs, we
+	# may see thread exit output when running to end, for threads
+	# spawned by the runtime.  E.g.:
+	#
+	#  (gdb) continue
+	#  Continuing.
+	#  [Thread 14364.0x21d4 exited with code 0]
+	#  [Thread 14364.0x4374 exited with code 0]
+	#  [Thread 14364.0x3aec exited with code 0]
+	#  [Thread 14364.0x3368 exited with code 0]
+	#  [Inferior 1 (process 14364) exited normally]
+	#
+	set extra "(\\\[Thread \[^\r\n\]+ exited with code $::decimal\\\]\r\n)*"
+    } else {
+	set extra ""
+    }
+
+    # By default, we don't rely on exit() behavior of remote stubs --
+    # it's common for exit() to be implemented as a simple infinite
+    # loop, or a forced crash/reset.  For native targets, by default, we
+    # assume process exit is reported as such.  If a non-reliable target
+    # is used, we set a breakpoint at exit, and continue to that.
+    if { [target_info exists exit_is_reliable] } {
+	set exit_is_reliable [target_info exit_is_reliable]
+    } else {
+	set exit_is_reliable [expr {! $use_gdb_stub}]
+    }
+
+    if { ! $exit_is_reliable } {
+	if {![gdb_breakpoint "exit"]} {
+	    return 0
+	}
+	gdb_test $command "Continuing..*Breakpoint .*exit.*" \
+	    $text
+    } else {
+	# Continue until we exit.  Should not stop again.
+	# Don't bother to check the output of the program, that may be
+	# extremely tough for some remote systems.
+	gdb_test $command \
+	    "Continuing.\[\r\n0-9\]+${extra}(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\
+	    $text
+    }
 }
 
 proc rerun_to_main {} {
-  global gdb_prompt use_gdb_stub
+    global gdb_prompt use_gdb_stub
 
-  if {$use_gdb_stub} {
-    gdb_run_cmd
-    gdb_expect {
-      -re ".*Breakpoint .*main .*$gdb_prompt $"\
-	      {pass "rerun to main" ; return 0}
-      -re "$gdb_prompt $"\
-	      {fail "rerun to main" ; return 0}
-      timeout {fail "(timeout) rerun to main" ; return 0}
-    }
-  } else {
-    send_gdb "run\n"
-    gdb_expect {
-      -re "The program .* has been started already.*y or n. $" {
-	  send_gdb "y\n" answer
-	  exp_continue
-      }
-      -re "Starting program.*$gdb_prompt $"\
-	      {pass "rerun to main" ; return 0}
-      -re "$gdb_prompt $"\
-	      {fail "rerun to main" ; return 0}
-      timeout {fail "(timeout) rerun to main" ; return 0}
+    if {$use_gdb_stub} {
+	gdb_run_cmd
+	gdb_expect {
+	    -re ".*Breakpoint .*main .*$gdb_prompt $"\
+		{pass "rerun to main" ; return 0}
+	    -re "$gdb_prompt $"\
+		{fail "rerun to main" ; return 0}
+	    timeout {fail "(timeout) rerun to main" ; return 0}
+	}
+    } else {
+	send_gdb "run\n"
+	gdb_expect {
+	    -re "The program .* has been started already.*y or n. $" {
+		send_gdb "y\n" answer
+		exp_continue
+	    }
+	    -re "Starting program.*$gdb_prompt $"\
+		{pass "rerun to main" ; return 0}
+	    -re "$gdb_prompt $"\
+		{fail "rerun to main" ; return 0}
+	    timeout {fail "(timeout) rerun to main" ; return 0}
+	}
     }
-  }
 }
 
 # Return true if EXECUTABLE contains a .gdb_index or .debug_names index section.
@@ -9500,21 +9500,21 @@ gdb_caching_proc gdb_has_argv0 {} {
     file delete $obj
 
     if { !$result
-      && ([istarget *-*-linux*]
-	  || [istarget *-*-freebsd*] || [istarget *-*-kfreebsd*]
-	  || [istarget *-*-netbsd*] || [istarget *-*-knetbsd*]
-	  || [istarget *-*-openbsd*]
-	  || [istarget *-*-darwin*]
-	  || [istarget *-*-solaris*]
-	  || [istarget *-*-aix*]
-	  || [istarget *-*-gnu*]
-	  || [istarget *-*-cygwin*] || [istarget *-*-mingw32*]
-	  || [istarget *-*-*djgpp*] || [istarget *-*-go32*]
-	  || [istarget *-wince-pe] || [istarget *-*-mingw32ce*]
-	  || [istarget *-*-osf*]
-	  || [istarget *-*-dicos*]
-	  || [istarget *-*-*vms*]
-	  || [istarget *-*-lynx*178]) } {
+	 && ([istarget *-*-linux*]
+	     || [istarget *-*-freebsd*] || [istarget *-*-kfreebsd*]
+	     || [istarget *-*-netbsd*] || [istarget *-*-knetbsd*]
+	     || [istarget *-*-openbsd*]
+	     || [istarget *-*-darwin*]
+	     || [istarget *-*-solaris*]
+	     || [istarget *-*-aix*]
+	     || [istarget *-*-gnu*]
+	     || [istarget *-*-cygwin*] || [istarget *-*-mingw32*]
+	     || [istarget *-*-*djgpp*] || [istarget *-*-go32*]
+	     || [istarget *-wince-pe] || [istarget *-*-mingw32ce*]
+	     || [istarget *-*-osf*]
+	     || [istarget *-*-dicos*]
+	     || [istarget *-*-*vms*]
+	     || [istarget *-*-lynx*178]) } {
 	fail "argv\[0\] should be available on this target"
     }
 
@@ -9627,7 +9627,7 @@ proc gdb_gnu_strip_debug { dest args } {
     verbose "result is $result"
     verbose "output is $output"
     if {$result == 1} {
-      return 1
+	return 1
     }
 
     # Workaround PR binutils/10802:
@@ -9641,7 +9641,7 @@ proc gdb_gnu_strip_debug { dest args } {
     verbose "result is $result"
     verbose "output is $output"
     if {$result == 1} {
-      return 1
+	return 1
     }
 
     # If no-main is passed, strip the symbol for main from the separate
@@ -9733,7 +9733,7 @@ proc test_class_help { command_class expected_initial_lines {list_of_commands {}
 	"Type \"help\" followed by command name for full documentation\.[\r\n]+"
     }
     set l_entire_body [concat $expected_initial_lines $l_list_of_commands \
-		       $l_stock_body $help_list_trailer]
+			   $l_stock_body $help_list_trailer]
 
     help_test_raw "help ${command_class}" $l_entire_body $testname
 }
@@ -9766,8 +9766,8 @@ proc test_prefix_command_help { command_list expected_initial_lines args } {
     # Use 'list' and not just {} because we want variables to
     # be expanded in this list.
     set l_stock_body [list\
-	 "List of \"$full_command\" subcommands\:.*\[\r\n\]+"\
-	 "Type \"help $full_command\" followed by subcommand name for full documentation\.\[\r\n\]+"]
+			  "List of \"$full_command\" subcommands\:.*\[\r\n\]+"\
+			  "Type \"help $full_command\" followed by subcommand name for full documentation\.\[\r\n\]+"]
     set l_entire_body [concat $expected_initial_lines $l_stock_body $help_list_trailer]
     if {[llength $args]>0} {
 	help_test_raw "help ${command}" $l_entire_body [lindex $args 0]
@@ -10389,8 +10389,8 @@ gdb_caching_proc gdb_target_symbol_prefix {} {
     set result [catch {exec $objdump_program --syms $obj} output]
 
     if { $result == 0 \
-	&& ![regexp -lineanchor \
-	     { ([^ a-zA-Z0-9]*)main$} $output dummy prefix] } {
+	     && ![regexp -lineanchor \
+		      { ([^ a-zA-Z0-9]*)main$} $output dummy prefix] } {
 	verbose "gdb_target_symbol_prefix: Could not find main in objdump output; returning null prefix" 2
     }
 
@@ -10477,8 +10477,8 @@ gdb_caching_proc support_nested_function_tests {} {
 # prepended.  (See gdb_target_symbol_prefix, above.)
 
 proc gdb_target_symbol { symbol } {
-  set prefix [gdb_target_symbol_prefix]
-  return "${prefix}${symbol}"
+    set prefix [gdb_target_symbol_prefix]
+    return "${prefix}${symbol}"
 }
 
 # gdb_target_symbol_prefix_flags_asm returns a string that can be
@@ -10891,7 +10891,7 @@ proc gdb_debug_init { } {
     global gdb_prompt
 
     if {![gdb_debug_enabled]} {
-      return;
+	return;
     }
 
     # First ensure logging is off.
@@ -10904,7 +10904,7 @@ proc gdb_debug_init { } {
 
     global gdbdebug
     foreach entry [split $gdbdebug ,] {
-      send_gdb "set debug $entry 1\n"
+	send_gdb "set debug $entry 1\n"
     }
 
     # Now that everything is set, enable logging.
@@ -10955,7 +10955,7 @@ proc gdb_stdin_log_write { message {type standard} } {
 
     global in_file
     if {![info exists in_file]} {
-      return
+	return
     }
 
     # Check message types.
@@ -11071,7 +11071,7 @@ gdb_caching_proc supports_fcf_protection {} {
 	int main () {
 	    return 0;
 	}
-  } executable "additional_flags=-fcf-protection=full"]
+    } executable "additional_flags=-fcf-protection=full"]
 }
 
 # Return true if symbols were read in using -readnow.  Otherwise,
@@ -11489,20 +11489,20 @@ gdb_caching_proc have_avx {} {
 
     # Compile a test program.
     set src {
-       #include "nat/x86-cpuid.h"
+	#include "nat/x86-cpuid.h"
 
 	int main() {
-	  unsigned int eax, ebx, ecx, edx;
+	    unsigned int eax, ebx, ecx, edx;
 
-	if (!x86_cpuid (1, &eax, &ebx, &ecx, &edx)) {
-	  return 0;
-	}
+	    if (!x86_cpuid (1, &eax, &ebx, &ecx, &edx)) {
+		return 0;
+	    }
 
-	if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) {
-	  return 1;
-	} else {
-	  return 0;
-	}
+	    if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) {
+		return 1;
+	    } else {
+		return 0;
+	    }
 	}
     }
     set compile_flags "incdir=${srcdir}/.."
@@ -11526,49 +11526,49 @@ gdb_caching_proc have_avx {} {
 
 # Return 1 if target supports avx2, otherwise return 0.
 gdb_caching_proc have_avx2 {} {
-	global srcdir
+    global srcdir
 
-	set me "have_avx2"
-	if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } {
-	    verbose "$me: target does not support avx2, returning 0" 2
-	    return 0
-	}
+    set me "have_avx2"
+    if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } {
+	verbose "$me: target does not support avx2, returning 0" 2
+	return 0
+    }
 
-	# Compile a test program.
-	set src {
-	   #include "nat/x86-cpuid.h"
+    # Compile a test program.
+    set src {
+	#include "nat/x86-cpuid.h"
 
-	    int main() {
-	      unsigned int eax, ebx, ecx, edx;
+	int main() {
+	    unsigned int eax, ebx, ecx, edx;
 
 	    if (!x86_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx)) {
 		return 0;
 	    }
 
 	    if ((ebx & bit_AVX2) == bit_AVX2) {
-	      return 1;
+		return 1;
 	    } else {
-	      return 0;
-	    }
+		return 0;
 	    }
 	}
-	set compile_flags "incdir=${srcdir}/.."
-	if {![gdb_simple_compile $me $src executable $compile_flags]} {
-	    return 0
-	}
+    }
+    set compile_flags "incdir=${srcdir}/.."
+    if {![gdb_simple_compile $me $src executable $compile_flags]} {
+	return 0
+    }
 
-	set target_obj [gdb_remote_download target $obj]
-	set result [remote_exec target $target_obj]
-	set status [lindex $result 0]
-	set output [lindex $result 1]
-	if { $output != "" } {
-	    set status 0
-	}
+    set target_obj [gdb_remote_download target $obj]
+    set result [remote_exec target $target_obj]
+    set status [lindex $result 0]
+    set output [lindex $result 1]
+    if { $output != "" } {
+	set status 0
+    }
 
-	remote_file build delete $obj
+    remote_file build delete $obj
 
-	verbose "$me: returning $status" 2
-	return $status
+    verbose "$me: returning $status" 2
+    return $status
 }
 
 # Called as
@@ -11952,7 +11952,7 @@ gdb_caching_proc have_epilogue_line_info {} {
 	}
     }
     if {![gdb_simple_compile "simple_program" $main]} {
-	 return False
+	return False
     }
 
     clean_restart
-- 
2.51.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFC 5/5] [gdb/testsuite] Reformat gdb.ada
  2026-09-04  9:38 [RFC 1/5] [pre-commit] Add indent-exp Tom de Vries
                   ` (2 preceding siblings ...)
  2026-09-04  9:38 ` [RFC 4/5] [gdb/testsuite] Reformat lib/gdb.exp Tom de Vries
@ 2026-09-04  9:38 ` Tom de Vries
  3 siblings, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2026-09-04  9:38 UTC (permalink / raw)
  To: gdb-patches

The gdb/testsuite/gdb.ada directory was recently (Dec 2025) reindented by
commit 6779faa9cea ("Reindent gdb.ada tests").

So this is a good candidate to see the impact of the indent-exp approach.

Run:
...
$ pre-commit run \
    --hook-stage manual \
    indent-exp \
    --files $(find gdb/testsuite/gdb.ada -type f -name "*.exp*")
...

In gdb.ada/ptype_field.exp, a comment looking like this is fixed:
...
 # foo \
    #     bar
...
to:
...
 # foo \
 #     bar
...

The change results in excessive indentation in gdb.ada/var_shadowing.exp.
Manually fix this using:
...
-gdb_test "info locals" [multi_line \
+gdb_test "info locals" \
+    [multi_line \
...
and reformat the same test to be more typical.
---
 gdb/testsuite/gdb.ada/non-ascii-latin-3.exp |  2 +-
 gdb/testsuite/gdb.ada/ptype_field.exp       |  8 ++++----
 gdb/testsuite/gdb.ada/var_shadowing.exp     | 13 +++++++------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp b/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp
index fd4cd5f064c..8dd422cfb7b 100644
--- a/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp
+++ b/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp
@@ -67,4 +67,4 @@ gdb_test break_2 "Breakpoint $decimal .*" \
     "gdb_breakpoint: set breakpoint at func_ż"
 
 gdb_test print_3 "warning: charset conversion failure.*" \
-     "print var_𝕯"
+    "print var_𝕯"
diff --git a/gdb/testsuite/gdb.ada/ptype_field.exp b/gdb/testsuite/gdb.ada/ptype_field.exp
index e808b8492bb..4e326a7ca98 100644
--- a/gdb/testsuite/gdb.ada/ptype_field.exp
+++ b/gdb/testsuite/gdb.ada/ptype_field.exp
@@ -64,10 +64,10 @@ gdb_test "complete ptype pck.c" "ptype pck\\.circle"
 
 # We can't query the members of a package yet, and this yields a bit
 # too much output, so comment out for now instead of kfailing.
-# gdb_test "complete ptype pck." \
-    #     [multi_line \
-    # 	 "ptype pck\\.circle" \
-    # 	 "ptype pck\\.position"]
+# gdb_test "complete ptype pck." \#
+#     [multi_line \#
+# 	 "ptype pck\\.circle" \#
+# 	 "ptype pck\\.position"]
 
 gdb_test "complete ptype circle.pos." \
     [multi_line \
diff --git a/gdb/testsuite/gdb.ada/var_shadowing.exp b/gdb/testsuite/gdb.ada/var_shadowing.exp
index ffa96b049cf..468485b118f 100644
--- a/gdb/testsuite/gdb.ada/var_shadowing.exp
+++ b/gdb/testsuite/gdb.ada/var_shadowing.exp
@@ -20,7 +20,7 @@ require allow_ada_tests
 standard_ada_testfile var_shadowing
 
 if {[gdb_compile_ada "${srcfile}" "${binfile}" \
-    executable [list debug]] != "" } {
+	 executable [list debug]] != "" } {
     return
 }
 
@@ -32,8 +32,9 @@ set i_level3 [gdb_get_line_number "I-Level3"]
 set bp_location [gdb_get_line_number "BREAK"]
 runto "var_shadowing.adb:$bp_location"
 
-gdb_test "info locals" [multi_line \
-    "i = 111\t<$testfile.adb:$i_level3>"  \
-    "i = 11\t<$testfile.adb:$i_level2, shadowed>"  \
-    "i = 1\t<$testfile.adb:$i_level1, shadowed>"  \
-] "info locals at innermost level"
+gdb_test "info locals" \
+    [multi_line \
+	 "i = 111\t<$testfile.adb:$i_level3>"  \
+	 "i = 11\t<$testfile.adb:$i_level2, shadowed>"  \
+	 "i = 1\t<$testfile.adb:$i_level1, shadowed>"] \
+    "info locals at innermost level"
-- 
2.51.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-04  9:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04  9:38 [RFC 1/5] [pre-commit] Add indent-exp Tom de Vries
2026-09-04  9:38 ` [RFC 2/5] [gdb/testsuite] Make lib/gdb.exp emacs indent compatible Tom de Vries
2026-09-04  9:38 ` [RFC 3/5] [gdb/testsuite] Update regexp in string_to_regexp Tom de Vries
2026-09-04  9:38 ` [RFC 4/5] [gdb/testsuite] Reformat lib/gdb.exp Tom de Vries
2026-09-04  9:38 ` [RFC 5/5] [gdb/testsuite] Reformat gdb.ada Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox