From patchwork Wed Oct 29 16:00:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 3475 Received: (qmail 17618 invoked by alias); 29 Oct 2014 16:03:46 -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 17607 invoked by uid 89); 29 Oct 2014 16:03:46 -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:03:40 +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:03:37 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) 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:03:35 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 237822190056 for ; Wed, 29 Oct 2014 16:03:10 +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 s9TG3YBe59900038 for ; Wed, 29 Oct 2014 16:03:34 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 s9TG3Yd7006073 for ; Wed, 29 Oct 2014 10:03:34 -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 s9TG0lWV032270 for ; Wed, 29 Oct 2014 10:03:34 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH 12/16] Drop non-prototype C function header variants: 'break' test case Date: Wed, 29 Oct 2014 17:00:27 +0100 Message-Id: <1414598446-13831-12-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-000001BCEC68 X-IsSubscribed: yes Remove old-style function headers from break.c and break1.c. Adjust break.exp accordingly; in particular eliminate references to the removed locations "breakpoint 9, 13, and 16" from break.exp. gdb/testsuite/ChangeLog: * gdb.base/break.c: Remove #ifdef PROTOTYPES, keep prototyped variant. * gdb.base/break1.c: Likewise. * gdb.base/break.exp: Drop references to removed code. --- gdb/testsuite/gdb.base/break.c | 29 ----------------------------- gdb/testsuite/gdb.base/break.exp | 29 ++++++++++------------------- gdb/testsuite/gdb.base/break1.c | 7 ------- 3 files changed, 10 insertions(+), 55 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.c b/gdb/testsuite/gdb.base/break.c index 0fd8f44..b22e430 100644 --- a/gdb/testsuite/gdb.base/break.c +++ b/gdb/testsuite/gdb.base/break.c @@ -18,17 +18,10 @@ #include #include -#ifdef PROTOTYPES extern int marker1 (void); extern int marker2 (int a); extern void marker3 (char *a, char *b); extern void marker4 (long d); -#else -extern int marker1 (); -extern int marker2 (); -extern void marker3 (); -extern void marker4 (); -#endif /* We're used by a test that requires malloc, so make sure it is in the executable. */ @@ -42,17 +35,10 @@ void *need_malloc () * testing stack backtraces and such. */ -#ifdef PROTOTYPES int factorial(int); int main (int argc, char **argv, char **envp) -#else -int -main (argc, argv, envp) -int argc; -char *argv[], **envp; -#endif { if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ fprintf (stderr, "usage: factorial \n"); @@ -72,12 +58,7 @@ char *argv[], **envp; return argc; /* set breakpoint 10 here */ } /* set breakpoint 10a here */ -#ifdef PROTOTYPES int factorial (int value) -#else -int factorial (value) -int value; -#endif { if (value > 1) { /* set breakpoint 7 here */ value *= factorial (value - 1); @@ -85,12 +66,7 @@ int value; return (value); /* set breakpoint 19 here */ } -#ifdef PROTOTYPES int multi_line_if_conditional (int a, int b, int c) -#else -int multi_line_if_conditional (a, b, c) - int a, b, c; -#endif { if (a /* set breakpoint 3 here */ && b @@ -100,12 +76,7 @@ int multi_line_if_conditional (a, b, c) return 1; } -#ifdef PROTOTYPES int multi_line_while_conditional (int a, int b, int c) -#else -int multi_line_while_conditional (a, b, c) - int a, b, c; -#endif { while (a /* set breakpoint 4 here */ && b diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index af4dbda..055c379 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -77,7 +77,7 @@ set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] # board. So, to be sure, we do a list command. # gdb_test "list main" \ - ".*main \\(argc, argv, envp\\).*" \ + ".*main \\(int argc, char \\*\\*argv, char \\*\\*envp\\).*" \ "use `list' to establish default source file" gdb_test "break $bp_location1" \ "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \ @@ -126,12 +126,11 @@ if {$hp_aCC_compiler} { set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] -set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:$bp_location8.* \[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* @@ -363,7 +362,7 @@ gdb_test "" \ "run until function breakpoint" # Test the 'list' commands sets current file for the 'break LINENO' command. -set bp_marker1 [gdb_get_line_number "set breakpoint 16 here" ${srcfile1}] +set bp_marker1 [gdb_get_line_number "set breakpoint 15 here" ${srcfile1}] gdb_test "list marker1" ".*" gdb_test "break $bp_marker1" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*${srcfile1}, line ${bp_marker1}\\." \ "break lineno" @@ -386,7 +385,7 @@ for {set i 6} {$i >= 1} {incr i -1} { # # Run until the breakpoint set at a quoted function # -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:$bp_location8.*" \ "run until quoted breakpoint" # # run until the file:function breakpoint at a line number in a file @@ -644,7 +643,7 @@ gdb_test "break \$foo" \ # Verify that we can set and trigger a breakpoint in a user-called function. # gdb_test "break marker2" \ - "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*" \ + "Breakpoint (\[0-9\]*) at .*, line $bp_location8.*" \ "set breakpoint on to-be-called function" gdb_test "print marker2(99)" \ @@ -658,10 +657,10 @@ gdb_test "print marker2(99)" \ # for hppa*-*-hpux. # gdb_test_multiple "bt" "backtrace while in called function" { - -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $" { + -re "#0\[ \t\]*($hex in )?marker2.*:$bp_location8\r\n#1.*_sr4export.*$gdb_prompt $" { pass "backtrace while in called function" } - -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $" { + -re "#0\[ \t\]*($hex in )?marker2.*:$bp_location8\r\n#1.*function called from gdb.*$gdb_prompt $" { pass "backtrace while in called function" } } @@ -671,13 +670,13 @@ gdb_test_multiple "bt" "backtrace while in called function" { # breakpoint inserted by GDB at the program's entry point. # gdb_test_multiple "finish" "finish from called function" { - -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $" { + -re "Run till exit from .*marker2.* at .*$bp_location8\r\n.* in _sr4export.*$gdb_prompt $" { pass "finish from called function" } - -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $" { + -re "Run till exit from .*marker2.* at .*$bp_location8\r\n.*function called from gdb.*$gdb_prompt $" { pass "finish from called function" } - -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $" { + -re "Run till exit from .*marker2.* at .*$bp_location8\r\n.*Value returned.*$gdb_prompt $" { pass "finish from called function" } } @@ -880,19 +879,11 @@ gdb_test_multiple "" $test { # has no exactly matching line symbol, and GDB reports the breakpoint # as if it were in the middle of a line rather than at the beginning. -set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] gdb_test_multiple "continue" \ "run until breakpoint set at small function, optimized file" { - -re "Breakpoint $decimal, marker4 \\(d=(d@entry=)?177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { - pass "run until breakpoint set at small function, optimized file" - } - -re "Breakpoint $decimal, $hex in marker4 \\(d=(d@entry=)?177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { - pass "run until breakpoint set at small function, optimized file" - } -re "Breakpoint $decimal, marker4 \\(d=(d@entry=)?177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { - # marker4() is defined at line 46 when compiled with -DPROTOTYPES pass "run until breakpoint set at small function, optimized file (line bp_location14)" } -re "Breakpoint $decimal, factorial \\(.*\\) .*\{\r\n$gdb_prompt" { diff --git a/gdb/testsuite/gdb.base/break1.c b/gdb/testsuite/gdb.base/break1.c index e536b72..d8060f3 100644 --- a/gdb/testsuite/gdb.base/break1.c +++ b/gdb/testsuite/gdb.base/break1.c @@ -53,14 +53,7 @@ int some_variable; These functions are in a separate source file to prevent an optimizing compiler from inlining them and optimizing them away. */ -#ifdef PROTOTYPES int marker1 (void) { return (0); } /* set breakpoint 15 here */ int marker2 (int a) { return (1); } /* set breakpoint 8 here */ void marker3 (char *a, char *b) {} /* set breakpoint 17 here */ void marker4 (long d) { values[0].a_field = d; } /* set breakpoint 14 here */ -#else -int marker1 () { return (0); } /* set breakpoint 16 here */ -int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */ -void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ -void marker4 (d) long d; { values[0].a_field = d; } /* set breakpoint 13 here */ -#endif