public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Make environ.exp run on all platforms (and create info-program.exp)
@ 2017-03-31 17:29 Sergio Durigan Junior
  2017-04-12 23:30 ` Sergio Durigan Junior
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-03-31 17:29 UTC (permalink / raw)
  To: GDB Patches; +Cc: Sergio Durigan Junior

This has been on my TODO list for a while.  There's a really old bug
about this (PR testsuite/8595), and there was no reason for
environ.exp to be specific for hppa* targets.  So this patch removes
this constraint, modernizes the testcase, and cleans up some things.
Most of the tests remained, and some were rewritten (especially the
one that checks if "show environment" works, which is something kind
of hard to do).

As a bonus, I'm adding a separated info-program.exp file containing
all the tests related to "info program" that were present on
environ.exp.

Tested locally, everything still passes.

gdb/testsuite/ChangeLog:
2017-03-31  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR testsuite/8595
	* gdb.base/environ.exp: Make test available in all architectures.
	Move bits related to "info program" testing to
	gdb.base/info-program.exp.  Rewrite tests to use the two new
	procedures mentione below.
	(test_set_show_env_var) New procedure.
	(test_set_show_env_var_equal): Likewise.
	* gdb.base/info-program.exp: New file.
---
 gdb/testsuite/ChangeLog                 |  11 ++
 gdb/testsuite/gdb.base/environ.exp      | 302 ++++++--------------------------
 gdb/testsuite/gdb.base/info-program.exp |  45 +++++
 3 files changed, 105 insertions(+), 253 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/info-program.exp

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index eb543eb..98901a0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2017-03-31  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR testsuite/8595
+	* gdb.base/environ.exp: Make test available in all architectures.
+	Move bits related to "info program" testing to
+	gdb.base/info-program.exp.  Rewrite tests to use the two new
+	procedures mentione below.
+	(test_set_show_env_var) New procedure.
+	(test_set_show_env_var_equal): Likewise.
+	* gdb.base/info-program.exp: New file.
+
 2017-03-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* gdb.python/py-section-script.exp (sepdebug): New testcases.
diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index a833f79..5ea5626 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -13,297 +13,93 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#
-# test running programs
-#
+gdb_start
 
-# This test exists solely to exercise the "environment" commands for
-# code-coverage on HP-UX.
-#
-if ![istarget "hppa*-*-hpux*"] then {
-  return
-}
-
-standard_testfile break.c break1.c
-
-if {[prepare_for_testing "failed to prepare" $testfile \
-	 [list $srcfile $srcfile2] {debug nowarnings}]} {
-    return -1
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
-
-# (No, this is not really related to the environment commands.  But it's
-# a convenient place to verify that this command works.)
-#
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
-          {pass "info program"}
-  -re "$gdb_prompt $"\
-          {fail "info program"}
-  timeout {fail "(timeout) info program"}
-}
-
-# We don't really care where this step lands, so long as it gets
-# the inferior pushed off the breakpoint it's currently on...
-#
-send_gdb "next\n"
-gdb_expect {
-  -re ".*$gdb_prompt $"\
-          {pass "step before info program"}
-  timeout {fail "(timeout) step before info program"}
+proc test_set_show_env_var { name value test_name } {
+    gdb_test_no_output "set environment $name $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped after being stepped..*$gdb_prompt $"\
-          {pass "info program after step"}
-  -re "$gdb_prompt $"\
-          {fail "info program after step"}
-  timeout {fail "(timeout) info program after step"}
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
 
-send_gdb "delete\n"
-gdb_expect {
-  -re ".*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re ".*$gdb_prompt $"\
-                     {pass "delete breakpoint before info program"}
-             timeout {fail "(timeout) delete breakpoint before info program"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "delete breakpoint before info program"}
-  timeout {fail "(timeout) delete breakpoint before info program"}
-}
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at a breakpoint that has since been deleted..*$gdb_prompt $"\
-          {pass "info program after deleted breakpoint"}
-  -re "$gdb_prompt $"\
-          {fail "info program after deleted breakpoint"}
-  timeout {fail "(timeout) info program after deleted breakpoint"}
+proc test_set_show_env_var_equal { name value test_name } {
+    gdb_test_no_output "set environment $name = $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
 
 # Verify that we can show all currently-set environment variables.
-# (It's a bit hacky, but nonetheless probably safe to check for at
-# least the SHELL variable.)
-#
-# need to increase timeout because of very long output
-set oldtimeout $timeout
-set timeout [expr "$timeout + 300"]
-
-send_gdb "show environment\n"
-gdb_expect {
-  -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
-          {pass "show environment"}
-  -re "$gdb_prompt $"\
-          {fail "show environment"}
-  timeout {fail "(timeout) show environment"}
-}
-set timeout $oldtimeout
+# It's hard to do this verification since we can't really compare each
+# entry with the current environment.  So we just check to see if
+# there is anything that looks like an environment variable being
+# printed.
+gdb_test "show environment" "(\[A-Za-z_\]\[A-Za-z0-9_\]*=.*\r\n)+" \
+    "show environment works"
 
 # Verify that we can unset a specific environment variable.
-#
-send_gdb "unset environment EDITOR\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue unset environment"}
-  timeout {fail "(timeout) issue unset environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "Environment variable \"EDITOR\" not defined.\r\n$gdb_prompt $"\
-          {pass "unset environment"}
-  -re "$gdb_prompt $"\
-          {fail "unset environment"}
-  timeout {fail "(timeout) unset environment"}
-}
+gdb_test_no_output "unset environment EDITOR" "unset environment variable"
+
+gdb_test "show environment EDITOR" "Environment variable \"EDITOR\" not defined\." \
+    "confirm unset environment variable worked"
 
 # Verify that we can unset all environment variables.
-#
-send_gdb "unset environment\n"
-gdb_expect {
-  -re "Delete all environment variables.*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re "$gdb_prompt $"\
-                     {pass "unset entire environment"}
-             timeout {fail "(timeout) unset entire environment"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "unset entire environment"}
-  timeout {fail "(timeout) unset entire environment"}
+set msg "unset all environment variables"
+gdb_test_multiple "unset environment" $msg {
+    -re "Delete all environment variables.*y or n.*$" {
+	gdb_test_no_output "y" $msg
+    }
+    -re "$gdb_prompt $" {
+	fail $msg
+    }
 }
 
 # Verify that we can set a specific environment variable.
-#
-send_gdb "set environment EDITOR emacs\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment"}
-  timeout {fail "(timeout) issue set environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = emacs\r\n$gdb_prompt $"\
-          {pass "set environment"}
-  -re "$gdb_prompt $"\
-          {fail "set environment"}
-  timeout {fail "(timeout) set environment"}
-}
+test_set_show_env_var "EDITOR" "emacs" "set environment variable"
 
 # Verify that GDB responds gracefully to a request to set environment,
 # with no variable name.
-#
-send_gdb "set environment\n"
-gdb_expect {
-  -re "Argument required .environment variable and value..*$gdb_prompt $"\
-          {pass "set environment without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable disallowed"}
-  timeout {fail "(timeout) set environment without variable disallowed"}
-}
+gdb_test "set environment" "Argument required \\\(environment variable and value\\\)\." \
+    "set environment without arguments"
 
 # I'm not sure just what GDB has in mind in explicitly checking
 # for this variant, but since GDB handles it, test it.
-#
-send_gdb "set environment =\n"
-gdb_expect {
-  -re "Argument required .environment variable to set..*$gdb_prompt $"\
-          {pass "set environment equals without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment equals without variable disallowed"}
-  timeout {fail "(timeout) set environment equals without variable disallowed"}
-}
+gdb_test "set environment =" "Argument required \\\(environment variable to set\\\)\." \
+    "set environment without variable name"
 
 # Setting an environment variable without a value sets it to a NULL
 # value.
-#
-send_gdb "set environment EDITOR\n"
-gdb_expect {
-  -re "Setting environment variable \"EDITOR\" to null value..*$gdb_prompt $"\
-          {pass "issue set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "issue set environment without variable value"}
-  timeout {fail "(timeout) issue set environment without variable value"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = \r\n$gdb_prompt $"\
-          {pass "set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable value"}
-  timeout {fail "(timeout) set environment without variable value"}
-}
+gdb_test "set environment EDITOR" "Setting environment variable \"EDITOR\" to null value\." \
+    "set environment variable to null value"
+gdb_test "show environment EDITOR" "EDITOR = " "show null environment variable"
 
 # Verify that GDB responds gracefully to an attempt to show a
 # non-existent environment variable.  (We hope this variable is
 # undefined!)
-#
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined..*$gdb_prompt $"\
-          {pass "show non-existent environment variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "show non-existent environment variable disallowed"}
-  timeout {fail "(timeout) show non-existent environment variable disallowed"}
-}
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined\." \
+    "show non-existent environment variable"
 
 # Verify that GDB can set an environment variable hitherto undefined.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment for previously undefined variable"}
-  timeout {fail "(timeout) issue set environment for previously undefined variable"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment for previously undefined variable"}
-  -re "$gdb_prompt $"\
-          {fail "set environment for previously undefined variable"}
-  timeout {fail "(timeout) set environment for previously undefined variable"}
-}
+test_set_show_env_var "FOOBARBAZGRUNGESPAZBALL" "t" \
+    "set environment variable previously undefined"
 
 # Verify that GDB can also set an environment variable using the "="
 # syntax.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL = t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with equals"}
-  timeout {fail "(timeout) issue set environment with equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment with equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with equals"}
-  timeout {fail "(timeout) set environment with equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "y" \
+    "set environment variable using = syntax"
 
 # Verify that GDB can set an environment variable to a value that has
 # an embedded (trailing, in this case) equals.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t=\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with trailing equals"}
-  timeout {fail "(timeout) issue set environment with trailing equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t=\r\n$gdb_prompt $"\
-          {pass "set environment with trailing equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with trailing equals"}
-  timeout {fail "(timeout) set environment with trailing equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "t=" \
+    "set environment variable with trailing equals"
 
 # Verify that GDB can set an environment variable to a value preceded
 # by whitespace, and that such whitespace is ignored (not included
 # in the set value).
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL =     foo\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with preceding whitespace"}
-  timeout {fail "(timeout) issue set environment with preceding whitespace"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = foo\r\n$gdb_prompt $"\
-          {pass "set environment with preceding whitespace"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with preceding whitespace"}
-  timeout {fail "(timeout) set environment with preceding whitespace"}
-}
-
-# Verify that GDB can manipulate the distinguished PATH variable.
-#
-send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "issue path"}
-  -re "$gdb_prompt $"\
-          {fail "issue path"}
-  timeout {fail "(timeout) issue path"}
-}
-send_gdb "show paths\n"
-gdb_expect {
-  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "show paths"}
-  -re "$gdb_prompt $"\
-          {fail "show paths"}
-  timeout {fail "(timeout) show paths"}
-}
+gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL =        foo" \
+    "set environment variable with trailing whitespace"
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "FOOBARBAZGRUNGESPAZBALL = foo" \
+    "confirm set environment variable with trailing whitespace"
 
 gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
new file mode 100644
index 0000000..a24a654
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-program.exp
@@ -0,0 +1,45 @@
+# Copyright 2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile normal.c
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+    return -1
+}
+
+if { ![runto_main] } {
+    fail "can't run to main"
+    return -1
+}
+
+gdb_test "info program" "\tUsing the running image of child process $decimal\.\r\nProgram stopped at $hex\.\r\nIt stopped at breakpoint $decimal\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after run to main"
+
+# We don't really care where this step lands, so long as it gets
+# the inferior pushed off the breakpoint it's currently on...
+gdb_test "next" "$decimal\t.*" "advancing pc"
+
+gdb_test "info program" "\tUsing the running image of child process $decimal\.\r\nProgram stopped at $hex\.\r\nIt stopped after being stepped\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after next"
+
+if { ![runto_main] } then {
+    fail "can't restart program"
+    return -1
+}
+
+delete_breakpoints
+
+gdb_test "info program" "\tUsing the running image of child process $decimal\.\r\nProgram stopped at $hex\.\r\nIt stopped at a breakpoint that has since been deleted\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after deleting all breakpoints"
-- 
2.9.3

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

* Re: [PATCH] Make environ.exp run on all platforms (and create info-program.exp)
  2017-03-31 17:29 [PATCH] Make environ.exp run on all platforms (and create info-program.exp) Sergio Durigan Junior
@ 2017-04-12 23:30 ` Sergio Durigan Junior
  2017-04-13 14:35 ` Luis Machado
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-04-12 23:30 UTC (permalink / raw)
  To: GDB Patches

On Friday, March 31 2017, I wrote:

> This has been on my TODO list for a while.  There's a really old bug
> about this (PR testsuite/8595), and there was no reason for
> environ.exp to be specific for hppa* targets.  So this patch removes
> this constraint, modernizes the testcase, and cleans up some things.
> Most of the tests remained, and some were rewritten (especially the
> one that checks if "show environment" works, which is something kind
> of hard to do).
>
> As a bonus, I'm adding a separated info-program.exp file containing
> all the tests related to "info program" that were present on
> environ.exp.
>
> Tested locally, everything still passes.

Ping.

> gdb/testsuite/ChangeLog:
> 2017-03-31  Sergio Durigan Junior  <sergiodj@redhat.com>
>
> 	PR testsuite/8595
> 	* gdb.base/environ.exp: Make test available in all architectures.
> 	Move bits related to "info program" testing to
> 	gdb.base/info-program.exp.  Rewrite tests to use the two new
> 	procedures mentione below.
> 	(test_set_show_env_var) New procedure.
> 	(test_set_show_env_var_equal): Likewise.
> 	* gdb.base/info-program.exp: New file.
> ---
>  gdb/testsuite/ChangeLog                 |  11 ++
>  gdb/testsuite/gdb.base/environ.exp      | 302 ++++++--------------------------
>  gdb/testsuite/gdb.base/info-program.exp |  45 +++++
>  3 files changed, 105 insertions(+), 253 deletions(-)
>  create mode 100644 gdb/testsuite/gdb.base/info-program.exp
>
> diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
> index eb543eb..98901a0 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,14 @@
> +2017-03-31  Sergio Durigan Junior  <sergiodj@redhat.com>
> +
> +	PR testsuite/8595
> +	* gdb.base/environ.exp: Make test available in all architectures.
> +	Move bits related to "info program" testing to
> +	gdb.base/info-program.exp.  Rewrite tests to use the two new
> +	procedures mentione below.
> +	(test_set_show_env_var) New procedure.
> +	(test_set_show_env_var_equal): Likewise.
> +	* gdb.base/info-program.exp: New file.
> +
>  2017-03-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
>  
>  	* gdb.python/py-section-script.exp (sepdebug): New testcases.
> diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
> index a833f79..5ea5626 100644
> --- a/gdb/testsuite/gdb.base/environ.exp
> +++ b/gdb/testsuite/gdb.base/environ.exp
> @@ -13,297 +13,93 @@
>  # You should have received a copy of the GNU General Public License
>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>  
> -#
> -# test running programs
> -#
> +gdb_start
>  
> -# This test exists solely to exercise the "environment" commands for
> -# code-coverage on HP-UX.
> -#
> -if ![istarget "hppa*-*-hpux*"] then {
> -  return
> -}
> -
> -standard_testfile break.c break1.c
> -
> -if {[prepare_for_testing "failed to prepare" $testfile \
> -	 [list $srcfile $srcfile2] {debug nowarnings}]} {
> -    return -1
> -}
> -
> -if ![runto_main] then { fail "environment command tests suppressed" }
> -
> -# (No, this is not really related to the environment commands.  But it's
> -# a convenient place to verify that this command works.)
> -#
> -send_gdb "info program\n"
> -gdb_expect {
> -  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
> -          {pass "info program"}
> -  -re "$gdb_prompt $"\
> -          {fail "info program"}
> -  timeout {fail "(timeout) info program"}
> -}
> -
> -# We don't really care where this step lands, so long as it gets
> -# the inferior pushed off the breakpoint it's currently on...
> -#
> -send_gdb "next\n"
> -gdb_expect {
> -  -re ".*$gdb_prompt $"\
> -          {pass "step before info program"}
> -  timeout {fail "(timeout) step before info program"}
> +proc test_set_show_env_var { name value test_name } {
> +    gdb_test_no_output "set environment $name $value" "$test_name"
> +    gdb_test "show environment $name" "$name = $value" \
> +	"confirm $test_name"
>  }
> -send_gdb "info program\n"
> -gdb_expect {
> -  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped after being stepped..*$gdb_prompt $"\
> -          {pass "info program after step"}
> -  -re "$gdb_prompt $"\
> -          {fail "info program after step"}
> -  timeout {fail "(timeout) info program after step"}
> -}
> -
> -if ![runto_main] then { fail "environment command tests suppressed" }
>  
> -send_gdb "delete\n"
> -gdb_expect {
> -  -re ".*y or n. $"\
> -          {send_gdb "y\n"
> -           gdb_expect {
> -             -re ".*$gdb_prompt $"\
> -                     {pass "delete breakpoint before info program"}
> -             timeout {fail "(timeout) delete breakpoint before info program"}
> -           }
> -          }
> -  -re "$gdb_prompt $"\
> -          {fail "delete breakpoint before info program"}
> -  timeout {fail "(timeout) delete breakpoint before info program"}
> -}
> -send_gdb "info program\n"
> -gdb_expect {
> -  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at a breakpoint that has since been deleted..*$gdb_prompt $"\
> -          {pass "info program after deleted breakpoint"}
> -  -re "$gdb_prompt $"\
> -          {fail "info program after deleted breakpoint"}
> -  timeout {fail "(timeout) info program after deleted breakpoint"}
> +proc test_set_show_env_var_equal { name value test_name } {
> +    gdb_test_no_output "set environment $name = $value" "$test_name"
> +    gdb_test "show environment $name" "$name = $value" \
> +	"confirm $test_name"
>  }
>  
>  # Verify that we can show all currently-set environment variables.
> -# (It's a bit hacky, but nonetheless probably safe to check for at
> -# least the SHELL variable.)
> -#
> -# need to increase timeout because of very long output
> -set oldtimeout $timeout
> -set timeout [expr "$timeout + 300"]
> -
> -send_gdb "show environment\n"
> -gdb_expect {
> -  -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
> -          {pass "show environment"}
> -  -re "$gdb_prompt $"\
> -          {fail "show environment"}
> -  timeout {fail "(timeout) show environment"}
> -}
> -set timeout $oldtimeout
> +# It's hard to do this verification since we can't really compare each
> +# entry with the current environment.  So we just check to see if
> +# there is anything that looks like an environment variable being
> +# printed.
> +gdb_test "show environment" "(\[A-Za-z_\]\[A-Za-z0-9_\]*=.*\r\n)+" \
> +    "show environment works"
>  
>  # Verify that we can unset a specific environment variable.
> -#
> -send_gdb "unset environment EDITOR\n"
> -gdb_expect {
> -  -re "$gdb_prompt $"\
> -          {pass "issue unset environment"}
> -  timeout {fail "(timeout) issue unset environment"}
> -}
> -send_gdb "show environment EDITOR\n"
> -gdb_expect {
> -  -re "Environment variable \"EDITOR\" not defined.\r\n$gdb_prompt $"\
> -          {pass "unset environment"}
> -  -re "$gdb_prompt $"\
> -          {fail "unset environment"}
> -  timeout {fail "(timeout) unset environment"}
> -}
> +gdb_test_no_output "unset environment EDITOR" "unset environment variable"
> +
> +gdb_test "show environment EDITOR" "Environment variable \"EDITOR\" not defined\." \
> +    "confirm unset environment variable worked"
>  
>  # Verify that we can unset all environment variables.
> -#
> -send_gdb "unset environment\n"
> -gdb_expect {
> -  -re "Delete all environment variables.*y or n. $"\
> -          {send_gdb "y\n"
> -           gdb_expect {
> -             -re "$gdb_prompt $"\
> -                     {pass "unset entire environment"}
> -             timeout {fail "(timeout) unset entire environment"}
> -           }
> -          }
> -  -re "$gdb_prompt $"\
> -          {fail "unset entire environment"}
> -  timeout {fail "(timeout) unset entire environment"}
> +set msg "unset all environment variables"
> +gdb_test_multiple "unset environment" $msg {
> +    -re "Delete all environment variables.*y or n.*$" {
> +	gdb_test_no_output "y" $msg
> +    }
> +    -re "$gdb_prompt $" {
> +	fail $msg
> +    }
>  }
>  
>  # Verify that we can set a specific environment variable.
> -#
> -send_gdb "set environment EDITOR emacs\n"
> -gdb_expect {
> -  -re "$gdb_prompt $"\
> -          {pass "issue set environment"}
> -  timeout {fail "(timeout) issue set environment"}
> -}
> -send_gdb "show environment EDITOR\n"
> -gdb_expect {
> -  -re "EDITOR = emacs\r\n$gdb_prompt $"\
> -          {pass "set environment"}
> -  -re "$gdb_prompt $"\
> -          {fail "set environment"}
> -  timeout {fail "(timeout) set environment"}
> -}
> +test_set_show_env_var "EDITOR" "emacs" "set environment variable"
>  
>  # Verify that GDB responds gracefully to a request to set environment,
>  # with no variable name.
> -#
> -send_gdb "set environment\n"
> -gdb_expect {
> -  -re "Argument required .environment variable and value..*$gdb_prompt $"\
> -          {pass "set environment without variable disallowed"}
> -  -re "$gdb_prompt $"\
> -          {fail "set environment without variable disallowed"}
> -  timeout {fail "(timeout) set environment without variable disallowed"}
> -}
> +gdb_test "set environment" "Argument required \\\(environment variable and value\\\)\." \
> +    "set environment without arguments"
>  
>  # I'm not sure just what GDB has in mind in explicitly checking
>  # for this variant, but since GDB handles it, test it.
> -#
> -send_gdb "set environment =\n"
> -gdb_expect {
> -  -re "Argument required .environment variable to set..*$gdb_prompt $"\
> -          {pass "set environment equals without variable disallowed"}
> -  -re "$gdb_prompt $"\
> -          {fail "set environment equals without variable disallowed"}
> -  timeout {fail "(timeout) set environment equals without variable disallowed"}
> -}
> +gdb_test "set environment =" "Argument required \\\(environment variable to set\\\)\." \
> +    "set environment without variable name"
>  
>  # Setting an environment variable without a value sets it to a NULL
>  # value.
> -#
> -send_gdb "set environment EDITOR\n"
> -gdb_expect {
> -  -re "Setting environment variable \"EDITOR\" to null value..*$gdb_prompt $"\
> -          {pass "issue set environment without variable value"}
> -  -re "$gdb_prompt $"\
> -          {fail "issue set environment without variable value"}
> -  timeout {fail "(timeout) issue set environment without variable value"}
> -}
> -send_gdb "show environment EDITOR\n"
> -gdb_expect {
> -  -re "EDITOR = \r\n$gdb_prompt $"\
> -          {pass "set environment without variable value"}
> -  -re "$gdb_prompt $"\
> -          {fail "set environment without variable value"}
> -  timeout {fail "(timeout) set environment without variable value"}
> -}
> +gdb_test "set environment EDITOR" "Setting environment variable \"EDITOR\" to null value\." \
> +    "set environment variable to null value"
> +gdb_test "show environment EDITOR" "EDITOR = " "show null environment variable"
>  
>  # Verify that GDB responds gracefully to an attempt to show a
>  # non-existent environment variable.  (We hope this variable is
>  # undefined!)
> -#
> -send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> -  -re "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined..*$gdb_prompt $"\
> -          {pass "show non-existent environment variable disallowed"}
> -  -re "$gdb_prompt $"\
> -          {fail "show non-existent environment variable disallowed"}
> -  timeout {fail "(timeout) show non-existent environment variable disallowed"}
> -}
> +gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
> +    "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined\." \
> +    "show non-existent environment variable"
>  
>  # Verify that GDB can set an environment variable hitherto undefined.
> -#
> -send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t\n"
> -gdb_expect {
> -  -re "$gdb_prompt $"\
> -          {pass "issue set environment for previously undefined variable"}
> -  timeout {fail "(timeout) issue set environment for previously undefined variable"}
> -}
> -send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> -  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
> -          {pass "set environment for previously undefined variable"}
> -  -re "$gdb_prompt $"\
> -          {fail "set environment for previously undefined variable"}
> -  timeout {fail "(timeout) set environment for previously undefined variable"}
> -}
> +test_set_show_env_var "FOOBARBAZGRUNGESPAZBALL" "t" \
> +    "set environment variable previously undefined"
>  
>  # Verify that GDB can also set an environment variable using the "="
>  # syntax.
> -#
> -send_gdb "set environment FOOBARBAZGRUNGESPAZBALL = t\n"
> -gdb_expect {
> -  -re "$gdb_prompt $"\
> -          {pass "issue set environment with equals"}
> -  timeout {fail "(timeout) issue set environment with equals"}
> -}
> -send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> -  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
> -          {pass "set environment with equals"}
> -  -re "$gdb_prompt $"\
> -          {fail "set environment with equals"}
> -  timeout {fail "(timeout) set environment with equals"}
> -}
> +test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "y" \
> +    "set environment variable using = syntax"
>  
>  # Verify that GDB can set an environment variable to a value that has
>  # an embedded (trailing, in this case) equals.
> -#
> -send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t=\n"
> -gdb_expect {
> -  -re "$gdb_prompt $"\
> -          {pass "issue set environment with trailing equals"}
> -  timeout {fail "(timeout) issue set environment with trailing equals"}
> -}
> -send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> -  -re "FOOBARBAZGRUNGESPAZBALL = t=\r\n$gdb_prompt $"\
> -          {pass "set environment with trailing equals"}
> -  -re "$gdb_prompt $"\
> -          {fail "set environment with trailing equals"}
> -  timeout {fail "(timeout) set environment with trailing equals"}
> -}
> +test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "t=" \
> +    "set environment variable with trailing equals"
>  
>  # Verify that GDB can set an environment variable to a value preceded
>  # by whitespace, and that such whitespace is ignored (not included
>  # in the set value).
> -#
> -send_gdb "set environment FOOBARBAZGRUNGESPAZBALL =     foo\n"
> -gdb_expect {
> -  -re "$gdb_prompt $"\
> -          {pass "issue set environment with preceding whitespace"}
> -  timeout {fail "(timeout) issue set environment with preceding whitespace"}
> -}
> -send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> -  -re "FOOBARBAZGRUNGESPAZBALL = foo\r\n$gdb_prompt $"\
> -          {pass "set environment with preceding whitespace"}
> -  -re "$gdb_prompt $"\
> -          {fail "set environment with preceding whitespace"}
> -  timeout {fail "(timeout) set environment with preceding whitespace"}
> -}
> -
> -# Verify that GDB can manipulate the distinguished PATH variable.
> -#
> -send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> -  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
> -          {pass "issue path"}
> -  -re "$gdb_prompt $"\
> -          {fail "issue path"}
> -  timeout {fail "(timeout) issue path"}
> -}
> -send_gdb "show paths\n"
> -gdb_expect {
> -  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
> -          {pass "show paths"}
> -  -re "$gdb_prompt $"\
> -          {fail "show paths"}
> -  timeout {fail "(timeout) show paths"}
> -}
> +gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL =        foo" \
> +    "set environment variable with trailing whitespace"
> +gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
> +    "FOOBARBAZGRUNGESPAZBALL = foo" \
> +    "confirm set environment variable with trailing whitespace"
>  
>  gdb_exit
>  return 0
> diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
> new file mode 100644
> index 0000000..a24a654
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/info-program.exp
> @@ -0,0 +1,45 @@
> +# Copyright 2017 Free Software Foundation, Inc.
> +
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +standard_testfile normal.c
> +
> +if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
> +    return -1
> +}
> +
> +if { ![runto_main] } {
> +    fail "can't run to main"
> +    return -1
> +}
> +
> +gdb_test "info program" "\tUsing the running image of child process $decimal\.\r\nProgram stopped at $hex\.\r\nIt stopped at breakpoint $decimal\.\r\nType \"info stack\" or \"info registers\" for more information\." \
> +    "info program after run to main"
> +
> +# We don't really care where this step lands, so long as it gets
> +# the inferior pushed off the breakpoint it's currently on...
> +gdb_test "next" "$decimal\t.*" "advancing pc"
> +
> +gdb_test "info program" "\tUsing the running image of child process $decimal\.\r\nProgram stopped at $hex\.\r\nIt stopped after being stepped\.\r\nType \"info stack\" or \"info registers\" for more information\." \
> +    "info program after next"
> +
> +if { ![runto_main] } then {
> +    fail "can't restart program"
> +    return -1
> +}
> +
> +delete_breakpoints
> +
> +gdb_test "info program" "\tUsing the running image of child process $decimal\.\r\nProgram stopped at $hex\.\r\nIt stopped at a breakpoint that has since been deleted\.\r\nType \"info stack\" or \"info registers\" for more information\." \
> +    "info program after deleting all breakpoints"
> -- 
> 2.9.3

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

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

* Re: [PATCH] Make environ.exp run on all platforms (and create info-program.exp)
  2017-03-31 17:29 [PATCH] Make environ.exp run on all platforms (and create info-program.exp) Sergio Durigan Junior
  2017-04-12 23:30 ` Sergio Durigan Junior
