public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 00/12] Remove DUPLICATEs warnings
@ 2021-11-26 23:00 Lancelot SIX
  2021-11-26 23:00 ` [PATCH 01/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-syn-frame.exp Lancelot SIX
                   ` (14 more replies)
  0 siblings, 15 replies; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

Hi,

This cleanup series is a continuation of the following series:
https://sourceware.org/pipermail/gdb-patches/2021-November/183628.html

With this series, I get rid of all the DUPLICATE warnings I have when
running the testsuite on in my current configuration (i.e. NixOS
GNU/Linux on x86_64, with python support enabled).  I have no doubt that
other configurations might still see other warnings, though.

As for the previous series, this series only contains pretty straight
forward fixes, mostly adjusting test names in order to distinguish
similar tests.

All feedback are welcome.

Best,
Lancelot.

Lancelot SIX (12):
  gdb/testsuite: Remove duplicates from gdb.mi/mi-syn-frame.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi-nsthrexec.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi-watch.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi2-var-child.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi-var-rtti.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp
  gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp
  gdb/testsuite: Remove duplicates from gdb.threads/staticthreads.ex

 gdb/testsuite/gdb.mi/mi-catch-load.exp        | 77 ++++++++++---------
 gdb/testsuite/gdb.mi/mi-language.exp          |  2 +-
 gdb/testsuite/gdb.mi/mi-nonstop-exit.exp      | 22 ++----
 gdb/testsuite/gdb.mi/mi-nonstop.exp           |  4 +-
 gdb/testsuite/gdb.mi/mi-nsthrexec.exp         |  2 +-
 gdb/testsuite/gdb.mi/mi-syn-frame.exp         | 16 ++--
 gdb/testsuite/gdb.mi/mi-var-child.exp         | 18 +----
 gdb/testsuite/gdb.mi/mi-var-rtti.cc           | 12 +--
 gdb/testsuite/gdb.mi/mi-watch.exp             |  2 +-
 .../gdb.mi/mi2-amd64-entry-value.exp          | 42 ++++++----
 gdb/testsuite/gdb.mi/mi2-var-child.exp        | 18 +----
 gdb/testsuite/gdb.threads/staticthreads.exp   |  2 +-
 12 files changed, 101 insertions(+), 116 deletions(-)

-- 
2.33.1


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

