[RFVv4,5/5] Add a test case for info args|functions|locals|variables [-q] [-t TYPEREGEXP] [NAMEREGEXP]

Message ID 0635db5a-c2ff-cc3f-3dfb-7c2c98c7323b@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves Oct. 26, 2018, 6:06 p.m. UTC
  On 10/25/2018 09:11 PM, Philippe Waroquiers wrote:
> Add a test case for info args|functions|locals|variables [-q] [-t TYPEREGEXP] [NAMEREGEXP]
> 
> gdb/testsuite/ChangeLog
> 2018-10-25  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
> 
>         * gdb.base/info_qt.c: New file.
>         * gdb.base/info_qt.exp: New file.

Thanks!

I still think that the gdb.sum output with the patch below on
top looks much clearer.  Do you disagree?

Note that the last hunk below shows that "info args" was
incorrect, should have been "info locals".

Otherwise looks good.

From 347d23341613bc0780d5ee189a21b45b6d1eac7a Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 26 Oct 2018 13:46:51 +0100
Subject: [PATCH] foreach

---
 gdb/testsuite/gdb.base/info_qt.exp | 53 ++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 31 deletions(-)
  

Comments

Philippe Waroquiers Oct. 27, 2018, 12:52 p.m. UTC | #1
On Fri, 2018-10-26 at 19:06 +0100, Pedro Alves wrote:
> On 10/25/2018 09:11 PM, Philippe Waroquiers wrote:
> > Add a test case for info args|functions|locals|variables [-q] [-t TYPEREGEXP] [NAMEREGEXP]
> > 
> > gdb/testsuite/ChangeLog
> > 2018-10-25  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
> > 
> >         * gdb.base/info_qt.c: New file.
> >         * gdb.base/info_qt.exp: New file.
> 
> Thanks!
> 
> I still think that the gdb.sum output with the patch below on
> top looks much clearer.  Do you disagree?
No, that is effectively much clearer.
I have applied the patch, handled (I think/hope) all the remaining
comments, and have pushed the series.

Again, many thanks for the several reviews done (Eli, Tom and you) ...

Philippe
  

Patch

diff --git a/gdb/testsuite/gdb.base/info_qt.exp b/gdb/testsuite/gdb.base/info_qt.exp
index 83084a3ce83..ab0872973a7 100644
--- a/gdb/testsuite/gdb.base/info_qt.exp
+++ b/gdb/testsuite/gdb.base/info_qt.exp
@@ -42,7 +42,7 @@  set number "\[0-9]\+"
 ############# Test 'info functions'.
 
 with_test_prefix "info functions nameregexp" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info functions info_fun"
 	"info functions -- info_fun"
 	"info functions ^info_fun" } {
@@ -56,13 +56,12 @@  with_test_prefix "info functions nameregexp" {
 		     "${number}:	int info_fun2bis\\\(char\\\);" \
 		     "${number}:	entier info_fun2xxx\\\(char, int, int\\\);" \
 		     "${number}:	entier info_fun2yyy\\\(char, int, int\\\);" \
-		    ] \
-		"info functions info_fun"
+		    ]
     }
 }
 
 with_test_prefix "info functions nameregexp quiet" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info functions -q info_fun"
 	"info functions -q -- info_fun" } {
 	    gdb_test $cmd \
@@ -74,21 +73,20 @@  with_test_prefix "info functions nameregexp quiet" {
 		     "${number}:	int info_fun2bis\\\(char\\\);" \
 		     "${number}:	entier info_fun2xxx\\\(char, int, int\\\);" \
 		     "${number}:	entier info_fun2yyy\\\(char, int, int\\\);" \
-		    ] \
-		"info functions -q info_fun"
+		    ]
 	}
 }
 
 with_test_prefix "info functions nameregexp quiet no match" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info functions -q nowaythiscanmatch"
 	"info functions -q -- -q" } {
-	    gdb_test_no_output $cmd "quiet info functions empty output"
+	    gdb_test_no_output $cmd
 	}
 }
 
 with_test_prefix "info functions typeregexp nameregexp" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info functions -t entier -q info_fun"
 	"info functions -q -t 'entier (' -- info_fun"
 	"info functions -q -t '(char, int, int)' -- info_fun"