@ 2017-04-13 14:35 ` Luis Machado
  2017-04-13 18:26   ` Sergio Durigan Junior
  2017-04-25 20:47 ` [PATCH v2] " Sergio Durigan Junior
  2017-04-26 22:28 ` [PATCH v3] " Sergio Durigan Junior
  3 siblings, 1 reply; 15+ messages in thread
From: Luis Machado @ 2017-04-13 14:35 UTC (permalink / raw)
  To: Sergio Durigan Junior, GDB Patches

On 03/31/2017 12:29 PM, Sergio Durigan Junior wrote:
> This has been on my TODO list for a while.  There's a really old bug
> about this (PR testsuite/8595), and there was no reason for
> environ.exp to be specific for hppa* targets.  So this patch removes
> this constraint, modernizes the testcase, and cleans up some things.
> Most of the tests remained, and some were rewritten (especially the
> one that checks if "show environment" works, which is something kind
> of hard to do).
>
> As a bonus, I'm adding a separated info-program.exp file containing
> all the tests related to "info program" that were present on
> environ.exp.
>
> Tested locally, everything still passes.

I haven't gone through the entire patch, but i have a question. Was this 
exercised for bare-metal?

If not, please make sure this test works correctly on bare-metal targets 
before assuming it does just because it passes on Linux-hosted tests. 
Otherwise we may have spurious failures due to tests that are not 
supposed to be executed in a bare-metal environment.

If you don't have access to bare-metal testing, i could give this a try 
(it may take a couple days though) and report back.


Thanks,
Luis

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

* Re: [PATCH] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-13 14:35 ` Luis Machado
@ 2017-04-13 18:26   ` Sergio Durigan Junior
  2017-04-13 18:29     ` Luis Machado
  0 siblings, 1 reply; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-04-13 18:26 UTC (permalink / raw)
  To: Luis Machado; +Cc: GDB Patches

Thanks for the review, Luis.

On Thursday, April 13 2017, Luis Machado wrote:

> On 03/31/2017 12:29 PM, Sergio Durigan Junior wrote:
>> This has been on my TODO list for a while.  There's a really old bug
>> about this (PR testsuite/8595), and there was no reason for
>> environ.exp to be specific for hppa* targets.  So this patch removes
>> this constraint, modernizes the testcase, and cleans up some things.
>> Most of the tests remained, and some were rewritten (especially the
>> one that checks if "show environment" works, which is something kind
>> of hard to do).
>>
>> As a bonus, I'm adding a separated info-program.exp file containing
>> all the tests related to "info program" that were present on
>> environ.exp.
>>
>> Tested locally, everything still passes.
>
> I haven't gone through the entire patch, but i have a question. Was
> this exercised for bare-metal?

Nope, I haven't had the chance to test this on bare-metal.

> If not, please make sure this test works correctly on bare-metal
> targets before assuming it does just because it passes on Linux-hosted
> tests. Otherwise we may have spurious failures due to tests that are
> not supposed to be executed in a bare-metal environment.
>
> If you don't have access to bare-metal testing, i could give this a
> try (it may take a couple days though) and report back.

I don't think I have access to a bare-metal easily; if you could test
this, I'd really appreciate.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

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

* Re: [PATCH] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-13 18:26   ` Sergio Durigan Junior
@ 2017-04-13 18:29     ` Luis Machado
  2017-04-13 18:34       ` Sergio Durigan Junior
  0 siblings, 1 reply; 15+ messages in thread
From: Luis Machado @ 2017-04-13 18:29 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: GDB Patches

On 04/13/2017 01:26 PM, Sergio Durigan Junior wrote:
> Thanks for the review, Luis.
>
> On Thursday, April 13 2017, Luis Machado wrote:
>
>> On 03/31/2017 12:29 PM, Sergio Durigan Junior wrote:
>>> This has been on my TODO list for a while.  There's a really old bug
>>> about this (PR testsuite/8595), and there was no reason for
>>> environ.exp to be specific for hppa* targets.  So this patch removes
>>> this constraint, modernizes the testcase, and cleans up some things.
>>> Most of the tests remained, and some were rewritten (especially the
>>> one that checks if "show environment" works, which is something kind
>>> of hard to do).
>>>
>>> As a bonus, I'm adding a separated info-program.exp file containing
>>> all the tests related to "info program" that were present on
>>> environ.exp.
>>>
>>> Tested locally, everything still passes.
>>
>> I haven't gone through the entire patch, but i have a question. Was
>> this exercised for bare-metal?
>
> Nope, I haven't had the chance to test this on bare-metal.
>
>> If not, please make sure this test works correctly on bare-metal
>> targets before assuming it does just because it passes on Linux-hosted
>> tests. Otherwise we may have spurious failures due to tests that are
>> not supposed to be executed in a bare-metal environment.
>>
>> If you don't have access to bare-metal testing, i could give this a
>> try (it may take a couple days though) and report back.
>
> I don't think I have access to a bare-metal easily; if you could test
> this, I'd really appreciate.

Got it. I'll let you know what i see (likely next week).

Thanks,
Luis

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

* Re: [PATCH] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-13 18:29     ` Luis Machado
@ 2017-04-13 18:34       ` Sergio Durigan Junior
  2017-04-20 19:54         ` Luis Machado
  0 siblings, 1 reply; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-04-13 18:34 UTC (permalink / raw)
  To: Luis Machado; +Cc: GDB Patches

On Thursday, April 13 2017, Luis Machado wrote:

>>> If you don't have access to bare-metal testing, i could give this a
>>> try (it may take a couple days though) and report back.
>>
>> I don't think I have access to a bare-metal easily; if you could test
>> this, I'd really appreciate.
>
> Got it. I'll let you know what i see (likely next week).

Thanks, much appreciated!

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

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

* Re: [PATCH] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-13 18:34       ` Sergio Durigan Junior
@ 2017-04-20 19:54         ` Luis Machado
  0 siblings, 0 replies; 15+ messages in thread
From: Luis Machado @ 2017-04-20 19:54 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: GDB Patches

On 04/13/2017 01:34 PM, Sergio Durigan Junior wrote:
> On Thursday, April 13 2017, Luis Machado wrote:
>
>>>> If you don't have access to bare-metal testing, i could give this a
>>>> try (it may take a couple days though) and report back.
>>>
>>> I don't think I have access to a bare-metal easily; if you could test
>>> this, I'd really appreciate.
>>
>> Got it. I'll let you know what i see (likely next week).
>
> Thanks, much appreciated!
>

Sorry for the delay. Here it is, for aarch64 bare-metal (both hardware 
and qemu):

--

                 === gdb Summary ===

# of expected passes            19
# of unexpected failures        4


Running /gdb/testsuite/gdb.base/info-program.exp ...
FAIL: gdb.base/info-program.exp: info program after run to main
FAIL: gdb.base/info-program.exp: info program after next
FAIL: gdb.base/info-program.exp: info program after deleting all breakpoints

Running /gdb/testsuite/gdb.base/environ.exp ...
FAIL: gdb.base/environ.exp: show environment works

--

The failure for environ.exp seems harmless. I can see the environment 
variables being printed, but something in the pattern matching is off. I 
have a number of environment variables, but the matching still fails. I 
can try to see if there is anything obvious if it doesn't ring any bells 
for you.

For info-program, these failures seem to be related to the "info 
program" output our remote target provides:

--

Breakpoint 1, main (argc=0, argv=0x0) at 
/gdb/testsuite/gdb.base/normal.c:23^M
23        return 0;^M
(gdb) info program^M
Debugging a target over a serial line.^M
Program stopped at 0x80000a28.^M
It stopped at breakpoint 1.^M
Type "info stack" or "info registers" for more information.^M
(gdb) FAIL: gdb.base/info-program.exp: info program after run to main
next^M
24      }^M
(gdb) PASS: gdb.base/info-program.exp: advancing pc
info program^M
Debugging a target over a serial line.^M
Program stopped at 0x80000a2c.^M
It stopped after being stepped.^M
Type "info stack" or "info registers" for more information.^M
(gdb) FAIL: gdb.base/info-program.exp: info program after next

...

(gdb) info breakpoints^M
No breakpoints or watchpoints.^M
(gdb) info program^M
Debugging a target over a serial line.^M
Program stopped at 0x80000a28.^M
It stopped at a breakpoint that has since been deleted.^M
Type "info stack" or "info registers" for more information.^M
(gdb) FAIL: gdb.base/info-program.exp: info program after deleting all 
breakpoints

--

So maybe a matter of making the pattern matching a bit more flexible?

Let me know if you want more information.

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

* [PATCH v2] Make environ.exp run on all platforms (and create info-program.exp)
  2017-03-31 17:29 [PATCH] Make environ.exp run on all platforms (and create info-program.exp) Sergio Durigan Junior
  2017-04-12 23:30 ` Sergio Durigan Junior
  2017-04-13 14:35 ` Luis Machado
@ 2017-04-25 20:47 ` Sergio Durigan Junior
  2017-04-26 18:43   ` Luis Machado
  2017-04-26 22:28 ` [PATCH v3] " Sergio Durigan Junior
  3 siblings, 1 reply; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-04-25 20:47 UTC (permalink / raw)
  To: GDB Patches; +Cc: Luis Machado, Sergio Durigan Junior

Changes from v1:

- Fixed regex of "show environment".

- Make regexes of "info program" more flexible (for bare-metal
  targets).


This has been on my TODO list for a while.  There's a really old bug
about this (PR testsuite/8595), and there was no reason for
environ.exp to be specific for hppa* targets.  So this patch removes
this constraint, modernizes the testcase, and cleans up some things.
Most of the tests remained, and some were rewritten (especially the
one that checks if "show environment" works, which is something kind
of hard to do).

As a bonus, I'm adding a separated info-program.exp file containing
all the tests related to "info program" that were present on
environ.exp.

Tested locally, everything still passes.

gdb/testsuite/ChangeLog:
2017-04-25  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR testsuite/8595
	* gdb.base/environ.exp: Make test available in all architectures.
	Move bits related to "info program" testing to
	gdb.base/info-program.exp.  Rewrite tests to use the two new
	procedures mentione below.
	(test_set_show_env_var) New procedure.
	(test_set_show_env_var_equal): Likewise.
	* gdb.base/info-program.exp: New file.