* [PATCH 01/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-syn-frame.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-11-26 23:00 ` [PATCH 02/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nsthrexec.exp Lancelot SIX
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-syn-frame.exp ...
    DUPLICATE: gdb.mi/mi-syn-frame.exp: list stack frames
    DUPLICATE: gdb.mi/mi-syn-frame.exp: finished exec continue
    DUPLICATE: gdb.mi/mi-syn-frame.exp: list stack frames

Fix by adjusting test names, using the already existing MI token to
distinguish commands when possible.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-syn-frame.exp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index 21f506b8f8f..2ef0ec9b0ee 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -45,7 +45,7 @@ mi_create_breakpoint "foo" \
 #
 
 mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nEvaluation of the expression containing the function\\\\n\\(foo\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
-    "call inferior's function with a breakpoint set in it"
+    "401-call inferior's function with a breakpoint set in it"
 
 
 mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
@@ -59,7 +59,7 @@ mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "404-stack-list-frames 0 0" \
   "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
-  "list stack frames"
+  "404-list stack frames"
 
 
 #
@@ -72,23 +72,23 @@ mi_create_breakpoint "subroutine" \
 
 mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
   ".*406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nEvaluation of the expression containing the function\\\\n\\(have_a_very_merry_interrupt\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
-  "data evaluate expression"
+  "406-data evaluate expression"
 
 # We should have both a signal handler and a call dummy frame
 # in this next output.
 
 mi_gdb_test "407-stack-list-frames" \
   "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
-  "list stack frames"
+  "407-list stack frames"
 
 
 mi_send_resuming_command "exec-continue" "testing exec continue"
 
-mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
+mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue, after second continue"
 
 mi_gdb_test "409-stack-list-frames 0 0" \
   "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
-  "list stack frames"
+  "409-list stack frames"
 
 #
 # Call bar() by hand, which should get an exception while running.
@@ -96,9 +96,9 @@ mi_gdb_test "409-stack-list-frames 0 0" \
 
 mi_gdb_test "410-data-evaluate-expression bar()" \
   ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
-  "call inferior function which raises exception"
+  "210-call inferior function which raises exception"
 
-mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"}.*\\\]" "backtrace from inferior function at exception"
+mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"}.*\\\]" "411-backtrace from inferior function at exception"
 
 mi_gdb_exit
 
-- 
2.33.1


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

* [PATCH 02/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nsthrexec.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
  2021-11-26 23:00 ` [PATCH 01/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-syn-frame.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-11-26 23:00 ` [PATCH 03/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-watch.exp Lancelot SIX
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-nsthrexec.exp ...
    DUPLICATE: gdb.mi/mi-nsthrexec.exp: breakpoint at main

Fix by adjusting the duplicated test name.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-nsthrexec.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
index 6f2acb7014e..799d0fb978e 100644
--- a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
@@ -70,7 +70,7 @@ mi_check_thread_states {"stopped" "stopped"} "thread state, all stopped"
 mi_delete_breakpoints
 
 mi_create_breakpoint main \
-    "breakpoint at main" \
+    "insert breakpoint at main" \
     -number 3 -func main
 
 
-- 
2.33.1


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

* [PATCH 03/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-watch.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
  2021-11-26 23:00 ` [PATCH 01/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-syn-frame.exp Lancelot SIX
  2021-11-26 23:00 ` [PATCH 02/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nsthrexec.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-11-26 23:00 ` [PATCH 04/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp Lancelot SIX
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When I run the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-watch.exp ...
    DUPLICATE: gdb.mi/mi-watch.exp: mi-mode=main: wp-type=sw: watchpoint trigger
    DUPLICATE: gdb.mi/mi-watch.exp: mi-mode=main: wp-type=hw: watchpoint trigger
    DUPLICATE: gdb.mi/mi-watch.exp: mi-mode=separate: wp-type=sw: watchpoint trigger
    DUPLICATE: gdb.mi/mi-watch.exp: mi-mode=separate: wp-type=hw: watchpoint trigger

Fix by adjusting the duplicated test name.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-watch.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index eb037bc9966..b894fbc935e 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -131,7 +131,7 @@ proc test_watchpoint_triggering {} {
     mi_execute_to "exec-continue" "watchpoint-scope" "callee3" ".*" \
         ".*basics.c" $line_callee3_close_brace \
         {"" "wpnum=\"2\""} \
-        "watchpoint trigger"
+        "watchpoint trigger, two"
 }
 
 proc test_watchpoint_all {mi_mode type} {
-- 
2.33.1


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

* [PATCH 04/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (2 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 03/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-watch.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-12-10 21:55   ` Pedro Alves
  2021-11-26 23:00 ` [PATCH 05/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp Lancelot SIX
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When I run the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-catch-load.exp ...
    DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main

Fix by grouping the various phases in with_test_prefix blocks.

Tested on x86_64-linux
---
 gdb/testsuite/gdb.mi/mi-catch-load.exp | 77 ++++++++++++++------------
 1 file changed, 41 insertions(+), 36 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp
index cbd3967f47a..431db68c5c6 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp
@@ -40,48 +40,53 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] !
     return -1
 }
 
-mi_clean_restart $binfile
-mi_runto_main
-
 # test -catch-load
-mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-load: auto-solib-add on"
-mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
-    "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
-    "catch-load: catch load"
-mi_send_resuming_command "exec-continue" "catch-load: continue"
+with_test_prefix "test -catch-load" {
+    mi_clean_restart $binfile
+    mi_runto_main
 
-gdb_expect {
-    -re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
-        pass "catch-load: solib-event stop"
-    }
-    -re ".*$mi_gdb_prompt$" {
-	setup_kfail mi/15945 *-*-*mingw*
-        fail "catch-load: solib-event stop"
-    }
-    timeout {
-        fail "(timeout) catch-load: solib-event stop"
+    mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" \
+		"catch-load: auto-solib-add on"
+    mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
+		"222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
+		"catch-load: catch load"
+    mi_send_resuming_command "exec-continue" "catch-load: continue"
+
+    gdb_expect {
+	-re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
+	    pass "catch-load: solib-event stop"
+	}
+	-re ".*$mi_gdb_prompt$" {
+	    setup_kfail mi/15945 *-*-*mingw*
+	    fail "catch-load: solib-event stop"
+	}
+	timeout {
+	    fail "(timeout) catch-load: solib-event stop"
+	}
     }
 }
 
-mi_clean_restart $binfile
-mi_runto_main
-
 # test -catch-unload
-mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
-mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
-    "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
-    "catch-unload: catch unload"
-mi_send_resuming_command "exec-continue" "catch-unload: continue"
+with_test_prefix "test -catch-unload" {
+    mi_clean_restart $binfile
+    mi_runto_main
 
-gdb_expect {
-    -re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
-        pass "catch-unload: solib-event stop"
-    }
-    -re ".*$mi_gdb_prompt$" {
-	setup_kfail mi/15945 *-*-*mingw*
-        fail "catch-unload: solib-event stop"
-    }
-    timeout {
-        fail "(timeout) catch-unload: solib-event stop"
+    mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
+    mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
+		"222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
+		"catch-unload: catch unload"
+    mi_send_resuming_command "exec-continue" "catch-unload: continue"
+
+    gdb_expect {
+	-re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
+	    pass "catch-unload: solib-event stop"
+	}
+	-re ".*$mi_gdb_prompt$" {
+	    setup_kfail mi/15945 *-*-*mingw*
+	    fail "catch-unload: solib-event stop"
+	}
+	timeout {
+	    fail "(timeout) catch-unload: solib-event stop"
+	}
     }
 }
-- 
2.33.1


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

* [PATCH 05/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (3 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 04/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-12-10 21:55   ` Pedro Alves
  2021-11-26 23:00 ` [PATCH 06/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-var-child.exp Lancelot SIX
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-var-child.exp ...
    DUPLICATE: gdb.mi/mi-var-child.exp: get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr
    DUPLICATE: gdb.mi/mi-var-child.exp: get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr
    DUPLICATE: gdb.mi/mi-var-child.exp: get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr
    DUPLICATE: gdb.mi/mi-var-child.exp: get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr

This testfile gives test names in comments, which are different from the
test names given to the test framework (the former gives a number to each
test while the latter describes what is tested), I'll use the test names
from the comment when describing the fixes below are they are easier to
reason about.

The tests c_variable-5.15B and c_variable-5.17 are identical, so drop
c_variable-5.15B.

The descriptive name of c_variable-5.41B is erroneous, and once it have
been fixed it turns out that this test is identical to c_variable-5.43,
therefore c_variable-5.41B is dropped as well.

The descriptive test names for c_variable-5.43B c_variable-5.44B are
erroneous, so fix them.

The above adjustments fix the DUPLICATEs warnings.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-var-child.exp | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp
index 63cea065c3f..cec433a4c8c 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child.exp
@@ -881,13 +881,6 @@ mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" {
          {\*\*\*psnp->char_ptr} 1 {char \*}}
 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
 
-# Test: c_variable-5.15B
-# Desc: children of *(*(*(psnp->char_ptr)))
-mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
-    {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
-         {\*\*\*\*psnp->char_ptr} 0 char}
-} "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
-
 # Test: c_variable-5.16
 # Desc: number of children of *(*(psnp->char_ptr))
 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \
@@ -1072,13 +1065,6 @@ mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" {
          {\*\*\*char_ptr} 1 {char \*}}
 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
 
-# Test: c_variable-5.41B
-# Desc: children of ***psnp->ptrs[0]->next->char_ptr
-mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
-    {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
-         {\*\*\*\*char_ptr} 0 char}
-} "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
-
 # Test: c_variable-5.42
 # Desc: number of children of **psnp->ptrs[0]->next->char_ptr
 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \
@@ -1101,13 +1087,13 @@ mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_
 # Test: c_variable-5.43B
 # Desc: children of ****psnp->ptrs[0]->next->char_ptr
 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" {} \
-	"get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
+	"get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
 
 # Test: c_variable-5.44B
 # Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
 	"\\^done,numchild=\"0\"" \
-	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
+	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
 
 # Test: c_variable-5.45
 # Desc: children of psnp->ptrs[0]->next->next
-- 
2.33.1


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

* [PATCH 06/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-var-child.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (4 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 05/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-11-26 23:00 ` [PATCH 07/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop.exp Lancelot SIX
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi2-var-child.exp ...
    DUPLICATE: gdb.mi/mi2-var-child.exp: get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr
    DUPLICATE: gdb.mi/mi2-var-child.exp: get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr
    DUPLICATE: gdb.mi/mi2-var-child.exp: get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr
    DUPLICATE: gdb.mi/mi2-var-child.exp: get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr

[The problems are exactly the same as those fixed in the previous patch
"gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp", I’ll
reuse the same explanations.]

This testfile gives test names in comments, which are different from the
test names given to the test framework (the former gives a number to
each test while the latter describes what is tested), I'll use the test
names from the comment when describing the fixes below are they are
easier to reason about.

The tests c_variable-5.15B and c_variable-5.17 are identical, so drop
c_variable-5.15B.

The descriptive name of c_variable-5.41B is erroneous, and once it have
been fixed it turns out that this test is identical to c_variable-5.43,
therefore c_variable-5.41B is dropped as well.

The descriptive test names for c_variable-5.43B c_variable-5.44B are
erroneous, so fix them.

The above adjustments fix the DUPLICATEs warnings.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi2-var-child.exp | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp
index 499e13b0f40..c848cf5d5c3 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-child.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp
@@ -821,13 +821,6 @@ mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" {
          {\*\*\*psnp->char_ptr} 1 {char \*}}
 } "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
 
-# Test: c_variable-5.15B
-# Desc: children of *(*(*(psnp->char_ptr)))
-mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
-    {{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
-         {\*\*\*\*psnp->char_ptr} 0 char}
-} "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
-
 # Test: c_variable-5.16
 # Desc: number of children of *(*(psnp->char_ptr))
 mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \
@@ -1013,13 +1006,6 @@ mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" {
          {\*\*\*char_ptr} 1 {char \*}}
 } "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
 
-# Test: c_variable-5.41B
-# Desc: children of ***psnp->ptrs[0]->next->char_ptr
-mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
-    {{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
-         {\*\*\*\*char_ptr} 0 char}
-} "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
-
 # Test: c_variable-5.42
 # Desc: number of children of **psnp->ptrs[0]->next->char_ptr
 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \
@@ -1042,13 +1028,13 @@ mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_
 # Test: c_variable-5.43B
 # Desc: children of ****psnp->ptrs[0]->next->char_ptr
 mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" {} \
-	"get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
+	"get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
 
 # Test: c_variable-5.44B
 # Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
 mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
 	"\\^done,numchild=\"0\"" \
-	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
+	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
 
 # Test: c_variable-5.45
 # Desc: children of psnp->ptrs[0]->next->next
-- 
2.33.1


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

* [PATCH 07/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (5 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 06/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-var-child.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-11-26 23:00 ` [PATCH 08/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp Lancelot SIX
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-nonstop.exp ...
    DUPLICATE: gdb.mi/mi-nonstop.exp: check varobj, w1, 1
    DUPLICATE: gdb.mi/mi-nonstop.exp: stacktrace of stopped thread

Fix by adjusting the problematic test names.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-nonstop.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-nonstop.exp b/gdb/testsuite/gdb.mi/mi-nonstop.exp
index b0b94913e6d..d52e971b12b 100644
--- a/gdb/testsuite/gdb.mi/mi-nonstop.exp
+++ b/gdb/testsuite/gdb.mi/mi-nonstop.exp
@@ -112,7 +112,7 @@ mi_check_thread_states {"running" "running" "stopped"} "thread state, stop on co
 # Check that when we update all varobj, we don't get no error about varobj
 # bound to running thread.
 mi_varobj_update * {I_W1} "update varobj, 2"
-mi_check_varobj_value I_W1 3 "check varobj, w1, 1"
+mi_check_varobj_value I_W1 3 "check varobj, w1, 2"
 
 
 # Check that stack commands are allowed on a stopped thread, even if some other threads
@@ -147,6 +147,6 @@ if { [mi_is_target_remote] } {
 # See that we can still poke other threads.
 mi_gdb_test "-stack-list-frames --thread 3" \
     "\\^done,stack=\\\[frame={level=\"0\",addr=\".*\",func=\"break_at_me\".*" \
-    "stacktrace of stopped thread"
+    "stacktrace of stopped thread, 2"
 
 mi_gdb_exit
-- 
2.33.1


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

* [PATCH 08/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (6 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 07/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-12-10 21:56   ` Pedro Alves
  2021-11-26 23:00 ` [PATCH 09/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-rtti.exp Lancelot SIX
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-nonstop-exit.exp ...
    DUPLICATE: gdb.mi/mi-nonstop-exit.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi-nonstop-exit.exp: mi runto main

This test runs the same sequence of operations twice.  Refactor the code
by running both of those sequences within a foreach_with_prefix block to
ensure that the commands have unique test names.

There is a slight modification of behaviour introduced by this patch.
mi_delete_breakpoints is called one more time just before quitting gdb,
which is in my opinion is worth given the simplification.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-nonstop-exit.exp | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
index 99ac92f15a3..740856ca822 100644
--- a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
+++ b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
@@ -39,24 +39,16 @@ save_vars { GDBFLAGS } {
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_runto_main] < 0 } {
-    continue
-}
-
-mi_send_resuming_command "exec-continue" "continue"
-
-mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
+foreach_with_prefix iteration {1 2} {
+    if { [mi_runto_main] < 0 } {
+        continue
+    }
 
-# Run the program again.
+    mi_send_resuming_command "exec-continue" "continue"
 
-mi_delete_breakpoints
+    mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
 
-if { [mi_runto_main] < 0 } {
-    continue
+    mi_delete_breakpoints
 }
 
-mi_send_resuming_command "exec-continue" "continue (2)"
-
-mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue (2)"
-
 mi_gdb_exit
-- 
2.33.1


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

* [PATCH 09/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-rtti.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (7 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 08/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-11-26 23:00 ` [PATCH 10/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp Lancelot SIX
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-var-rtti.exp ...
    DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of ptr.Base.public (with RTTI) in use_rtti_with_multiple_inheritence
    DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of ptr (without RTTI) in skip_type_update_when_not_use_rtti
    DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of ptr.public (without RTTI) in skip_type_update_when_not_use_rtti
    DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of s.ptr (without RTTI) in skip_type_update_when_not_use_rtti
    DUPLICATE: gdb.mi/mi-var-rtti.exp: list children of s.ptr.public (without RTTI) in skip_type_update_when_not_use_rtti

Fix by adjusting the test names.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-var-rtti.cc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.cc b/gdb/testsuite/gdb.mi/mi-var-rtti.cc
index 30b46173eba..6ea2636e19c 100644
--- a/gdb/testsuite/gdb.mi/mi-var-rtti.cc
+++ b/gdb/testsuite/gdb.mi/mi-var-rtti.cc
@@ -218,7 +218,7 @@ void use_rtti_with_multiple_inheritence_test ()
 	} "list children of ptr.First (with RTTI) in $testname"
 	mi_list_varobj_children "VAR.First.public" {
 	    { VAR.First.public.F F 0 int }
-	} "list children of ptr.Base.public (with RTTI) in $testname"
+	} "list children of ptr.First.public (with RTTI) in $testname"
 	mi_list_varobj_children "VAR.Base" {
 	    { VAR.Base.public public 1 }
 	} "list children of ptr.Base (with RTTI) in $testname"
@@ -325,13 +325,15 @@ void skip_type_update_when_not_use_rtti_test ()
 	ptr = &d;
 	s.ptr = &d;
   /*: 
-	mi_varobj_update PTR {PTR PTR.public.A} \
+	with_test_prefix "after_assign" {
+	    mi_varobj_update PTR {PTR PTR.public.A} \
 		"update ptr to derived type in $testname"
-	check_derived_without_rtti PTR ptr $testname
+	    check_derived_without_rtti PTR ptr $testname
 
-	mi_varobj_update S {S.public.ptr S.public.ptr.public.A} \
+	    mi_varobj_update S {S.public.ptr S.public.ptr.public.A} \
 		"update s to derived type in $testname"
-	check_derived_without_rtti S.public.ptr s.ptr $testname
+	    check_derived_without_rtti S.public.ptr s.ptr $testname
+	}
   :*/
 
 	ptr = 0;
-- 
2.33.1


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

* [PATCH 10/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (8 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 09/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-rtti.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-12-10 21:56   ` Pedro Alves
  2021-11-26 23:00 ` [PATCH 11/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp Lancelot SIX
                   ` (4 subsequent siblings)
  14 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-language.exp ...
    DUPLICATE: gdb.mi/mi-language.exp: set lang ada

Fix the erroneous test name.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-language.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.mi/mi-language.exp b/gdb/testsuite/gdb.mi/mi-language.exp
index d1e4503b6f9..a4e946e3789 100644
--- a/gdb/testsuite/gdb.mi/mi-language.exp
+++ b/gdb/testsuite/gdb.mi/mi-language.exp
@@ -45,7 +45,7 @@ mi_gdb_test "-data-evaluate-expression --language c \"sizeof (void*)\"" \
 # Double-check that the current language has not changed.
 mi_gdb_test "show lang ada" \
             ".*The current source language is \\\\\"ada\\\\\".*" \
-            "set lang ada"
+            "show lang ada"
 
 # Test what happens when specifying an invalid language name...
 mi_gdb_test "-data-evaluate-expression --language invlang \"sizeof (void*)\"" \
-- 
2.33.1


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

* [PATCH 11/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (9 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 10/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-12-10 21:56   ` Pedro Alves
  2021-11-26 23:00 ` [PATCH 12/12] gdb/testsuite: Remove duplicates from gdb.threads/staticthreads.ex Lancelot SIX
                   ` (3 subsequent siblings)
  14 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp ...
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main

Fix by enclosing the various 'mi_runto_main' calls (which are
responsible for the DUPLICATEs warnings) in 'with_test_prefix' blocks
since this is the easiest way to adjust the test names.

Tested on x86_64-linux.
---
 .../gdb.mi/mi2-amd64-entry-value.exp          | 42 ++++++++++++-------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
index 4505bfada67..eae9a9c17ad 100644
--- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
@@ -49,8 +49,10 @@ foreach name {different breakhere_different breakhere_validity breakhere_invalid
 
 # Test various kinds of `set print entry-values'.
 
-if {[mi_runto_main] == -1} {
-    return -1
+with_test_prefix "setup for set print-entry-values no" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
 }
 mi_gdb_test "-gdb-set print entry-values no" {\^done} "no: set print entry-values"
 mi_send_resuming_command "exec-continue" "no: entry_equal: continue"
@@ -66,8 +68,10 @@ mi_send_resuming_command "exec-continue" "no: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "no: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "no: invalid: -stack-list-variables"
 
-if {[mi_runto_main] == -1} {
-    return -1
+with_test_prefix "setup for set print-entry-values only" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
 }
 mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values"
 mi_send_resuming_command "exec-continue" "only: entry_equal: continue"
@@ -83,8 +87,10 @@ mi_send_resuming_command "exec-continue" "only: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "only: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} "only: invalid: -stack-list-variables"
 
-if {[mi_runto_main] == -1} {
-    return -1
+with_test_prefix "setup for set print-entry-values preferred" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
 }
 mi_gdb_test "-gdb-set print entry-values preferred" {\^done} "preferred: set print entry-values"
 mi_send_resuming_command "exec-continue" "preferred: entry_equal: continue"
@@ -100,8 +106,10 @@ mi_send_resuming_command "exec-continue" "preferred: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "preferred: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} "preferred: invalid: -stack-list-variables"
 
-if {[mi_runto_main] == -1} {
-    return -1
+with_test_prefix "setup for set print-entry-values if-needed" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
 }
 mi_gdb_test "-gdb-set print entry-values if-needed" {\^done} "if-needed: set print entry-values"
 mi_send_resuming_command "exec-continue" "if-needed: entry_equal: continue"
@@ -117,8 +125,10 @@ mi_send_resuming_command "exec-continue" "if-needed: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "if-needed: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "if-needed: invalid: -stack-list-variables"
 
-if {[mi_runto_main] == -1} {
-    return -1
+with_test_prefix "setup for set print-entry-values both" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
 }
 mi_gdb_test "-gdb-set print entry-values both" {\^done} "both: set print entry-values"
 mi_send_resuming_command "exec-continue" "both: entry_equal: continue"
@@ -134,8 +144,10 @@ mi_send_resuming_command "exec-continue" "both: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"},{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "both: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"},{name="inv@entry",arg="1",value="<optimized out>"}\]} "both: invalid: -stack-list-variables"
 
-if {[mi_runto_main] == -1} {
-    return -1
+with_test_prefix "setup for set print-entry-values compact" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
 }
 mi_gdb_test "-gdb-set print entry-values compact" {\^done} "compact: set print entry-values"
 mi_send_resuming_command "exec-continue" "compact: entry_equal: continue"
@@ -151,8 +163,10 @@ mi_send_resuming_command "exec-continue" "compact: invalid: continue"
 mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "compact: invalid: stop"
 mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "compact: invalid: -stack-list-variables"
 
-if {[mi_runto_main] == -1} {
-    return -1
+with_test_prefix "setup for set print-entry-values default" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
 }
 mi_gdb_test "-gdb-set print entry-values default" {\^done} "default: set print entry-values"
 mi_send_resuming_command "exec-continue" "default: entry_equal: continue"
-- 
2.33.1


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

* [PATCH 12/12] gdb/testsuite: Remove duplicates from gdb.threads/staticthreads.ex
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (10 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 11/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp Lancelot SIX
@ 2021-11-26 23:00 ` Lancelot SIX
  2021-12-09 18:15 ` [PATCH 00/12] Remove DUPLICATEs warnings Tom Tromey
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 33+ messages in thread
From: Lancelot SIX @ 2021-11-26 23:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Lancelot SIX

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.threads/staticthreads.exp ...
    DUPLICATE: gdb.threads/staticthreads.exp: couldn't compile staticthreads.c: unrecognized error

Fix by using foreach_with_prefix instead of foreach when preparing the
test case.

Testeed on x86_64-linux both in a setup where the test fails to prepare
and in a setup where the test fails to setup.
---
 gdb/testsuite/gdb.threads/staticthreads.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp
index e80405426e0..37530c68e39 100644
--- a/gdb/testsuite/gdb.threads/staticthreads.exp
+++ b/gdb/testsuite/gdb.threads/staticthreads.exp
@@ -22,7 +22,7 @@
 standard_testfile
 set static_flag "-static"
 
-foreach have_tls { "-DHAVE_TLS" "" } {
+foreach_with_prefix have_tls { "-DHAVE_TLS" "" } {
     if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 	     executable \
 	     [list debug "additional_flags=${static_flag} ${have_tls}" \
-- 
2.33.1


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

* Re: [PATCH 00/12] Remove DUPLICATEs warnings
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (11 preceding siblings ...)
  2021-11-26 23:00 ` [PATCH 12/12] gdb/testsuite: Remove duplicates from gdb.threads/staticthreads.ex Lancelot SIX
@ 2021-12-09 18:15 ` Tom Tromey
  2021-12-10 22:01 ` Pedro Alves
  2022-01-07 22:43 ` Lancelot SIX
  14 siblings, 0 replies; 33+ messages in thread
From: Tom Tromey @ 2021-12-09 18:15 UTC (permalink / raw)
  To: Lancelot SIX via Gdb-patches; +Cc: Lancelot SIX

>>>>> "Lancelot" == Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org> writes:

Lancelot> This cleanup series is a continuation of the following series:
Lancelot> https://sourceware.org/pipermail/gdb-patches/2021-November/183628.html

I read through these and they looked fine to me.  This is ok to push.

thank you,
Tom

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

* Re: [PATCH 05/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp
  2021-11-26 23:00 ` [PATCH 05/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp Lancelot SIX
@ 2021-12-10 21:55   ` Pedro Alves
  2021-12-16 23:40     ` Lancelot SIX
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Alves @ 2021-12-10 21:55 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches

On 2021-11-26 23:00, Lancelot SIX via Gdb-patches wrote:
>  # Test: c_variable-5.44B
>  # Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
>  mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
>  	"\\^done,numchild=\"0\"" \
> -	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
> +	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"

Did you consider using variables to eliminate risk of these ever diverging?  Something like:

  set expr "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
  mi_gdb_test "-var-info-num-children $expr" \
  	"\\^done,numchild=\"0\"" \
	"get number of children of $expr"

  ...

  set expr "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
  mi_list_varobj_children $expr {
      [list [string_to_regexp $expr]] \
         {\*\*\*char_ptr} 1 {char \*}}
  } "get children of $expr"

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

* Re: [PATCH 04/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
  2021-11-26 23:00 ` [PATCH 04/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp Lancelot SIX
@ 2021-12-10 21:55   ` Pedro Alves
  2021-12-16 23:27     ` Lancelot SIX
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Alves @ 2021-12-10 21:55 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches

On 2021-11-26 23:00, Lancelot SIX via Gdb-patches wrote:
> When I run the testsuite, I have:
> 
>     Running .../gdb/testsuite/gdb.mi/mi-catch-load.exp ...
>     DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
>     DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main
> 
> Fix by grouping the various phases in with_test_prefix blocks.
> 
> Tested on x86_64-linux
> ---
>  gdb/testsuite/gdb.mi/mi-catch-load.exp | 77 ++++++++++++++------------
>  1 file changed, 41 insertions(+), 36 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp
> index cbd3967f47a..431db68c5c6 100644
> --- a/gdb/testsuite/gdb.mi/mi-catch-load.exp
> +++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp
> @@ -40,48 +40,53 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] !
>      return -1
>  }
>  
> -mi_clean_restart $binfile
> -mi_runto_main
> -
>  # test -catch-load
> -mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-load: auto-solib-add on"
> -mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
> -    "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
> -    "catch-load: catch load"
> -mi_send_resuming_command "exec-continue" "catch-load: continue"
> +with_test_prefix "test -catch-load" {

Can you drop the "test" from this?  These are all tests, so word like "test" and "check" are redundant.


> +    mi_clean_restart $binfile
> +    mi_runto_main
>  
> -gdb_expect {
> -    -re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
> -        pass "catch-load: solib-event stop"
> -    }
> -    -re ".*$mi_gdb_prompt$" {
> -	setup_kfail mi/15945 *-*-*mingw*
> -        fail "catch-load: solib-event stop"
> -    }
> -    timeout {
> -        fail "(timeout) catch-load: solib-event stop"
> +    mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" \
> +		"catch-load: auto-solib-add on"


Given the prefix, this manual "catch-load:" prefix is now redundant.


> +    mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
> +		"222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
> +		"catch-load: catch load"
> +    mi_send_resuming_command "exec-continue" "catch-load: continue"
> +
> +    gdb_expect {
> +	-re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
> +	    pass "catch-load: solib-event stop"
> +	}
> +	-re ".*$mi_gdb_prompt$" {
> +	    setup_kfail mi/15945 *-*-*mingw*
> +	    fail "catch-load: solib-event stop"
> +	}
> +	timeout {
> +	    fail "(timeout) catch-load: solib-event stop"
> +	}
>      }
>  }
>  
> -mi_clean_restart $binfile
> -mi_runto_main
> -
>  # test -catch-unload
> -mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
> -mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
> -    "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
> -    "catch-unload: catch unload"
> -mi_send_resuming_command "exec-continue" "catch-unload: continue"
> +with_test_prefix "test -catch-unload" {
> +    mi_clean_restart $binfile
> +    mi_runto_main
>  
> -gdb_expect {
> -    -re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
> -        pass "catch-unload: solib-event stop"
> -    }
> -    -re ".*$mi_gdb_prompt$" {
> -	setup_kfail mi/15945 *-*-*mingw*
> -        fail "catch-unload: solib-event stop"
> -    }
> -    timeout {
> -        fail "(timeout) catch-unload: solib-event stop"
> +    mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
> +    mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
> +		"222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
> +		"catch-unload: catch unload"
> +    mi_send_resuming_command "exec-continue" "catch-unload: continue"
> +
> +    gdb_expect {
> +	-re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
> +	    pass "catch-unload: solib-event stop"
> +	}
> +	-re ".*$mi_gdb_prompt$" {
> +	    setup_kfail mi/15945 *-*-*mingw*
> +	    fail "catch-unload: solib-event stop"
> +	}
> +	timeout {
> +	    fail "(timeout) catch-unload: solib-event stop"

While at it, could you move the "(timeout)" to the end?  Like:

	    fail "catch-unload: solib-event stop (timeout)"

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

* Re: [PATCH 08/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
  2021-11-26 23:00 ` [PATCH 08/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp Lancelot SIX
@ 2021-12-10 21:56   ` Pedro Alves
  2021-12-16 23:48     ` Lancelot SIX
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Alves @ 2021-12-10 21:56 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches

On 2021-11-26 23:00, Lancelot SIX via Gdb-patches wrote:
> When running the testsuite, I have:
> 
>     Running .../gdb/testsuite/gdb.mi/mi-nonstop-exit.exp ...
>     DUPLICATE: gdb.mi/mi-nonstop-exit.exp: breakpoint at main
>     DUPLICATE: gdb.mi/mi-nonstop-exit.exp: mi runto main
> 
> This test runs the same sequence of operations twice.  Refactor the code
> by running both of those sequences within a foreach_with_prefix block to
> ensure that the commands have unique test names.
> 
> There is a slight modification of behaviour introduced by this patch.
> mi_delete_breakpoints is called one more time just before quitting gdb,
> which is in my opinion is worth given the simplification.

It's much more typical to delete breakpoints _before_ running to main.  I.e.,
putting the "restart" code at the beginning.  If that works, I'd mildly prefer that.

This is OK either way.

> 
> Tested on x86_64-linux.
> ---
>  gdb/testsuite/gdb.mi/mi-nonstop-exit.exp | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
> index 99ac92f15a3..740856ca822 100644
> --- a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
> +++ b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
> @@ -39,24 +39,16 @@ save_vars { GDBFLAGS } {
>  mi_gdb_test "-gdb-set mi-async 1" ".*"
>  mi_detect_async
>  
> -if { [mi_runto_main] < 0 } {
> -    continue
> -}
> -
> -mi_send_resuming_command "exec-continue" "continue"
> -
> -mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
> +foreach_with_prefix iteration {1 2} {
> +    if { [mi_runto_main] < 0 } {
> +        continue
> +    }
>  
> -# Run the program again.
> +    mi_send_resuming_command "exec-continue" "continue"
>  
> -mi_delete_breakpoints
> +    mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
>  
> -if { [mi_runto_main] < 0 } {
> -    continue
> +    mi_delete_breakpoints
>  }
>  
> -mi_send_resuming_command "exec-continue" "continue (2)"
> -
> -mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue (2)"
> -
>  mi_gdb_exit
> 


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

* Re: [PATCH 11/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp
  2021-11-26 23:00 ` [PATCH 11/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp Lancelot SIX
@ 2021-12-10 21:56   ` Pedro Alves
  2021-12-17 22:57     ` Lancelot SIX
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Alves @ 2021-12-10 21:56 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches

On 2021-11-26 23:00, Lancelot SIX via Gdb-patches wrote:
>  mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "no: invalid: stop"
>  mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "no: invalid: -stack-list-variables"
>  
> -if {[mi_runto_main] == -1} {
> -    return -1
> +with_test_prefix "setup for set print-entry-values only" {
> +    if {[mi_runto_main] == -1} {
> +	return -1
> +    }
>  }
>  mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values"
>  mi_send_resuming_command "exec-continue" "only: entry_equal: continue"
> @@ -83,8 +87,10 @@ mi_send_resuming_command "exec-continue" "only: invalid: continue"

IWBN to get this grouped properly while at it.  Would you mind removing the "only:" etc.
manual prefixes instead, converting that to the with_test_prefix prefix?  Like:

with_test_prefix "only" {
    if {[mi_runto_main] == -1} {
	return -1
    }

-   mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values"
-   mi_send_resuming_command "exec-continue" "only: entry_equal: continue"
+  mi_gdb_test "-gdb-set print entry-values only" {\^done} "set print entry-values"
+  mi_send_resuming_command "exec-continue" "entry_equal: continue"
}

etc?

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

* Re: [PATCH 10/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp
  2021-11-26 23:00 ` [PATCH 10/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp Lancelot SIX
@ 2021-12-10 21:56   ` Pedro Alves
  2021-12-16 23:59     ` Lancelot SIX
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Alves @ 2021-12-10 21:56 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches

On 2021-11-26 23:00, Lancelot SIX via Gdb-patches wrote:
> When running the testsuite, I have:
> 
>     Running .../gdb/testsuite/gdb.mi/mi-language.exp ...
>     DUPLICATE: gdb.mi/mi-language.exp: set lang ada
> 
> Fix the erroneous test name.
> 
> Tested on x86_64-linux.
> ---
>  gdb/testsuite/gdb.mi/mi-language.exp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.mi/mi-language.exp b/gdb/testsuite/gdb.mi/mi-language.exp
> index d1e4503b6f9..a4e946e3789 100644
> --- a/gdb/testsuite/gdb.mi/mi-language.exp
> +++ b/gdb/testsuite/gdb.mi/mi-language.exp
> @@ -45,7 +45,7 @@ mi_gdb_test "-data-evaluate-expression --language c \"sizeof (void*)\"" \
>  # Double-check that the current language has not changed.
>  mi_gdb_test "show lang ada" \
>              ".*The current source language is \\\\\"ada\\\\\".*" \
> -            "set lang ada"
> +            "show lang ada"
>  

FYI, you can also just remove the last argument, as it defaults to the command string.
Less duplication that way.

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

* Re: [PATCH 00/12] Remove DUPLICATEs warnings
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (12 preceding siblings ...)
  2021-12-09 18:15 ` [PATCH 00/12] Remove DUPLICATEs warnings Tom Tromey
@ 2021-12-10 22:01 ` Pedro Alves
  2022-01-07 22:43 ` Lancelot SIX
  14 siblings, 0 replies; 33+ messages in thread
From: Pedro Alves @ 2021-12-10 22:01 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches

On 2021-11-26 23:00, Lancelot SIX via Gdb-patches wrote:
> Hi,
> 
> This cleanup series is a continuation of the following series:
> https://sourceware.org/pipermail/gdb-patches/2021-November/183628.html
> 
> With this series, I get rid of all the DUPLICATE warnings I have when
> running the testsuite on in my current configuration (i.e. NixOS
> GNU/Linux on x86_64, with python support enabled).  I have no doubt that
> other configurations might still see other warnings, though.
> 
> As for the previous series, this series only contains pretty straight
> forward fixes, mostly adjusting test names in order to distinguish
> similar tests.
> 
> All feedback are welcome.

Thanks!  I sent a few comments, but nothing major.  The patches I didn't comment
on, I just think they're perfect.  Thanks a lot for doing this.

> 
> Best,
> Lancelot.
> 
> Lancelot SIX (12):
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-syn-frame.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-nsthrexec.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-watch.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi2-var-child.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-var-rtti.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp
>   gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp
>   gdb/testsuite: Remove duplicates from gdb.threads/staticthreads.ex
> 
>  gdb/testsuite/gdb.mi/mi-catch-load.exp        | 77 ++++++++++---------
>  gdb/testsuite/gdb.mi/mi-language.exp          |  2 +-
>  gdb/testsuite/gdb.mi/mi-nonstop-exit.exp      | 22 ++----
>  gdb/testsuite/gdb.mi/mi-nonstop.exp           |  4 +-
>  gdb/testsuite/gdb.mi/mi-nsthrexec.exp         |  2 +-
>  gdb/testsuite/gdb.mi/mi-syn-frame.exp         | 16 ++--
>  gdb/testsuite/gdb.mi/mi-var-child.exp         | 18 +----
>  gdb/testsuite/gdb.mi/mi-var-rtti.cc           | 12 +--
>  gdb/testsuite/gdb.mi/mi-watch.exp             |  2 +-
>  .../gdb.mi/mi2-amd64-entry-value.exp          | 42 ++++++----
>  gdb/testsuite/gdb.mi/mi2-var-child.exp        | 18 +----
>  gdb/testsuite/gdb.threads/staticthreads.exp   |  2 +-
>  12 files changed, 101 insertions(+), 116 deletions(-)
> 


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

* Re: [PATCH 04/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
  2021-12-10 21:55   ` Pedro Alves
@ 2021-12-16 23:27     ` Lancelot SIX
  2021-12-17 12:21       ` Pedro Alves
  0 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-12-16 23:27 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> > +with_test_prefix "test -catch-load" {
> 
> Can you drop the "test" from this?  These are all tests, so word like "test" and "check" are redundant.
> 

Done

> > +		"catch-load: auto-solib-add on"
> 
> 
> Given the prefix, this manual "catch-load:" prefix is now redundant.
> 

Done

> 
> While at it, could you move the "(timeout)" to the end?  Like:
> 
> 	    fail "catch-unload: solib-event stop (timeout)"

Done.

Thanks for the review.  Bellow is the new version of the patch.

Lancelot.

---
From 6fcb1d880bf5009aa9ce9e873a5c5f50e6fc142d Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lsix@lancelotsix.com>
Date: Mon, 22 Nov 2021 22:36:47 +0000
Subject: [PATCH] gdb/testsuite: Remove duplicates from
 gdb.mi/mi-catch-load.exp

When I run the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-catch-load.exp ...
    DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main

Fix by grouping the various phases in with_test_prefix blocks.  Since
the tests now have a prefix, remove the manually written prefixes in
testnames.

Also change some messages with the pattern "(timeout) $testname" into
"$estname (timeout)" since tools will handle this as $testname[1] (which
is what we want in this particular scenario).

Tested on x86_64-linux.

[1] https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages
---
 gdb/testsuite/gdb.mi/mi-catch-load.exp | 77 ++++++++++++++------------
 1 file changed, 41 insertions(+), 36 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp
index cbd3967f47a..b55b1ccf715 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp
@@ -40,48 +40,53 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] !
     return -1
 }
 
-mi_clean_restart $binfile
-mi_runto_main
-
 # test -catch-load
-mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-load: auto-solib-add on"
-mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
-    "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
-    "catch-load: catch load"
-mi_send_resuming_command "exec-continue" "catch-load: continue"
+with_test_prefix "catch-load" {
+    mi_clean_restart $binfile
+    mi_runto_main
 
-gdb_expect {
-    -re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
-        pass "catch-load: solib-event stop"
-    }
-    -re ".*$mi_gdb_prompt$" {
-	setup_kfail mi/15945 *-*-*mingw*
-        fail "catch-load: solib-event stop"
-    }
-    timeout {
-        fail "(timeout) catch-load: solib-event stop"
+    mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" \
+		"auto-solib-add on"
+    mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
+		"222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
+		"catch load"
+    mi_send_resuming_command "exec-continue" "continue"
+
+    gdb_expect {
+	-re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
+	    pass "solib-event stop"
+	}
+	-re ".*$mi_gdb_prompt$" {
+	    setup_kfail mi/15945 *-*-*mingw*
+	    fail "solib-event stop"
+	}
+	timeout {
+	    fail "solib-event stop (timeout)"
+	}
     }
 }
 
-mi_clean_restart $binfile
-mi_runto_main
-
 # test -catch-unload
-mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
-mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
-    "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
-    "catch-unload: catch unload"
-mi_send_resuming_command "exec-continue" "catch-unload: continue"
+with_test_prefix "catch-unload" {
+    mi_clean_restart $binfile
+    mi_runto_main
 
-gdb_expect {
-    -re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
-        pass "catch-unload: solib-event stop"
-    }
-    -re ".*$mi_gdb_prompt$" {
-	setup_kfail mi/15945 *-*-*mingw*
-        fail "catch-unload: solib-event stop"
-    }
-    timeout {
-        fail "(timeout) catch-unload: solib-event stop"
+    mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "auto-solib-add on"
+    mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
+		"222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
+		"catch unload"
+    mi_send_resuming_command "exec-continue" "continue"
+
+    gdb_expect {
+	-re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
+	    pass "solib-event stop"
+	}
+	-re ".*$mi_gdb_prompt$" {
+	    setup_kfail mi/15945 *-*-*mingw*
+	    fail "solib-event stop"
+	}
+	timeout {
+	    fail "solib-event stop (timeout)"
+	}
     }
 }
-- 
2.34.0


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

* Re: [PATCH 05/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp
  2021-12-10 21:55   ` Pedro Alves
@ 2021-12-16 23:40     ` Lancelot SIX
  2021-12-17 13:00       ` [PATCH] gdb/testsuite: Remove some duplication " Pedro Alves
  0 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-12-16 23:40 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> 
> Did you consider using variables to eliminate risk of these ever diverging?  Something like:
> 
>   set expr "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
>   mi_gdb_test "-var-info-num-children $expr" \
>   	"\\^done,numchild=\"0\"" \
> 	"get number of children of $expr"
> 
>   ...

Actually, not that much.  This file is 1k+ lines with plenty of tests
just like this one.  Do not get me wrong, doing this would be a big
plus, but given the extend of changes I would think it is a bit out of
the scope of what I want to achieve.

Do you mind if I postpone this refactoring?  i.e. I get it out of my
mind until next time I have to come back to this file, or want to spend
time just doing this.

Lancelot.

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

* Re: [PATCH 08/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
  2021-12-10 21:56   ` Pedro Alves
@ 2021-12-16 23:48     ` Lancelot SIX
  2021-12-17 13:52       ` Pedro Alves
  0 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-12-16 23:48 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> > There is a slight modification of behaviour introduced by this patch.
> > mi_delete_breakpoints is called one more time just before quitting gdb,
> > which is in my opinion is worth given the simplification.
> 
> It's much more typical to delete breakpoints _before_ running to main.  I.e.,
> putting the "restart" code at the beginning.  If that works, I'd mildly prefer that.
> 
> This is OK either way.
> 

I have changed this, and the test still happy.

Thanks for the review,
Lancelot.

---
From 14a33ceabb1fbe46c94ee709e8c8cd8ae96397ba Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lsix@lancelotsix.com>
Date: Tue, 23 Nov 2021 13:42:13 +0000
Subject: [PATCH] gdb/testsuite: Remove duplicates from
 gdb.mi/mi-nonstop-exit.exp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-nonstop-exit.exp ...
    DUPLICATE: gdb.mi/mi-nonstop-exit.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi-nonstop-exit.exp: mi runto main

This test runs the same sequence of operations twice.  Refactor the code
by running both of those sequences within a foreach_with_prefix block to
ensure that the commands have unique test names.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-nonstop-exit.exp | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
index 99ac92f15a3..8da585b48df 100644
--- a/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
+++ b/gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
@@ -39,24 +39,15 @@ save_vars { GDBFLAGS } {
 mi_gdb_test "-gdb-set mi-async 1" ".*"
 mi_detect_async
 
-if { [mi_runto_main] < 0 } {
-    continue
-}
-
-mi_send_resuming_command "exec-continue" "continue"
-
-mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
+foreach_with_prefix iteration {1 2} {
+    mi_delete_breakpoints
+    if { [mi_runto_main] < 0 } {
+        continue
+    }
 
-# Run the program again.
+    mi_send_resuming_command "exec-continue" "continue"
 
-mi_delete_breakpoints
-
-if { [mi_runto_main] < 0 } {
-    continue
+    mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
 }
 
-mi_send_resuming_command "exec-continue" "continue (2)"
-
-mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue (2)"
-
 mi_gdb_exit
-- 
2.34.0


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

* Re: [PATCH 10/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp
  2021-12-10 21:56   ` Pedro Alves
@ 2021-12-16 23:59     ` Lancelot SIX
  2021-12-17 13:53       ` Pedro Alves
  0 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-12-16 23:59 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Fri, Dec 10, 2021 at 09:56:51PM +0000, Pedro Alves wrote:
> On 2021-11-26 23:00, Lancelot SIX via Gdb-patches wrote:
> > When running the testsuite, I have:
> > 
> >     Running .../gdb/testsuite/gdb.mi/mi-language.exp ...
> >     DUPLICATE: gdb.mi/mi-language.exp: set lang ada
> > 
> > Fix the erroneous test name.
> > 
> > Tested on x86_64-linux.
> > ---
> >  gdb/testsuite/gdb.mi/mi-language.exp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/gdb/testsuite/gdb.mi/mi-language.exp b/gdb/testsuite/gdb.mi/mi-language.exp
> > index d1e4503b6f9..a4e946e3789 100644
> > --- a/gdb/testsuite/gdb.mi/mi-language.exp
> > +++ b/gdb/testsuite/gdb.mi/mi-language.exp
> > @@ -45,7 +45,7 @@ mi_gdb_test "-data-evaluate-expression --language c \"sizeof (void*)\"" \
> >  # Double-check that the current language has not changed.
> >  mi_gdb_test "show lang ada" \
> >              ".*The current source language is \\\\\"ada\\\\\".*" \
> > -            "set lang ada"
> > +            "show lang ada"
> >  
> 
> FYI, you can also just remove the last argument, as it defaults to the command string.
> Less duplication that way.

Done.

Thanks for the review.

Lancelot

---
From da0cd214af2e410e1994cfa9f3b7f4d99e768d09 Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lsix@lancelotsix.com>
Date: Tue, 23 Nov 2021 15:15:57 +0000
Subject: [PATCH] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi-language.exp ...
    DUPLICATE: gdb.mi/mi-language.exp: set lang ada

This is due to an erroneous explicit test name.  This explicit test name
also happens to be useless (at least it would have been if it was
correct) since it only repeats the command, so just remove the explicit
test name and let the command be used as default test name.  Also remove
explicit test name at another location in the file since it also just
repeat the command.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.mi/mi-language.exp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-language.exp b/gdb/testsuite/gdb.mi/mi-language.exp
index d1e4503b6f9..c98eb0a8142 100644
--- a/gdb/testsuite/gdb.mi/mi-language.exp
+++ b/gdb/testsuite/gdb.mi/mi-language.exp
@@ -28,8 +28,7 @@ mi_gdb_test "-list-features" \
             "-list-features should include \"language-option\""
 
 mi_gdb_test "set lang ada" \
-            ".*=cmd-param-changed,param=\"language\",value=\"ada\".*" \
-            "set lang ada"
+            ".*=cmd-param-changed,param=\"language\",value=\"ada\".*"
 
 # Evaluate an expression that the Ada language is unable to parse.
 mi_gdb_test "-data-evaluate-expression \"sizeof (void*)\"" \
@@ -44,8 +43,7 @@ mi_gdb_test "-data-evaluate-expression --language c \"sizeof (void*)\"" \
 
 # Double-check that the current language has not changed.
 mi_gdb_test "show lang ada" \
-            ".*The current source language is \\\\\"ada\\\\\".*" \
-            "set lang ada"
+            ".*The current source language is \\\\\"ada\\\\\".*"
 
 # Test what happens when specifying an invalid language name...
 mi_gdb_test "-data-evaluate-expression --language invlang \"sizeof (void*)\"" \
-- 
2.34.0


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

* Re: [PATCH 04/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
  2021-12-16 23:27     ` Lancelot SIX
@ 2021-12-17 12:21       ` Pedro Alves
  0 siblings, 0 replies; 33+ messages in thread
From: Pedro Alves @ 2021-12-17 12:21 UTC (permalink / raw)
  To: Lancelot SIX; +Cc: gdb-patches

On 2021-12-16 23:27, Lancelot SIX wrote:
> From 6fcb1d880bf5009aa9ce9e873a5c5f50e6fc142d Mon Sep 17 00:00:00 2001
> From: Lancelot SIX <lsix@lancelotsix.com>
> Date: Mon, 22 Nov 2021 22:36:47 +0000
> Subject: [PATCH] gdb/testsuite: Remove duplicates from
>  gdb.mi/mi-catch-load.exp
> 
> When I run the testsuite, I have:
> 
>     Running .../gdb/testsuite/gdb.mi/mi-catch-load.exp ...
>     DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
>     DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main
> 
> Fix by grouping the various phases in with_test_prefix blocks.  Since
> the tests now have a prefix, remove the manually written prefixes in
> testnames.
> 
> Also change some messages with the pattern "(timeout) $testname" into
> "$estname (timeout)" since tools will handle this as $testname[1] (which
> is what we want in this particular scenario).
> 
> Tested on x86_64-linux.
> 
> [1] https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages

Perfect.  This is OK.

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

* [PATCH] gdb/testsuite: Remove some duplication from gdb.mi/mi-var-child.exp
  2021-12-16 23:40     ` Lancelot SIX
@ 2021-12-17 13:00       ` Pedro Alves
  2021-12-17 23:24         ` Lancelot SIX
  0 siblings, 1 reply; 33+ messages in thread
From: Pedro Alves @ 2021-12-17 13:00 UTC (permalink / raw)
  To: Lancelot SIX; +Cc: gdb-patches

On 2021-12-16 23:40, Lancelot SIX wrote:
>>
>> Did you consider using variables to eliminate risk of these ever diverging?  Something like:
>>
>>   set expr "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
>>   mi_gdb_test "-var-info-num-children $expr" \
>>   	"\\^done,numchild=\"0\"" \
>> 	"get number of children of $expr"
>>
>>   ...
> 
> Actually, not that much.  This file is 1k+ lines with plenty of tests
> just like this one.  Do not get me wrong, doing this would be a big
> plus, but given the extend of changes I would think it is a bit out of
> the scope of what I want to achieve.
> 
> Do you mind if I postpone this refactoring?  i.e. I get it out of my
> mind until next time I have to come back to this file, or want to spend
> time just doing this.

That is certainly fine.  Please go ahead with what you had.

I gave it another look, and noticed that at least the "get number of children" tests
can be easily factored out, like below.  This applies on top of your patch.

WDYT?

From 1fe228ef69838a1687692b45c4d6b7f4d34be5de Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Fri, 17 Dec 2021 11:00:31 +0000
Subject: [PATCH] gdb/testsuite: Remove some duplication from
 gdb.mi/mi-var-child.exp

Add a new procedure to test -var-info-num-children, reducing
duplication throughout.

There are no gdb.sum message changes after this.

Tested on x86_64-linux.

Change-Id: I0767d8abdb2045e4eaabd8e935e862d9a4e4ebe2
---
 gdb/testsuite/gdb.mi/mi-var-child.exp | 238 ++++++++------------------
 1 file changed, 73 insertions(+), 165 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp
index cec433a4c8c..0ee2d98c2cd 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child.exp
@@ -43,6 +43,14 @@ mi_runto do_children_tests
 set line_dlt_first_real [gdb_get_line_number "weird = &struct_declarations;"]
 mi_continue_to_line $line_dlt_first_real "step to real start of do_children_test"
 
+# Check that -var-info-num-children reports EXPECTED children for
+# EXPRESSION.
+
+proc test_number_of_children {expression expected} {
+    mi_gdb_test "-var-info-num-children $expression" \
+	"\\^done,numchild=\"$expected\"" \
+	"get number of children of $expression"
+}
 
 #####        #####
 #                #
@@ -81,9 +89,7 @@ mi_list_varobj_children "struct_declarations" {
 
 # Test: c_variable-4.4
 # Desc: number of children of struct_declarations
-mi_gdb_test "-var-info-num-children struct_declarations" \
-	"\\^done,numchild=\"11\"" \
-	"get number of children of struct_declarations"
+test_number_of_children "struct_declarations" 11
 
 # Test: c_variable-4.5
 # Desc: children of struct_declarations.integer
@@ -92,9 +98,7 @@ mi_list_varobj_children "struct_declarations.integer" {} \
 
 # Test: c_variable-4.6
 # Desc: number of children of struct_declarations.integer
-mi_gdb_test "-var-info-num-children struct_declarations.integer" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.integer"
+test_number_of_children "struct_declarations.integer" 0
 
 # Test: c_variable-4.7
 # Desc: children of struct_declarations.character
@@ -103,9 +107,7 @@ mi_list_varobj_children "struct_declarations.character" {} \
 
 # Test: c_variable-4.8
 # Desc: number of children of struct_declarations.character
-mi_gdb_test "-var-info-num-children struct_declarations.character" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.character"
+test_number_of_children "struct_declarations.character" 0
 
 # Test: c_variable-4.9
 # Desc: children of struct_declarations.char_ptr
@@ -115,9 +117,7 @@ mi_list_varobj_children "struct_declarations.char_ptr" {
 
 # Test: c_variable-4.10
 # Desc: number of children of struct_declarations.char_ptr
-mi_gdb_test "-var-info-num-children struct_declarations.char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of struct_declarations.char_ptr"
+test_number_of_children "struct_declarations.char_ptr" 1
 
 # Test: c_variable-4.11
 # Desc: children of struct_declarations.long_int
@@ -126,9 +126,7 @@ mi_list_varobj_children "struct_declarations.long_int" {} \
 
 # Test: c_variable-4.12
 # Desc: number of children of struct_declarations.long_int
-mi_gdb_test "-var-info-num-children struct_declarations.long_int" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.long_int"
+test_number_of_children "struct_declarations.long_int" 0
 
 # Test: c_variable-4.13
 # Desc: children of int_ptr_ptr
@@ -142,9 +140,7 @@ mi_list_varobj_children "struct_declarations.int_ptr_ptr" {
 
 # Test: c_variable-4.14
 # Desc: number of children of int_ptr_ptr
-mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of struct_declarations.int_ptr_ptr"
+test_number_of_children "struct_declarations.int_ptr_ptr" 1
 
 
 # Test: c_variable-4.15
@@ -155,9 +151,7 @@ mi_list_array_varobj_children "struct_declarations.long_array" 12 \
 
 # Test: c_variable-4.16
 # Desc: number of children of struct_declarations.long_array
-mi_gdb_test "-var-info-num-children struct_declarations.long_array" \
-	"\\^done,numchild=\"12\"" \
-	"get number of children of struct_declarations.long_array"
+test_number_of_children "struct_declarations.long_array" 12
 
 # Test: c_variable-4.17
 # Desc: children of struct_declarations.func_ptr
@@ -166,9 +160,7 @@ mi_list_varobj_children "struct_declarations.func_ptr" {} \
 
 # Test: c_variable-4.18
 # Desc: number of children of struct_declarations.func_ptr
-mi_gdb_test "-var-info-num-children struct_declarations.func_ptr" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.func_ptr"
+test_number_of_children "struct_declarations.func_ptr" 0
 
 
 # Test: c_variable-4.19
@@ -178,9 +170,7 @@ mi_list_varobj_children "struct_declarations.func_ptr_struct" {} \
 
 # Test: c_variable-4.20
 # Desc: number of children of struct_declarations.func_ptr_struct
-mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_struct" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.func_ptr_struct"
+test_number_of_children "struct_declarations.func_ptr_struct" 0
 
 
 # Test: c_variable-4.21
@@ -190,9 +180,7 @@ mi_list_varobj_children "struct_declarations.func_ptr_ptr" {} \
 
 # Test: c_variable-4.22
 # Desc: number of children of struct_declarations.func_ptr_ptr
-mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_ptr" \
-       "\\^done,numchild=\"0\"" \
-       "get number of children of struct_declarations.func_ptr_ptr"
+test_number_of_children "struct_declarations.func_ptr_ptr" 0
 
 # Test: c_variable-4.23
 # Desc: children of struct_declarations.u1
@@ -205,9 +193,7 @@ mi_list_varobj_children "struct_declarations.u1" {
 
 # Test: c_variable-4.24
 # Desc: number of children of struct_declarations.u1
-mi_gdb_test "-var-info-num-children struct_declarations.u1" \
-	"\\^done,numchild=\"4\"" \
-	"get number of children of struct_declarations.u1"
+test_number_of_children "struct_declarations.u1" 4
 
 # Test: c_variable-4.25
 # Desc: children of struct_declarations.s2
@@ -224,18 +210,14 @@ mi_list_varobj_children "struct_declarations.s2" {
 
 # Test: c_variable-4.26
 # Desc: number of children of struct_declarations.s2
-mi_gdb_test "-var-info-num-children struct_declarations.s2" \
-	"\\^done,numchild=\"4\"" \
-	"get number of children of struct_declarations.s2"
+test_number_of_children "struct_declarations.s2" 4
 
 
 for {set i 1} {$i <= 9} {incr i} {
     mi_list_varobj_children "struct_declarations.long_array.$i" {} \
 	"get children of struct_declarations.long_array.$i"
 
-    mi_gdb_test "-var-info-num-children struct_declarations.long_array.$i" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.long_array.$i"
+    test_number_of_children "struct_declarations.long_array.$i" 0
 }
 
 # Test: c_variable-4.45
@@ -245,9 +227,7 @@ mi_list_varobj_children "struct_declarations.u1.a" {} \
 
 # Test: c_variable-4.46
 # Desc: number of children of struct_declarations.u1.a
-mi_gdb_test "-var-info-num-children struct_declarations.u1.a" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.u1.a"
+test_number_of_children "struct_declarations.u1.a" 0
 
 # Test: c_variable-4.47
 # Desc: children of struct_declarations.u1.b
@@ -257,9 +237,7 @@ mi_list_varobj_children "struct_declarations.u1.b" {
 
 # Test: c_variable-4.48
 # Desc: number of children of struct_declarations.u1.b
-mi_gdb_test "-var-info-num-children struct_declarations.u1.b" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of struct_declarations.u1.b"
+test_number_of_children "struct_declarations.u1.b" 1
 
 # Test: c_variable-4.49
 # Desc: children of struct_declarations.u1.c
@@ -268,9 +246,7 @@ mi_list_varobj_children "struct_declarations.u1.c" {} \
 
 # Test: c_variable-4.50
 # Desc: number of children of struct_declarations.u1.c
-mi_gdb_test "-var-info-num-children struct_declarations.u1.c" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.u1.c"
+test_number_of_children "struct_declarations.u1.c" 0
 
 # Test: c_variable-4.51
 # Desc: children of struct_declarations.u1.d
@@ -280,9 +256,7 @@ mi_list_varobj_children "struct_declarations.u1.d" {} \
 
 # Test: c_variable-4.52
 # Desc: number of children of struct_declarations.u1.d
-mi_gdb_test "-var-info-num-children struct_declarations.u1.d" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.u1.d"
+test_number_of_children "struct_declarations.u1.d" 0
 
 
 # Test: c_variable-4.53
@@ -295,9 +269,7 @@ mi_list_varobj_children "struct_declarations.s2.u2" {
 
 # Test: c_variable-4.54
 # Desc: number of children of struct_declarations.s2.u2
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2" \
-	"\\^done,numchild=\"3\"" \
-	"get number of children of struct_declarations.s2.u2"
+test_number_of_children "struct_declarations.s2.u2" 3
 
 # Test: c_variable-4.55
 # Desc: children of struct_declarations.s2.g
@@ -306,9 +278,7 @@ mi_list_varobj_children struct_declarations.s2.g {} \
 
 # Test: c_variable-4.56
 # Desc: number of children of struct_declarations.s2.g
-mi_gdb_test "-var-info-num-children struct_declarations.s2.g" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.s2.g"
+test_number_of_children "struct_declarations.s2.g" 0
 
 
 # Test: c_variable-4.57
@@ -318,9 +288,7 @@ mi_list_varobj_children struct_declarations.s2.h {} \
 
 # Test: c_variable-4.58
 # Desc: number of children of struct_declarations.s2.h
-mi_gdb_test "-var-info-num-children struct_declarations.s2.h" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.s2.h"
+test_number_of_children "struct_declarations.s2.h" 0
 
 
 # Test: c_variable-4.59
@@ -334,9 +302,7 @@ mi_list_varobj_children struct_declarations.s2.i $t \
 
 # Test: c_variable-4.60
 # Desc: number of children of struct_declarations.s2.i
-mi_gdb_test "-var-info-num-children struct_declarations.s2.i" \
-	"\\^done,numchild=\"10\"" \
-	"get number of children of struct_declarations.s2.i"
+test_number_of_children "struct_declarations.s2.i" 10
 
 # Test: c_variable-4.61
 # Desc: children of struct_declarations.s2.u2.u1s1
@@ -349,9 +315,7 @@ mi_list_varobj_children struct_declarations.s2.u2.u1s1 {
 
 # Test: c_variable-4.62
 # Desc: number of children of struct_declarations.s2.u2.u1s1
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1" \
-	"\\^done,numchild=\"4\"" \
-	"get number of children of struct_declarations.s2.u2.u1s1"
+test_number_of_children "struct_declarations.s2.u2.u1s1" 4
 
 # Test: c_variable-4.63
 # Desc: children of struct_declarations.s2.u2.f
@@ -360,9 +324,7 @@ mi_list_varobj_children struct_declarations.s2.u2.f {} \
 
 # Test: c_variable-4.64
 # Desc: number of children of struct_declarations.s2.u2.f
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.f" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.s2.u2.f"
+test_number_of_children "struct_declarations.s2.u2.f" 0
 
 # Test: c_variable-4.65
 # Desc: children of struct_declarations.s2.u2.u1s2
@@ -373,9 +335,7 @@ mi_list_varobj_children struct_declarations.s2.u2.u1s2 {
 
 # Test: c_variable-4.66
 # Desc: number of children of struct_declarations.s2.u2.u1s2
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2" \
-	"\\^done,numchild=\"2\"" \
-	"get number of children of struct_declarations.s2.u2.u1s2"
+test_number_of_children "struct_declarations.s2.u2.u1s2" 2
 
 # Test: c_variable-4.67
 # Desc: children of struct_declarations.s2.u2.u1s1.d
@@ -384,9 +344,7 @@ mi_list_varobj_children struct_declarations.s2.u2.u1s1.d {} \
 
 # Test: c_variable-4.68
 # Desc: number of children of struct_declarations.s2.u2.u1s1.d
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.d" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.s2.u2.u1s1.d"
+test_number_of_children "struct_declarations.s2.u2.u1s1.d" 0
 
 # Test: c_variable-4.69
 # Desc: children of struct_declarations.s2.u2.u1s1.e
@@ -399,9 +357,7 @@ mi_list_varobj_children struct_declarations.s2.u2.u1s1.e $t \
 
 # Test: c_variable-4.70
 # Desc: number of children of struct_declarations.s2.u2.u1s1.e
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.e" \
-	"\\^done,numchild=\"10\"" \
-	"get number of children of struct_declarations.s2.u2.u1s1.e"
+test_number_of_children "struct_declarations.s2.u2.u1s1.e" 10
 
 
 # Test: c_variable-4.71
@@ -411,9 +367,7 @@ mi_list_varobj_children struct_declarations.s2.u2.u1s1.func {} \
 
 # Test: c_variable-4.72
 # Desc: number of children of struct_declarations.s2.u2.u1s1.func
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.func" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.s2.u2.u1s1.func"
+test_number_of_children "struct_declarations.s2.u2.u1s1.func" 0
 
 
 # Test: c_variable-4.73
@@ -423,9 +377,7 @@ mi_list_varobj_children struct_declarations.s2.u2.u1s1.foo {} \
 
 # Test: c_variable-4.74
 # Desc: number of children of struct_declarations.s2.u2.u1s1.foo
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.foo" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.s2.u2.u1s1.foo"
+test_number_of_children "struct_declarations.s2.u2.u1s1.foo" 0
 
 
 # Test: c_variable-4.75
@@ -437,9 +389,7 @@ mi_list_varobj_children struct_declarations.s2.u2.u1s2.array_ptr {
 
 # Test: c_variable-4.76
 # Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.array_ptr" \
-	"\\^done,numchild=\"2\"" \
-	"get number of children of struct_declarations.s2.u2.u1s2.array_ptr"
+test_number_of_children "struct_declarations.s2.u2.u1s2.array_ptr" 2
 
 # Test: c_variable-4.77
 # Desc: children of struct_declarations.s2.u2.u1s2.func
@@ -448,9 +398,7 @@ mi_list_varobj_children struct_declarations.s2.u2.u1s2.func {} \
 
 # Test: c_variable-4.78
 # Desc: number of children of struct_declarations.s2.u2.u1s2.func
-mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.func" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of struct_declarations.s2.u2.u1s2.func"
+test_number_of_children "struct_declarations.s2.u2.u1s2.func" 0
 
 # Test: c_variable-4.79
 # Desc: children of struct_declarations.int_ptr_ptr.*int_ptr_ptr
@@ -461,9 +409,7 @@ mi_list_varobj_children "struct_declarations.int_ptr_ptr.*int_ptr_ptr" {
 
 # Test: c_variable-4.80
 # Desc: Number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr
-mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr"
+test_number_of_children "struct_declarations.int_ptr_ptr.*int_ptr_ptr" 1
 
 
 # Step to "struct_declarations.integer = 123;"
@@ -495,9 +441,7 @@ mi_list_varobj_children "weird" {
 
 # Test: c_variable-4.83
 # Desc: number of children of weird
-mi_gdb_test "-var-info-num-children weird" \
-	"\\^done,numchild=\"11\"" \
-	"get number of children of weird"
+test_number_of_children "weird" 11
 
 
 # Test: c_variable-4.84
@@ -510,9 +454,7 @@ mi_list_array_varobj_children weird.long_array 12 "long" \
 
 # Test: c_variable-4.85
 # Desc: number of children of weird.long_array
-mi_gdb_test "-var-info-num-children weird.long_array" \
-	"\\^done,numchild=\"12\"" \
-	"get number of children of weird.long_array"
+test_number_of_children "weird.long_array" 12
 
 # Test: c_variable-4.86
 # Desc: children of weird.int_ptr_ptr
@@ -525,9 +467,7 @@ mi_list_varobj_children weird.int_ptr_ptr {
 
 # Test: c_variable-4.87
 # Desc: number of children of weird.int_ptr_ptr
-mi_gdb_test "-var-info-num-children weird.int_ptr_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of weird.int_ptr_ptr"
+test_number_of_children "weird.int_ptr_ptr" 1
 
 # Test: c_variable-4.88
 # Desc: children of *weird->int_ptr_ptr
@@ -540,9 +480,7 @@ mi_list_varobj_children "weird.int_ptr_ptr.*int_ptr_ptr" {
 
 # Test: c_variable-4.89
 # Desc: number of children *weird->int_ptr_ptr
-mi_gdb_test "-var-info-num-children weird.int_ptr_ptr.*int_ptr_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of weird.int_ptr_ptr.*int_ptr_ptr"
+test_number_of_children "weird.int_ptr_ptr.*int_ptr_ptr" 1
 
 # Test: c_variable-4.90
 # Desc: create weird->int_ptr_ptr
@@ -557,9 +495,7 @@ mi_list_varobj_children "weird->int_ptr_ptr" {
 
 # Test: c_variable-4.92
 # Desc: number of children of (weird->int_ptr_ptr)
-mi_gdb_test "-var-info-num-children weird->int_ptr_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of weird->int_ptr_ptr"
+test_number_of_children "weird->int_ptr_ptr" 1
 
 # Test: c_variable-4.93
 # Desc: children of *(weird->int_ptr_ptr)
@@ -570,9 +506,7 @@ mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr" {
 
 # Test: c_variable-4.94
 # Desc: number of children of *(weird->int_ptr_ptr)
-mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr"
+test_number_of_children "weird->int_ptr_ptr.*weird->int_ptr_ptr" 1
 
 # Test: c_variable-4.95
 # Desc: children of *(*(weird->int_ptr_ptr))
@@ -857,9 +791,7 @@ mi_list_varobj_children "psnp->char_ptr" {
 
 # Test: c_variable-5.12
 # Desc: number of children of psnp->char_ptr
-mi_gdb_test "-var-info-num-children psnp->char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->char_ptr"
+test_number_of_children "psnp->char_ptr" 1
 
 # Test: c_variable-5.13
 # Desc: children of *(psnp->char_ptr)
@@ -870,9 +802,7 @@ mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr" {
 
 # Test: c_variable-5.14
 # Desc: number of children of *(psnp->char_ptr)
-mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->char_ptr.*psnp->char_ptr"
+test_number_of_children "psnp->char_ptr.*psnp->char_ptr" 1
 
 # Test: c_variable-5.15
 # Desc: children of *(*(psnp->char_ptr))
@@ -883,9 +813,7 @@ mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" {
 
 # Test: c_variable-5.16
 # Desc: number of children of *(*(psnp->char_ptr))
-mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
+test_number_of_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" 1
 
 # Test: c_variable-5.17
 # Desc: children of *(*(*(psnp->char_ptr)))
@@ -896,9 +824,9 @@ mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp
 
 # Test: c_variable-5.18
 # Desc: number of children of *(*(*(psnp->char_ptr)))
-mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
+test_number_of_children \
+    "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \
+    1
 
 # Test: c_variable-5.17B
 # Desc: children of *(*(*(*(psnp->char_ptr))))
@@ -907,9 +835,9 @@ mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp
 
 # Test: c_variable-5.18B
 # Desc: number of children of *(*(*(*(psnp->char_ptr))))
-mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
+test_number_of_children \
+    "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \
+    0
 
 # Test: c_variable-5.19
 # Desc: create psnp->long_ptr
@@ -924,9 +852,7 @@ mi_list_varobj_children "psnp->long_ptr" {
 
 # Test: c_variable-5.21
 # Desc: number of children of psnp->long_ptr
-mi_gdb_test "-var-info-num-children psnp->long_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->long_ptr"
+test_number_of_children "psnp->long_ptr" 1
 
 # Test: c_variable-5.22
 # Desc: children of *(psnp->long_ptr)
@@ -937,9 +863,7 @@ mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr" {
 
 # Test: c_variable-5.23
 # Desc: number of children of *(psnp->long_ptr)
-mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->long_ptr.*psnp->long_ptr"
+test_number_of_children "psnp->long_ptr.*psnp->long_ptr" 1
 
 # Test: c_variable-5.24
 # Desc: children of *(*(psnp->long_ptr))
@@ -950,9 +874,7 @@ mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" {
 
 # Test: c_variable-5.25
 # Desc: number of children of *(*(psnp->long_ptr))
-mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
+test_number_of_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" 1
 
 # Test: c_variable-5.26
 # Desc: children of *(*(*(psnp->long_ptr)))
@@ -963,9 +885,9 @@ mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp
 
 # Test: c_variable-5.27
 # Desc: number of children of *(*(*(psnp->long_ptr)))
-mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
+test_number_of_children \
+    "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \
+    1
 
 # Test: c_variable-5.28
 # Desc: children of *(*(*(*(psnp->long_ptr))))
@@ -974,9 +896,9 @@ mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp
 
 # Test: c_variable-5.29
 # Desc: number of children of *(*(*(*(psnp->long_ptr))))
-mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
+test_number_of_children \
+    "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \
+    0
 
 # Test: c_variable-5.30
 # Desc: create psnp->ptrs
@@ -993,9 +915,7 @@ mi_list_varobj_children "psnp->ptrs" {
 
 # Test: c_variable-5.32
 # Desc: number of children of psnp->ptrs
-mi_gdb_test "-var-info-num-children psnp->ptrs" \
-	"\\^done,numchild=\"3\"" \
-	"get number of children of psnp->ptrs"
+test_number_of_children "psnp->ptrs" 3
 
 # Test: c_variable-5.33
 # Desc: children of psnp->ptrs[0]
@@ -1008,9 +928,7 @@ mi_list_varobj_children "psnp->ptrs.0" {
 
 # Test: c_variable-5.34
 # Desc: number of children of psnp->ptrs[0]
-mi_gdb_test "-var-info-num-children psnp->ptrs.0" \
-	"\\^done,numchild=\"4\"" \
-	"get number of children of psnp->ptrs.0"
+test_number_of_children "psnp->ptrs.0" 4
 
 # Test: c_variable-5.35
 # Desc: children of psnp->ptrs[0]->next
@@ -1025,9 +943,7 @@ mi_list_varobj_children "psnp->ptrs.0.next" {
 
 # Test: c_variable-5.36
 # Desc: number of children of psnp->ptrs[0]->next
-mi_gdb_test "-var-info-num-children psnp->ptrs.0.next" \
-	"\\^done,numchild=\"4\"" \
-	"get number of children of psnp->ptrs.0.next"
+test_number_of_children "psnp->ptrs.0.next" 4
 
 
 # Test: c_variable-5.37
@@ -1042,9 +958,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.char_ptr" {
 
 # Test: c_variable-5.38
 # Desc: number of children of psnp->ptrs[0]->next->char_ptr
-mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->ptrs.0.next.char_ptr"
+test_number_of_children "psnp->ptrs.0.next.char_ptr" 1
 
 # Test: c_variable-5.39
 # Desc: children of *psnp->ptrs[0]->next->char_ptr
@@ -1054,9 +968,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr" {
 
 # Test: c_variable-5.40
 # Desc: number of children of *psnp->ptrs[0]->next->char_ptr
-mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr"
+test_number_of_children "psnp->ptrs.0.next.char_ptr.*char_ptr" 1
 
 # Test: c_variable-5.41
 # Desc: children of **psnp->ptrs[0]->next->char_ptr
@@ -1067,9 +979,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" {
 
 # Test: c_variable-5.42
 # Desc: number of children of **psnp->ptrs[0]->next->char_ptr
-mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
+test_number_of_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" 1
 
 # Test: c_variable-5.43
 # Desc: children of ***psnp->ptrs[0]->next->char_ptr
@@ -1080,9 +990,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char
 
 # Test: c_variable-5.44
 # Desc: number of children of ***psnp->ptrs[0]->next->char_ptr
-mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \
-	"\\^done,numchild=\"1\"" \
-	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
+test_number_of_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" 1
 
 # Test: c_variable-5.43B
 # Desc: children of ****psnp->ptrs[0]->next->char_ptr
@@ -1091,9 +999,9 @@ mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char
 
 # Test: c_variable-5.44B
 # Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
-mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
-	"\\^done,numchild=\"0\"" \
-	"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr"
+test_number_of_children \
+    "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
+    0
 
 # Test: c_variable-5.45
 # Desc: children of psnp->ptrs[0]->next->next

base-commit: 72994b6028360eccb5d25b39d2e18b386d091426
prerequisite-patch-id: 47ccdbc92dcdecc6aca9bf4388cfa9422e412470
-- 
2.26.2



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

* Re: [PATCH 08/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
  2021-12-16 23:48     ` Lancelot SIX
@ 2021-12-17 13:52       ` Pedro Alves
  0 siblings, 0 replies; 33+ messages in thread
From: Pedro Alves @ 2021-12-17 13:52 UTC (permalink / raw)
  To: Lancelot SIX; +Cc: gdb-patches

On 2021-12-16 23:48, Lancelot SIX wrote:
>>> There is a slight modification of behaviour introduced by this patch.
>>> mi_delete_breakpoints is called one more time just before quitting gdb,
>>> which is in my opinion is worth given the simplification.
>>
>> It's much more typical to delete breakpoints _before_ running to main.  I.e.,
>> putting the "restart" code at the beginning.  If that works, I'd mildly prefer that.
>>
>> This is OK either way.
>>
> 
> I have changed this, and the test still happy.
> 

OK.

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

* Re: [PATCH 10/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp
  2021-12-16 23:59     ` Lancelot SIX
@ 2021-12-17 13:53       ` Pedro Alves
  0 siblings, 0 replies; 33+ messages in thread
From: Pedro Alves @ 2021-12-17 13:53 UTC (permalink / raw)
  To: Lancelot SIX; +Cc: gdb-patches

On 2021-12-16 23:59, Lancelot SIX wrote:
> On Fri, Dec 10, 2021 at 09:56:51PM +0000, Pedro Alves wrote:
>> On 2021-11-26 23:00, Lancelot SIX via Gdb-patches wrote:
>>> When running the testsuite, I have:
>>>
>>>     Running .../gdb/testsuite/gdb.mi/mi-language.exp ...
>>>     DUPLICATE: gdb.mi/mi-language.exp: set lang ada
>>>
>>> Fix the erroneous test name.
>>>
>>> Tested on x86_64-linux.
>>> ---
>>>  gdb/testsuite/gdb.mi/mi-language.exp | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/gdb/testsuite/gdb.mi/mi-language.exp b/gdb/testsuite/gdb.mi/mi-language.exp
>>> index d1e4503b6f9..a4e946e3789 100644
>>> --- a/gdb/testsuite/gdb.mi/mi-language.exp
>>> +++ b/gdb/testsuite/gdb.mi/mi-language.exp
>>> @@ -45,7 +45,7 @@ mi_gdb_test "-data-evaluate-expression --language c \"sizeof (void*)\"" \
>>>  # Double-check that the current language has not changed.
>>>  mi_gdb_test "show lang ada" \
>>>              ".*The current source language is \\\\\"ada\\\\\".*" \
>>> -            "set lang ada"
>>> +            "show lang ada"
>>>  
>>
>> FYI, you can also just remove the last argument, as it defaults to the command string.
>> Less duplication that way.
> 
> Done.
> 
> Thanks for the review.

This is OK.

Thanks,
Pedro Alves

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

* Re: [PATCH 11/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp
  2021-12-10 21:56   ` Pedro Alves
@ 2021-12-17 22:57     ` Lancelot SIX
  2022-01-06 16:49       ` Pedro Alves
  0 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-12-17 22:57 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> 
> IWBN to get this grouped properly while at it.  Would you mind removing the "only:" etc.
> manual prefixes instead, converting that to the with_test_prefix prefix?  Like:
> 
> with_test_prefix "only" {
>     if {[mi_runto_main] == -1} {
> 	return -1
>     }
> 
> -   mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values"
> -   mi_send_resuming_command "exec-continue" "only: entry_equal: continue"
> +  mi_gdb_test "-gdb-set print entry-values only" {\^done} "set print entry-values"
> +  mi_send_resuming_command "exec-continue" "entry_equal: continue"
> }
> 
> etc?

Hi,

Yes.  Looking at the file it is posssible to go even one step further
and have a second level of with_test_prefix.  This is what I have done
in the revision of this patch (which makes the patch much longer, but I
think it is worth).  See below.

Thanks,
Lancelot.

---
From 15a5eb28aae0b7a926fe04a97cd7359a76e40fca Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lsix@lancelotsix.com>
Date: Tue, 23 Nov 2021 15:26:18 +0000
Subject: [PATCH] gdb/testsuite: Remove duplicates from
 gdb.mi/mi2-amd64-entry-value.exp

When running the testsuite, I have:

    Running .../gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp ...
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: breakpoint at main
    DUPLICATE: gdb.mi/mi2-amd64-entry-value.exp: mi runto main

Fix by enclosing the various 'mi_runto_main' calls (which are
responsible for the DUPLICATEs warnings) in 'with_test_prefix'.

All the test did have a name prefix manually baked in the test name.
So while at it, remove it and group the tests in with_test_prefix.  The
result is a clearer file organization.

Tested on x86_64-linux.
---
 .../gdb.mi/mi2-amd64-entry-value.exp          | 431 +++++++++++++-----
 1 file changed, 320 insertions(+), 111 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
index 4505bfada67..a4e1e3fea8e 100644
--- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
@@ -49,121 +49,330 @@ foreach name {different breakhere_different breakhere_validity breakhere_invalid
 
 # Test various kinds of `set print entry-values'.
 
-if {[mi_runto_main] == -1} {
-    return -1
+with_test_prefix "no" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
+    mi_gdb_test "-gdb-set print entry-values no" {\^done} \
+	"set print entry-values"
+
+    with_test_prefix "entry_equal" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="val",value="5"}} .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "entry_different" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="val",value="6"}} .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="6"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "validity" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="lost",value="<optimized out>"},{name="born",value="10"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="born",arg="1",value="10"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "invalid" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} \
+	    "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
 }
-mi_gdb_test "-gdb-set print entry-values no" {\^done} "no: set print entry-values"
-mi_send_resuming_command "exec-continue" "no: entry_equal: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"}} .* .* {.* disp="keep"} "no: entry_equal: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"}\]} "no: entry_equal: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "no: entry_different: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"}} .* .* {.* disp="keep"} "no: entry_different: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"}\]} "no: entry_different: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "no: validity: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="lost",value="<optimized out>"},{name="born",value="10"}} .* .* {.* disp="keep"} "no: validity: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="born",arg="1",value="10"}\]} "no: validity: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "no: invalid: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "no: invalid: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "no: invalid: -stack-list-variables"
-
-if {[mi_runto_main] == -1} {
-    return -1
+
+with_test_prefix "only" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
+    mi_gdb_test "-gdb-set print entry-values only" {\^done} \
+	"set print entry-values"
+
+    with_test_prefix "entry_equal" {
+	mi_send_resuming_command "exec-continue" \
+	    "continue"
+	mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "entry_different" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "validity" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="lost@entry",value="5"},{name="born@entry",value="<optimized out>"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born@entry",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "invalid" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="inv@entry",value="<optimized out>"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
 }
-mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values"
-mi_send_resuming_command "exec-continue" "only: entry_equal: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "only: entry_equal: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} "only: entry_equal: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "only: entry_different: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "only: entry_different: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} "only: entry_different: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "only: validity: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="lost@entry",value="5"},{name="born@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "only: validity: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born@entry",arg="1",value="<optimized out>"}\]} "only: validity: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "only: invalid: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "only: invalid: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} "only: invalid: -stack-list-variables"
-
-if {[mi_runto_main] == -1} {
-    return -1
+
+with_test_prefix "preferred" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
+    mi_gdb_test "-gdb-set print entry-values preferred" {\^done} \
+	"set print entry-values"
+
+    with_test_prefix "entry_equal" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "entry_different" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "validity" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="lost@entry",value="5"},{name="born",value="10"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "invalid" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="inv@entry",value="<optimized out>"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
 }
-mi_gdb_test "-gdb-set print entry-values preferred" {\^done} "preferred: set print entry-values"
-mi_send_resuming_command "exec-continue" "preferred: entry_equal: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "preferred: entry_equal: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} "preferred: entry_equal: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "preferred: entry_different: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val@entry",value="5"}} .* .* {.* disp="keep"} "preferred: entry_different: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val@entry",arg="1",value="5"}\]} "preferred: entry_different: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "preferred: validity: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="lost@entry",value="5"},{name="born",value="10"}} .* .* {.* disp="keep"} "preferred: validity: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} "preferred: validity: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "preferred: invalid: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "preferred: invalid: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv@entry",arg="1",value="<optimized out>"}\]} "preferred: invalid: -stack-list-variables"
-
-if {[mi_runto_main] == -1} {
-    return -1
+
+with_test_prefix "if-needed" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
+    mi_gdb_test "-gdb-set print entry-values if-needed" {\^done} \
+	"set print entry-values"
+
+    with_test_prefix "entry_equal" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "entry_different" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="6"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "validity" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="lost@entry",value="5"},{name="born",value="10"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "invalid" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} \
+	    "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
 }
-mi_gdb_test "-gdb-set print entry-values if-needed" {\^done} "if-needed: set print entry-values"
-mi_send_resuming_command "exec-continue" "if-needed: entry_equal: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"}} .* .* {.* disp="keep"} "if-needed: entry_equal: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"}\]} "if-needed: entry_equal: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "if-needed: entry_different: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"}} .* .* {.* disp="keep"} "if-needed: entry_different: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"}\]} "if-needed: entry_different: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "if-needed: validity: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="lost@entry",value="5"},{name="born",value="10"}} .* .* {.* disp="keep"} "if-needed: validity: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} "if-needed: validity: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "if-needed: invalid: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "if-needed: invalid: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "if-needed: invalid: -stack-list-variables"
-
-if {[mi_runto_main] == -1} {
-    return -1
+
+with_test_prefix "both" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
+    mi_gdb_test "-gdb-set print entry-values both" {\^done} \
+	"set print entry-values"
+
+    with_test_prefix "entry_equal" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="val",value="5"},{name="val@entry",value="5"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "entry_different" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="val",value="6"},{name="val@entry",value="5"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "validity" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="lost",value="<optimized out>"},{name="lost@entry",value="5"},{name="born",value="10"},{name="born@entry",value="<optimized out>"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"},{name="born@entry",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "invalid" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="inv",value="<optimized out>"},{name="inv@entry",value="<optimized out>"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"},{name="inv@entry",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
 }
