From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10404 invoked by alias); 4 Jan 2002 22:17:12 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10268 invoked from network); 4 Jan 2002 22:17:05 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 4 Jan 2002 22:17:05 -0000 Received: from porcupine.cygnus.com (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id OAA18807 for ; Fri, 4 Jan 2002 14:17:01 -0800 (PST) Received: from porcupine.cygnus.com (law@localhost) by porcupine.cygnus.com (8.11.6/8.11.6) with ESMTP id g04MExO01755 for ; Fri, 4 Jan 2002 15:14:59 -0700 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 To: gdb-patches@sources.redhat.com Reply-to: law@redhat.com From: law@redhat.com Subject: Test for GCC debug symbol bug Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 04 Jan 2002 14:17:00 -0000 Message-ID: <1754.1010182499@porcupine.cygnus.com> X-SW-Source: 2002-01/txt/msg00041.txt.bz2 This patch adds a test for a GCC bug in its line number output. Basically if we have a multi-line IF or WHILE conditional, GCC will emit incorrect line numbers for the IF/WHILE statement. The incorrect line numbers (of course) make debugging multi-line IF/WHILE statements a PITA. To help ensure the GCC team doesn't break this again, I'd like to add this relatively simple test to the GDB testsuite. * gdb.base/break.c (multi_line_if_conditional): New function. (multi_ilne_while_conditional): Likewise. * gdb.base/break.exp: Verify that a breakpoint on a multi-line IF or WHILE condition puts the breakpoint at the start of the condition. Index: break.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/break.c,v retrieving revision 1.7 diff -c -3 -p -r1.7 break.c *** break.c 1999/10/02 00:24:35 1.7 --- break.c 2002/01/04 21:56:33 *************** int value; *** 99,101 **** --- 99,131 ---- return (value); } + #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 + && b + && c) + return 0; + else + 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 + && b + && c) + { + a--, b--, c--; + } + return 0; + } Index: break.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/break.exp,v retrieving revision 1.62.80.1 diff -c -3 -p -r1.62.80.1 break.exp *** break.exp 2001/12/19 20:39:46 1.62.80.1 --- break.exp 2002/01/04 21:56:33 *************** gdb_test "break $srcfile:85" \ *** 122,127 **** --- 122,139 ---- # + # Test putting a break at the start of a multi-line if conditional. + # Verify the breakpoint was put at the start of the conditional. + # + gdb_test "break multi_line_if_conditional" \ + "Breakpoint.*at.* file .*$srcfile, line 109\\." \ + "breakpoint at start of multi line if conditional" + + gdb_test "break multi_line_while_conditional" \ + "Breakpoint.*at.* file .*$srcfile, line 124\\." \ + "breakpoint at start of multi line while conditional" + + # # check to see what breakpoints are set # if [target_info exists gdb_stub] { *************** gdb_test "info break" \ *** 141,147 **** \[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:96.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* ! \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:85" \ "breakpoint info" --- 153,161 ---- \[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:96.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* ! \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:85.* ! \[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:109.* ! \[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:124" \ "breakpoint info"