From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 29FE33944420 for ; Wed, 11 Mar 2020 23:45:47 +0000 (GMT) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DD093AED6; Wed, 11 Mar 2020 23:45:45 +0000 (UTC) Date: Thu, 12 Mar 2020 00:45:44 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH][gdb/testsuite] Avoid breakpoint in GLIBC in gdb.threads/execl.exp Message-ID: <20200311234542.GA340@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2020 23:45:48 -0000 Hi, When running the gdb.threads/execl.exp test-case, we run into this FAIL: ... (gdb) continue^M Continuing.^M ^M Thread 1 "execl" hit Breakpoint 2, __GI_execl (path=0x6024a0 \ "build/gdb/testsuite/outputs/gdb.threads/execl/execl1", \ arg=) at execl.c:51^M 51 if (execl (new_image, new_image, NULL) == -1) \ /* set breakpoint here */^M (gdb) FAIL: gdb.threads/execl.exp: continue across exec ... The fail is due to the continue command hitting a breakpoint in __GI_execl rather than main. This problem originates from where we execute the "b 51" command, and get two breakpoint locations: ... (gdb) run ^M Starting program: build/gdb/testsuite/outputs/gdb.threads/execl/execl ^M [Thread debugging using libthread_db enabled]^M Using host libthread_db library "/lib64/libthread_db.so.1".^M ^M Breakpoint 1, main (argc=1, argv=0x7fffffffd3f8) at gdb.threads/execl.c:44^M 44 pthread_create (&thread1, NULL, thread_function, NULL);^M (gdb) b 51^M Breakpoint 2 at 0x400787: gdb.threads/execl.c:51. (2 locations)^M (gdb) PASS: gdb.threads/execl.exp: set breakpoint at execl ... Adding a "info breakpoints" command, we can see the locations: ... (gdb) info breakpoints^M Num Type Disp Enb Address What^M 1 breakpoint keep y 0x00000000004006ee in main at \ gdb.threads/execl.c:44^M breakpoint already hit 1 time^M 2 breakpoint keep y ^M 2.1 y 0x0000000000400787 in main at \ gdb.threads/execl.c:51^M 2.2 y 0x00007ffff758d925 in __GI_execl at \ execl.c:51^M (gdb) PASS: gdb.threads/execl.exp: info breakpoints ... The fact that the __GI_execl breakpoint location is there, is a bug, filed as PR25656. Without debug info for GLIBC though, the bug is not triggered. Fix the FAIL by working around the bug, and deleting the breakpoint after hitting the first breakpoint location. Tested on x86_64-linux. OK for trunk? Thanks, - Tom [gdb/testsuite] Avoid breakpoint in GLIBC in gdb.threads/execl.exp gdb/testsuite/ChangeLog: 2020-03-12 Tom de Vries * gdb.threads/execl.exp: Delete breakpoint after hitting it. --- gdb/testsuite/gdb.threads/execl.exp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp index 5f28fed142..1649081f83 100644 --- a/gdb/testsuite/gdb.threads/execl.exp +++ b/gdb/testsuite/gdb.threads/execl.exp @@ -42,6 +42,13 @@ gdb_test "continue" ".*breakpoint here.*" "continue to exec" gdb_test "info threads" "1 *Thread.*2 *Thread.*3 *Thread.*" "info threads before exec" +# Work around PR25656, where the breakpoint above sets 2 breakpoint locations: +# - one on gdb.threads/execl.c:$linenumber, and +# - one in GLIBC's execl.c:$linenumber, in __GI_execl +# Delete the breakpoint to make sure we hit main upon continue, rather than +# __GI_execl. +gdb_test_no_output "delete 2" + # When continuing from this point we'll hit the breakpoint in main() # again, this time in the exec'd process. gdb_test "continue" ".*Breakpoint 1, main.*" \