-mi_gdb_test "-gdb-set print entry-values both" {\^done} "both: set print entry-values"
-mi_send_resuming_command "exec-continue" "both: entry_equal: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "both: entry_equal: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} "both: entry_equal: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "both: entry_different: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "both: entry_different: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} "both: entry_different: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "both: validity: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="lost",value="<optimized out>"},{name="lost@entry",value="5"},{name="born",value="10"},{name="born@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "both: validity: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"},{name="born@entry",arg="1",value="<optimized out>"}\]} "both: validity: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "both: invalid: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"},{name="inv@entry",value="<optimized out>"}} .* .* {.* disp="keep"} "both: invalid: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"},{name="inv@entry",arg="1",value="<optimized out>"}\]} "both: invalid: -stack-list-variables"
-
-if {[mi_runto_main] == -1} {
-    return -1
+
+with_test_prefix "compact" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
+    mi_gdb_test "-gdb-set print entry-values compact" {\^done} \
+	"set print entry-values"
+
+    with_test_prefix "entry_equal" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="val",value="5"},{name="val@entry",value="5"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "entry_different" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"},{name="val@entry",value="5"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "validity" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="lost@entry",value="5"},{name="born",value="10"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "invalid" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} \
+	    "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
 }
-mi_gdb_test "-gdb-set print entry-values compact" {\^done} "compact: set print entry-values"
-mi_send_resuming_command "exec-continue" "compact: entry_equal: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "compact: entry_equal: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} "compact: entry_equal: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "compact: entry_different: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "compact: entry_different: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} "compact: entry_different: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "compact: validity: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="lost@entry",value="5"},{name="born",value="10"}} .* .* {.* disp="keep"} "compact: validity: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} "compact: validity: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "compact: invalid: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "compact: invalid: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "compact: invalid: -stack-list-variables"
-
-if {[mi_runto_main] == -1} {
-    return -1
+
+with_test_prefix "default" {
+    if {[mi_runto_main] == -1} {
+	return -1
+    }
+    mi_gdb_test "-gdb-set print entry-values default" {\^done} \
+	"set print entry-values"
+
+    with_test_prefix "entry_equal" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="val",value="5"},{name="val@entry",value="5"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "entry_different" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="val",value="6"},{name="val@entry",value="5"}} .* .* \
+	    {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "validity" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="lost",value="<optimized out>"},{name="lost@entry",value="5"},{name="born",value="10"}} \
+	    .* .* {.* disp="keep"} "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} \
+	    "-stack-list-variables"
+    }
+
+    with_test_prefix "invalid" {
+	mi_send_resuming_command "exec-continue" "continue"
+	mi_expect_stop "breakpoint-hit" .* \
+	    {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} \
+	    "stop"
+	mi_gdb_test "-stack-list-variables --all-values" \
+	    {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} \
+	    "-stack-list-variables"
+    }
 }