---
 gdb/testsuite/ChangeLog                 |  11 ++
 gdb/testsuite/gdb.base/environ.exp      | 302 ++++++--------------------------
 gdb/testsuite/gdb.base/info-program.exp |  45 +++++
 3 files changed, 105 insertions(+), 253 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/info-program.exp

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c4d5b79..a7df5c6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2017-04-25  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR testsuite/8595
+	* gdb.base/environ.exp: Make test available in all architectures.
+	Move bits related to "info program" testing to
+	gdb.base/info-program.exp.  Rewrite tests to use the two new
+	procedures mentione below.
+	(test_set_show_env_var) New procedure.
+	(test_set_show_env_var_equal): Likewise.
+	* gdb.base/info-program.exp: New file.
+
 2017-04-19  Pedro Alves  <palves@redhat.com>
 
 	* gdb.threads/threadapply.exp (kill_and_remove_inferior): New
diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index a833f79..06df5a7 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -13,297 +13,93 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#
-# test running programs
-#
+gdb_start
 
-# This test exists solely to exercise the "environment" commands for
-# code-coverage on HP-UX.
-#
-if ![istarget "hppa*-*-hpux*"] then {
-  return
-}
-
-standard_testfile break.c break1.c
-
-if {[prepare_for_testing "failed to prepare" $testfile \
-	 [list $srcfile $srcfile2] {debug nowarnings}]} {
-    return -1
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
-
-# (No, this is not really related to the environment commands.  But it's
-# a convenient place to verify that this command works.)
-#
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
-          {pass "info program"}
-  -re "$gdb_prompt $"\
-          {fail "info program"}
-  timeout {fail "(timeout) info program"}
-}
-
-# We don't really care where this step lands, so long as it gets
-# the inferior pushed off the breakpoint it's currently on...
-#
-send_gdb "next\n"
-gdb_expect {
-  -re ".*$gdb_prompt $"\
-          {pass "step before info program"}
-  timeout {fail "(timeout) step before info program"}
+proc test_set_show_env_var { name value test_name } {
+    gdb_test_no_output "set environment $name $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped after being stepped..*$gdb_prompt $"\
-          {pass "info program after step"}
-  -re "$gdb_prompt $"\
-          {fail "info program after step"}
-  timeout {fail "(timeout) info program after step"}
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
 
-send_gdb "delete\n"
-gdb_expect {
-  -re ".*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re ".*$gdb_prompt $"\
-                     {pass "delete breakpoint before info program"}
-             timeout {fail "(timeout) delete breakpoint before info program"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "delete breakpoint before info program"}
-  timeout {fail "(timeout) delete breakpoint before info program"}
-}
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at a breakpoint that has since been deleted..*$gdb_prompt $"\
-          {pass "info program after deleted breakpoint"}
-  -re "$gdb_prompt $"\
-          {fail "info program after deleted breakpoint"}
-  timeout {fail "(timeout) info program after deleted breakpoint"}
+proc test_set_show_env_var_equal { name value test_name } {
+    gdb_test_no_output "set environment $name = $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
 
 # Verify that we can show all currently-set environment variables.
-# (It's a bit hacky, but nonetheless probably safe to check for at
-# least the SHELL variable.)
-#
-# need to increase timeout because of very long output
-set oldtimeout $timeout
-set timeout [expr "$timeout + 300"]
-
-send_gdb "show environment\n"
-gdb_expect {
-  -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
-          {pass "show environment"}
-  -re "$gdb_prompt $"\
-          {fail "show environment"}
-  timeout {fail "(timeout) show environment"}
-}
-set timeout $oldtimeout
+# It's hard to do this verification since we can't really compare each
+# entry with the current environment.  So we just check to see if
+# there is anything that looks like an environment variable being
+# printed.
+gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \
+    "show environment works"
 
 # Verify that we can unset a specific environment variable.
-#
-send_gdb "unset environment EDITOR\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue unset environment"}
-  timeout {fail "(timeout) issue unset environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "Environment variable \"EDITOR\" not defined.\r\n$gdb_prompt $"\
-          {pass "unset environment"}
-  -re "$gdb_prompt $"\
-          {fail "unset environment"}
-  timeout {fail "(timeout) unset environment"}
-}
+gdb_test_no_output "unset environment EDITOR" "unset environment variable"
+
+gdb_test "show environment EDITOR" "Environment variable \"EDITOR\" not defined\." \
+    "confirm unset environment variable worked"
 
 # Verify that we can unset all environment variables.
-#
-send_gdb "unset environment\n"
-gdb_expect {
-  -re "Delete all environment variables.*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re "$gdb_prompt $"\
-                     {pass "unset entire environment"}
-             timeout {fail "(timeout) unset entire environment"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "unset entire environment"}
-  timeout {fail "(timeout) unset entire environment"}
+set msg "unset all environment variables"
+gdb_test_multiple "unset environment" $msg {
+    -re "Delete all environment variables.*y or n.*$" {
+	gdb_test_no_output "y" $msg
+    }
+    -re "$gdb_prompt $" {
+	fail $msg
+    }
 }
 
 # Verify that we can set a specific environment variable.
-#
-send_gdb "set environment EDITOR emacs\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment"}
-  timeout {fail "(timeout) issue set environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = emacs\r\n$gdb_prompt $"\
-          {pass "set environment"}
-  -re "$gdb_prompt $"\
-          {fail "set environment"}
-  timeout {fail "(timeout) set environment"}
-}
+test_set_show_env_var "EDITOR" "emacs" "set environment variable"
 
 # Verify that GDB responds gracefully to a request to set environment,
 # with no variable name.
-#
-send_gdb "set environment\n"
-gdb_expect {
-  -re "Argument required .environment variable and value..*$gdb_prompt $"\
-          {pass "set environment without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable disallowed"}
-  timeout {fail "(timeout) set environment without variable disallowed"}
-}
+gdb_test "set environment" "Argument required \\\(environment variable and value\\\)\." \
+    "set environment without arguments"
 
 # I'm not sure just what GDB has in mind in explicitly checking
 # for this variant, but since GDB handles it, test it.
-#
-send_gdb "set environment =\n"
-gdb_expect {
-  -re "Argument required .environment variable to set..*$gdb_prompt $"\
-          {pass "set environment equals without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment equals without variable disallowed"}
-  timeout {fail "(timeout) set environment equals without variable disallowed"}
-}
+gdb_test "set environment =" "Argument required \\\(environment variable to set\\\)\." \
+    "set environment without variable name"
 
 # Setting an environment variable without a value sets it to a NULL
 # value.
-#
-send_gdb "set environment EDITOR\n"
-gdb_expect {
-  -re "Setting environment variable \"EDITOR\" to null value..*$gdb_prompt $"\
-          {pass "issue set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "issue set environment without variable value"}
-  timeout {fail "(timeout) issue set environment without variable value"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = \r\n$gdb_prompt $"\
-          {pass "set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable value"}
-  timeout {fail "(timeout) set environment without variable value"}
-}
+gdb_test "set environment EDITOR" "Setting environment variable \"EDITOR\" to null value\." \
+    "set environment variable to null value"
+gdb_test "show environment EDITOR" "EDITOR = " "show null environment variable"
 
 # Verify that GDB responds gracefully to an attempt to show a
 # non-existent environment variable.  (We hope this variable is
 # undefined!)
-#
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined..*$gdb_prompt $"\
-          {pass "show non-existent environment variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "show non-existent environment variable disallowed"}
-  timeout {fail "(timeout) show non-existent environment variable disallowed"}
-}
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined\." \
+    "show non-existent environment variable"
 
 # Verify that GDB can set an environment variable hitherto undefined.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment for previously undefined variable"}
-  timeout {fail "(timeout) issue set environment for previously undefined variable"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment for previously undefined variable"}
-  -re "$gdb_prompt $"\
-          {fail "set environment for previously undefined variable"}
-  timeout {fail "(timeout) set environment for previously undefined variable"}
-}
+test_set_show_env_var "FOOBARBAZGRUNGESPAZBALL" "t" \
+    "set environment variable previously undefined"
 
 # Verify that GDB can also set an environment variable using the "="
 # syntax.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL = t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with equals"}
-  timeout {fail "(timeout) issue set environment with equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment with equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with equals"}
-  timeout {fail "(timeout) set environment with equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "y" \
+    "set environment variable using = syntax"
 
 # Verify that GDB can set an environment variable to a value that has
 # an embedded (trailing, in this case) equals.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t=\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with trailing equals"}
-  timeout {fail "(timeout) issue set environment with trailing equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t=\r\n$gdb_prompt $"\
-          {pass "set environment with trailing equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with trailing equals"}
-  timeout {fail "(timeout) set environment with trailing equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "t=" \
+    "set environment variable with trailing equals"
 
 # Verify that GDB can set an environment variable to a value preceded
 # by whitespace, and that such whitespace is ignored (not included
 # in the set value).
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL =     foo\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with preceding whitespace"}
-  timeout {fail "(timeout) issue set environment with preceding whitespace"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = foo\r\n$gdb_prompt $"\
-          {pass "set environment with preceding whitespace"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with preceding whitespace"}
-  timeout {fail "(timeout) set environment with preceding whitespace"}
-}
-
-# Verify that GDB can manipulate the distinguished PATH variable.
-#
-send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "issue path"}
-  -re "$gdb_prompt $"\
-          {fail "issue path"}
-  timeout {fail "(timeout) issue path"}
-}
-send_gdb "show paths\n"
-gdb_expect {
-  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "show paths"}
-  -re "$gdb_prompt $"\
-          {fail "show paths"}
-  timeout {fail "(timeout) show paths"}
-}
+gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL =        foo" \
+    "set environment variable with trailing whitespace"
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "FOOBARBAZGRUNGESPAZBALL = foo" \
+    "confirm set environment variable with trailing whitespace"
 
 gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
new file mode 100644
index 0000000..3cd8fd5
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-program.exp
@@ -0,0 +1,45 @@
+# Copyright 2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile normal.c
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+    return -1
+}
+
+if { ![runto_main] } {
+    fail "can't run to main"
+    return -1
+}
+
+gdb_test "info program" "\t.*\r\nProgram stopped at $hex\.\r\nIt stopped at breakpoint $decimal\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after run to main"
+
+# We don't really care where this step lands, so long as it gets
+# the inferior pushed off the breakpoint it's currently on...
+gdb_test "next" "$decimal\t.*" "advancing pc"
+
+gdb_test "info program" "\t.*\r\nProgram stopped at $hex\.\r\nIt stopped after being stepped\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after next"
+
+if { ![runto_main] } then {
+    fail "can't restart program"
+    return -1
+}
+
+delete_breakpoints
+
+gdb_test "info program" "\t.*\r\nProgram stopped at $hex\.\r\nIt stopped at a breakpoint that has since been deleted\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after deleting all breakpoints"
-- 
2.9.3

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

