public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] gdb/testsuite: Miscellaneous fixes
@ 2023-04-19 19:30 Sandra Loosemore
  2023-04-19 19:30 ` [PATCH 1/5] gdb/testsuite: Fix style.exp failures on targets without argc/argv support Sandra Loosemore
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Sandra Loosemore @ 2023-04-19 19:30 UTC (permalink / raw)
  To: gdb-patches

I've had most of these patches in our local GDB tree for some time, to
fix some broken tests we've encountered in testing our nios2-elf
toolchains and others we've seen in other toolchains too when testing
on remote Windows host.  Is it OK to push these to mainline?

-Sandra


Sandra Loosemore (5):
  gdb/testsuite: Fix style.exp failures on targets without argc/argv
    support
  gdb/testsuite: Fix style.exp failures on targets without libopcodes
    styling
  gdb/testsuite: Adjust some testcases to allow Windows pathnames
  gdb/testsuite: Disable some tests that are broken on remote Windows
    host
  gdb/testsuite: Make hook-stop.exp ignore termination message from GDB
    stub

 gdb/testsuite/gdb.base/bad-file.exp           |  6 +++
 gdb/testsuite/gdb.base/early-init-file.exp    |  6 +++
 .../gdb.base/empty-host-env-vars.exp          |  6 +++
 gdb/testsuite/gdb.base/hook-stop.exp          |  2 +-
 .../maint-expand-symbols-header-file.exp      |  4 +-
 gdb/testsuite/gdb.base/setshow.exp            | 14 +++--
 gdb/testsuite/gdb.base/style.exp              | 52 ++++++++++++++++---
 gdb/testsuite/gdb.dwarf2/dw2-filename.exp     |  2 +-
 gdb/testsuite/gdb.mi/mi-info-sources.exp      | 32 ++++++------
 9 files changed, 95 insertions(+), 29 deletions(-)

-- 
2.31.1


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

* [PATCH 1/5] gdb/testsuite: Fix style.exp failures on targets without argc/argv support
  2023-04-19 19:30 [PATCH 0/5] gdb/testsuite: Miscellaneous fixes Sandra Loosemore
@ 2023-04-19 19:30 ` Sandra Loosemore
  2023-04-19 19:30 ` [PATCH 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling Sandra Loosemore
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Sandra Loosemore @ 2023-04-19 19:30 UTC (permalink / raw)
  To: gdb-patches

Some embedded targets don't have full support for argc/argv.  argv
may print as "0x0" or as an address with a symbol name following.
This causes problems for the regexps in the style.exp line-wrapping
tests that assume it always prints as an ordinary address in backtrace
output.

This patch generalizes the regexps to handle these additional forms
and reworks some of the line-wrapping tests to account for the argv
address string being shorter or longer than a regular address.
---
 gdb/testsuite/gdb.base/style.exp | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 0370550d251..60f909e2402 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -92,7 +92,7 @@ proc run_style_tests { } {
 
 	set argv ""
 	gdb_test_multiple "frame" "frame without styling" {
-	    -re -wrap "main \\(argc=.*, (argv=$hex)\\).*style\\.c:\[0-9\].*" {
+	    -re -wrap "main \\(argc=.*, (argv=$hex.*)\\).*style\\.c:\[0-9\].*" {
 		set argv $expect_out(1,string)
 		pass $gdb_test_name
 	    }
@@ -105,9 +105,13 @@ proc run_style_tests { } {
 	set file_expr "$base_file_expr:\[0-9\]+"
 	set arg_expr [limited_style "arg." variable]
 
+	# On some embedded targets that don't fully support argc/argv,
+	# argv may print as "0x0" or as an address with a symbol name
+	# following, so use a regexp general enough to match that and
+	# do not make assumptions about how long the address string is.
 	gdb_test "frame" \
 	    [multi_line \
-		 "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+$arg_expr=$hex\\)\\s+at\\s+$file_expr" \
+		 "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+$arg_expr=$hex.*\\)\\s+at\\s+$file_expr" \
 		 "\[0-9\]+\\s+.*return.* break here .*"]
 	gdb_test "info breakpoints" "$main_expr at $file_expr.*"
 
@@ -134,16 +138,21 @@ proc run_style_tests { } {
 	    # the line listing; this is why the words from the source
 	    # code are spelled out in the final result line of the
 	    # test.
+	    set re0_styled \
+		[multi_line \
+		     "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+$arg_expr=$hex\\)" \
+		     "\\s+at\\s+$file_expr" \
+		     "\[0-9\]+\\s+.*return.* break here .*"]
 	    set re1_styled \
 		[multi_line \
 		     "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+" \
-		     "\\s+$arg_expr=$hex\\)" \
+		     "\\s+$arg_expr=$hex.*\\)" \
 		     "\\s+at\\s+$file_expr" \
 		     "\[0-9\]+\\s+.*return.* break here .*"]
 	    set re2_styled \
 		[multi_line \
 		     "#0\\s+$main_expr\\s+\\($arg_expr=.*" \
-		     "\\s+$arg_expr=$hex\\)\\s+at\\s+$file_expr" \
+		     "\\s+$arg_expr=$hex.*\\)\\s+at\\s+$file_expr" \
 		     "\[0-9\]+\\s+.*return.* break here .*"]
 
 	    # The length of the line containing argv containing:
@@ -152,7 +161,11 @@ proc run_style_tests { } {
 	    # - closing parenthesis
 	    set line_len [expr 4 + $argv_len + 1]
 
-	    if { $line_len > $width } {
+	    if { $argv == "argv=0x0" && $width >= 27 } {
+		# Embedded target with no argv support.
+		# #0  main (argc=0, argv=0x0)
+		set re_styled $re0_styled
+	    } elseif { $line_len > $width } {
 		# At on the next line.
 		set re_styled $re1_styled
 	    } else {
-- 
2.31.1


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

* [PATCH 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling
  2023-04-19 19:30 [PATCH 0/5] gdb/testsuite: Miscellaneous fixes Sandra Loosemore
  2023-04-19 19:30 ` [PATCH 1/5] gdb/testsuite: Fix style.exp failures on targets without argc/argv support Sandra Loosemore