-mi_gdb_test "-gdb-set print entry-values default" {\^done} "default: set print entry-values"
-mi_send_resuming_command "exec-continue" "default: entry_equal: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="5"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "default: entry_equal: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="5"},{name="val@entry",arg="1",value="5"}\]} "default: entry_equal: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "default: entry_different: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="val",value="6"},{name="val@entry",value="5"}} .* .* {.* disp="keep"} "default: entry_different: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="val",arg="1",value="6"},{name="val@entry",arg="1",value="5"}\]} "default: entry_different: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "default: validity: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="lost",value="<optimized out>"},{name="lost@entry",value="5"},{name="born",value="10"}} .* .* {.* disp="keep"} "default: validity: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="lost",arg="1",value="<optimized out>"},{name="lost@entry",arg="1",value="5"},{name="born",arg="1",value="10"}\]} "default: validity: -stack-list-variables"
-mi_send_resuming_command "exec-continue" "default: invalid: continue"
-mi_expect_stop "breakpoint-hit" .* {{name="inv",value="<optimized out>"}} .* .* {.* disp="keep"} "default: invalid: stop"
-mi_gdb_test "-stack-list-variables --all-values" {\^done,variables=\[{name="inv",arg="1",value="<optimized out>"}\]} "default: invalid: -stack-list-variables"
-- 
2.34.0


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

