From a1dea79abed02b14c9984aecc843f1295366e54c Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Tue, 9 Dec 2003 18:19:20 +0000 Subject: [PATCH] Committed after testing and independent approval/endorsement. 2003-12-09 Fred Fish * gdb.base/break.c (marker1, marker2, marker3, marker4): Move functions to break1.c and leave prototypes behind. Add more "set breakpoint NN here" comments. * gdb.base/break1.c: New file. * gdb.base/break.exp: Handle compiling test case from multiple source files and change source file references as needed. * gdb.base/completion.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/define.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/info-proc.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/until.exp: Ditto. * gdb.base/condbreak.exp: Use bp_locationNN variables instead of hardcoded line numbers. * gdb.base/define.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/until.exp: Ditto. * gdb.base/completion.exp: Use "break1" for completion tests since "break" is no longer a unique prefix. --- gdb/testsuite/ChangeLog | 27 +++++++++ gdb/testsuite/gdb.base/break.c | 51 ++++++++++------ gdb/testsuite/gdb.base/break.exp | 83 ++++++++++++++++----------- gdb/testsuite/gdb.base/break1.c | 44 ++++++++++++++ gdb/testsuite/gdb.base/completion.exp | 68 ++++++++++++---------- gdb/testsuite/gdb.base/condbreak.exp | 57 +++++++++++------- gdb/testsuite/gdb.base/define.exp | 24 ++++++-- gdb/testsuite/gdb.base/ena-dis-br.exp | 51 ++++++++++------ gdb/testsuite/gdb.base/info-proc.exp | 20 +++++-- gdb/testsuite/gdb.base/maint.exp | 23 ++++++-- gdb/testsuite/gdb.base/until.exp | 31 +++++++--- 11 files changed, 336 insertions(+), 143 deletions(-) create mode 100644 gdb/testsuite/gdb.base/break1.c diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 90d2ff1411..5abdef40a0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,30 @@ +2003-12-09 Fred Fish + + * gdb.base/break.c (marker1, marker2, marker3, marker4): Move + functions to break1.c and leave prototypes behind. Add more + "set breakpoint NN here" comments. + * gdb.base/break1.c: New file. + + * gdb.base/break.exp: Handle compiling test case from multiple + source files and change source file references as needed. + * gdb.base/completion.exp: Ditto. + * gdb.base/condbreak.exp: Ditto. + * gdb.base/define.exp: Ditto. + * gdb.base/ena-dis-br.exp: Ditto. + * gdb.base/info-proc.exp: Ditto. + * gdb.base/maint.exp: Ditto. + * gdb.base/until.exp: Ditto. + + * gdb.base/condbreak.exp: Use bp_locationNN variables instead of + hardcoded line numbers. + * gdb.base/define.exp: Ditto. + * gdb.base/ena-dis-br.exp: Ditto. + * gdb.base/maint.exp: Ditto. + * gdb.base/until.exp: Ditto. + + * gdb.base/completion.exp: Use "break1" for completion tests since + "break" is no longer a unique prefix. + 2003-12-06 Andrew Cagney * gdb.base/structs.exp (test_struct_returns): When applicable, set diff --git a/gdb/testsuite/gdb.base/break.c b/gdb/testsuite/gdb.base/break.c index 36b840e7a3..bf398fcca9 100644 --- a/gdb/testsuite/gdb.base/break.c +++ b/gdb/testsuite/gdb.base/break.c @@ -1,3 +1,25 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software + Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + #ifdef vxworks # include @@ -32,23 +54,16 @@ char *arg; # include #endif /* ! vxworks */ -/* - * The following functions do nothing useful. They are included simply - * as places to try setting breakpoints at. They are explicitly - * "one-line functions" to verify that this case works (some versions - * of gcc have or have had problems with this). - */ - #ifdef PROTOTYPES -int marker1 (void) { return (0); } -int marker2 (int a) { return (1); } /* set breakpoint 8 here */ -void marker3 (char *a, char *b) {} -void marker4 (long d) {} /* set breakpoint 14 here */ +extern int marker1 (void); +extern int marker2 (int a); +extern void marker3 (char *a, char *b); +extern void marker4 (long d); #else -int marker1 () { return (0); } -int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */ -void marker3 (a, b) char *a, *b; {} -void marker4 (d) long d; {} /* set breakpoint 13 here */ +extern int marker1 (); +extern int marker2 (); +extern void marker3 (); +extern void marker4 (); #endif /* @@ -79,8 +94,8 @@ char *argv[], **envp; printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */ /* set breakpoint 12 here */ marker1 (); /* set breakpoint 11 here */ - marker2 (43); - marker3 ("stack", "trace"); + marker2 (43); /* set breakpoint 20 here */ + marker3 ("stack", "trace"); /* set breakpoint 21 here */ marker4 (177601976L); argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */ return argc; /* set breakpoint 10 here */ @@ -96,7 +111,7 @@ int value; if (value > 1) { /* set breakpoint 7 here */ value *= factorial (value - 1); } - return (value); + return (value); /* set breakpoint 19 here */ } #ifdef PROTOTYPES diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index aa2e1ddd32..c425d1439c 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -34,10 +34,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } if [get_compiler_info ${binfile}] { @@ -87,7 +96,7 @@ gdb_test "break main" \ # test break at quoted function # gdb_test "break \"marker2\"" \ - "Breakpoint.*at.* file .*$srcfile, line.*" \ + "Breakpoint.*at.* file .*$srcfile1, line.*" \ "breakpoint quoted function" # @@ -165,13 +174,13 @@ 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"] -set bp_location9 [gdb_get_line_number "set breakpoint 9 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 .*$srcfile:($bp_location8|$bp_location9).* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).* \[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.* @@ -232,7 +241,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 .*$srcfile:($bp_location8|$bp_location9).*" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \ "run until quoted breakpoint" # # run until the file:function breakpoint at a line number in a file @@ -393,7 +402,7 @@ gdb_expect { # Run to the desired default location. If not positioned here, the # tests below don't work. # -gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until $bp_location1" +gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1" # Verify that GDB allows one to just say "break", which is treated @@ -445,10 +454,10 @@ if ![runto_main] then { fail "break tests suppressed" } send_gdb "break $bp_location1\n" gdb_expect { -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\ - {pass "set to-be-silent break $bp_location1"} + {pass "set to-be-silent break bp_location1"} -re "$gdb_prompt $"\ - {fail "set to-be-silent break $bp_location1"} - timeout {fail "(timeout) set to-be-silent break $bp_location1"} + {fail "set to-be-silent break bp_location1"} + timeout {fail "(timeout) set to-be-silent break bp_location1"} } send_gdb "commands $expect_out(1,string)\n" @@ -456,33 +465,33 @@ send_gdb "silent\n" send_gdb "end\n" gdb_expect { -re ".*$gdb_prompt $"\ - {pass "set silent break $bp_location1"} - timeout {fail "(timeout) set silent break $bp_location1"} + {pass "set silent break bp_location1"} + timeout {fail "(timeout) set silent break bp_location1"} } send_gdb "info break $expect_out(1,string)\n" gdb_expect { -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\ - {pass "info silent break $bp_location1"} + {pass "info silent break bp_location1"} -re "$gdb_prompt $"\ - {fail "info silent break $bp_location1"} - timeout {fail "(timeout) info silent break $bp_location1"} + {fail "info silent break bp_location1"} + timeout {fail "(timeout) info silent break bp_location1"} } send_gdb "continue\n" gdb_expect { -re "Continuing.\r\n$gdb_prompt $"\ - {pass "hit silent break $bp_location1"} + {pass "hit silent break bp_location1"} -re "$gdb_prompt $"\ - {fail "hit silent break $bp_location1"} - timeout {fail "(timeout) hit silent break $bp_location1"} + {fail "hit silent break bp_location1"} + timeout {fail "(timeout) hit silent break bp_location1"} } send_gdb "bt\n" gdb_expect { -re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\ - {pass "stopped for silent break $bp_location1"} + {pass "stopped for silent break bp_location1"} -re "$gdb_prompt $"\ - {fail "stopped for silent break $bp_location1"} - timeout {fail "(timeout) stopped for silent break $bp_location1"} + {fail "stopped for silent break bp_location1"} + timeout {fail "(timeout) stopped for silent break bp_location1"} } # Verify that GDB can at least parse a breakpoint with the @@ -561,8 +570,8 @@ gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} send_gdb "set \$foo=$bp_location11\n" gdb_expect { -re "$gdb_prompt $"\ - {pass "set convenience variable \$foo to $bp_location11"} - timeout {fail "(timeout) set convenience variable \$foo to $bp_location11"} + {pass "set convenience variable \$foo to bp_location11"} + timeout {fail "(timeout) set convenience variable \$foo to bp_location11"} } send_gdb "break \$foo\n" gdb_expect { @@ -849,8 +858,16 @@ test_next_with_recursion set binfileo2 ${objdir}/${subdir}/${testfile}o2 -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfileo2}" executable {debug additional_flags="-O2" }] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}O0.o" object {debug "additional_flags=-w -O2"}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug "additional_flags=-w -O2"}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } if [get_compiler_info ${binfileo2}] { @@ -877,7 +894,7 @@ gdb_test "break main" \ # test break at function # gdb_test "break marker4" \ - "Breakpoint.*at.* file .*$srcfile, line.*" \ + "Breakpoint.*at.* file .*$srcfile1, line.*" \ "breakpoint small function, optimized file" # @@ -922,19 +939,19 @@ if ![target_info exists use_gdb_stub] { # 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"] -set bp_location14 [gdb_get_line_number "set breakpoint 14 here"] +set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] +set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] send_gdb "continue\n" gdb_expect { - -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { + -re "Breakpoint $decimal, marker4 \\(d=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=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { + -re "Breakpoint $decimal, $hex in marker4 \\(d=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=177601976\\) at .*$srcfile:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { + -re "Breakpoint $decimal, marker4 \\(d=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)" + pass "run until breakpoint set at small function, optimized file (line bp_location14)" } -re ".*$gdb_prompt " { fail "run until breakpoint set at small function, optimized file" diff --git a/gdb/testsuite/gdb.base/break1.c b/gdb/testsuite/gdb.base/break1.c new file mode 100644 index 0000000000..2ed8b2a4a0 --- /dev/null +++ b/gdb/testsuite/gdb.base/break1.c @@ -0,0 +1,44 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software + Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + +/* The code for this file was extracted from the gdb testsuite + testcase "break.c". */ + +/* The following functions do nothing useful. They are included + simply as places to try setting breakpoints at. They are + explicitly "one-line functions" to verify that this case works + (some versions of gcc have or have had problems with this). + + 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) {} /* 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; {} /* set breakpoint 13 here */ +#endif diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index a1ff58a255..9f5435dff8 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -38,8 +38,8 @@ # "info ajksdlfk " no completions # "info" " " # "info " ambiguous (all info commands) -# "p \"break" unambiguous (completes to filename "break.c") -# "p \"break." unambiguous (should complete to "break.c" but does not, +# "p \"break1" unambiguous (completes to filename "break1.c") +# "p \"break1." unambiguous (should complete to "break1.c" but does not, # due to readline limitations) # "p 'a" ambiguous (all symbols starting with a) # "p b-a" ambiguous (all symbols starting with a) @@ -64,9 +64,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } if [get_compiler_info ${binfile}] { @@ -351,61 +361,61 @@ gdb_expect { } -send_gdb "p \"break\t" +send_gdb "p \"break1\t" sleep 1 gdb_expect { - -re "^p \"break\\\x07$"\ + -re "^p \"break1\\\x07$"\ { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { fail "complete 'p \"break'"} - timeout {fail "(timeout) complete 'p \"break'"} + -re ".*$gdb_prompt $" { fail "complete 'p \"break1'"} + timeout {fail "(timeout) complete 'p \"break1'"} } } - -re "^p \"break\\.c\"$"\ + -re "^p \"break1\\.c\"$"\ { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { pass "complete 'p \"break'"} - timeout {fail "(timeout) complete 'p \"break'"} + -re ".*$gdb_prompt $" { pass "complete 'p \"break1'"} + timeout {fail "(timeout) complete 'p \"break1'"} } } - -re "^p \"break.*$" + -re "^p \"break1.*$" { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { fail "complete 'p \"break'"} - timeout {fail "(timeout) complete 'p \"break'"} + -re ".*$gdb_prompt $" { fail "complete 'p \"break1'"} + timeout {fail "(timeout) complete 'p \"break1'"} } } - -re ".*$gdb_prompt $" { fail "complete 'p \"break'" } - timeout { fail "(timeout) complete 'p \"break'" } + -re ".*$gdb_prompt $" { fail "complete 'p \"break1'" } + timeout { fail "(timeout) complete 'p \"break1'" } } setup_xfail "*-*-*" -send_gdb "p \"break.\t" +send_gdb "p \"break1.\t" sleep 1 gdb_expect { - -re "^p \"break\\.\\\x07$"\ + -re "^p \"break1\\.\\\x07$"\ { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { fail "complete 'p \"break.'"} - timeout {fail "(timeout) complete 'p \"break.'"} + -re ".*$gdb_prompt $" { fail "complete 'p \"break1.'"} + timeout {fail "(timeout) complete 'p \"break1.'"} } } - -re "^p \"break\\.c\"$"\ + -re "^p \"break1\\.c\"$"\ { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { pass "complete 'p \"break.'"} - timeout {fail "(timeout) complete 'p \"break.'"} + -re ".*$gdb_prompt $" { pass "complete 'p \"break1.'"} + timeout {fail "(timeout) complete 'p \"break1.'"} } } - -re "^p \"break\\..*$" + -re "^p \"break1\\..*$" { send_gdb "\n" gdb_expect { - -re ".*$gdb_prompt $" { fail "complete 'p \"break.'"} - timeout {fail "(timeout) complete 'p \"break.'"} + -re ".*$gdb_prompt $" { fail "complete 'p \"break1.'"} + timeout {fail "(timeout) complete 'p \"break1.'"} } } - -re ".*$gdb_prompt $" { fail "complete 'p \"break.'" } - timeout { fail "(timeout) complete 'p \"break.'" } + -re ".*$gdb_prompt $" { fail "complete 'p \"break1.'" } + timeout { fail "(timeout) complete 'p \"break1.'" } } send_gdb "p 'a\t" @@ -682,7 +692,7 @@ gdb_expect { -re "marker1.*$gdb_prompt info func marker$"\ { send_gdb "\n" gdb_expect { - -re "All functions matching regular expression \"marker\":.*File.*break.c:\r\nint marker1\\((void|)\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\ + -re "All functions matching regular expression \"marker\":.*File.*break1.c:\r\nint marker1\\((void|)\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long int\\);.*$gdb_prompt $"\ { pass "complete 'info func marke'"} -re ".*$gdb_prompt $" { fail "complete 'info func marke'"} timeout {fail "(timeout) complete 'info func marke'"} diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp index c234431f15..dc4df21fc0 100644 --- a/gdb/testsuite/gdb.base/condbreak.exp +++ b/gdb/testsuite/gdb.base/condbreak.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -35,10 +35,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } if [get_compiler_info ${binfile}] { @@ -55,6 +64,13 @@ if [target_info exists gdb_stub] { gdb_step_for_stub; } +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location6 [gdb_get_line_number "set breakpoint 6 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] +set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1] +set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1] + # # test break at function # @@ -66,15 +82,15 @@ gdb_test "break main" \ # test conditional break at function # gdb_test "break marker1 if 1==1" \ - "Breakpoint.*at.* file .*$srcfile, line.*" + "Breakpoint.*at.* file .*$srcfile1, line.*" gdb_test "delete 2" "" # # test conditional break at line number # -gdb_test "break 79 if 1==1" \ - "Breakpoint.*at.* file .*$srcfile, line 79\\." +gdb_test "break $srcfile:$bp_location1 if 1==1" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." gdb_test "delete 3" "" @@ -82,16 +98,16 @@ gdb_test "delete 3" "" # test conditional break at function # gdb_test "break marker1 if (1==1)" \ - "Breakpoint.*at.* file .*$srcfile, line.*" + "Breakpoint.*at.* file .*$srcfile1, line.*" # # test conditional break at line number # -gdb_test "break 79 if (1==1)" \ - "Breakpoint.*at.* file .*$srcfile, line 79\\." +gdb_test "break $srcfile:$bp_location1 if (1==1)" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." gdb_test "break marker2 if (a==43)" \ - "Breakpoint.*at.* file .*$srcfile, line.*" + "Breakpoint.*at.* file .*$srcfile1, line.*" # # check to see what breakpoints are set @@ -105,15 +121,14 @@ if {$hp_aCC_compiler} { set marker2_proto "" } -set main_line 75 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 marker1$marker1_proto at .*$srcfile:4\[38\].* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location6.* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile1:($bp_location15|$bp_location16).* \[\t \]+stop only if 1 == 1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* \[\t \]+stop only if 1 == 1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile:4\[49\].* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).* \[\t \]+stop only if a == 43.*" \ "breakpoint info" @@ -128,7 +143,7 @@ rerun_to_main # # run until the breakpoint at a line number # -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \ +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \ "run until breakpoint set at a line number" # @@ -173,10 +188,10 @@ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=. # Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior. send_gdb "continue\n" gdb_expect { - -re "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*$gdb_prompt $" { + -re "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" { pass "run until breakpoint at marker1" } - -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*$gdb_prompt $" { + -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" { xfail "run until breakpoint at marker1" } -re "$gdb_prompt $" { @@ -192,10 +207,10 @@ gdb_expect { setup_xfail hppa2.0w-*-* 11512CLLbs send_gdb "continue\n" gdb_expect { - -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" { + -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" { pass "run until breakpoint at marker2" } - -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" { + -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" { xfail "run until breakpoint at marker2" } -re "$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp index 06ea1c0f4f..7e948f18e0 100644 --- a/gdb/testsuite/gdb.base/define.exp +++ b/gdb/testsuite/gdb.base/define.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2001 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2001, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -34,10 +34,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } gdb_exit @@ -45,6 +54,9 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] + if ![runto_main] then { fail "define tests suppressed" } # Verify that GDB allows a user to define their very own commands. @@ -68,7 +80,7 @@ gdb_expect { # send_gdb "nextwhere\n" gdb_expect { - -re ".*79\[ \t\]*printf.*#0\[ \t\]*main.*:79.*$gdb_prompt $"\ + -re ".*$bp_location1\[ \t\]*printf.*#0\[ \t\]*main.*:$bp_location1.*$gdb_prompt $"\ {pass "use user command: nextwhere"} -re "$gdb_prompt $"\ {fail "use user command: nextwhere"} @@ -224,7 +236,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { - -re "#0\[ \t\]*main.*:81.*$gdb_prompt $"\ + -re "#0\[ \t\]*main.*:$bp_location11.*$gdb_prompt $"\ {pass "use hook-stop command"} -re "$gdb_prompt $"\ {fail "use hook-stop command"} diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index 93f6707097..b0e3c1de62 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -1,5 +1,4 @@ -# Copyright 1997, 1998, 1999 Free Software Foundation, Inc. - +# Copyright 1997, 1998, 1999, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -32,9 +31,18 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -43,6 +51,17 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +set bp_location1 [gdb_get_line_number "set breakpoint 1 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] +set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] +set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] +set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] +set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1] +set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1] +set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1] +set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1] + if ![runto_main] then { fail "enable/disable break tests suppressed" } # Verify that we can set a breakpoint (the location is irrelevant), @@ -50,7 +69,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } # send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -98,7 +117,7 @@ gdb_expect { # send_gdb "break marker2\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[49\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ {pass "break marker2"} -re "$gdb_prompt $"\ {fail "break marker2"} @@ -156,7 +175,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker3\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line (45|50).*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location17|$bp_location18).*$gdb_prompt $"\ {pass "break marker3"} -re "$gdb_prompt $"\ {fail "break marker3"} @@ -181,7 +200,7 @@ gdb_expect { send_gdb "continue\n" gdb_expect { - -re ".*marker3 .*:(45|50).*$gdb_prompt $"\ + -re ".*marker3 .*:($bp_location17|$bp_location18).*$gdb_prompt $"\ {pass "continue to auto-deleted break marker3"} -re "Breakpoint \[0-9\]*, marker3.*$gdb_prompt $"\ {fail "continue to auto-deleted break marker3"} @@ -206,7 +225,7 @@ gdb_expect { # send_gdb "break marker4\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line (46|51).*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location14|$bp_location13).*$gdb_prompt $"\ {pass "break marker4"} -re "$gdb_prompt $"\ {fail "break marker4"} @@ -237,7 +256,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -328,7 +347,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -365,7 +384,7 @@ rerun_to_main send_gdb "continue\n" gdb_expect { - -re ".*marker1 .*:4\[38\].*$gdb_prompt $"\ + -re ".*marker1 .*:($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "continue to ignored & auto-deleted break marker1"} -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $"\ {fail "continue to ignored & auto-deleted break marker1"} @@ -381,7 +400,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -423,9 +442,9 @@ gdb_expect { # if ![runto_main] then { fail "enable/disable break tests suppressed" } -send_gdb "break 79\n" +send_gdb "break $bp_location1\n" gdb_expect { - -re "Breakpoint \[0-9\]*.*, line 79.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*.*, line $bp_location1.*$gdb_prompt $"\ {pass "prepare to continue with ignore count"} -re "$gdb_prompt $"\ {fail "prepare to continue with ignore count"} @@ -442,7 +461,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { - -re ".*81\[ \t\]*marker1.*$gdb_prompt $"\ + -re ".*$bp_location11\[ \t\]*marker1.*$gdb_prompt $"\ {pass "step after continue with ignore count"} -re "$gdb_prompt $"\ {fail "step after continue with ignore count"} diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp index 2a9a4b09a3..d0da68f73f 100644 --- a/gdb/testsuite/gdb.base/info-proc.exp +++ b/gdb/testsuite/gdb.base/info-proc.exp @@ -1,4 +1,4 @@ -# Copyright 2002 Free Software Foundation, Inc. +# Copyright 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,12 +27,22 @@ if $tracelevel then { set prms_id 0 set bug_id 0 -set testfile "break" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} set ws "\[ \t\]+" -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +set testfile "break" +set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 212d1064b1..48641642e1 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,10 +65,19 @@ set bug_id 0 set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" - } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -412,11 +421,13 @@ gdb_expect { timeout { fail "(timeout) maint info sections DATA" } } +set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] + send_gdb "maint info breakpoints\n" gdb_expect { - -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ + -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ { pass "maint info breakpoints" } - -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\ + -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\ { pass "maint info breakpoints (with shlib events)" } -re ".*$gdb_prompt $" { fail "maint info breakpoints" } timeout { fail "(timeout) maint info breakpoints" } diff --git a/gdb/testsuite/gdb.base/until.exp b/gdb/testsuite/gdb.base/until.exp index f646c6d36a..033005db0f 100644 --- a/gdb/testsuite/gdb.base/until.exp +++ b/gdb/testsuite/gdb.base/until.exp @@ -23,13 +23,21 @@ if $tracelevel then { strace $tracelevel } -set testfile break +set testfile "break" set srcfile ${testfile}.c +set srcfile1 ${testfile}1.c set binfile ${objdir}/${subdir}/${testfile} -remote_exec build "rm -f ${binfile}" -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } gdb_exit @@ -37,6 +45,11 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] +set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] +set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] +set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] + if ![runto_main] then { fail "Can't run to main" return 0 @@ -45,8 +58,8 @@ if ![runto_main] then { # Verify that "until " works. (This is really just syntactic # sugar for "tbreak ; continue".) # -gdb_test "until 79" \ - "main .* at .*:79.*" \ +gdb_test "until $bp_location1" \ + "main .* at .*:$bp_location1.*" \ "until line number" # Verify that a malformed "advance" is gracefully caught. @@ -62,8 +75,8 @@ delete_breakpoints # inner invocations of factorial() are completed and we are back at this # frame. # -gdb_test "until 99" \ - "factorial.*value=720.*at.*${srcfile}:99.*return \\(value\\)." \ +gdb_test "until $bp_location19" \ + "factorial.*value=720.*at.*${srcfile}:$bp_location19.*return \\(value\\).*" \ "until factorial, recursive function" # Run to a function called by main @@ -76,6 +89,6 @@ delete_breakpoints # stop at main, the caller, where we put the 'guard' breakpoint. # gdb_test "until marker3" \ - "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:(82.*marker2 \\(43\\)|83.*marker3 \\(.stack., .trace.\\))." \ + "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:($bp_location20.*marker2 \\(43\\)|$bp_location21.*marker3 \\(.stack., .trace.\\)).*" \ "until func, not called by current frame" -- 2.34.1