* Re: [PATCH v2] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-25 20:47 ` [PATCH v2] " Sergio Durigan Junior
@ 2017-04-26 18:43   ` Luis Machado
  2017-04-26 19:42     ` Sergio Durigan Junior
  0 siblings, 1 reply; 15+ messages in thread
From: Luis Machado @ 2017-04-26 18:43 UTC (permalink / raw)
  To: Sergio Durigan Junior, GDB Patches


On 04/25/2017 03:47 PM, Sergio Durigan Junior wrote:
> Changes from v1:
>
> - Fixed regex of "show environment".
>
> - Make regexes of "info program" more flexible (for bare-metal
>   targets).
>
>
> This has been on my TODO list for a while.  There's a really old bug
> about this (PR testsuite/8595), and there was no reason for
> environ.exp to be specific for hppa* targets.  So this patch removes
> this constraint, modernizes the testcase, and cleans up some things.
> Most of the tests remained, and some were rewritten (especially the
> one that checks if "show environment" works, which is something kind
> of hard to do).
>
> As a bonus, I'm adding a separated info-program.exp file containing
> all the tests related to "info program" that were present on
> environ.exp.
>
> Tested locally, everything still passes.
>
> gdb/testsuite/ChangeLog:
> 2017-04-25  Sergio Durigan Junior  <sergiodj@redhat.com>
>
> 	PR testsuite/8595
> 	* gdb.base/environ.exp: Make test available in all architectures.
> 	Move bits related to "info program" testing to
> 	gdb.base/info-program.exp.  Rewrite tests to use the two new
> 	procedures mentione below.
> 	(test_set_show_env_var) New procedure.
> 	(test_set_show_env_var_equal): Likewise.
> 	* gdb.base/info-program.exp: New file.
> ---
>  gdb/testsuite/ChangeLog                 |  11 ++
>  gdb/testsuite/gdb.base/environ.exp      | 302 ++++++--------------------------
>  gdb/testsuite/gdb.base/info-program.exp |  45 +++++
>  3 files changed, 105 insertions(+), 253 deletions(-)
>  create mode 100644 gdb/testsuite/gdb.base/info-program.exp

I get full passes with gdb.base/environment.exp now, but 
gdb.base/info-program.exp is still failing.

FAIL: gdb.base/info-program.exp: info program after run to main
FAIL: gdb.base/info-program.exp: info program after next
FAIL: gdb.base/info-program.exp: info program after deleting all breakpoints

By removing the initial \t from the patterns of these 3 tests, i get 
full passes for gdb.base/info-program.exp as well.

Luis

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

* Re: [PATCH v2] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-26 18:43   ` Luis Machado
@ 2017-04-26 19:42     ` Sergio Durigan Junior
  0 siblings, 0 replies; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-04-26 19:42 UTC (permalink / raw)
  To: Luis Machado; +Cc: GDB Patches

On Wednesday, April 26 2017, Luis Machado wrote:

> On 04/25/2017 03:47 PM, Sergio Durigan Junior wrote:
>> Changes from v1:
>>
>> - Fixed regex of "show environment".
>>
>> - Make regexes of "info program" more flexible (for bare-metal
>>   targets).
>>
>>
>> This has been on my TODO list for a while.  There's a really old bug
>> about this (PR testsuite/8595), and there was no reason for
>> environ.exp to be specific for hppa* targets.  So this patch removes
>> this constraint, modernizes the testcase, and cleans up some things.
>> Most of the tests remained, and some were rewritten (especially the
>> one that checks if "show environment" works, which is something kind
>> of hard to do).
>>
>> As a bonus, I'm adding a separated info-program.exp file containing
>> all the tests related to "info program" that were present on
>> environ.exp.
>>
>> Tested locally, everything still passes.
>>
>> gdb/testsuite/ChangeLog:
>> 2017-04-25  Sergio Durigan Junior  <sergiodj@redhat.com>
>>
>> 	PR testsuite/8595
>> 	* gdb.base/environ.exp: Make test available in all architectures.
>> 	Move bits related to "info program" testing to
>> 	gdb.base/info-program.exp.  Rewrite tests to use the two new
>> 	procedures mentione below.
>> 	(test_set_show_env_var) New procedure.
>> 	(test_set_show_env_var_equal): Likewise.
>> 	* gdb.base/info-program.exp: New file.
>> ---
>>  gdb/testsuite/ChangeLog                 |  11 ++
>>  gdb/testsuite/gdb.base/environ.exp      | 302 ++++++--------------------------
>>  gdb/testsuite/gdb.base/info-program.exp |  45 +++++
>>  3 files changed, 105 insertions(+), 253 deletions(-)
>>  create mode 100644 gdb/testsuite/gdb.base/info-program.exp
>
> I get full passes with gdb.base/environment.exp now, but
> gdb.base/info-program.exp is still failing.
>
> FAIL: gdb.base/info-program.exp: info program after run to main
> FAIL: gdb.base/info-program.exp: info program after next
> FAIL: gdb.base/info-program.exp: info program after deleting all breakpoints
>
> By removing the initial \t from the patterns of these 3 tests, i get
> full passes for gdb.base/info-program.exp as well.

Sigh...  Thanks for testing.  OK, I'll remove the \t from the beginning.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

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

* [PATCH v3] Make environ.exp run on all platforms (and create info-program.exp)
  2017-03-31 17:29 [PATCH] Make environ.exp run on all platforms (and create info-program.exp) Sergio Durigan Junior
                   ` (2 preceding siblings ...)
  2017-04-25 20:47 ` [PATCH v2] " Sergio Durigan Junior
@ 2017-04-26 22:28 ` Sergio Durigan Junior
  2017-04-27 14:53   ` Pedro Alves
  3 siblings, 1 reply; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-04-26 22:28 UTC (permalink / raw)
  To: GDB Patches; +Cc: Luis Machado, Sergio Durigan Junior

Changes since v2:

- Removed \t when matching the output of 'info program'.

This has been on my TODO list for a while.  There's a really old bug
about this (PR testsuite/8595), and there was no reason for
environ.exp to be specific for hppa* targets.  So this patch removes
this constraint, modernizes the testcase, and cleans up some things.
Most of the tests remained, and some were rewritten (especially the
one that checks if "show environment" works, which is something kind
of hard to do).

As a bonus, I'm adding a separated info-program.exp file containing
all the tests related to "info program" that were present on
environ.exp.

Tested locally, everything still passes.

gdb/testsuite/ChangeLog:
2017-04-26  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR testsuite/8595
	* gdb.base/environ.exp: Make test available in all architectures.
	Move bits related to "info program" testing to
	gdb.base/info-program.exp.  Rewrite tests to use the two new
	procedures mentione below.
	(test_set_show_env_var) New procedure.
	(test_set_show_env_var_equal): Likewise.
	* gdb.base/info-program.exp: New file.
---
 gdb/testsuite/ChangeLog                 |  11 ++
 gdb/testsuite/gdb.base/environ.exp      | 302 ++++++--------------------------
 gdb/testsuite/gdb.base/info-program.exp |  45 +++++
 3 files changed, 105 insertions(+), 253 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/info-program.exp

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c4d5b79..11c6436 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2017-04-26  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR testsuite/8595
+	* gdb.base/environ.exp: Make test available in all architectures.
+	Move bits related to "info program" testing to
+	gdb.base/info-program.exp.  Rewrite tests to use the two new
+	procedures mentione below.
+	(test_set_show_env_var) New procedure.
+	(test_set_show_env_var_equal): Likewise.
+	* gdb.base/info-program.exp: New file.
+
 2017-04-19  Pedro Alves  <palves@redhat.com>
 
 	* gdb.threads/threadapply.exp (kill_and_remove_inferior): New
diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index a833f79..06df5a7 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -13,297 +13,93 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#
-# test running programs
-#
+gdb_start
 
-# This test exists solely to exercise the "environment" commands for
-# code-coverage on HP-UX.
-#
-if ![istarget "hppa*-*-hpux*"] then {
-  return
-}
-
-standard_testfile break.c break1.c
-
-if {[prepare_for_testing "failed to prepare" $testfile \
-	 [list $srcfile $srcfile2] {debug nowarnings}]} {
-    return -1
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
-
-# (No, this is not really related to the environment commands.  But it's
-# a convenient place to verify that this command works.)
-#
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
-          {pass "info program"}
-  -re "$gdb_prompt $"\
-          {fail "info program"}
-  timeout {fail "(timeout) info program"}
-}
-
-# We don't really care where this step lands, so long as it gets
-# the inferior pushed off the breakpoint it's currently on...
-#
-send_gdb "next\n"
-gdb_expect {
-  -re ".*$gdb_prompt $"\
-          {pass "step before info program"}
-  timeout {fail "(timeout) step before info program"}
+proc test_set_show_env_var { name value test_name } {
+    gdb_test_no_output "set environment $name $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped after being stepped..*$gdb_prompt $"\
-          {pass "info program after step"}
-  -re "$gdb_prompt $"\
-          {fail "info program after step"}
-  timeout {fail "(timeout) info program after step"}
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
 
-send_gdb "delete\n"
-gdb_expect {
-  -re ".*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re ".*$gdb_prompt $"\
-                     {pass "delete breakpoint before info program"}
-             timeout {fail "(timeout) delete breakpoint before info program"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "delete breakpoint before info program"}
-  timeout {fail "(timeout) delete breakpoint before info program"}
-}
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at a breakpoint that has since been deleted..*$gdb_prompt $"\
-          {pass "info program after deleted breakpoint"}
-  -re "$gdb_prompt $"\
-          {fail "info program after deleted breakpoint"}
-  timeout {fail "(timeout) info program after deleted breakpoint"}
+proc test_set_show_env_var_equal { name value test_name } {
+    gdb_test_no_output "set environment $name = $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
 
 # Verify that we can show all currently-set environment variables.
-# (It's a bit hacky, but nonetheless probably safe to check for at
-# least the SHELL variable.)
-#
-# need to increase timeout because of very long output
-set oldtimeout $timeout
-set timeout [expr "$timeout + 300"]
-
-send_gdb "show environment\n"
-gdb_expect {
-  -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
-          {pass "show environment"}
-  -re "$gdb_prompt $"\
-          {fail "show environment"}
-  timeout {fail "(timeout) show environment"}
-}
-set timeout $oldtimeout
+# It's hard to do this verification since we can't really compare each
+# entry with the current environment.  So we just check to see if
+# there is anything that looks like an environment variable being
+# printed.
+gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \
+    "show environment works"
 
 # Verify that we can unset a specific environment variable.
-#
-send_gdb "unset environment EDITOR\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue unset environment"}
-  timeout {fail "(timeout) issue unset environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "Environment variable \"EDITOR\" not defined.\r\n$gdb_prompt $"\
-          {pass "unset environment"}
-  -re "$gdb_prompt $"\
-          {fail "unset environment"}
-  timeout {fail "(timeout) unset environment"}
-}
+gdb_test_no_output "unset environment EDITOR" "unset environment variable"
+
+gdb_test "show environment EDITOR" "Environment variable \"EDITOR\" not defined\." \
+    "confirm unset environment variable worked"
 
 # Verify that we can unset all environment variables.
-#
-send_gdb "unset environment\n"
-gdb_expect {
-  -re "Delete all environment variables.*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re "$gdb_prompt $"\
-                     {pass "unset entire environment"}
-             timeout {fail "(timeout) unset entire environment"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "unset entire environment"}
-  timeout {fail "(timeout) unset entire environment"}
+set msg "unset all environment variables"
+gdb_test_multiple "unset environment" $msg {
+    -re "Delete all environment variables.*y or n.*$" {
+	gdb_test_no_output "y" $msg
+    }
+    -re "$gdb_prompt $" {
+	fail $msg
+    }
 }
 
 # Verify that we can set a specific environment variable.
-#
-send_gdb "set environment EDITOR emacs\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment"}
-  timeout {fail "(timeout) issue set environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = emacs\r\n$gdb_prompt $"\
-          {pass "set environment"}
-  -re "$gdb_prompt $"\
-          {fail "set environment"}
-  timeout {fail "(timeout) set environment"}
-}
+test_set_show_env_var "EDITOR" "emacs" "set environment variable"
 
 # Verify that GDB responds gracefully to a request to set environment,
 # with no variable name.
-#
-send_gdb "set environment\n"
-gdb_expect {
-  -re "Argument required .environment variable and value..*$gdb_prompt $"\
-          {pass "set environment without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable disallowed"}
-  timeout {fail "(timeout) set environment without variable disallowed"}
-}
+gdb_test "set environment" "Argument required \\\(environment variable and value\\\)\." \
+    "set environment without arguments"
 
 # I'm not sure just what GDB has in mind in explicitly checking
 # for this variant, but since GDB handles it, test it.
-#
-send_gdb "set environment =\n"
-gdb_expect {
-  -re "Argument required .environment variable to set..*$gdb_prompt $"\
-          {pass "set environment equals without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment equals without variable disallowed"}
-  timeout {fail "(timeout) set environment equals without variable disallowed"}
-}
+gdb_test "set environment =" "Argument required \\\(environment variable to set\\\)\." \
+    "set environment without variable name"
 
 # Setting an environment variable without a value sets it to a NULL
 # value.
-#
-send_gdb "set environment EDITOR\n"
-gdb_expect {
-  -re "Setting environment variable \"EDITOR\" to null value..*$gdb_prompt $"\
-          {pass "issue set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "issue set environment without variable value"}
-  timeout {fail "(timeout) issue set environment without variable value"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = \r\n$gdb_prompt $"\
-          {pass "set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable value"}
-  timeout {fail "(timeout) set environment without variable value"}
-}
+gdb_test "set environment EDITOR" "Setting environment variable \"EDITOR\" to null value\." \
+    "set environment variable to null value"
+gdb_test "show environment EDITOR" "EDITOR = " "show null environment variable"
 
 # Verify that GDB responds gracefully to an attempt to show a
 # non-existent environment variable.  (We hope this variable is
 # undefined!)
-#
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined..*$gdb_prompt $"\
-          {pass "show non-existent environment variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "show non-existent environment variable disallowed"}
-  timeout {fail "(timeout) show non-existent environment variable disallowed"}
-}
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined\." \
+    "show non-existent environment variable"
 
 # Verify that GDB can set an environment variable hitherto undefined.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment for previously undefined variable"}
-  timeout {fail "(timeout) issue set environment for previously undefined variable"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment for previously undefined variable"}
-  -re "$gdb_prompt $"\
-          {fail "set environment for previously undefined variable"}
-  timeout {fail "(timeout) set environment for previously undefined variable"}
-}
+test_set_show_env_var "FOOBARBAZGRUNGESPAZBALL" "t" \
+    "set environment variable previously undefined"
 
 # Verify that GDB can also set an environment variable using the "="
 # syntax.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL = t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with equals"}
-  timeout {fail "(timeout) issue set environment with equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment with equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with equals"}
-  timeout {fail "(timeout) set environment with equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "y" \
+    "set environment variable using = syntax"
 
 # Verify that GDB can set an environment variable to a value that has
 # an embedded (trailing, in this case) equals.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t=\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with trailing equals"}
-  timeout {fail "(timeout) issue set environment with trailing equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t=\r\n$gdb_prompt $"\
-          {pass "set environment with trailing equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with trailing equals"}
-  timeout {fail "(timeout) set environment with trailing equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "t=" \
+    "set environment variable with trailing equals"
 
 # Verify that GDB can set an environment variable to a value preceded
 # by whitespace, and that such whitespace is ignored (not included
 # in the set value).
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL =     foo\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with preceding whitespace"}
-  timeout {fail "(timeout) issue set environment with preceding whitespace"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = foo\r\n$gdb_prompt $"\
-          {pass "set environment with preceding whitespace"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with preceding whitespace"}
-  timeout {fail "(timeout) set environment with preceding whitespace"}
-}
-
-# Verify that GDB can manipulate the distinguished PATH variable.
-#
-send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "issue path"}
-  -re "$gdb_prompt $"\
-          {fail "issue path"}
-  timeout {fail "(timeout) issue path"}
-}
-send_gdb "show paths\n"
-gdb_expect {
-  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "show paths"}
-  -re "$gdb_prompt $"\
-          {fail "show paths"}
-  timeout {fail "(timeout) show paths"}
-}
+gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL =        foo" \
+    "set environment variable with trailing whitespace"
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "FOOBARBAZGRUNGESPAZBALL = foo" \
+    "confirm set environment variable with trailing whitespace"
 
 gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
new file mode 100644
index 0000000..e5e5fb9
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-program.exp
@@ -0,0 +1,45 @@
+# Copyright 2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile normal.c
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+    return -1
+}
+
+if { ![runto_main] } {
+    fail "can't run to main"
+    return -1
+}
+
+gdb_test "info program" ".*\r\nProgram stopped at $hex\.\r\nIt stopped at breakpoint $decimal\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after run to main"
+
+# We don't really care where this step lands, so long as it gets
+# the inferior pushed off the breakpoint it's currently on...
+gdb_test "next" "$decimal\t.*" "advancing pc"
+
+gdb_test "info program" ".*\r\nProgram stopped at $hex\.\r\nIt stopped after being stepped\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after next"
+
+if { ![runto_main] } then {
+    fail "can't restart program"
+    return -1
+}
+
+delete_breakpoints
+
+gdb_test "info program" ".*\r\nProgram stopped at $hex\.\r\nIt stopped at a breakpoint that has since been deleted\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after deleting all breakpoints"
-- 
2.9.3

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

* Re: [PATCH v3] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-26 22:28 ` [PATCH v3] " Sergio Durigan Junior
@ 2017-04-27 14:53   ` Pedro Alves
  2017-04-27 19:06     ` Sergio Durigan Junior
  0 siblings, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2017-04-27 14:53 UTC (permalink / raw)
  To: Sergio Durigan Junior, GDB Patches; +Cc: Luis Machado

On 04/26/2017 11:28 PM, Sergio Durigan Junior wrote:
> Changes since v2:
> 
> - Removed \t when matching the output of 'info program'.
> 
> This has been on my TODO list for a while.  There's a really old bug
> about this (PR testsuite/8595), and there was no reason for
> environ.exp to be specific for hppa* targets.  So this patch removes
> this constraint, modernizes the testcase, and cleans up some things.
> Most of the tests remained, and some were rewritten (especially the
> one that checks if "show environment" works, which is something kind
> of hard to do).

It'd be good to cross check for overlap with gdb.base/testenv.exp.

>  # Verify that we can show all currently-set environment variables.
> -# (It's a bit hacky, but nonetheless probably safe to check for at
> -# least the SHELL variable.)
> -#
> -# need to increase timeout because of very long output
> -set oldtimeout $timeout
> -set timeout [expr "$timeout + 300"]
> -
> -send_gdb "show environment\n"
> -gdb_expect {
> -  -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
> -          {pass "show environment"}
> -  -re "$gdb_prompt $"\
> -          {fail "show environment"}
> -  timeout {fail "(timeout) show environment"}
> -}
> -set timeout $oldtimeout
> +# It's hard to do this verification since we can't really compare each
> +# entry with the current environment.  So we just check to see if
> +# there is anything that looks like an environment variable being
> +# printed.
> +gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \
> +    "show environment works"

We can easily set a variable in the environment before spawning GDB.
We'd just have to limit that specific test to when not testing with a
remote host, I think?  See gdb.base/gdbhistsize-history.exp for example.

> +gdb_test_multiple "unset environment" $msg {
> +    -re "Delete all environment variables.*y or n.*$" {
> +	gdb_test_no_output "y" $msg
> +    }
> +    -re "$gdb_prompt $" {
> +	fail $msg
> +    }
>  }

The '-re "$gdb_prompt $"' part is not necessary because
gdb_test_multiple already does that by default.
And then you can use gdb_test for this:

  gdb_test "unset environment" "" $msg \
    "Delete all environment variables. .y or n. $" \
    "y"

> -# Verify that GDB can manipulate the distinguished PATH variable.
> -#
> -send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> -  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
> -          {pass "issue path"}
> -  -re "$gdb_prompt $"\
> -          {fail "issue path"}
> -  timeout {fail "(timeout) issue path"}
> -}
> -send_gdb "show paths\n"
> -gdb_expect {
> -  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
> -          {pass "show paths"}
> -  -re "$gdb_prompt $"\
> -          {fail "show paths"}
> -  timeout {fail "(timeout) show paths"}

Any reason these "path" command tests are dropped?
(AFAICS, the MI equivalent is tested by gdb.mi/mi-basics.exp).

> -}
> +gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL =        foo" \
> +    "set environment variable with trailing whitespace"
> +gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
> +    "FOOBARBAZGRUNGESPAZBALL = foo" \
> +    "confirm set environment variable with trailing whitespace"
>  
>  gdb_exit
>  return 0
> diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
> new file mode 100644
> index 0000000..e5e5fb9
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/info-program.exp
> @@ -0,0 +1,45 @@
> +# Copyright 2017 Free Software Foundation, Inc.

If the moved code is based on older code, the original copyright year
must be preserved.

Thanks,
Pedro Alves

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

* Re: [PATCH v3] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-27 14:53   ` Pedro Alves
@ 2017-04-27 19:06     ` Sergio Durigan Junior
  2017-04-27 22:37       ` Pedro Alves
  0 siblings, 1 reply; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-04-27 19:06 UTC (permalink / raw)
  To: Pedro Alves; +Cc: GDB Patches, Luis Machado

On Thursday, April 27 2017, Pedro Alves wrote:

> On 04/26/2017 11:28 PM, Sergio Durigan Junior wrote:
>> Changes since v2:
>> 
>> - Removed \t when matching the output of 'info program'.
>> 
>> This has been on my TODO list for a while.  There's a really old bug
>> about this (PR testsuite/8595), and there was no reason for
>> environ.exp to be specific for hppa* targets.  So this patch removes
>> this constraint, modernizes the testcase, and cleans up some things.
>> Most of the tests remained, and some were rewritten (especially the
>> one that checks if "show environment" works, which is something kind
>> of hard to do).
>
> It'd be good to cross check for overlap with gdb.base/testenv.exp.

One could say there is overlap, but testenv.exp is basically testing the
interaction between GDB's environment system with live inferiors, while
environ.exp is testing the "set/show" commands only.  They are both
worth having.

>>  # Verify that we can show all currently-set environment variables.
>> -# (It's a bit hacky, but nonetheless probably safe to check for at
>> -# least the SHELL variable.)
>> -#
>> -# need to increase timeout because of very long output
>> -set oldtimeout $timeout
>> -set timeout [expr "$timeout + 300"]
>> -
>> -send_gdb "show environment\n"
>> -gdb_expect {
>> -  -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
>> -          {pass "show environment"}
>> -  -re "$gdb_prompt $"\
>> -          {fail "show environment"}
>> -  timeout {fail "(timeout) show environment"}
>> -}
>> -set timeout $oldtimeout
>> +# It's hard to do this verification since we can't really compare each
>> +# entry with the current environment.  So we just check to see if
>> +# there is anything that looks like an environment variable being
>> +# printed.
>> +gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \
>> +    "show environment works"
>
> We can easily set a variable in the environment before spawning GDB.
> We'd just have to limit that specific test to when not testing with a
> remote host, I think?  See gdb.base/gdbhistsize-history.exp for example.

Yeah, I thought about that, but what this command really wants to test
is that there is a list of environment variables.

testenv.exp has a test that does just what you described; I'd rather
leave the environ.exp test like it is now, unless you really think it's
worth doing it as you proposed.

>
>> +gdb_test_multiple "unset environment" $msg {
>> +    -re "Delete all environment variables.*y or n.*$" {
>> +	gdb_test_no_output "y" $msg
>> +    }
>> +    -re "$gdb_prompt $" {
>> +	fail $msg
>> +    }
>>  }
>
> The '-re "$gdb_prompt $"' part is not necessary because
> gdb_test_multiple already does that by default.
> And then you can use gdb_test for this:
>
>   gdb_test "unset environment" "" $msg \
>     "Delete all environment variables. .y or n. $" \
>     "y"

Hm, thanks, fixed that.

>> -# Verify that GDB can manipulate the distinguished PATH variable.
>> -#
>> -send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
>> -gdb_expect {
>> -  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
>> -          {pass "issue path"}
>> -  -re "$gdb_prompt $"\
>> -          {fail "issue path"}
>> -  timeout {fail "(timeout) issue path"}
>> -}
>> -send_gdb "show paths\n"
>> -gdb_expect {
>> -  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
>> -          {pass "show paths"}
>> -  -re "$gdb_prompt $"\
>> -          {fail "show paths"}
>> -  timeout {fail "(timeout) show paths"}
>
> Any reason these "path" command tests are dropped?
> (AFAICS, the MI equivalent is tested by gdb.mi/mi-basics.exp).

Somehow I thought these tests were not really testing anything useful.
I've put them back now.

>> -}
>> +gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL =        foo" \
>> +    "set environment variable with trailing whitespace"
>> +gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
>> +    "FOOBARBAZGRUNGESPAZBALL = foo" \
>> +    "confirm set environment variable with trailing whitespace"
>>  
>>  gdb_exit
>>  return 0
>> diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
>> new file mode 100644
>> index 0000000..e5e5fb9
>> --- /dev/null
>> +++ b/gdb/testsuite/gdb.base/info-program.exp
>> @@ -0,0 +1,45 @@
>> +# Copyright 2017 Free Software Foundation, Inc.
>
> If the moved code is based on older code, the original copyright year
> must be preserved.

Fixed.

Below is the updated patch.

Thanks for the review,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Fri, 31 Mar 2017 13:24:36 -0400
Subject: [PATCH] Make environ.exp run on all platforms (and create
 info-program.exp)

This has been on my TODO list for a while.  There's a really old bug
about this (PR testsuite/8595), and there was no reason for
environ.exp to be specific for hppa* targets.  So this patch removes
this constraint, modernizes the testcase, and cleans up some things.
Most of the tests remained, and some were rewritten (especially the
one that checks if "show environment" works, which is something kind
of hard to do).

As a bonus, I'm adding a separated info-program.exp file containing
all the tests related to "info program" that were present on
environ.exp.

Tested locally, everything still passes.

gdb/testsuite/ChangeLog:
2017-04-27  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR testsuite/8595
	* gdb.base/environ.exp: Make test available in all architectures.
	Move bits related to "info program" testing to
	gdb.base/info-program.exp.  Rewrite tests to use the two new
	procedures mentione below.
	(test_set_show_env_var) New procedure.
	(test_set_show_env_var_equal): Likewise.
	* gdb.base/info-program.exp: New file.
---
 gdb/testsuite/ChangeLog                 |  11 ++
 gdb/testsuite/gdb.base/environ.exp      | 302 ++++++--------------------------
 gdb/testsuite/gdb.base/info-program.exp |  45 +++++
 3 files changed, 106 insertions(+), 252 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/info-program.exp

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c4d5b79..c3279ad 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2017-04-27  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR testsuite/8595
+	* gdb.base/environ.exp: Make test available in all architectures.
+	Move bits related to "info program" testing to
+	gdb.base/info-program.exp.  Rewrite tests to use the two new
+	procedures mentione below.
+	(test_set_show_env_var) New procedure.
+	(test_set_show_env_var_equal): Likewise.
+	* gdb.base/info-program.exp: New file.
+
 2017-04-19  Pedro Alves  <palves@redhat.com>
 
 	* gdb.threads/threadapply.exp (kill_and_remove_inferior): New
diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index a833f79..dd7bd8f 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -13,297 +13,95 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#
-# test running programs
-#
+gdb_start
 
-# This test exists solely to exercise the "environment" commands for
-# code-coverage on HP-UX.
-#
-if ![istarget "hppa*-*-hpux*"] then {
-  return
-}
-
-standard_testfile break.c break1.c
-
-if {[prepare_for_testing "failed to prepare" $testfile \
-	 [list $srcfile $srcfile2] {debug nowarnings}]} {
-    return -1
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
-
-# (No, this is not really related to the environment commands.  But it's
-# a convenient place to verify that this command works.)
-#
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
-          {pass "info program"}
-  -re "$gdb_prompt $"\
-          {fail "info program"}
-  timeout {fail "(timeout) info program"}
-}
-
-# We don't really care where this step lands, so long as it gets
-# the inferior pushed off the breakpoint it's currently on...
-#
-send_gdb "next\n"
-gdb_expect {
-  -re ".*$gdb_prompt $"\
-          {pass "step before info program"}
-  timeout {fail "(timeout) step before info program"}
+proc test_set_show_env_var { name value test_name } {
+    gdb_test_no_output "set environment $name $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped after being stepped..*$gdb_prompt $"\
-          {pass "info program after step"}
-  -re "$gdb_prompt $"\
-          {fail "info program after step"}
-  timeout {fail "(timeout) info program after step"}
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
 
-send_gdb "delete\n"
-gdb_expect {
-  -re ".*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re ".*$gdb_prompt $"\
-                     {pass "delete breakpoint before info program"}
-             timeout {fail "(timeout) delete breakpoint before info program"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "delete breakpoint before info program"}
-  timeout {fail "(timeout) delete breakpoint before info program"}
-}
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at a breakpoint that has since been deleted..*$gdb_prompt $"\
-          {pass "info program after deleted breakpoint"}
-  -re "$gdb_prompt $"\
-          {fail "info program after deleted breakpoint"}
-  timeout {fail "(timeout) info program after deleted breakpoint"}
+proc test_set_show_env_var_equal { name value test_name } {
+    gdb_test_no_output "set environment $name = $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
 
 # Verify that we can show all currently-set environment variables.
-# (It's a bit hacky, but nonetheless probably safe to check for at
-# least the SHELL variable.)
-#
-# need to increase timeout because of very long output
-set oldtimeout $timeout
-set timeout [expr "$timeout + 300"]
-
-send_gdb "show environment\n"
-gdb_expect {
-  -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
-          {pass "show environment"}
-  -re "$gdb_prompt $"\
-          {fail "show environment"}
-  timeout {fail "(timeout) show environment"}
-}
-set timeout $oldtimeout
+# It's hard to do this verification since we can't really compare each
+# entry with the current environment.  So we just check to see if
+# there is anything that looks like an environment variable being
+# printed.
+gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \
+    "show environment works"
 
 # Verify that we can unset a specific environment variable.
-#
-send_gdb "unset environment EDITOR\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue unset environment"}
-  timeout {fail "(timeout) issue unset environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "Environment variable \"EDITOR\" not defined.\r\n$gdb_prompt $"\
-          {pass "unset environment"}
-  -re "$gdb_prompt $"\
-          {fail "unset environment"}
-  timeout {fail "(timeout) unset environment"}
-}
+gdb_test_no_output "unset environment EDITOR" "unset environment variable"
+
+gdb_test "show environment EDITOR" "Environment variable \"EDITOR\" not defined\." \
+    "confirm unset environment variable worked"
 
 # Verify that we can unset all environment variables.
-#
-send_gdb "unset environment\n"
-gdb_expect {
-  -re "Delete all environment variables.*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re "$gdb_prompt $"\
-                     {pass "unset entire environment"}
-             timeout {fail "(timeout) unset entire environment"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "unset entire environment"}
-  timeout {fail "(timeout) unset entire environment"}
-}
+gdb_test "unset environment" "" "unset all environment variables" \
+    "Delete all environment variables. .y or n. $" \
+    "y"
 
 # Verify that we can set a specific environment variable.
-#
-send_gdb "set environment EDITOR emacs\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment"}
-  timeout {fail "(timeout) issue set environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = emacs\r\n$gdb_prompt $"\
-          {pass "set environment"}
-  -re "$gdb_prompt $"\
-          {fail "set environment"}
-  timeout {fail "(timeout) set environment"}
-}
+test_set_show_env_var "EDITOR" "emacs" "set environment variable"
 
 # Verify that GDB responds gracefully to a request to set environment,
 # with no variable name.
-#
-send_gdb "set environment\n"
-gdb_expect {
-  -re "Argument required .environment variable and value..*$gdb_prompt $"\
-          {pass "set environment without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable disallowed"}
-  timeout {fail "(timeout) set environment without variable disallowed"}
-}
+gdb_test "set environment" "Argument required \\\(environment variable and value\\\)\." \
+    "set environment without arguments"
 
 # I'm not sure just what GDB has in mind in explicitly checking
 # for this variant, but since GDB handles it, test it.
-#
-send_gdb "set environment =\n"
-gdb_expect {
-  -re "Argument required .environment variable to set..*$gdb_prompt $"\
-          {pass "set environment equals without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment equals without variable disallowed"}
-  timeout {fail "(timeout) set environment equals without variable disallowed"}
-}
+gdb_test "set environment =" "Argument required \\\(environment variable to set\\\)\." \
+    "set environment without variable name"
 
 # Setting an environment variable without a value sets it to a NULL
 # value.
-#
-send_gdb "set environment EDITOR\n"
-gdb_expect {
-  -re "Setting environment variable \"EDITOR\" to null value..*$gdb_prompt $"\
-          {pass "issue set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "issue set environment without variable value"}
-  timeout {fail "(timeout) issue set environment without variable value"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = \r\n$gdb_prompt $"\
-          {pass "set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable value"}
-  timeout {fail "(timeout) set environment without variable value"}
-}
+gdb_test "set environment EDITOR" "Setting environment variable \"EDITOR\" to null value\." \
+    "set environment variable to null value"
+gdb_test "show environment EDITOR" "EDITOR = " "show null environment variable"
 
 # Verify that GDB responds gracefully to an attempt to show a
 # non-existent environment variable.  (We hope this variable is
 # undefined!)
-#
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined..*$gdb_prompt $"\
-          {pass "show non-existent environment variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "show non-existent environment variable disallowed"}
-  timeout {fail "(timeout) show non-existent environment variable disallowed"}
-}
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined\." \
+    "show non-existent environment variable"
 
 # Verify that GDB can set an environment variable hitherto undefined.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment for previously undefined variable"}
-  timeout {fail "(timeout) issue set environment for previously undefined variable"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment for previously undefined variable"}
-  -re "$gdb_prompt $"\
-          {fail "set environment for previously undefined variable"}
-  timeout {fail "(timeout) set environment for previously undefined variable"}
-}
+test_set_show_env_var "FOOBARBAZGRUNGESPAZBALL" "t" \
+    "set environment variable previously undefined"
 
 # Verify that GDB can also set an environment variable using the "="
 # syntax.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL = t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with equals"}
-  timeout {fail "(timeout) issue set environment with equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment with equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with equals"}
-  timeout {fail "(timeout) set environment with equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "y" \
+    "set environment variable using = syntax"
 
 # Verify that GDB can set an environment variable to a value that has
 # an embedded (trailing, in this case) equals.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t=\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with trailing equals"}
-  timeout {fail "(timeout) issue set environment with trailing equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t=\r\n$gdb_prompt $"\
-          {pass "set environment with trailing equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with trailing equals"}
-  timeout {fail "(timeout) set environment with trailing equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "t=" \
+    "set environment variable with trailing equals"
 
 # Verify that GDB can set an environment variable to a value preceded
 # by whitespace, and that such whitespace is ignored (not included
 # in the set value).
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL =     foo\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with preceding whitespace"}
-  timeout {fail "(timeout) issue set environment with preceding whitespace"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = foo\r\n$gdb_prompt $"\
-          {pass "set environment with preceding whitespace"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with preceding whitespace"}
-  timeout {fail "(timeout) set environment with preceding whitespace"}
-}
+gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL =        foo" \
+    "set environment variable with trailing whitespace"
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "FOOBARBAZGRUNGESPAZBALL = foo" \
+    "confirm set environment variable with trailing whitespace"
 
 # Verify that GDB can manipulate the distinguished PATH variable.
-#
-send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "issue path"}
-  -re "$gdb_prompt $"\
-          {fail "issue path"}
-  timeout {fail "(timeout) issue path"}
-}
-send_gdb "show paths\n"
-gdb_expect {
-  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "show paths"}
-  -re "$gdb_prompt $"\
-          {fail "show paths"}
-  timeout {fail "(timeout) show paths"}
-}
+gdb_test "path /tmp/FOOBARBAZGRUNGESPAZBALL" \
+    ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*" \
+    "set path containing env var name"
+gdb_test "show paths" \
+    "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*" \
+    "show paths correctly show path with env var name"
 
 gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
new file mode 100644
index 0000000..e3690c8
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-program.exp
@@ -0,0 +1,45 @@
+# Copyright 1997-2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile normal.c
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+    return -1
+}
+
+if { ![runto_main] } {
+    fail "can't run to main"
+    return -1
+}
+
+gdb_test "info program" ".*\r\nProgram stopped at $hex\.\r\nIt stopped at breakpoint $decimal\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after run to main"
+
+# We don't really care where this step lands, so long as it gets
+# the inferior pushed off the breakpoint it's currently on...
+gdb_test "next" "$decimal\t.*" "advancing pc"
+
+gdb_test "info program" ".*\r\nProgram stopped at $hex\.\r\nIt stopped after being stepped\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after next"
+
+if { ![runto_main] } then {
+    fail "can't restart program"
+    return -1
+}
+
+delete_breakpoints
+
+gdb_test "info program" ".*\r\nProgram stopped at $hex\.\r\nIt stopped at a breakpoint that has since been deleted\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after deleting all breakpoints"
-- 
2.9.3

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

* Re: [PATCH v3] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-27 19:06     ` Sergio Durigan Junior
@ 2017-04-27 22:37       ` Pedro Alves
  2017-04-29  0:32         ` Sergio Durigan Junior
  0 siblings, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2017-04-27 22:37 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: GDB Patches, Luis Machado