* Re: [PATCH] gdb/testsuite: Remove some duplication from gdb.mi/mi-var-child.exp
  2021-12-17 13:00       ` [PATCH] gdb/testsuite: Remove some duplication " Pedro Alves
@ 2021-12-17 23:24         ` Lancelot SIX
  2022-01-06 16:44           ` Pedro Alves
  0 siblings, 1 reply; 33+ messages in thread
From: Lancelot SIX @ 2021-12-17 23:24 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> That is certainly fine.  Please go ahead with what you had.
> 
> I gave it another look, and noticed that at least the "get number of children" tests
> can be easily factored out, like below.  This applies on top of your patch.
> 
> WDYT?
> 

Nice!

I was expecting something similar could be done, but I did not pushed to
do it.  It looks good, and I confirm that I have no difference in the
.sum file.

I am confident this is OK, and I have integrated this patch in my
branch.  If this is OK, I'll push with the rest of my series.

Thanks,
Lancelot.

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

* Re: [PATCH] gdb/testsuite: Remove some duplication from gdb.mi/mi-var-child.exp
  2021-12-17 23:24         ` Lancelot SIX
@ 2022-01-06 16:44           ` Pedro Alves
  0 siblings, 0 replies; 33+ messages in thread
From: Pedro Alves @ 2022-01-06 16:44 UTC (permalink / raw)
  To: Lancelot SIX; +Cc: gdb-patches

On 2021-12-17 23:24, Lancelot SIX wrote:
>> That is certainly fine.  Please go ahead with what you had.
>>
>> I gave it another look, and noticed that at least the "get number of children" tests
>> can be easily factored out, like below.  This applies on top of your patch.
>>
>> WDYT?
>>
> 
> Nice!
> 
> I was expecting something similar could be done, but I did not pushed to
> do it.  It looks good, and I confirm that I have no difference in the
> .sum file.
> 
> I am confident this is OK, and I have integrated this patch in my
> branch.  If this is OK, I'll push with the rest of my series.

Sorry, missed this question before.  Yes, this is totally fine, and actually
less work for me, so thanks.  :-)

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

* Re: [PATCH 11/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp
  2021-12-17 22:57     ` Lancelot SIX
