From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 7CE083858C78; Tue, 28 Feb 2023 11:09:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CE083858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677582575; bh=3z2DArUnL2moeMysyx1SrrgEQlUnhApPu1q10J3SSGk=; h=From:To:Subject:Date:From; b=WHiGHjkMS20s+g8ceePQkUA7Nj2xqLGUoeqQfUUbphoGT6bhAMUzjxEcZ4fUqjj9w 78vTWq4pGsPScaItgMG0iHKVyUArgtkHvxboWGyACGDrQM4dCF2BJwcmxEepduVnvH zNeqljqDolwFqD9NCkNf1gNiSvGB9Sn/5f0H99Z8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: fix failure in gdb.mi/mi-pending.exp with extended-remote X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 47171eeb9468fd38e3785b0181d63a2abea3bf29 X-Git-Newrev: 05ac6365e558a207fcf7fa39c3fc8c7b1d0601aa Message-Id: <20230228110935.7CE083858C78@sourceware.org> Date: Tue, 28 Feb 2023 11:09:35 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D05ac6365e558= a207fcf7fa39c3fc8c7b1d0601aa commit 05ac6365e558a207fcf7fa39c3fc8c7b1d0601aa Author: Andrew Burgess Date: Sat Feb 18 22:50:52 2023 +0000 gdb/testsuite: fix failure in gdb.mi/mi-pending.exp with extended-remote =20 I currently see this failure when running the gdb.mi/mi-pending.exp test using the native-extended-remote board: =20 -break-insert -f -c x=3D=3D4 mi-pendshr.c:pendfunc2 &"No source file named mi-pendshr.c.\n" ^done,bkpt=3D{number=3D"2",type=3D"breakpoint",disp=3D"keep",enabled= =3D"y",addr=3D"",pending=3D"mi-pendshr.c:pendfunc2",cond=3D"x=3D= =3D4",evaluated-by=3D"host",times=3D"0",original-location=3D"mi-pendshr.c:p= endfunc2"} (gdb) FAIL: gdb.mi/mi-pending.exp: MI pending breakpoint on mi-pendshr.c:pe= ndfunc2 if x=3D=3D4 (unexpected output) =20 The failure is caused by the 'evaluated-by=3D"host"' string, which only appears in the output when the test is run using the native-extended-remote board. =20 I could fix this by just updating the pattern in gdb.mi/mi-pending.exp, but I have instead updated mi-pending.exp to make more use of the support procs in mi-support.exp. This did require making a couple of adjustments to mi-support.exp, but I think the result is that mi-pending.exp is now easier to read, and I see no failures with native-extended-remote anymore. =20 One of the test names has changed after this work, I think the old test name was wrong - it described a breakpoint as pending when the breakpoint was not pending, I suspect a copy & paste error. =20 But there's no changes to what is actually being tested after this patch. =20 Approved-By: Pedro Alves Diff: --- gdb/testsuite/gdb.mi/mi-pending.exp | 34 +++++++++++++++++++++++++--------- gdb/testsuite/lib/mi-support.exp | 19 ++++++++++++++----- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-= pending.exp index a5c6ee5c906..71c3d45fe44 100644 --- a/gdb/testsuite/gdb.mi/mi-pending.exp +++ b/gdb/testsuite/gdb.mi/mi-pending.exp @@ -52,19 +52,35 @@ mi_load_shlibs $lib_sl1 mi_load_shlibs $lib_sl2 =20 # Set pending breakpoint via MI. -mi_gdb_test "-break-insert -f pendfunc1" \ - ".*\\^done,bkpt=3D\{number=3D\"1\",type=3D\"breakpoint\",disp=3D\"keep= \",enabled=3D\"y\",addr=3D\"\",pending=3D\"pendfunc1\",times=3D\"0= \",original-location=3D\"pendfunc1\"\}"\ - "MI pending breakpoint on pendfunc1" +mi_create_breakpoint_pending "-f pendfunc1" \ + "MI pending breakpoint on pendfunc1" \ + -number "1" \ + -type "breakpoint" \ + -disp "keep" \ + -enabled "y" \ + -pending "pendfunc1" \ + -original-location "pendfunc1" =20 # Set pending breakpoint with a condition via MI. -mi_gdb_test "-break-insert -f -c x=3D=3D4 ${libfile1}.c:pendfunc2" \ - ".*\\^done,bkpt=3D\{number=3D\"2\",type=3D\"breakpoint\",disp=3D\"keep= \",enabled=3D\"y\",addr=3D\"\",pending=3D\"${libfile1}.c:pendfunc2= \",cond=3D\"x=3D=3D4\",times=3D\"0\",original-location=3D\"${libfile1}.c:pe= ndfunc2\"\}"\ - "MI pending breakpoint on ${libfile1}.c:pendfunc2 if x=3D=3D4" +mi_create_breakpoint_pending "-f -c x=3D=3D4 ${libfile1}.c:pendfunc2" \ + "MI pending breakpoint on ${libfile1}.c:pendfunc2 if x=3D=3D4" \ + -number "2" \ + -type "breakpoint" \ + -disp "keep" \ + -enabled "y" \ + -pending "${libfile1}.c:pendfunc2" \ + -cond "x=3D=3D4" \ + -original-location "${libfile1}.c:pendfunc2" =20 # Set breakpoint so that we can stop when the thread is created -mi_gdb_test "-break-insert -f thread_func" \ - ".*\\^done,bkpt=3D\{number=3D\"3\",type=3D\"breakpoint\",disp=3D\"keep= \",enabled=3D\"y\",addr=3D\"${hex}\",func=3D\"thread_func\".*\}"\ - "MI pending breakpoint on thread_func" +mi_create_breakpoint "-f thread_func" \ + "MI breakpoint on thread_func" \ + -number "3" \ + -type "breakpoint" \ + -disp "keep" \ + -enabled "y" \ + -addr "$hex" \ + -func "thread_func" =20 mi_run_cmd =20 diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-suppor= t.exp index 6454205e124..ab251da339c 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1390,6 +1390,14 @@ proc mi_create_breakpoint_multi {location test args}= { return $bp } =20 +# Like mi_create_breakpoint, but creates a pending breakpoint. + +proc mi_create_breakpoint_pending {location test args} { + set bp [eval mi_make_breakpoint_pending $args] + mi_gdb_test "222-break-insert $location" ".*\r\n222\\^done,$bp" $test + return $bp +} + # Creates varobj named NAME for EXPRESSION. # Name cannot be "-". proc mi_create_varobj { name expression testname } { @@ -2637,10 +2645,12 @@ proc mi_make_breakpoint_multi {args} { # -break-info for pending breakpoints. # # Arguments for the breakpoint may be specified using the options: -# number, type, disp, enabled, pending, original-location, and thread. +# number, type, disp, enabled, pending, original-location, thread, and +# cond. # -# For the option -thread the corresponding output field is only -# included if the option is present and not the empty string. +# For the options -thread and -cond the corresponding output fields +# are only included if the options are present and not the empty +# string. # # Example: mi_make_breakpoint_pending -number 2 -pending func # will return the breakpoint: @@ -2649,7 +2659,7 @@ proc mi_make_breakpoint_multi {args} { =20 proc mi_make_breakpoint_pending {args} { parse_args {{number .*} {type .*} {disp .*} {enabled .*} - {pending .*} {original-location .*} {thread ""}} + {pending .*} {original-location .*} {thread ""} {cond ""}} =20 set attr_list {} foreach attr [list number type disp enabled] { @@ -2665,7 +2675,6 @@ proc mi_make_breakpoint_pending {args} { set ignore 0 set times 0 set script "" - set cond "" set evaluated-by "" =20 set result [mi_make_breakpoint_1 \