On 04/27/2017 08:06 PM, Sergio Durigan Junior wrote:
>  # Verify that GDB can manipulate the distinguished PATH variable.
> -#
> -send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
> -gdb_expect {
> -  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
> -          {pass "issue path"}
> -  -re "$gdb_prompt $"\
> -          {fail "issue path"}
> -  timeout {fail "(timeout) issue path"}
> -}
> -send_gdb "show paths\n"
> -gdb_expect {
> -  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
> -          {pass "show paths"}
> -  -re "$gdb_prompt $"\
> -          {fail "show paths"}
> -  timeout {fail "(timeout) show paths"}
> -}
> +gdb_test "path /tmp/FOOBARBAZGRUNGESPAZBALL" \
> +    ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*" \
> +    "set path containing env var name"

Can you drop the redundant leading ".*" in the regexes while at it?
I saw a couple in info-program.exp, but there might be more
throughout the patch.

BTW, re. the test msg above, I don't think that the fact that that
funny name was used as env var name in the previous tests is relevant.

> +gdb_test "show paths" \
> +    "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*" \
> +    "show paths correctly show path with env var name"

Ditto.  (and "correctly shows path")

> +# We don't really care where this step lands, so long as it gets
> +# the inferior pushed off the breakpoint it's currently on...
> +gdb_test "next" "$decimal\t.*" "advancing pc"

s/advancing/advance.  But the old test message was better IMO:

> -  {pass "step before info program"}

because the next test is explicitly checking that
"It stopped after being stepped" is printed.

OK with the nits above addressed.

Thanks,
Pedro Alves

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

* Re: [PATCH v3] Make environ.exp run on all platforms (and create info-program.exp)
  2017-04-27 22:37       ` Pedro Alves
@ 2017-04-29  0:32         ` Sergio Durigan Junior
  0 siblings, 0 replies; 15+ messages in thread
From: Sergio Durigan Junior @ 2017-04-29  0:32 UTC (permalink / raw)
  To: Pedro Alves; +Cc: GDB Patches, Luis Machado

On Thursday, April 27 2017, Pedro Alves wrote:

> On 04/27/2017 08:06 PM, Sergio Durigan Junior wrote:
>>  # Verify that GDB can manipulate the distinguished PATH variable.
>> -#
>> -send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
>> -gdb_expect {
>> -  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
>> -          {pass "issue path"}
>> -  -re "$gdb_prompt $"\
>> -          {fail "issue path"}
>> -  timeout {fail "(timeout) issue path"}
>> -}
>> -send_gdb "show paths\n"
>> -gdb_expect {
>> -  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
>> -          {pass "show paths"}
>> -  -re "$gdb_prompt $"\
>> -          {fail "show paths"}
>> -  timeout {fail "(timeout) show paths"}
>> -}
>> +gdb_test "path /tmp/FOOBARBAZGRUNGESPAZBALL" \
>> +    ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*" \
>> +    "set path containing env var name"
>
> Can you drop the redundant leading ".*" in the regexes while at it?
> I saw a couple in info-program.exp, but there might be more
> throughout the patch.

Removed every instance.

> BTW, re. the test msg above, I don't think that the fact that that
> funny name was used as env var name in the previous tests is relevant.

I rewrote the test message to just say that it expects set/show paths to
work correctly.

>> +gdb_test "show paths" \
>> +    "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*" \
>> +    "show paths correctly show path with env var name"
>
> Ditto.  (and "correctly shows path")

Likewise.

>> +# We don't really care where this step lands, so long as it gets
>> +# the inferior pushed off the breakpoint it's currently on...
>> +gdb_test "next" "$decimal\t.*" "advancing pc"
>
> s/advancing/advance.  But the old test message was better IMO:
>
>> -  {pass "step before info program"}
>
> because the next test is explicitly checking that
> "It stopped after being stepped" is printed.

Restored the previous message.

> OK with the nits above addressed.

Thanks, what I pushed is below.

45ce1b47e4490993b5c1a04f4a8acb62d9ec5039

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

From 45ce1b47e4490993b5c1a04f4a8acb62d9ec5039 Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Fri, 31 Mar 2017 13:24:36 -0400
Subject: [PATCH] Make environ.exp run on all platforms (and create
 info-program.exp)

This has been on my TODO list for a while.  There's a really old bug
about this (PR testsuite/8595), and there was no reason for
environ.exp to be specific for hppa* targets.  So this patch removes
this constraint, modernizes the testcase, and cleans up some things.
Most of the tests remained, and some were rewritten (especially the
one that checks if "show environment" works, which is something kind
of hard to do).

As a bonus, I'm adding a separated info-program.exp file containing
all the tests related to "info program" that were present on
environ.exp.

Tested locally, everything still passes.

gdb/testsuite/ChangeLog:
2017-04-28  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR testsuite/8595
	* gdb.base/environ.exp: Make test available in all architectures.
	Move bits related to "info program" testing to
	gdb.base/info-program.exp.  Rewrite tests to use the two new
	procedures mentione below.
	(test_set_show_env_var) New procedure.
	(test_set_show_env_var_equal): Likewise.
	* gdb.base/info-program.exp: New file.
