From patchwork Wed Oct 29 16:00:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 3469 Received: (qmail 11656 invoked by alias); 29 Oct 2014 16:02:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 11645 invoked by uid 89); 29 Oct 2014 16:02:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp12.uk.ibm.com Received: from e06smtp12.uk.ibm.com (HELO e06smtp12.uk.ibm.com) (195.75.94.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 29 Oct 2014 16:02:08 +0000 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Oct 2014 16:02:05 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 29 Oct 2014 16:02:04 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id DCD8A17D8045 for ; Wed, 29 Oct 2014 16:02:06 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9TG23fb61014076 for ; Wed, 29 Oct 2014 16:02:03 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9TG233n002912 for ; Wed, 29 Oct 2014 10:02:03 -0600 Received: from br87z6lw.boeblingen.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s9TG0lWP032270 for ; Wed, 29 Oct 2014 10:02:03 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH 06/16] Eliminate literal line numbers in foll-exec.exp Date: Wed, 29 Oct 2014 17:00:21 +0100 Message-Id: <1414598446-13831-6-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1414597859-12523-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1414597859-12523-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14102916-0009-0000-0000-000001BCEA97 X-IsSubscribed: yes Remove literal line numbers from the regexps in foll-exec.exp. Add appropriate eye-catchers to foll-exec.c and execd-proc.c and refer to those instead. gdb/testsuite/ChangeLog: * gdb.base/execd-prog.c: Add eye-catchers. * gdb.base/foll-exec.c: Likewise. * gdb.base/foll-exec.exp: Refer to eye-catchers instead of literal line numbers. --- gdb/testsuite/gdb.base/execd-prog.c | 2 +- gdb/testsuite/gdb.base/foll-exec.c | 4 ++-- gdb/testsuite/gdb.base/foll-exec.exp | 37 +++++++++++++++++++----------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/gdb/testsuite/gdb.base/execd-prog.c b/gdb/testsuite/gdb.base/execd-prog.c index 5469f65..5435f7d 100644 --- a/gdb/testsuite/gdb.base/execd-prog.c +++ b/gdb/testsuite/gdb.base/execd-prog.c @@ -20,7 +20,7 @@ main (argc, argv) should not be able to see that other definition of local_j after we are exec'd. */ - int local_j = argc; + int local_j = argc; /* after-exec */ char * s; printf ("Hello from execd-prog...\n"); diff --git a/gdb/testsuite/gdb.base/foll-exec.c b/gdb/testsuite/gdb.base/foll-exec.c index 78c1cda..5b0d9c5 100644 --- a/gdb/testsuite/gdb.base/foll-exec.c +++ b/gdb/testsuite/gdb.base/foll-exec.c @@ -24,7 +24,7 @@ main () printf ("foll-exec is about to execl(execd-prog)...\n"); - execl (BASEDIR "/execd-prog", + execl (BASEDIR "/execd-prog", /* tbreak-execl */ BASEDIR "/execd-prog", "execl arg1 from foll-exec", "execl arg2 from foll-exec", @@ -38,6 +38,6 @@ main () printf ("foll-exec is about to execv(execd-prog)...\n"); - execv (BASEDIR "/execd-prog", argv); + execv (BASEDIR "/execd-prog", argv); /* tbreak-execv */ } } diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp index c1b1354..e1b0a59 100644 --- a/gdb/testsuite/gdb.base/foll-exec.exp +++ b/gdb/testsuite/gdb.base/foll-exec.exp @@ -119,7 +119,7 @@ proc do_exec_tests {} { # send_gdb "next 3\n" gdb_expect { - -re "20.*execlp.*$gdb_prompt $"\ + -re ".*execlp \\(.*$gdb_prompt $"\ {pass "step to exec call"} -re "$gdb_prompt $" {fail "step to exec call"} timeout {fail "(timeout) step to exec call"} @@ -149,9 +149,10 @@ proc do_exec_tests {} { # Try stepping through an execlp call, without catching it. # We should stop in execd-program, at its first statement. # + set execd_line [gdb_get_line_number "after-exec" $srcfile2] send_gdb "next\n" gdb_expect { - -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\ + -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\ {pass "step through execlp call"} -re "$gdb_prompt $" {fail "step through execlp call"} timeout {fail "(timeout) step through execlp call"} @@ -162,7 +163,7 @@ proc do_exec_tests {} { # send_gdb "next\n" gdb_expect { - -re "26.*printf.*$gdb_prompt $"\ + -re "printf \\(.Hello .*$gdb_prompt $"\ {pass "step after execlp call"} -re "$gdb_prompt $" {fail "step after execlp call"} timeout {fail "(timeout) step after execlp call"} @@ -256,7 +257,7 @@ proc do_exec_tests {} { # send_gdb "continue\n" gdb_expect { - -re ".*${srcfile2}:23.*$gdb_prompt $"\ + -re ".*${srcfile2}:${execd_line}.*$gdb_prompt $"\ {pass "continue after hit catch exec"} -re "$gdb_prompt $" {fail "continue after hit catch exec"} timeout {fail "(timeout) continue after hit catch exec"} @@ -276,16 +277,17 @@ proc do_exec_tests {} { # Verify that we can follow through follow an execl() # call. (We must jump around earlier exec* calls.) # - send_gdb "tbreak 27\n" + set tbreak_line [gdb_get_line_number "tbreak-execl" $srcfile] + send_gdb "tbreak ${tbreak_line}\n" gdb_expect { - -re "Temporary breakpoint .*file .*${srcfile}, line 27.*$gdb_prompt $"\ + -re "Temporary breakpoint .*file .*${srcfile}, line ${tbreak_line}.*$gdb_prompt $"\ {pass "prepare to jump to execl call"} -re "$gdb_prompt $" {fail "prepare to jump to execl call"} timeout {fail "(timeout) prepare to jump to execl call"} } - send_gdb "jump 27\n" + send_gdb "jump ${tbreak_line}\n" gdb_expect { - -re "main.* at .*${srcfile}:27.*$gdb_prompt $"\ + -re "main.* at .*${srcfile}:${tbreak_line}.*$gdb_prompt $"\ {pass "jump to execl call"} -re "$gdb_prompt $" {fail "jump to execl call"} timeout {fail "(timeout) jump to execl call"} @@ -298,14 +300,14 @@ proc do_exec_tests {} { # send_gdb "next 2\n" gdb_expect { - -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\ + -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\ {pass "step through execl call"} -re "$gdb_prompt $" {fail "step through execl call"} timeout {fail "(timeout) step through execl call"} } send_gdb "next\n" gdb_expect { - -re "26.*printf.*$gdb_prompt $"\ + -re "printf \\(.Hello .*$gdb_prompt $"\ {pass "step after execl call"} -re "$gdb_prompt $" {fail "step after execl call"} timeout {fail "(timeout) step after execl call"} @@ -336,30 +338,31 @@ proc do_exec_tests {} { # Verify that we can follow through follow an execv() # call. (We must jump around earlier exec* calls.) # - send_gdb "tbreak 41\n" + set tbreak_line [gdb_get_line_number "tbreak-execv"] + send_gdb "tbreak ${tbreak_line}\n" gdb_expect { - -re "Temporary breakpoint .*file .*${srcfile}, line 41.*$gdb_prompt $"\ + -re "Temporary breakpoint .*file .*${srcfile}, line ${tbreak_line}.*$gdb_prompt $"\ {pass "prepare to jump to execv call"} -re "$gdb_prompt $" {fail "prepare to jump to execv call"} timeout {fail "(timeout) prepare to jump to execv call"} } - send_gdb "jump 41\n" + send_gdb "jump ${tbreak_line}\n" gdb_expect { - -re "main.* at .*${srcfile}:41.*$gdb_prompt $"\ + -re "main.* at .*${srcfile}:${tbreak_line}.*$gdb_prompt $"\ {pass "jump to execv call"} -re "$gdb_prompt $" {fail "jump to execv call"} timeout {fail "(timeout) jump to execv call"} } send_gdb "next\n" gdb_expect { - -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\ + -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\ {pass "step through execv call"} -re "$gdb_prompt $" {fail "step through execv call"} timeout {fail "(timeout) step through execv call"} } send_gdb "next\n" gdb_expect { - -re "26.*printf.*$gdb_prompt $"\ + -re "printf \\(.Hello .*$gdb_prompt $"\ {pass "step after execv call"} -re "$gdb_prompt $" {fail "step after execv call"} timeout {fail "(timeout) step after execv call"} @@ -393,7 +396,7 @@ proc do_exec_tests {} { # send_gdb "continue\n" gdb_expect { - -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:23.*int local_j = argc;.*$gdb_prompt $"\ + -re ".*xecuting new program: .*${testfile2}.*${srcfile2}:${execd_line}.*int local_j = argc;.*$gdb_prompt $"\ {pass "continue through exec"} -re "$gdb_prompt $" {fail "continue through exec"} timeout {fail "(timeout) continue through exec"}