@ 2022-01-06 16:49       ` Pedro Alves
  0 siblings, 0 replies; 33+ messages in thread
From: Pedro Alves @ 2022-01-06 16:49 UTC (permalink / raw)
  To: Lancelot SIX; +Cc: gdb-patches

On 2021-12-17 22:57, Lancelot SIX wrote:
>>
>> IWBN to get this grouped properly while at it.  Would you mind removing the "only:" etc.
>> manual prefixes instead, converting that to the with_test_prefix prefix?  Like:
>>
>> with_test_prefix "only" {
>>     if {[mi_runto_main] == -1} {
>> 	return -1
>>     }
>>
>> -   mi_gdb_test "-gdb-set print entry-values only" {\^done} "only: set print entry-values"
>> -   mi_send_resuming_command "exec-continue" "only: entry_equal: continue"
>> +  mi_gdb_test "-gdb-set print entry-values only" {\^done} "set print entry-values"
>> +  mi_send_resuming_command "exec-continue" "entry_equal: continue"
>> }
>>
>> etc?
> 
> Hi,
> 
> Yes.  Looking at the file it is posssible to go even one step further
> and have a second level of with_test_prefix.  This is what I have done
> in the revision of this patch (which makes the patch much longer, but I
> think it is worth).  See below.
> 
> Thanks,
> Lancelot.

OK.

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

* Re: [PATCH 00/12] Remove DUPLICATEs warnings
  2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
                   ` (13 preceding siblings ...)
  2021-12-10 22:01 ` Pedro Alves
@ 2022-01-07 22:43 ` Lancelot SIX
  14 siblings, 0 replies; 33+ messages in thread