---
 gdb/testsuite/ChangeLog                 |  11 ++
 gdb/testsuite/gdb.base/environ.exp      | 302 ++++++--------------------------
 gdb/testsuite/gdb.base/info-program.exp |  45 +++++
 3 files changed, 106 insertions(+), 252 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/info-program.exp

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a835a40..2f24d47 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2017-04-28  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	PR testsuite/8595
+	* gdb.base/environ.exp: Make test available in all architectures.
+	Move bits related to "info program" testing to
+	gdb.base/info-program.exp.  Rewrite tests to use the two new
+	procedures mentione below.
+	(test_set_show_env_var) New procedure.
+	(test_set_show_env_var_equal): Likewise.
+	* gdb.base/info-program.exp: New file.
+
 2017-04-27  Keith Seitz  <keiths@redhat.com>
 
 	* gdb.cp/oranking.cc (test15): New function.
diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index a833f79..0b69a80 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -13,297 +13,95 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#
-# test running programs
-#
+gdb_start
 
-# This test exists solely to exercise the "environment" commands for
-# code-coverage on HP-UX.
-#
-if ![istarget "hppa*-*-hpux*"] then {
-  return
-}
-
-standard_testfile break.c break1.c
-
-if {[prepare_for_testing "failed to prepare" $testfile \
-	 [list $srcfile $srcfile2] {debug nowarnings}]} {
-    return -1
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
-
-# (No, this is not really related to the environment commands.  But it's
-# a convenient place to verify that this command works.)
-#
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
-          {pass "info program"}
-  -re "$gdb_prompt $"\
-          {fail "info program"}
-  timeout {fail "(timeout) info program"}
-}
-
-# We don't really care where this step lands, so long as it gets
-# the inferior pushed off the breakpoint it's currently on...
-#
-send_gdb "next\n"
-gdb_expect {
-  -re ".*$gdb_prompt $"\
-          {pass "step before info program"}
-  timeout {fail "(timeout) step before info program"}
+proc test_set_show_env_var { name value test_name } {
+    gdb_test_no_output "set environment $name $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped after being stepped..*$gdb_prompt $"\
-          {pass "info program after step"}
-  -re "$gdb_prompt $"\
-          {fail "info program after step"}
-  timeout {fail "(timeout) info program after step"}
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
 
-send_gdb "delete\n"
-gdb_expect {
-  -re ".*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re ".*$gdb_prompt $"\
-                     {pass "delete breakpoint before info program"}
-             timeout {fail "(timeout) delete breakpoint before info program"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "delete breakpoint before info program"}
-  timeout {fail "(timeout) delete breakpoint before info program"}
-}
-send_gdb "info program\n"
-gdb_expect {
-  -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at a breakpoint that has since been deleted..*$gdb_prompt $"\
-          {pass "info program after deleted breakpoint"}
-  -re "$gdb_prompt $"\
-          {fail "info program after deleted breakpoint"}
-  timeout {fail "(timeout) info program after deleted breakpoint"}
+proc test_set_show_env_var_equal { name value test_name } {
+    gdb_test_no_output "set environment $name = $value" "$test_name"
+    gdb_test "show environment $name" "$name = $value" \
+	"confirm $test_name"
 }
 
 # Verify that we can show all currently-set environment variables.
-# (It's a bit hacky, but nonetheless probably safe to check for at
-# least the SHELL variable.)
-#
-# need to increase timeout because of very long output
-set oldtimeout $timeout
-set timeout [expr "$timeout + 300"]
-
-send_gdb "show environment\n"
-gdb_expect {
-  -re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
-          {pass "show environment"}
-  -re "$gdb_prompt $"\
-          {fail "show environment"}
-  timeout {fail "(timeout) show environment"}
-}
-set timeout $oldtimeout
+# It's hard to do this verification since we can't really compare each
+# entry with the current environment.  So we just check to see if
+# there is anything that looks like an environment variable being
+# printed.
+gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \
+    "show environment works"
 
 # Verify that we can unset a specific environment variable.
-#
-send_gdb "unset environment EDITOR\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue unset environment"}
-  timeout {fail "(timeout) issue unset environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "Environment variable \"EDITOR\" not defined.\r\n$gdb_prompt $"\
-          {pass "unset environment"}
-  -re "$gdb_prompt $"\
-          {fail "unset environment"}
-  timeout {fail "(timeout) unset environment"}
-}
+gdb_test_no_output "unset environment EDITOR" "unset environment variable"
+
+gdb_test "show environment EDITOR" "Environment variable \"EDITOR\" not defined\." \
+    "confirm unset environment variable worked"
 
 # Verify that we can unset all environment variables.
-#
-send_gdb "unset environment\n"
-gdb_expect {
-  -re "Delete all environment variables.*y or n. $"\
-          {send_gdb "y\n"
-           gdb_expect {
-             -re "$gdb_prompt $"\
-                     {pass "unset entire environment"}
-             timeout {fail "(timeout) unset entire environment"}
-           }
-          }
-  -re "$gdb_prompt $"\
-          {fail "unset entire environment"}
-  timeout {fail "(timeout) unset entire environment"}
-}
+gdb_test "unset environment" "" "unset all environment variables" \
+    "Delete all environment variables. .y or n. $" \
+    "y"
 
 # Verify that we can set a specific environment variable.
-#
-send_gdb "set environment EDITOR emacs\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment"}
-  timeout {fail "(timeout) issue set environment"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = emacs\r\n$gdb_prompt $"\
-          {pass "set environment"}
-  -re "$gdb_prompt $"\
-          {fail "set environment"}
-  timeout {fail "(timeout) set environment"}
-}
+test_set_show_env_var "EDITOR" "emacs" "set environment variable"
 
 # Verify that GDB responds gracefully to a request to set environment,
 # with no variable name.
-#
-send_gdb "set environment\n"
-gdb_expect {
-  -re "Argument required .environment variable and value..*$gdb_prompt $"\
-          {pass "set environment without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable disallowed"}
-  timeout {fail "(timeout) set environment without variable disallowed"}
-}
+gdb_test "set environment" "Argument required \\\(environment variable and value\\\)\." \
+    "set environment without arguments"
 
 # I'm not sure just what GDB has in mind in explicitly checking
 # for this variant, but since GDB handles it, test it.
-#
-send_gdb "set environment =\n"
-gdb_expect {
-  -re "Argument required .environment variable to set..*$gdb_prompt $"\
-          {pass "set environment equals without variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "set environment equals without variable disallowed"}
-  timeout {fail "(timeout) set environment equals without variable disallowed"}
-}
+gdb_test "set environment =" "Argument required \\\(environment variable to set\\\)\." \
+    "set environment without variable name"
 
 # Setting an environment variable without a value sets it to a NULL
 # value.
-#
-send_gdb "set environment EDITOR\n"
-gdb_expect {
-  -re "Setting environment variable \"EDITOR\" to null value..*$gdb_prompt $"\
-          {pass "issue set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "issue set environment without variable value"}
-  timeout {fail "(timeout) issue set environment without variable value"}
-}
-send_gdb "show environment EDITOR\n"
-gdb_expect {
-  -re "EDITOR = \r\n$gdb_prompt $"\
-          {pass "set environment without variable value"}
-  -re "$gdb_prompt $"\
-          {fail "set environment without variable value"}
-  timeout {fail "(timeout) set environment without variable value"}
-}
+gdb_test "set environment EDITOR" "Setting environment variable \"EDITOR\" to null value\." \
+    "set environment variable to null value"
+gdb_test "show environment EDITOR" "EDITOR = " "show null environment variable"
 
 # Verify that GDB responds gracefully to an attempt to show a
 # non-existent environment variable.  (We hope this variable is
 # undefined!)
-#
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined..*$gdb_prompt $"\
-          {pass "show non-existent environment variable disallowed"}
-  -re "$gdb_prompt $"\
-          {fail "show non-existent environment variable disallowed"}
-  timeout {fail "(timeout) show non-existent environment variable disallowed"}
-}
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined\." \
+    "show non-existent environment variable"
 
 # Verify that GDB can set an environment variable hitherto undefined.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment for previously undefined variable"}
-  timeout {fail "(timeout) issue set environment for previously undefined variable"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment for previously undefined variable"}
-  -re "$gdb_prompt $"\
-          {fail "set environment for previously undefined variable"}
-  timeout {fail "(timeout) set environment for previously undefined variable"}
-}
+test_set_show_env_var "FOOBARBAZGRUNGESPAZBALL" "t" \
+    "set environment variable previously undefined"
 
 # Verify that GDB can also set an environment variable using the "="
 # syntax.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL = t\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with equals"}
-  timeout {fail "(timeout) issue set environment with equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t\r\n$gdb_prompt $"\
-          {pass "set environment with equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with equals"}
-  timeout {fail "(timeout) set environment with equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "y" \
+    "set environment variable using = syntax"
 
 # Verify that GDB can set an environment variable to a value that has
 # an embedded (trailing, in this case) equals.
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL t=\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with trailing equals"}
-  timeout {fail "(timeout) issue set environment with trailing equals"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = t=\r\n$gdb_prompt $"\
-          {pass "set environment with trailing equals"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with trailing equals"}
-  timeout {fail "(timeout) set environment with trailing equals"}
-}
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "t=" \
+    "set environment variable with trailing equals"
 
 # Verify that GDB can set an environment variable to a value preceded
 # by whitespace, and that such whitespace is ignored (not included
 # in the set value).
-#
-send_gdb "set environment FOOBARBAZGRUNGESPAZBALL =     foo\n"
-gdb_expect {
-  -re "$gdb_prompt $"\
-          {pass "issue set environment with preceding whitespace"}
-  timeout {fail "(timeout) issue set environment with preceding whitespace"}
-}
-send_gdb "show environment FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re "FOOBARBAZGRUNGESPAZBALL = foo\r\n$gdb_prompt $"\
-          {pass "set environment with preceding whitespace"}
-  -re "$gdb_prompt $"\
-          {fail "set environment with preceding whitespace"}
-  timeout {fail "(timeout) set environment with preceding whitespace"}
-}
+gdb_test_no_output "set environment FOOBARBAZGRUNGESPAZBALL =        foo" \
+    "set environment variable with trailing whitespace"
+gdb_test "show environment FOOBARBAZGRUNGESPAZBALL" \
+    "FOOBARBAZGRUNGESPAZBALL = foo" \
+    "confirm set environment variable with trailing whitespace"
 
 # Verify that GDB can manipulate the distinguished PATH variable.
-#
-send_gdb "path /tmp/FOOBARBAZGRUNGESPAZBALL\n"
-gdb_expect {
-  -re ".*Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "issue path"}
-  -re "$gdb_prompt $"\
-          {fail "issue path"}
-  timeout {fail "(timeout) issue path"}
-}
-send_gdb "show paths\n"
-gdb_expect {
-  -re "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*$gdb_prompt $"\
-          {pass "show paths"}
-  -re "$gdb_prompt $"\
-          {fail "show paths"}
-  timeout {fail "(timeout) show paths"}
-}
+gdb_test "path /tmp/FOOBARBAZGRUNGESPAZBALL" \
+    "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*" \
+    "set path works properly"
+gdb_test "show paths" \
+    "Executable and object file path: /tmp/FOOBARBAZGRUNGESPAZBALL.*" \
+    "show paths works properly"
 
 gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.base/info-program.exp b/gdb/testsuite/gdb.base/info-program.exp
new file mode 100644
index 0000000..bf8187c
--- /dev/null
+++ b/gdb/testsuite/gdb.base/info-program.exp
@@ -0,0 +1,45 @@
+# Copyright 1997-2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile normal.c
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+    return -1
+}
+
+if { ![runto_main] } {
+    fail "can't run to main"
+    return -1
+}
+
+gdb_test "info program" "Program stopped at $hex\.\r\nIt stopped at breakpoint $decimal\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after run to main"
+
+# We don't really care where this step lands, so long as it gets
+# the inferior pushed off the breakpoint it's currently on...
+gdb_test "next" "$decimal\t.*" "step before info program"
+
+gdb_test "info program" "Program stopped at $hex\.\r\nIt stopped after being stepped\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after next"
+
+if { ![runto_main] } then {
+    fail "can't restart program"
+    return -1
+}
+
+delete_breakpoints
+
+gdb_test "info program" "Program stopped at $hex\.\r\nIt stopped at a breakpoint that has since been deleted\.\r\nType \"info stack\" or \"info registers\" for more information\." \
+    "info program after deleting all breakpoints"
-- 
2.9.3

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

end of thread, other threads:[~2017-04-29  0:32 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31 17:29 [PATCH] Make environ.exp run on all platforms (and create info-program.exp) Sergio Durigan Junior
2017-04-12 23:30 ` Sergio Durigan Junior
2017-04-13 14:35 ` Luis Machado
2017-04-13 18:26   ` Sergio Durigan Junior
2017-04-13 18:29     ` Luis Machado
2017-04-13 18:34       ` Sergio Durigan Junior
2017-04-20 19:54         ` Luis Machado
2017-04-25 20:47 ` [PATCH v2] " Sergio Durigan Junior
2017-04-26 18:43   ` Luis Machado
2017-04-26 19:42     ` Sergio Durigan Junior
2017-04-26 22:28 ` [PATCH v3] " Sergio Durigan Junior
2017-04-27 14:53   ` Pedro Alves
2017-04-27 19:06     ` Sergio Durigan Junior
2017-04-27 22:37       ` Pedro Alves
2017-04-29  0:32         ` Sergio Durigan Junior

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).