@@ -99,8 +97,7 @@  with_test_prefix "info functions typeregexp nameregexp" {
 		     "File .*info_qt.c:" \
 		     "${number}:	entier info_fun2xxx\\\(char, int, int\\\);" \
 		     "${number}:	entier info_fun2yyy\\\(char, int, int\\\);" \
-		    ] \
-		"info functions -q info_fun"
+		    ]
 	}
 }
 
@@ -112,7 +109,7 @@  with_test_prefix "info functions typeregexp nameregexp no match" {
 ############# Test 'info variables'.
 
 with_test_prefix "info variables nameregexp" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info variables info_qt"
 	"info variables -- info_qt"
 	"info variables ^info_qt" } {
@@ -123,21 +120,20 @@  with_test_prefix "info variables nameregexp" {
 		     "File .*info_qt.c:" \
 		     "${number}:	entier info_qt_ent;" \
 		     "${number}:	int info_qt_inc;" \
-		    ] \
-		"info functions info_fun"
+		    ]
 	}
 }
 
 with_test_prefix "info variables nameregexp quiet no match" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info variables -q nowaythiscanmatch"
 	"info variables -q -- -q" } {
-	    gdb_test_no_output $cmd "quiet info variables empty output"
+	    gdb_test_no_output $cmd
 	}
 }
 
 with_test_prefix "info variables typeregexp nameregexp quiet" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info variables -t entier -q info_qt"
 	"info variables -q -t entier -- info_qt" } {
 	    gdb_test $cmd \
@@ -145,8 +141,7 @@  with_test_prefix "info variables typeregexp nameregexp quiet" {
 		     "" \
 		     "File .*info_qt.c:" \
 		     "${number}:	entier info_qt_ent;" \
-		    ] \
-		"info variables -q -t entier info_fun"
+		    ]
 	}
 }
 
@@ -162,7 +157,7 @@  with_test_prefix "info variables typeregexp nameregexp quiet no match" {
 gdb_test "frame 1" ".* in setup .*" "set frame 1 for info args"
 
 with_test_prefix "info args matching all args" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info args"
 	"info args arg_"
 	"info args g"
@@ -172,21 +167,19 @@  with_test_prefix "info args matching all args" {
 		     "arg_c = 100 'd'" \
 		     "arg_i = 3" \
 		     "arg_j = 4" \
-		    ] \
-		"info args"
+		    ]
 	}
 }
 
 with_test_prefix "info args matching some args" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info args -t int"
 	"info args arg_[ij]"} {
 	    gdb_test $cmd \
 		[multi_line \
 		     "arg_i = 3" \
 		     "arg_j = 4" \
-		    ] \
-		"info args"
+		    ]
 	}
 }
 
@@ -201,7 +194,7 @@  with_test_prefix "info args no match" {
 gdb_test "frame 1" ".* in setup .*" "set frame 1 for info locals"
 
 with_test_prefix "info locals matching all locals" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info locals"
 	"info locals loc_arg_"
 	"info locals g"
@@ -211,13 +204,12 @@  with_test_prefix "info locals matching all locals" {
 		     "loc_arg_c = 100 'd'" \
 		     "loc_arg_i = 3" \
 		     "loc_arg_j = 4" \
-		    ] \
-		"info locals"
+		    ]
 	}
 }
 
 with_test_prefix "info locals matching some locals" {
-    foreach_with_prefix cmd {
+    foreach cmd {
 	"info locals -t int"
 	"info locals arg_[ij]"
 	"info locals loc_arg_[ij]"} {
@@ -225,8 +217,7 @@  with_test_prefix "info locals matching some locals" {
 		[multi_line \
 		     "loc_arg_i = 3" \
 		     "loc_arg_j = 4" \
-		    ] \
-		"info args"
+		    ]
 	}
 }