From: Lancelot SIX @ 2022-01-07 22:43 UTC (permalink / raw)
  To: gdb-patches

Hi,

I will shortly push this series (with the requested changes where
appropriate).

Note that I have removed the patches that were conflicting with
https://sourceware.org/pipermail/gdb-patches/2021-December/184634.html
(i.e. patches 1, 3, 5, 6, 9 and 11)

Thanks for all the reviews.
Best,
Lancelot.

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

end of thread, other threads:[~2022-01-07 22:43 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26 23:00 [PATCH 00/12] Remove DUPLICATEs warnings Lancelot SIX
2021-11-26 23:00 ` [PATCH 01/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-syn-frame.exp Lancelot SIX
2021-11-26 23:00 ` [PATCH 02/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nsthrexec.exp Lancelot SIX
2021-11-26 23:00 ` [PATCH 03/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-watch.exp Lancelot SIX
2021-11-26 23:00 ` [PATCH 04/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp Lancelot SIX
2021-12-10 21:55   ` Pedro Alves
2021-12-16 23:27     ` Lancelot SIX
2021-12-17 12:21       ` Pedro Alves
2021-11-26 23:00 ` [PATCH 05/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-child.exp Lancelot SIX
2021-12-10 21:55   ` Pedro Alves
2021-12-16 23:40     ` Lancelot SIX
2021-12-17 13:00       ` [PATCH] gdb/testsuite: Remove some duplication " Pedro Alves
2021-12-17 23:24         ` Lancelot SIX
2022-01-06 16:44           ` Pedro Alves
2021-11-26 23:00 ` [PATCH 06/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-var-child.exp Lancelot SIX
2021-11-26 23:00 ` [PATCH 07/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop.exp Lancelot SIX
2021-11-26 23:00 ` [PATCH 08/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp Lancelot SIX
2021-12-10 21:56   ` Pedro Alves
2021-12-16 23:48     ` Lancelot SIX
2021-12-17 13:52       ` Pedro Alves
2021-11-26 23:00 ` [PATCH 09/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-var-rtti.exp Lancelot SIX
2021-11-26 23:00 ` [PATCH 10/12] gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp Lancelot SIX
2021-12-10 21:56   ` Pedro Alves
2021-12-16 23:59     ` Lancelot SIX
2021-12-17 13:53       ` Pedro Alves
2021-11-26 23:00 ` [PATCH 11/12] gdb/testsuite: Remove duplicates from gdb.mi/mi2-amd64-entry-value.exp Lancelot SIX
2021-12-10 21:56   ` Pedro Alves
2021-12-17 22:57     ` Lancelot SIX
2022-01-06 16:49       ` Pedro Alves
2021-11-26 23:00 ` [PATCH 12/12] gdb/testsuite: Remove duplicates from gdb.threads/staticthreads.ex Lancelot SIX
2021-12-09 18:15 ` [PATCH 00/12] Remove DUPLICATEs warnings Tom Tromey
2021-12-10 22:01 ` Pedro Alves
2022-01-07 22:43 ` Lancelot SIX

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