@ 2023-04-19 19:30 ` Sandra Loosemore
  2023-04-21 14:37   ` Tom Tromey
  2023-04-19 19:30 ` [PATCH 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames Sandra Loosemore
  2023-04-19 19:30 ` [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host Sandra Loosemore
  3 siblings, 1 reply; 14+ messages in thread
From: Sandra Loosemore @ 2023-04-19 19:30 UTC (permalink / raw)
  To: gdb-patches

Do not expect disassembler output to be styled by libopcodes if GDB
reports the target does not support that.
---
 gdb/testsuite/gdb.base/style.exp | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 60f909e2402..d6ce48237e4 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -24,6 +24,29 @@ if {[build_executable "failed to build" $testfile $srcfile {debug macros}]} {
     return -1
 }
 
+# Check whether libopcodes styling is supported for this target.
+set have_libopcodes_styling 1
+proc test_for_libopcodes_styling {} {
+  global binfile
+  global have_libopcodes_styling
+  clean_restart ${binfile}
+
+  gdb_test_multiple "maint set libopcodes-styling enabled on" "" {
+      -re "^maint set libopcodes-styling enabled on\r\n"
+      {
+	  exp_continue
+      }
+      -re "Use of libopcodes styling not supported on architecture \[^\r\n\]+\r\n"
+      {
+	  set have_libopcodes_styling 0
+	  exp_continue
+      }
+     -re "^$::gdb_prompt $"
+      {
+      }
+  }
+}
+
 # The tests in this file are run multiple times with GDB's styles
 # disabled one at a time.  This variable is the style that is
 # currently disabled.
@@ -68,6 +91,7 @@ proc clean_restart_and_disable { prefix args } {
 proc run_style_tests { } {
     global testfile srcfile hex binfile
     global currently_disabled_style decimal hex
+    global have_libopcodes_styling
 
     save_vars { env(TERM) } {
 	# We need an ANSI-capable terminal to get the output.
@@ -195,7 +219,7 @@ proc run_style_tests { } {
 	# symbol will be styled.  However, if pygments is not being
 	# used then we can know how the symbol name will be styled.
 	set main [limited_style main function]
-	if { $::python_disassembly_styling } {
+	if { $::python_disassembly_styling || !$have_libopcodes_styling } {
 	    set func "some_called_function"
 	} else {
 	    set func [limited_style some_called_function function]
@@ -495,6 +519,9 @@ if {[allow_python_tests] && [gdb_py_module_available "pygments"]} {
     set python_disassembly_styling false
 }
 
+# Check to see if libopcodes styling is available for this target
+test_for_libopcodes_styling
+
 # Run tests with all styles in their default state.
 with_test_prefix "all styles enabled" {
     run_style_tests
-- 
2.31.1


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

* [PATCH 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames
  2023-04-19 19:30 [PATCH 0/5] gdb/testsuite: Miscellaneous fixes Sandra Loosemore
  2023-04-19 19:30 ` [PATCH 1/5] gdb/testsuite: Fix style.exp failures on targets without argc/argv support Sandra Loosemore
  2023-04-19 19:30 ` [PATCH 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling Sandra Loosemore
@ 2023-04-19 19:30 ` Sandra Loosemore
  2023-04-21 14:44   ` Tom Tromey
  2023-04-19 19:30 ` [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host Sandra Loosemore
  3 siblings, 1 reply; 14+ messages in thread
From: Sandra Loosemore @ 2023-04-19 19:30 UTC (permalink / raw)
  To: gdb-patches

This patch fixes some testcases that formerly had patterns with
hardwired "/" pathname separators in them, which broke when testing on
(remote) Windows host.
---
 .../maint-expand-symbols-header-file.exp      |  4 +--
 gdb/testsuite/gdb.base/setshow.exp            | 14 ++++++--
 gdb/testsuite/gdb.dwarf2/dw2-filename.exp     |  2 +-
 gdb/testsuite/gdb.mi/mi-info-sources.exp      | 32 +++++++++----------
 4 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
index d38d2ab7398..43b5aabea3c 100644
--- a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
+++ b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
@@ -40,13 +40,13 @@ gdb_test_no_output "maint info symtabs" $test
 gdb_test_no_output "maint expand-symtabs maint-expand-symbols-header-file.h"
 
 # Check that the include symtab was in fact expanded.
-set file_re "\[^\r\n\]*/maint-expand-symbols-header-file.h"
+set file_re "\[^\r\n\]*maint-expand-symbols-header-file.h"
 gdb_test "maint info symtabs" \
     "\r\n\t{ symtab $file_re \\(\\(struct symtab \\*\\) $hex\\)\r\n.*" \
     "check header file psymtab expansion"
 
 # Check that the symtab the include symtab was referring to was expanded.
-set file_re "\[^\r\n\]*/maint-expand-symbols-header-file.c"
+set file_re "\[^\r\n\]*maint-expand-symbols-header-file.c"
 gdb_test "maint info symtabs" \
     "\r\n\t{ symtab $file_re \\(\\(struct symtab \\*\\) $hex\\)\r\n.*" \
     "check source file psymtab expansion"
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index 86821ca1db0..6f8644af710 100644
--- a/gdb/testsuite/gdb.base/setshow.exp
+++ b/gdb/testsuite/gdb.base/setshow.exp
@@ -280,10 +280,18 @@ proc_with_prefix test_setshow_history {} {
 
     #get home directory path
     set HOME ""
+    set STRINGHOME ""
     set test "show environment HOME"
     gdb_test_multiple $test $test {
 	-re "\nHOME = (\[^\r\n\]*)\[\r\n\]+$::gdb_prompt $" {
 	    set HOME $expect_out(1,string)
+	    if { [ishost *-*-mingw*] } {
+	      # Backslashes in the pathname must be escaped for the patterns
+	      # that match quoted string output.
+	      regsub -all {\\} $HOME {\\\\} STRINGHOME
+	    } else {
+	      set STRINGHOME $HOME
+	    }
 	    pass $test
 	}
     }
@@ -294,13 +302,13 @@ proc_with_prefix test_setshow_history {} {
 
     #test show history filename ~/foobar.baz
     gdb_test "show history filename" \
-	"The filename in which to record the command history is \"[string_to_regexp $HOME]/foobar.baz\"..*" \
+	"The filename in which to record the command history is \"[string_to_regexp $HOME].foobar.baz\"..*" \
 	"show history filename (~/foobar.baz)"
     gdb_test "p \$_gdb_setting(\"history filename\")" \
-	" = \"[string_to_regexp $HOME]/foobar.baz\"..*" \
+	" = \"[string_to_regexp $STRINGHOME].foobar.baz\".*" \
 	"_gdb_setting history filename"
     gdb_test "p \$_gdb_setting_str(\"history filename\")" \
-	" = \"[string_to_regexp $HOME]/foobar.baz\"..*" \
+	" = \"[string_to_regexp $STRINGHOME].foobar.baz\".*" \
 	"_gdb_setting_str history filename"
 
     #get current working directory
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-filename.exp b/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
index 3bdac4c1cb8..c0ee3ac0d3f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-filename.exp
@@ -38,4 +38,4 @@ gdb_test "interpreter-exec mi -file-list-exec-source-files" \
     ".*{file=\"file1\\.txt\",fullname=\".+file1\\.txt\",debug-fully-read=\"\[^\"\]+\"}.*"
 
 # And `info sources' should return the fullname incl. the directories.
-gdb_test "info sources" {[/]file1\.txt.*}
+gdb_test "info sources" {.+file1\.txt.*}
diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.exp b/gdb/testsuite/gdb.mi/mi-info-sources.exp
index f639f3cdef9..3778ccb3fbe 100644
--- a/gdb/testsuite/gdb.mi/mi-info-sources.exp
+++ b/gdb/testsuite/gdb.mi/mi-info-sources.exp
@@ -118,16 +118,16 @@ proc check_info_sources { debug_fully_read } {
 		[mi_list "files" \
 		     ".*" \
 		     [mi_tuple "" \
-			  [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \
-			  [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \
+			  [mi_field "file" "\[^\"\]*mi-info-sources-base\\.c"] \
+			  [mi_field "fullname" "\[^\"\]+mi-info-sources-base\\.c"] \
 			  [mi_field "debug-fully-read" "${debug_fully_read}"]] \
 		     ".*"]
 	    set p2 \
 		[mi_list "files" \
 		     ".*" \
 		     [mi_tuple "" \
-			  [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \
-			  [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \
+			  [mi_field "file" "\[^\"\]*mi-info-sources\\.c"] \
+			  [mi_field "fullname" "\[^\"\]+mi-info-sources\\.c"] \
 			  [mi_field "debug-fully-read" "true"]] \
 		     ".*"]
 	} else {
@@ -135,16 +135,16 @@ proc check_info_sources { debug_fully_read } {
 		[mi_list "files" \
 		     ".*" \
 		     [mi_tuple "" \
-			  [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \
-			  [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \
+			  [mi_field "file" "\[^\"\]*mi-info-sources\\.c"] \
+			  [mi_field "fullname" "\[^\"\]+mi-info-sources\\.c"] \
 			  [mi_field "debug-fully-read" "true"]] \
 		     ".*"]
 	    set p2 \
 		[mi_list "files" \
 		     ".*" \
 		     [mi_tuple "" \
-			  [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \
-			  [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \
+			  [mi_field "file" "\[^\"\]*mi-info-sources-base\\.c"] \
+			  [mi_field "fullname" "\[^\"\]+mi-info-sources-base\\.c"] \
 			  [mi_field "debug-fully-read" "${debug_fully_read}"]] \
 		     ".*"]
 	}
@@ -156,8 +156,8 @@ proc check_info_sources { debug_fully_read } {
 
 	set p [mi_list "files" \
 		   [mi_tuple "" \
-			[mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \
-			[mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \
+			[mi_field "file" "\[^\"\]*mi-info-sources-base\\.c"] \
+			[mi_field "fullname" "\[^\"\]+mi-info-sources-base\\.c"] \
 			[mi_field "debug-fully-read" "${debug_fully_read}"]]]
 	mi_gdb_test "-file-list-exec-source-files --basename -- base" ".*\\^done,${p}" \
 	    "-file-list-exec-source-files --basename -- base"
@@ -171,13 +171,13 @@ proc check_info_sources { debug_fully_read } {
 
 	set p [mi_list "files" \
 		   [mi_tuple "" \
-			[mi_field "filename" "\[^\"\]+/mi-info-sources(\.debug)?"] \
+			[mi_field "filename" "\[^\"\]+mi-info-sources(\.debug)?"] \
 			[mi_field "debug-info" "${debug_info}"] \
 			[mi_list "sources" \
 			     ".*" \
 			     [mi_tuple "" \
-				  [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \
-				  [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \
+				  [mi_field "file" "\[^\"\]*mi-info-sources\\.c"] \
+				  [mi_field "fullname" "\[^\"\]+mi-info-sources\\.c"] \
 				  [mi_field "debug-fully-read" "true"]] \
 			     ".*"]]]
 	mi_gdb_test "-file-list-exec-source-files --group-by-objfile" \
@@ -186,13 +186,13 @@ proc check_info_sources { debug_fully_read } {
 
 	set p [mi_list "files" \
 		   [mi_tuple "" \
-			[mi_field "filename" "\[^\"\]+/mi-info-sources(\.debug)?"] \
+			[mi_field "filename" "\[^\"\]+mi-info-sources(\.debug)?"] \
 			[mi_field "debug-info" "${debug_info}"] \
 			[mi_list "sources" \
 			     ".*" \
 			     [mi_tuple "" \
-				  [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \
-				  [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \
+				  [mi_field "file" "\[^\"\]*mi-info-sources-base\\.c"] \
+				  [mi_field "fullname" "\[^\"\]+mi-info-sources-base\\.c"] \
 				  [mi_field "debug-fully-read" "${debug_fully_read}"]] \
 			     ".*"]]]
 	mi_gdb_test "-file-list-exec-source-files --group-by-objfile" \
-- 
2.31.1


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

* [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host
  2023-04-19 19:30 [PATCH 0/5] gdb/testsuite: Miscellaneous fixes Sandra Loosemore
                   ` (2 preceding siblings ...)
  2023-04-19 19:30 ` [PATCH 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames Sandra Loosemore
@ 2023-04-19 19:30 ` Sandra Loosemore
  2023-04-21 14:46   ` Tom Tromey
  2023-04-21 14:52   ` Tom Tromey
  3 siblings, 2 replies; 14+ messages in thread
From: Sandra Loosemore @ 2023-04-19 19:30 UTC (permalink / raw)
  To: gdb-patches

These testcases assume host==build or that the remote host has a Posix
shell to run commands in.  Don't try to run them if that's not the case.
---
 gdb/testsuite/gdb.base/bad-file.exp            | 6 ++++++
 gdb/testsuite/gdb.base/early-init-file.exp     | 6 ++++++
 gdb/testsuite/gdb.base/empty-host-env-vars.exp | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/gdb/testsuite/gdb.base/bad-file.exp b/gdb/testsuite/gdb.base/bad-file.exp
index 5d8dfee8fea..98101d9e15a 100644
--- a/gdb/testsuite/gdb.base/bad-file.exp
+++ b/gdb/testsuite/gdb.base/bad-file.exp
@@ -20,6 +20,12 @@
 # print different text then the plan is to update the expected text
 # instead of making this test linux-only or some such.
 
+# The pathnames and shell commands in this test don't work on Windows host.
+if { [is_remote host] && [ishost *-*-mingw*] } {
+    untested "does not work on remote Windows host"
+    return 0
+}
+
 # There is no such file, but we still use the normal mechanism to pick
 # its name and path.
 standard_testfile
diff --git a/gdb/testsuite/gdb.base/early-init-file.exp b/gdb/testsuite/gdb.base/early-init-file.exp
index fcd1ff041a1..0bb2c456a3e 100644
--- a/gdb/testsuite/gdb.base/early-init-file.exp
+++ b/gdb/testsuite/gdb.base/early-init-file.exp
@@ -15,6 +15,12 @@
 
 # Test GDB's early init file mechanism.
 
+# Test assumes host == build.
+if {[is_remote host]} {
+    untested "does not work on remote host"
+    return 0
+}
+
 standard_testfile
 
 # Compile the test executable.
diff --git a/gdb/testsuite/gdb.base/empty-host-env-vars.exp b/gdb/testsuite/gdb.base/empty-host-env-vars.exp
index 96240311c24..a28798ff69a 100644
--- a/gdb/testsuite/gdb.base/empty-host-env-vars.exp
+++ b/gdb/testsuite/gdb.base/empty-host-env-vars.exp
@@ -13,6 +13,12 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# This test assumes host == build.
+if {[is_remote host]} {
+    untested "does not work on remote host"
+    return 0
+}
+
 # GDB reads some environment variables on startup, make sure it behaves
 # correctly if these variables are defined but empty.
 
-- 
2.31.1


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

* Re: [PATCH 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling
  2023-04-19 19:30 ` [PATCH 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling Sandra Loosemore
@ 2023-04-21 14:37   ` Tom Tromey
  2023-04-21 19:15     ` Sandra Loosemore
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Tromey @ 2023-04-21 14:37 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: gdb-patches

>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:

Sandra> Do not expect disassembler output to be styled by libopcodes if GDB
Sandra> reports the target does not support that.

Sandra> +# Check whether libopcodes styling is supported for this target.
Sandra> +set have_libopcodes_styling 1
Sandra> +proc test_for_libopcodes_styling {} {
Sandra> +  global binfile
Sandra> +  global have_libopcodes_styling
Sandra> +  clean_restart ${binfile}
Sandra> +
Sandra> +  gdb_test_multiple "maint set libopcodes-styling enabled on" "" {
Sandra> +      -re "^maint set libopcodes-styling enabled on\r\n"
Sandra> +      {

The Tcl style usually puts the "{" at the end of the previous line.

Here it may not matter, so it's just stylistic.  However due to Tcl's
unusual lexing, it does matter in some spots, so IMO it's best to be
consistent.

Tcl represents the ultimate achievement of a certain style -- they
managed to enforce "{" placement in the language.  If only GNU were so
enterprising.

Tom

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

* Re: [PATCH 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames
  2023-04-19 19:30 ` [PATCH 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames Sandra Loosemore
@ 2023-04-21 14:44   ` Tom Tromey
  2023-04-21 19:26     ` Sandra Loosemore
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Tromey @ 2023-04-21 14:44 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: gdb-patches

>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:

Sandra> This patch fixes some testcases that formerly had patterns with
Sandra> hardwired "/" pathname separators in them, which broke when testing on
Sandra> (remote) Windows host.

Sandra> +    set STRINGHOME ""
Sandra>      set test "show environment HOME"
Sandra>      gdb_test_multiple $test $test {
Sandra>  	-re "\nHOME = (\[^\r\n\]*)\[\r\n\]+$::gdb_prompt $" {
Sandra>  	    set HOME $expect_out(1,string)
Sandra> +	    if { [ishost *-*-mingw*] } {
Sandra> +	      # Backslashes in the pathname must be escaped for the patterns
Sandra> +	      # that match quoted string output.
Sandra> +	      regsub -all {\\} $HOME {\\\\} STRINGHOME

I don't understand this one, because the uses all use string_to_regexp.
But if the computed value of HOME doesn't work in that context, then it
seems like that means there is a bug in string_to_regexp, because the
contract of string_to_regexp is to return a regexp that will exactly
match the input, no matter what it is.

Sandra> -	"The filename in which to record the command history is \"[string_to_regexp $HOME]/foobar.baz\"..*" \
Sandra> +	"The filename in which to record the command history is \"[string_to_regexp $HOME].foobar.baz\"..*" \

Also why didn't this one need to be changed?  (Though if there really is
a bug in string_to_regexp then it's irrelevant.)

Tom

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

* Re: [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host
  2023-04-19 19:30 ` [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host Sandra Loosemore
@ 2023-04-21 14:46   ` Tom Tromey
  2023-04-21 14:52   ` Tom Tromey
  1 sibling, 0 replies; 14+ messages in thread
From: Tom Tromey @ 2023-04-21 14:46 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: gdb-patches

>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:

Sandra> These testcases assume host==build or that the remote host has a Posix
Sandra> shell to run commands in.  Don't try to run them if that's not the case.
 
Sandra> +# The pathnames and shell commands in this test don't work on Windows host.
Sandra> +if { [is_remote host] && [ishost *-*-mingw*] } {
Sandra> +    untested "does not work on remote Windows host"
Sandra> +    return 0

I guess this spot can't really use 'require' but the other ones could.

Tom

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

* Re: [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host
  2023-04-19 19:30 ` [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host Sandra Loosemore
  2023-04-21 14:46   ` Tom Tromey
@ 2023-04-21 14:52   ` Tom Tromey
  2023-04-21 19:33     ` Sandra Loosemore
  1 sibling, 1 reply; 14+ messages in thread
From: Tom Tromey @ 2023-04-21 14:52 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: gdb-patches

>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:

Sandra> +# The pathnames and shell commands in this test don't work on Windows host.
Sandra> +if { [is_remote host] && [ishost *-*-mingw*] } {

It belatedly occurred to me to wonder if the "is_remote host" part is needed.
Like, would this work on native Windows but just not cross Windows?

Tom

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

* Re: [PATCH 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling
  2023-04-21 14:37   ` Tom Tromey
@ 2023-04-21 19:15     ` Sandra Loosemore
  0 siblings, 0 replies; 14+ messages in thread
From: Sandra Loosemore @ 2023-04-21 19:15 UTC (permalink / raw)
  To: Tom Tromey, Sandra Loosemore; +Cc: gdb-patches

On 4/21/23 08:37, Tom Tromey wrote:
>>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:
> 
> Sandra> Do not expect disassembler output to be styled by libopcodes if GDB
> Sandra> reports the target does not support that.
> 
> Sandra> +# Check whether libopcodes styling is supported for this target.
> Sandra> +set have_libopcodes_styling 1
> Sandra> +proc test_for_libopcodes_styling {} {
> Sandra> +  global binfile
> Sandra> +  global have_libopcodes_styling
> Sandra> +  clean_restart ${binfile}
> Sandra> +
> Sandra> +  gdb_test_multiple "maint set libopcodes-styling enabled on" "" {
> Sandra> +      -re "^maint set libopcodes-styling enabled on\r\n"
> Sandra> +      {
> 
> The Tcl style usually puts the "{" at the end of the previous line.
> 
> Here it may not matter, so it's just stylistic.  However due to Tcl's
> unusual lexing, it does matter in some spots, so IMO it's best to be
> consistent.
> 
> Tcl represents the ultimate achievement of a certain style -- they
> managed to enforce "{" placement in the language.  If only GNU were so
> enterprising.

Ack, I will fix this and resubmit this piece.  I don't write TCL often 
enough to remember all these things....

-Sandra

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

* Re: [PATCH 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames
  2023-04-21 14:44   ` Tom Tromey
@ 2023-04-21 19:26     ` Sandra Loosemore
  2023-04-22  0:11       ` Tom Tromey
  0 siblings, 1 reply; 14+ messages in thread
From: Sandra Loosemore @ 2023-04-21 19:26 UTC (permalink / raw)
  To: Tom Tromey, Sandra Loosemore; +Cc: gdb-patches

On 4/21/23 08:44, Tom Tromey wrote:
>>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:
> 
> Sandra> This patch fixes some testcases that formerly had patterns with
> Sandra> hardwired "/" pathname separators in them, which broke when testing on
> Sandra> (remote) Windows host.
> 
> Sandra> +    set STRINGHOME ""
> Sandra>      set test "show environment HOME"
> Sandra>      gdb_test_multiple $test $test {
> Sandra>  	-re "\nHOME = (\[^\r\n\]*)\[\r\n\]+$::gdb_prompt $" {
> Sandra>  	    set HOME $expect_out(1,string)
> Sandra> +	    if { [ishost *-*-mingw*] } {
> Sandra> +	      # Backslashes in the pathname must be escaped for the patterns
> Sandra> +	      # that match quoted string output.
> Sandra> +	      regsub -all {\\} $HOME {\\\\} STRINGHOME
> 
> I don't understand this one, because the uses all use string_to_regexp.
> But if the computed value of HOME doesn't work in that context, then it
> seems like that means there is a bug in string_to_regexp, because the
> contract of string_to_regexp is to return a regexp that will exactly
> match the input, no matter what it is.

The output of the two commands it is trying to match using STRINGHOME 
(as opposed to HOME) is

p $_gdb_setting("history filename")
$1 = "C:\\cygwin\\home\\sandra/foobar.baz"

p $_gdb_setting_str("history filename")
$2 = "C:\\cygwin\\home\\sandra/foobar.baz"

E.g., the output is printed with C string syntax, in which every 
backslash is doubled.  So the thing passed to string_to_regexp also 
needs to have doubled backslashes.

> 
> Sandra> -	"The filename in which to record the command history is \"[string_to_regexp $HOME]/foobar.baz\"..*" \
> Sandra> +	"The filename in which to record the command history is \"[string_to_regexp $HOME].foobar.baz\"..*" \
> 
> Also why didn't this one need to be changed?  (Though if there really is
> a bug in string_to_regexp then it's irrelevant.)

Because in this case the output it is trying to match does is *not* 
printed with C string escapes in spite of the surrounding quotes.

Maybe this just needs more comments?  Or is there a utility function to 
add C escapes to a string that should be used on non-Windows hosts too?

-Sandra

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

* Re: [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host
  2023-04-21 14:52   ` Tom Tromey
@ 2023-04-21 19:33     ` Sandra Loosemore
  2023-04-22  0:11       ` Tom Tromey
  0 siblings, 1 reply; 14+ messages in thread
From: Sandra Loosemore @ 2023-04-21 19:33 UTC (permalink / raw)
  To: Tom Tromey, Sandra Loosemore; +Cc: gdb-patches

On 4/21/23 08:52, Tom Tromey wrote:
>>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:
> 
> Sandra> +# The pathnames and shell commands in this test don't work on Windows host.
> Sandra> +if { [is_remote host] && [ishost *-*-mingw*] } {
> 
> It belatedly occurred to me to wonder if the "is_remote host" part is needed.
> Like, would this work on native Windows but just not cross Windows?

Is it even possible to run the testsuite on native Windows without being 
inside Cygwin or some similar environment?  :-S  We don't do that here, 
anyway -- only Canadian-cross with remote Windows host.

-Sandra

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

* Re: [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host
  2023-04-21 19:33     ` Sandra Loosemore
@ 2023-04-22  0:11       ` Tom Tromey
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Tromey @ 2023-04-22  0:11 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: Tom Tromey, Sandra Loosemore, gdb-patches

>> Like, would this work on native Windows but just not cross Windows?

Sandra> Is it even possible to run the testsuite on native Windows without
Sandra> being inside Cygwin or some similar environment?  :-S

I have no idea, I've never managed to get the gdb test suite working at
all on Windows.  Though to be clear I haven't tried very hard.

Tom

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

* Re: [PATCH 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames
  2023-04-21 19:26     ` Sandra Loosemore
@ 2023-04-22  0:11       ` Tom Tromey
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Tromey @ 2023-04-22  0:11 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: Tom Tromey, Sandra Loosemore, gdb-patches

Sandra> The output of the two commands it is trying to match using STRINGHOME
Sandra> (as opposed to HOME) is

Sandra> p $_gdb_setting("history filename")
Sandra> $1 = "C:\\cygwin\\home\\sandra/foobar.baz"

Sandra> p $_gdb_setting_str("history filename")
Sandra> $2 = "C:\\cygwin\\home\\sandra/foobar.baz"

Ok, I get it now.  Thanks.

Sandra> Maybe this just needs more comments?  Or is there a utility function
Sandra> to add C escapes to a string that should be used on non-Windows hosts
Sandra> too?

I think a comment by the setting of STRINGHOME would be great.

Tom

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

end of thread, other threads:[~2023-04-22  0:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 19:30 [PATCH 0/5] gdb/testsuite: Miscellaneous fixes Sandra Loosemore
2023-04-19 19:30 ` [PATCH 1/5] gdb/testsuite: Fix style.exp failures on targets without argc/argv support Sandra Loosemore
2023-04-19 19:30 ` [PATCH 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling Sandra Loosemore
2023-04-21 14:37   ` Tom Tromey
2023-04-21 19:15     ` Sandra Loosemore
2023-04-19 19:30 ` [PATCH 3/5] gdb/testsuite: Adjust some testcases to allow Windows pathnames Sandra Loosemore
2023-04-21 14:44   ` Tom Tromey
2023-04-21 19:26     ` Sandra Loosemore
2023-04-22  0:11       ` Tom Tromey
2023-04-19 19:30 ` [PATCH 4/5] gdb/testsuite: Disable some tests that are broken on remote Windows host Sandra Loosemore
2023-04-21 14:46   ` Tom Tromey
2023-04-21 14:52   ` Tom Tromey
2023-04-21 19:33     ` Sandra Loosemore
2023-04-22  0:11       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).