From: law@redhat.com
To: gdb-patches@sources.redhat.com
Subject: Test for GCC debug symbol bug
Date: Fri, 04 Jan 2002 14:17:00 -0000 [thread overview]
Message-ID: <1754.1010182499@porcupine.cygnus.com> (raw)
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"
next reply other threads:[~2002-01-04 22:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-04 14:17 law [this message]
2002-01-04 17:55 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1754.1010182499@porcupine.cygnus.com \
--to=law@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox