diff options
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.base/gdb1476.c | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/gdb1476.exp | 72 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/sepdebug.c | 150 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/sepdebug.exp | 987 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/bs15503.cc | 74 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/bs15503.exp | 100 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/exception.cc | 69 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/exception.exp | 222 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/ChangeLog-1999-2003 | 768 |
9 files changed, 2454 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/gdb1476.c b/gdb/testsuite/gdb.base/gdb1476.c new file mode 100644 index 00000000000..c3f43760bf3 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdb1476.c @@ -0,0 +1,12 @@ +void x() +{ + void (*fp)() = 0; + fp(); +} + +int +main() +{ + x(); + return 0; +} diff --git a/gdb/testsuite/gdb.base/gdb1476.exp b/gdb/testsuite/gdb.base/gdb1476.exp new file mode 100644 index 00000000000..b88b2de0652 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdb1476.exp @@ -0,0 +1,72 @@ +# Copyright 2004 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@gnu.org + +# This file is part of the gdb testsuite. + +if $tracelevel { + strace $tracelevel +} + +# Testcase for backtrace/gdb1476. + +set prms_id 0 +set bug_id 0 + +set testfile "gdb1476" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +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." +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# +# Run to `main' where we begin our tests. +# + +if ![runto_main] then { + gdb_suppress_tests +} + +# If we can examine what's at memory address 0, it is possible that we +# could also execute it. This could probably make us run away, +# executing random code, which could have all sorts of ill effects, +# especially on targets without an MMU. Don't run the tests in that +# case. + +send_gdb "x 0\n" +gdb_expect { + -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { } + -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { } + -re ".*$gdb_prompt $" { + untested "Memory at address 0 is possibly executable" + return + } +} + +gdb_test "continue" "Program received signal SIGSEGV.*" \ + "continue to null pointer call" + +gdb_test "backtrace 10" \ + "#0\[ \t\]*0x0* in .*\r\n#1\[ \t\]*$hex in x.*\r\n#2\[ \t\]*$hex in main.*" \ + "backtrace from null pointer call" diff --git a/gdb/testsuite/gdb.base/sepdebug.c b/gdb/testsuite/gdb.base/sepdebug.c new file mode 100644 index 00000000000..adb69210a88 --- /dev/null +++ b/gdb/testsuite/gdb.base/sepdebug.c @@ -0,0 +1,150 @@ +/* Copyright 1994, 1995, 1999, 2002, 2003, 2004 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 <stdio.h> + +/* VxWorks does not supply atoi. */ +static int +atoi (z) + char *z; +{ + int i = 0; + + while (*z >= '0' && *z <= '9') + i = i * 10 + (*z++ - '0'); + return i; +} + +/* I don't know of any way to pass an array to VxWorks. This function + can be called directly from gdb. */ + +vxmain (arg) +char *arg; +{ + char *argv[2]; + + argv[0] = ""; + argv[1] = arg; + main (2, argv, (char **) 0); +} + +#else /* ! vxworks */ +# include <stdio.h> +# include <stdlib.h> +#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 */ +#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 */ +#endif + +/* + * This simple classical example of recursion is useful for + * 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 +{ +#ifdef usestubs + set_debug_traps(); /* set breakpoint 5 here */ + breakpoint(); +#endif + if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ + fprintf (stderr, "usage: factorial <number>\n"); + return 1; + } + printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */ + /* set breakpoint 12 here */ + marker1 (); /* set breakpoint 11 here */ + marker2 (43); + marker3 ("stack", "trace"); + 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 */ +} + +#ifdef PROTOTYPES +int factorial (int value) +#else +int factorial (value) +int value; +#endif +{ + if (value > 1) { /* set breakpoint 7 here */ + value *= factorial (value - 1); + } + 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 /* set breakpoint 3 here */ + && 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 /* set breakpoint 4 here */ + && b + && c) + { + a--, b--, c--; + } + return 0; +} diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp new file mode 100644 index 00000000000..1028dab575b --- /dev/null +++ b/gdb/testsuite/gdb.base/sepdebug.exp @@ -0,0 +1,987 @@ +# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2002, 2003, 2004 +# 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 + +# Based on break.exp, written by Rob Savoye. (rob@cygnus.com) +# Modified to test gdb's handling of separate debug info files. + +# This file has two parts. The first is testing that gdb behaves +# normally after reading in an executable and its corresponding +# separate debug file. The second moves the .debug file to a different +# location and tests the "set debug-file-directory" command. + + +if $tracelevel then { + strace $tracelevel +} + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "sepdebug" +set srcfile ${testfile}.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." +} + +# FIXME: this is nasty. We need to check for the stabs debug format. +# To do this we must run gdb on the unstripped executable, list 'main' +# (as to have a default source file), use get_debug_format (which does +# 'info source') and then see if the debug info is stabs. If so, we +# bail out. We cannot do this any other way because get_debug_format +# finds out the debug format using gdb itself, and in case of stabs we +# get an error loading the program if it is already stripped. An +# alternative would be to find out the debug info from the flags +# passed to dejagnu when the test is run. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +gdb_test "list main" "" "" +get_debug_format +if { [test_debug_format "stabs"] } then { + # the separate debug info feature doesn't work well in binutils with stabs. + # It produces a corrupted debug info only file, and gdb chokes on it. + # It is almost impossible to capture the failing message out of gdb, + # because it happens inside gdb_load. At that point any error message + # is intercepted by dejagnu itself, and, because of the error threshold, + # any faulty test result is changed into an UNRESOLVED. + # (see dejagnu/lib/framework.exp) + unsupported "no separate debug info handling with stabs" + return -1 +} elseif { [test_debug_format "unknown"] } then { + # gdb doesn't know what the debug format is. We are out of luck here. + unsupported "unknown debugging format" + return -1 +} +gdb_exit + +# Note: the procedure gdb_gnu_strip_debug will produce an executable called +# ${binfile}, which is just like the executable ($binfile) but without +# the debuginfo. Instead $binfile has a .gnudebuglink section which contains +# the name of a debuginfo only file. This file will be stored in the +# gdb.base/.debug subdirectory. + +if [gdb_gnu_strip_debug $binfile] { + # check that you have a recent version of strip and objcopy installed + unsupported "cannot produce separate debug info files" + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if [target_info exists gdb_stub] { + gdb_step_for_stub; +} +# +# test simple breakpoint setting commands +# + +# Test deleting all breakpoints when there are none installed, +# GDB should not prompt for confirmation. +# Note that gdb-init.exp provides a "delete_breakpoints" proc +# for general use elsewhere. + +send_gdb "delete breakpoints\n" +gdb_expect { + -re "Delete all breakpoints.*$" { + send_gdb "y\n" + gdb_expect { + -re "$gdb_prompt $" { + fail "Delete all breakpoints when none (unexpected prompt)" + } + timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" } + } + } + -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" } + timeout { fail "Delete all breakpoints when none (timeout)" } +} + +# +# test break at function +# +gdb_test "break main" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "breakpoint function" + +# +# test break at quoted function +# +gdb_test "break \"marker2\"" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "breakpoint quoted function" + +# +# test break at function in file +# +gdb_test "break $srcfile:factorial" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "breakpoint function in file" + +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] + +# +# test break at line number +# +# Note that the default source file is the last one whose source text +# was printed. For native debugging, before we've executed the +# program, this is the file containing main, but for remote debugging, +# it's wherever the processor was stopped when we connected to the +# board. So, to be sure, we do a list command. +# +gdb_test "list main" \ + ".*main \\(argc, argv, envp\\).*" \ + "use `list' to establish default source file" +gdb_test "break $bp_location1" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \ + "breakpoint line number" + +# +# test duplicate breakpoint +# +gdb_test "break $bp_location1" \ + "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \ + "breakpoint duplicate" + +set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] + +# +# test break at line number in file +# +gdb_test "break $srcfile:$bp_location2" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \ + "breakpoint line number in file" + +set bp_location3 [gdb_get_line_number "set breakpoint 3 here"] +set bp_location4 [gdb_get_line_number "set breakpoint 4 here"] + +# +# 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 $bp_location3\\." \ + "breakpoint at start of multi line if conditional" + +gdb_test "break multi_line_while_conditional" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ + "breakpoint at start of multi line while conditional" + +set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] +set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] + +# +# check to see what breakpoints are set +# +if [target_info exists gdb_stub] { + set main_line $bp_location5 +} else { + set main_line $bp_location6 +} + +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"] + +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 factorial 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.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.* +\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.* +\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4" \ + "breakpoint info" + +# FIXME: The rest of this test doesn't work with anything that can't +# handle arguments. +# Huh? There doesn't *appear* to be anything that passes arguments +# below. +if [istarget "mips-idt-*"] then { + return +} + +# +# run until the breakpoint at main is hit. For non-stubs-using targets. +# +if ![target_info exists use_gdb_stub] { + if [istarget "*-*-vxworks*"] then { + send_gdb "run vxmain \"2\"\n" + set timeout 120 + verbose "Timeout is now $timeout seconds" 2 + } else { + send_gdb "run\n" + } + gdb_expect { + -re "The program .* has been started already.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ + { pass "run until function breakpoint" } + -re ".*$gdb_prompt $" { fail "run until function breakpoint" } + timeout { fail "run until function breakpoint (timeout)" } + } +} else { + if ![target_info exists gdb_stub] { + gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue" + } +} + +# +# run until the breakpoint at a line number +# +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" + +# +# Run until the breakpoint set in a function in a file +# +for {set i 6} {$i >= 1} {incr i -1} { + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \ + "run until file:function($i) breakpoint" +} + +# +# 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).*" \ + "run until quoted breakpoint" +# +# run until the file:function breakpoint at a line number in a file +# +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \ + "run until file:linenum breakpoint" + +# Test break at offset +1 +set bp_location10 [gdb_get_line_number "set breakpoint 10 here"] + +gdb_test "break +1" \ + "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \ + "breakpoint offset +1" + +# Check to see if breakpoint is hit when stepped onto + +gdb_test "step" \ + ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \ + "step onto breakpoint" + +# +# delete all breakpoints so we can start over, course this can be a test too +# +delete_breakpoints + +# +# test temporary breakpoint at function +# + +gdb_test "tbreak main" "Breakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function" + +# +# test break at function in file +# + +gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" \ + "Temporary breakpoint function in file" + +# +# test break at line number +# +send_gdb "tbreak $bp_location1\n" +gdb_expect { + -re "Breakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } + -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } + timeout { fail "breakpoint line number #1 (timeout)" } +} + +gdb_test "tbreak $bp_location6" "Breakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2" + +# +# test break at line number in file +# +send_gdb "tbreak $srcfile:$bp_location2\n" +gdb_expect { + -re "Breakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } + -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } + timeout { fail "Temporary breakpoint line number in file #1 (timeout)" } +} + +set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] +gdb_test "tbreak $srcfile:$bp_location11" "Breakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2" + +# +# check to see what breakpoints are set (temporary this time) +# +gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:$bp_location7.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \ + "Temporary breakpoint info" + + +#*********** + +# Verify that catchpoints for fork, vfork and exec don't trigger +# inappropriately. (There are no calls to those system functions +# in this test program.) +# +if ![runto_main] then { fail "break tests suppressed" } + +send_gdb "catch\n" +gdb_expect { + -re "Catch requires an event name.*$gdb_prompt $"\ + {pass "catch requires an event name"} + -re "$gdb_prompt $"\ + {fail "catch requires an event name"} + timeout {fail "(timeout) catch requires an event name"} +} + + +set name "set catch fork, never expected to trigger" +send_gdb "catch fork\n" +gdb_expect { + -re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $" + {pass $name} + -re "Catch of fork not yet implemented.*$gdb_prompt $" + {pass $name} + -re "$gdb_prompt $" + {fail $name} + timeout {fail "(timeout) $name"} +} + + +set name "set catch vfork, never expected to trigger" +send_gdb "catch vfork\n" + +# If we are on HP-UX 10.20, we expect an error message to be +# printed if we type "catch vfork" at the gdb gdb_prompt. This is +# because on HP-UX 10.20, we cannot catch vfork events. + +if [istarget "hppa*-hp-hpux10.20"] then { + gdb_expect { + -re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $" + {pass $name} + -re "$gdb_prompt $" + {fail $name} + timeout {fail "(timeout) $name"} + } +} else { + gdb_expect { + -re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $" + {pass $name} + -re "Catch of vfork not yet implemented.*$gdb_prompt $" + {pass $name} + -re "$gdb_prompt $" + {fail $name} + timeout {fail "(timeout) $name"} + } +} + +set name "set catch exec, never expected to trigger" +send_gdb "catch exec\n" +gdb_expect { + -re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $" + {pass $name} + -re "Catch of exec not yet implemented.*$gdb_prompt $" + {pass $name} + -re "$gdb_prompt $" {fail $name} + timeout {fail "(timeout) $name"} +} + +# Verify that GDB responds gracefully when asked to set a breakpoint +# on a nonexistent source line. +# +send_gdb "break 999\n" +gdb_expect { + -re "No line 999 in file .*$gdb_prompt $"\ + {pass "break on non-existent source line"} + -re "$gdb_prompt $"\ + {fail "break on non-existent source line"} + timeout {fail "(timeout) break on non-existent source line"} +} + +# 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" + + +# Verify that GDB allows one to just say "break", which is treated +# as the "default" breakpoint. Note that GDB gets cute when printing +# the informational message about other breakpoints at the same +# location. We'll hit that bird with this stone too. +# +send_gdb "break\n" +gdb_expect { + -re "Breakpoint \[0-9\]*.*$gdb_prompt $"\ + {pass "break on default location, 1st time"} + -re "$gdb_prompt $"\ + {fail "break on default location, 1st time"} + timeout {fail "(timeout) break on default location, 1st time"} +} + +send_gdb "break\n" +gdb_expect { + -re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ + {pass "break on default location, 2nd time"} + -re "$gdb_prompt $"\ + {fail "break on default location, 2nd time"} + timeout {fail "(timeout) break on default location, 2nd time"} +} + +send_gdb "break\n" +gdb_expect { + -re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ + {pass "break on default location, 3rd time"} + -re "$gdb_prompt $"\ + {fail "break on default location, 3rd time"} + timeout {fail "(timeout) break on default location, 3rd time"} +} + +send_gdb "break\n" +gdb_expect { + -re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ + {pass "break on default location, 4th time"} + -re "$gdb_prompt $"\ + {fail "break on default location, 4th time"} + timeout {fail "(timeout) break on default location, 4th time"} +} + +# Verify that a "silent" breakpoint can be set, and that GDB is indeed +# "silent" about its triggering. +# +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"} + -re "$gdb_prompt $"\ + {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" +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"} +} + +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"} + -re "$gdb_prompt $"\ + {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"} + -re "$gdb_prompt $"\ + {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"} + -re "$gdb_prompt $"\ + {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 +# "thread" keyword. (We won't attempt to test here that a +# thread-specific breakpoint really triggers appropriately. +# The gdb.threads subdirectory contains tests for that.) +# +set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] +send_gdb "break $bp_location12 thread 999\n" +gdb_expect { + -re "Unknown thread 999.*$gdb_prompt $"\ + {pass "thread-specific breakpoint on non-existent thread disallowed"} + -re "$gdb_prompt $"\ + {fail "thread-specific breakpoint on non-existent thread disallowed"} + timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} +} +send_gdb "break $bp_location12 thread foo\n" +gdb_expect { + -re "Junk after thread keyword..*$gdb_prompt $"\ + {pass "thread-specific breakpoint on bogus thread ID disallowed"} + -re "$gdb_prompt $"\ + {fail "thread-specific breakpoint on bogus thread ID disallowed"} + timeout {fail "(timeout) thread-specific breakpoint on bogus thread ID disallowed"} +} + +# Verify that GDB responds gracefully to a breakpoint command with +# trailing garbage. +# +send_gdb "break $bp_location12 foo\n" +gdb_expect { + -re "Junk at end of arguments..*$gdb_prompt $"\ + {pass "breakpoint with trailing garbage disallowed"} + -re "$gdb_prompt $"\ + {fail "breakpoint with trailing garbage disallowed"} + timeout {fail "(timeout) breakpoint with trailing garbage disallowed"} +} + +# Verify that GDB responds gracefully to a "clear" command that has +# no matching breakpoint. (First, get us off the current source line, +# which we know has a breakpoint.) +# +send_gdb "next\n" +gdb_expect { + -re ".*$gdb_prompt $"\ + {pass "step over breakpoint"} + timeout {fail "(timeout) step over breakpoint"} +} +send_gdb "clear 81\n" +gdb_expect { + -re "No breakpoint at 81..*$gdb_prompt $"\ + {pass "clear line has no breakpoint disallowed"} + -re "$gdb_prompt $"\ + {fail "clear line has no breakpoint disallowed"} + timeout {fail "(timeout) clear line has no breakpoint disallowed"} +} +send_gdb "clear\n" +gdb_expect { + -re "No breakpoint at this line..*$gdb_prompt $"\ + {pass "clear current line has no breakpoint disallowed"} + -re "$gdb_prompt $"\ + {fail "clear current line has no breakpoint disallowed"} + timeout {fail "(timeout) clear current line has no breakpoint disallowed"} +} + +# Verify that we can set and clear multiple breakpoints. +# +# We don't test that it deletes the correct breakpoints. We do at +# least test that it deletes more than one breakpoint. +# +gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1" +gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2" +gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} + +# Verify that a breakpoint can be set via a convenience variable. +# +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"} +} +send_gdb "break \$foo\n" +gdb_expect { + -re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\ + {pass "set breakpoint via convenience variable"} + -re "$gdb_prompt $"\ + {fail "set breakpoint via convenience variable"} + timeout {fail "(timeout) set breakpoint via convenience variable"} +} + +# Verify that GDB responds gracefully to an attempt to set a +# breakpoint via a convenience variable whose type is not integer. +# +send_gdb "set \$foo=81.5\n" +gdb_expect { + -re "$gdb_prompt $"\ + {pass "set convenience variable \$foo to 81.5"} + timeout {fail "(timeout) set convenience variable \$foo to 81.5"} +} +send_gdb "break \$foo\n" +gdb_expect { + -re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\ + {pass "set breakpoint via non-integer convenience variable disallowed"} + -re "$gdb_prompt $"\ + {fail "set breakpoint via non-integer convenience variable disallowed"} + timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"} +} + +# Verify that we can set and trigger a breakpoint in a user-called function. +# +send_gdb "break marker2\n" +gdb_expect { + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ + {pass "set breakpoint on to-be-called function"} + -re "$gdb_prompt $"\ + {fail "set breakpoint on to-be-called function"} + timeout {fail "(timeout) set breakpoint on to-be-called function"} +} +send_gdb "print marker2(99)\n" +gdb_expect { + -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\ + {pass "hit breakpoint on called function"} + -re "$gdb_prompt $"\ + {fail "hit breakpoint on called function"} + timeout {fail "(timeout) hit breakpoint on called function"} +} + +# As long as we're stopped (breakpointed) in a called function, +# verify that we can successfully backtrace & such from here. +# +# In this and the following test, the _sr4export check apparently is needed +# for hppa*-*-hpux. +# +send_gdb "bt\n" +gdb_expect { + -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\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 $"\ + {pass "backtrace while in called function"} + -re "$gdb_prompt $"\ + {fail "backtrace while in called function"} + timeout {fail "(timeout) backtrace while in called function"} +} + +# Return from the called function. For remote targets, it's important to do +# this before runto_main, which otherwise may silently stop on the dummy +# breakpoint inserted by GDB at the program's entry point. +# +send_gdb "finish\n" +gdb_expect { + -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\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 $"\ + {pass "finish from called function"} + -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\ + {pass "finish from called function"} + -re "$gdb_prompt $"\ + {fail "finish from called function"} + timeout {fail "(timeout) finish from called function"} +} + +# Verify that GDB responds gracefully to a "finish" command with +# arguments. +# +if ![runto_main] then { fail "break tests suppressed" } + +send_gdb "finish 123\n" +gdb_expect { + -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\ + {pass "finish with arguments disallowed"} + -re "$gdb_prompt $"\ + {fail "finish with arguments disallowed"} + timeout {fail "(timeout) finish with arguments disallowed"} +} + +# Verify that GDB responds gracefully to a request to "finish" from +# the outermost frame. On a stub that never exits, this will just +# run to the stubs routine, so we don't get this error... Thus the +# second condition. +# + +send_gdb "finish\n" +gdb_expect { + -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\ + {pass "finish from outermost frame disallowed"} + -re "Run till exit from.*\r\n$gdb_prompt $" { + pass "finish from outermost frame disallowed" + } + -re "$gdb_prompt $"\ + {fail "finish from outermost frame disallowed"} + timeout {fail "(timeout) finish from outermost frame disallowed"} +} + +# Verify that we can explicitly ask GDB to stop on all shared library +# events, and that it does so. +# +if [istarget "hppa*-*-hpux*"] then { + if ![runto_main] then { fail "break tests suppressed" } + + send_gdb "set stop-on-solib-events 1\n" + gdb_expect { + -re "$gdb_prompt $"\ + {pass "set stop-on-solib-events"} + timeout {fail "(timeout) set stop-on-solib-events"} + } + + send_gdb "run\n" + gdb_expect { + -re ".*Start it from the beginning.*y or n. $"\ + {send_gdb "y\n" + gdb_expect { + -re ".*Stopped due to shared library event.*$gdb_prompt $"\ + {pass "triggered stop-on-solib-events"} + -re "$gdb_prompt $"\ + {fail "triggered stop-on-solib-events"} + timeout {fail "(timeout) triggered stop-on-solib-events"} + } + } + -re "$gdb_prompt $"\ + {fail "rerun for stop-on-solib-events"} + timeout {fail "(timeout) rerun for stop-on-solib-events"} + } + + send_gdb "set stop-on-solib-events 0\n" + gdb_expect { + -re "$gdb_prompt $"\ + {pass "reset stop-on-solib-events"} + timeout {fail "(timeout) reset stop-on-solib-events"} + } +} + +# Hardware breakpoints are unsupported on HP-UX. Verify that GDB +# gracefully responds to requests to create them. +# +if [istarget "hppa*-*-hpux*"] then { + if ![runto_main] then { fail "break tests suppressed" } + + send_gdb "hbreak\n" + gdb_expect { + -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ + {pass "hw breaks disallowed"} + -re "$gdb_prompt $"\ + {fail "hw breaks disallowed"} + timeout {fail "(timeout) hw breaks disallowed"} + } + + send_gdb "thbreak\n" + gdb_expect { + -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ + {pass "temporary hw breaks disallowed"} + -re "$gdb_prompt $"\ + {fail "temporary hw breaks disallowed"} + timeout {fail "(timeout) temporary hw breaks disallowed"} + } +} + +#******** + + +# +# Test "next" over recursive function call. +# + +proc test_next_with_recursion {} { + global gdb_prompt + global decimal + global binfile + + if [target_info exists use_gdb_stub] { + # Reload the program. + delete_breakpoints + gdb_load ${binfile}; + } else { + # FIXME: should be using runto + gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y" + + delete_breakpoints + } + + gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial" + + # Run until we call factorial with 6 + + if [istarget "*-*-vxworks*"] then { + send_gdb "run vxmain \"6\"\n" + } else { + gdb_run_cmd + } + gdb_expect { + -re "Break.* factorial .value=6. .*$gdb_prompt $" {} + -re ".*$gdb_prompt $" { + fail "run to factorial(6)"; + gdb_suppress_tests; + } + timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests } + } + + # Continue until we call factorial recursively with 5. + + if [gdb_test "continue" \ + "Continuing.*Break.* factorial .value=5. .*" \ + "continue to factorial(5)"] then { gdb_suppress_tests } + + # Do a backtrace just to confirm how many levels deep we are. + + if [gdb_test "backtrace" \ + "#0\[ \t\]+ factorial .value=5..*" \ + "backtrace from factorial(5)"] then { gdb_suppress_tests } + + # Now a "next" should position us at the recursive call, which + # we will be performing with 4. + + if [gdb_test "next" \ + ".* factorial .value - 1.;.*" \ + "next to recursive call"] then { gdb_suppress_tests } + + # Disable the breakpoint at the entry to factorial by deleting them all. + # The "next" should run until we return to the next line from this + # recursive call to factorial with 4. + # Buggy versions of gdb will stop instead at the innermost frame on + # the line where we are trying to "next" to. + + delete_breakpoints + + if [istarget "mips*tx39-*"] { + set timeout 60 + } + # We used to set timeout here for all other targets as well. This + # is almost certainly wrong. The proper timeout depends on the + # target system in use, and how we communicate with it, so there + # is no single value appropriate for all targets. The timeout + # should be established by the Dejagnu config file(s) for the + # board, and respected by the test suite. + # + # For example, if I'm running GDB over an SSH tunnel talking to a + # portmaster in California talking to an ancient 68k board running + # a crummy ROM monitor (a situation I can only wish were + # hypothetical), then I need a large timeout. But that's not the + # kind of knowledge that belongs in this file. + + gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \ + "next over recursive call" + + # OK, we should be back in the same stack frame we started from. + # Do a backtrace just to confirm. + + set result [gdb_test "backtrace" \ + "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \ + "backtrace from factorial(5.1)"] + if { $result != 0 } { gdb_suppress_tests } + + if [target_info exists gdb,noresults] { gdb_suppress_tests } + gdb_continue_to_end "recursive next test" + gdb_stop_suppressing_tests; +} + +test_next_with_recursion + + +#******** + +# now move the .debug file to a different location so that we can test +# the "set debug-file-directory" command. + +remote_exec build "mv ${objdir}/${subdir}/.debug/${testfile}.debug ${objdir}/${subdir}" +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_test "set debug-file-directory ${objdir}/${subdir}" ".*" "set separate debug location" +gdb_load ${binfile} + +if [target_info exists gdb_stub] { + gdb_step_for_stub; +} + +# +# test break at function +# +gdb_test "break main" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "breakpoint function, optimized file" + +# +# test break at function +# +gdb_test "break marker4" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "breakpoint small function, optimized file" + +# +# run until the breakpoint at main is hit. For non-stubs-using targets. +# +if ![target_info exists use_gdb_stub] { + if [istarget "*-*-vxworks*"] then { + send_gdb "run vxmain \"2\"\n" + set timeout 120 + verbose "Timeout is now $timeout seconds" 2 + } else { + send_gdb "run\n" + } + gdb_expect { + -re "The program .* has been started already.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\ + { pass "run until function breakpoint, optimized file" } + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\ + { pass "run until function breakpoint, optimized file (code motion)" } + -re ".*$gdb_prompt $" { fail "run until function breakpoint, optimized file" } + timeout { fail "run until function breakpoint, optimized file (timeout)" } + } +} else { + if ![target_info exists gdb_stub] { + gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file" + } +} + +# +# run until the breakpoint at a small function +# + +# +# Add a second pass pattern. The behavior differs here between stabs +# and dwarf for one-line functions. Stabs preserves two line symbols +# (one before the prologue and one after) with the same line number, +# but dwarf regards these as duplicates and discards one of them. +# Therefore the address after the prologue (where the breakpoint is) +# 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"] +send_gdb "continue\n" +gdb_expect { + -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$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.*" { + 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.*" { + # marker4() is defined at line 46 when compiled with -DPROTOTYPES + 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" + } + timeout { + fail "run until breakpoint set at small function, optimized file (timeout)" + } +} + + +# Reset the default arguments for VxWorks +if [istarget "*-*-vxworks*"] { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + send_gdb "set args main\n" + gdb_expect -re ".*$gdb_prompt $" {} +} diff --git a/gdb/testsuite/gdb.cp/bs15503.cc b/gdb/testsuite/gdb.cp/bs15503.cc new file mode 100644 index 00000000000..aec5a0b8fcb --- /dev/null +++ b/gdb/testsuite/gdb.cp/bs15503.cc @@ -0,0 +1,74 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 1992, 2004 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 */ + +#include <string> +#include <iostream> +using namespace std; + +template <class T> +class StringTest { +public: + virtual void runTest(); + void testFunction(); +}; + +template <class T> +void StringTest<T>:: runTest() { + testFunction (); +} + +template <class T> +void StringTest <T>::testFunction() { + // initialize s with string literal + cout << "in StringTest" << endl; + string s("I am a shot string"); + cout << s << endl; + + // insert 'r' to fix "shot" + s.insert(s.begin()+10,'r' ); + cout << s << endl; + + // concatenate another string + s += "and now a longer string"; + cout << s << endl; + + // find position where blank needs to be inserted + string::size_type spos = s.find("and"); + s.insert(spos, " "); + cout << s << endl; + + // erase the concatenated part + s.erase(spos); + cout << s << endl; +} + +int main() { + StringTest<wchar_t> ts; + ts.runTest(); +} + +/* output: +I am a shot string +I am a short string +I am a short stringand now a longer string +I am a short string and now a longer string +I am a short string +*/ diff --git a/gdb/testsuite/gdb.cp/bs15503.exp b/gdb/testsuite/gdb.cp/bs15503.exp new file mode 100644 index 00000000000..9b6095bec1a --- /dev/null +++ b/gdb/testsuite/gdb.cp/bs15503.exp @@ -0,0 +1,100 @@ +# Copyright 1992, 2004 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. */ + +# Test case for CLLbs15503 +# This file was written by Sue Kimura (sue_kimura@hp.com) +# Rewritten by Michael Chastain (mec.gnu@mindspring.com) + +if $tracelevel { + strace $tracelevel +} + +set testfile "bs15503" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile}] { + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug c++"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# Set breakpoint on template function + +gdb_test "break StringTest<wchar_t>::testFunction" \ + "Breakpoint $decimal at $hex: file .*${srcfile}, line $decimal." + +gdb_test "continue" \ + ".*Breakpoint $decimal, StringTest<wchar_t>::testFunction \\(this=$hex\\).*" \ + "continue to StringTest<wchar_t>" + +# Run to some random point in the middle of the function. + +gdb_breakpoint [gdb_get_line_number "find position where blank needs to be inserted"] +gdb_continue_to_breakpoint "find position where blank needs to be inserted" + +# Call some string methods. + +gdb_test "print s.length()" "\\$\[0-9\]+ = 42" +gdb_test "print s\[0\]" "\\$\[0-9\]+ =.* 'I'" +gdb_test "print s\[s.length()-1\]" "\\$\[0-9\]+ =.* 'g'" +gdb_test "print (const char *) s" \ + "\\$\[0-9\]+ = $hex \"I am a short stringand now a longer string\"" + +# TODO: tests that do not work with gcc 2.95.3 +# -- chastain 2004-01-07 +# +# gdb_test "print s.compare(s)" "\\$\[0-9\]+ = 0" +# gdb_test "print s.compare(\"AAA\")" "\\$\[0-9\]+ = 1" +# gdb_test "print s.compare(\"ZZZ\")" "\\$\[0-9\]+ = -1" + +# TODO: tests that do not work with gcc 2.95.3 and gcc 3.3.2. +# cannot call overloaded non-member operator. -- chastain 2004-01-07 +# +# gdb_test "print s == s" "\\$\[0-9\]+ = true" +# gdb_test "print s > "AAA" "\\$\[0-9\]+ = true" +# gdb_test "print s < "ZZZ" "\\$\[0-9\]+ = true" + +# TODO crash gdb! This is going to be a great test! +# -- chastain 2004-01-07 +# +# gdb_test "print s == \"I am a short stringand now a longer string\"" \ +# "\\$\[0-9\]+ = "true" + +gdb_test "print (const char *) s.substr(0,4)" "\\$\[0-9\]+ = $hex \"I am\"" +gdb_test "print (const char *) (s=s.substr(0,4))" \ + "\\$\[0-9\]+ = $hex \"I am\"" + +# TODO: cannot call overloaded non-member operator again. +# -- chastain 2004-01-07 +# +# gdb_test "print (const char *) (s + s)" \ +# "\\$\[0-9\]+ = $hex \"I amI am\"" +# gdb_test "print (const char *) (s + \" \" + s)" \ +# "\\$\[0-9\]+ = $hex \"I am I am\"" diff --git a/gdb/testsuite/gdb.cp/exception.cc b/gdb/testsuite/gdb.cp/exception.cc new file mode 100644 index 00000000000..4134fbcf7e7 --- /dev/null +++ b/gdb/testsuite/gdb.cp/exception.cc @@ -0,0 +1,69 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 1997, 1998, 2004 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 */ + +// Test file for exception handling support. + +#include <iostream> +using namespace std; + +int foo (int i) +{ + if (i < 32) + throw (int) 13; + else + return i * 2; +} + +extern "C" int bar (int k, unsigned long eharg, int flag); + +int bar (int k, unsigned long eharg, int flag) +{ + cout << "k is " << k << " eharg is " << eharg << " flag is " << flag << endl; + return 1; +} + +int main() +{ + int j; + + try { + j = foo (20); + } + catch (int x) { + cout << "Got an except " << x << endl; + } + + try { + try { + j = foo (20); + } + catch (int x) { + cout << "Got an except " << x << endl; + throw; + } + } + catch (int y) { + cout << "Got an except (rethrown) " << y << endl; + } + + // Not caught + foo (20); +} diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp new file mode 100644 index 00000000000..d921eade955 --- /dev/null +++ b/gdb/testsuite/gdb.cp/exception.exp @@ -0,0 +1,222 @@ +# Copyright 1997, 1998, 2004 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 + +# This file is part of the gdb testsuite. +# tests for exception-handling support +# Written by Satish Pai <pai@apollo.hp.com> 1997-07-23 +# Rewritten by Michael Chastain <mec.gnu@mindspring.com> 2004-01-08 + +# This file used to have two copies of the tests with different +# compiler flags for hp-ux. Instead, the user should set CXXOPTS +# or run runtest with --target_board unix/gdb:debug_flags="..." +# to choose the compiler flags. +# +# The interesting compiler flags are: "aCC +A -Wl,-a,-archive" . +# Static-linked executables use a different mechanism to get the +# address of the notification hook in the C++ support library. + +# TODO: this file is not ready for production yet. If you are working +# on C++ exception support for gdb, you can take out the "continue" +# statement and try your luck. -- chastain 2004-01-09 + +# TODO: this file has many absolute line numbers. +# Replace them with gdb_get_line_number. + +set ws "\[\r\n\t \]+" +set nl "\[\r\n\]+" + +if $tracelevel then { + strace $tracelevel +} + +set testfile "exception" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# Start with a fresh gdb + +set prms_id 0 +set bug_id 0 + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +# As I said before, this test script is not ready yet! + +continue + +# Set a catch catchpoint + +gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" + +# Set a throw catchpoint + +gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \ + "catch throw (static executable)" + +# The catchpoints should be listed in the list of breakpoints. + +set re_head "Num${ws}Type${ws}Disp${ws}Enb${ws}Address${ws}What" +set re_1_main "1${ws}breakpoint${ws}keep${ws}y${ws}$hex${ws}in main.*breakpoint already hit.*" +set re_2_catch "2${ws}catch catch${ws}keep${ws}y${ws}$hex${ws}exception catch" +set re_3_catch "3${ws}catch throw${ws}keep${ws}y${ws}$hex${ws}exception throw" +set re_2_bp "2${ws}breakpoint${ws}keep${ws}y${ws}$hex${ws}exception catch" +set re_3_bp "3${ws}breakpoint${ws}keep${ws}y${ws}$hex${ws}exception throw" + +set name "info breakpoints" +gdb_test_multiple "info breakpoints" $name { + -re "$re_head${ws}$re_1_main${ws}$re_2_catch${ws}$re_3_catch\r\n$gdb_prompt $" { + pass $name + } + -re "$re_head${ws}$re_1_main${ws}$re_2_bp${ws}$re_3_bp\r\n$gdb_prompt $" { + # TODO: gdb HEAD 2004-01-08 does this. Is this okay? + unresolved $name + } +} + +# Some targets support "info catch". +# Some do not. + +set name "info catch" +gdb_test_multiple "info catch" $name { + -re "Info catch not supported with this target/compiler combination.\r\n$gdb_prompt $" { + unsupported $name + } + -re "No catches.\r\n$gdb_prompt $" { + # TODO: gdb HEAD 2004-01-08 does this. Is this okay? + unresolved $name + } +} + +# Get the first exception thrown + +set name "continue to first throw" +gdb_test_multiple "continue" $name { + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\), throw location.*${srcfile}:30, catch location .*${srcfile}:50\r\n$gdb_prompt $" { + pass $name + } + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\)\r\n.*\r\n$gdb_prompt $" { + # TODO: gdb HEAD 2004-01-08 does this. Is this okay? + unresolved $name + } +} + +# Backtrace from the throw point. +# This should get to user code. + +set name "backtrace after first throw" +gdb_test_multiple "backtrace" $name { + -re ".*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:30\r\n#\[0-9\]+${ws}$hex in main \\((void|)\\) at .*${srcfile}:48\r\n$gdb_prompt $" { + pass $name + } +} + +# Continue to the catch. + +set name "continue to first catch" +gdb_test_multiple "continue" $name { + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\), throw location.*${srcfile}:30, catch location .*${srcfile}:50\r\n$gdb_prompt $" { + pass $name + } + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\)\r\n.*\r\n$gdb_prompt $" { + # TODO: gdb HEAD 2004-01-08 does this. Is this okay? + unresolved $name + } +} + +# Backtrace from the catch point. +# This should get to user code. + +set name "backtrace after first catch" +gdb_test_multiple "backtrace" $name { + -re ".*#\[0-9\]+${ws}$hex in main \\((void|)\\) at .*$srcfile:50\r\n$gdb_prompt $" { + pass $name + } +} + +# Continue to second throw. + +set name "continue to second throw" +gdb_test_multiple "continue" $name { + -re "Continuing.${ws}Got an except 13${ws}Catchpoint \[0-9\]+ \\(exception thrown\\), throw location.*${srcfile}:30, catch location .*${srcfile}:58\r\n$gdb_prompt $" { + pass $name + } + -re "Continuing.${ws}Got an except 13${ws}Catchpoint \[0-9\]+ \\(exception thrown\\)\r\n.*\r\n$gdb_prompt $" { + # TODO: gdb HEAD 2004-01-08 does this. Is this okay? + unresolved $name + } +} + +# Backtrace from the throw point. +# This should get to user code. + +set name "backtrace after second throw" +gdb_test_multiple "backtrace" $name { + -re ".*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:30\r\n#\[0-9\]+${ws}$hex in main \\((void|)\\) at .*${srcfile}:56\r\n$gdb_prompt $" { + pass $name + } +} + +# Continue to second catch. + +set name "continue to second catch" +gdb_test_multiple "continue" $name { + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\), throw location.*${srcfile}:30, catch location .*${srcfile}:58\r\n$gdb_prompt $" { + pass $name + } + -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\)\r\n.*\r\n$gdb_prompt $" { + # TODO: gdb HEAD 2004-01-08 does this. Is this okay? + unresolved $name + } +} + +# Backtrace from the catch point. +# This should get to user code. + +set name "backtrace after second catch" +gdb_test_multiple "backtrace" $name { + -re ".*#\[0-9\]+${ws}$hex in main \\((void|)\\) at .*$srcfile:58\r\n$gdb_prompt $" { + pass $name + } +} + +# That is all for now. +# +# The original code had: +# +# continue to re-throw ; backtrace +# continue to catch ; backtrace +# continue to throw out of main +# +# The problem is that "re-throw" does not show a throw; only a catch. +# I do not know if this is because of a bug, or because the generated +# code is optimized for a throw into the same function. +# +# -- chastain 2004-01-09 diff --git a/gdb/testsuite/gdb.mi/ChangeLog-1999-2003 b/gdb/testsuite/gdb.mi/ChangeLog-1999-2003 new file mode 100644 index 00000000000..6f263c33056 --- /dev/null +++ b/gdb/testsuite/gdb.mi/ChangeLog-1999-2003 @@ -0,0 +1,768 @@ +2003-08-07 Andrew Cagney <cagney@redhat.com> + + * mi2-basics.exp: Copy base MI .exp file, set MIFLAGS to -i=mi2. + * mi2-break.exp, mi2-cli.exp, mi2-console.exp: Ditto. + * mi2-disassemble.exp, mi2-eval.exp, mi2-file.exp: Ditto. + * mi2-hack-cli.exp, mi2-pthreads.exp, mi2-read-memory.exp: Ditto. + * mi2-regs.exp, mi2-return.exp, mi2-simplerun.exp: Ditto. + * mi2-stack.exp, mi2-stepi.exp, mi2-syn-frame.exp: Ditto. + * mi2-until.exp, mi2-var-block.exp, mi2-var-child.exp: Ditto. + * mi2-var-cmd.exp, mi2-var-display.exp, mi2-watch.exp: Ditto. + +2003-05-03 J. Brobecker <brobecker@gnat.com> + + From Thierry Schneider <tpschneider1@yahoo.com>: + * mi1-symbol.exp (-symbol-list-lines): New test file to + validate all symbol-related commands + +2003-04-08 Andrew Cagney <cagney@redhat.com> + + * gdb792.exp: Skip when C++. + +2003-02-23 Stephane Carrez <stcarrez@nerim.fr> + + * mi-syn-frame.exp: Don't run this test when gdb,nosignals is set. + +2002-12-13 Jeff Johnston <jjohnstn@redhat.com> + + * mi-basics.exp: Change tests for -environment-directory. Also add + tests for -environment-cd, -environment-pwd, and -environment-path. + Part of fix for PR gdb/741. + +2002-11-05 Jeff Johnston <jjohnstn@redhat.com> + + * gdb792.cc: New file to test patch for PR gdb/792. + * gdb792.exp: Ditto. + +2002-11-04 Elena Zannoni <ezannoni@redhat.com> + + * mi-console.exp: Use mi_runto, mi_run_to_main, mi_next_to, + mi_step_to wherever possible. Update copyright notices. + * mi-disassemble.exp: Ditto. + * mi-eval.exp: Ditto. + * mi-read-memory.exp: Ditto. + * mi-regs.exp: Ditto. + * mi-return.exp: Ditto. + * mi-stack.exp: Ditto. + * mi-stepi.exp: Ditto. + * mi-var-block.exp: Ditto. + * mi-var-cmd.exp: Ditto. + * mi-watch.exp: Ditto. + * mi1-console.exp: Ditto. + * mi1-disassemble.exp: Ditto. + * mi1-eval.exp: Ditto. + * mi1-read-memory.exp: Ditto. + * mi1-regs.exp: Ditto. + * mi1-return.exp: Ditto. + * mi1-stack.exp: Ditto. + * mi1-stepi.exp: Ditto. + * mi1-var-block.exp: Ditto. + * mi1-var-cmd.exp: Ditto. + * mi1-watch.exp: Ditto. + +2002-10-23 Jeff Johnston <jjohnstn@redhat.com> + + * mi-var-cmd.exp: Add tests to verify that a -var-assign that changes + a value shows up in the changelist of a -var-update. Part of fix + for gdb/702. + * mi1-var-cmd.exp: Ditto. + +2002-10-03 Jeff Johnston <jjohnstn@redhat.com> + + * mi-return.exp: Change expected frame output to remove extraneous + space in level field when frame level is single digit. Part of + fix for PR gdb/192. + * mi-stack.exp: Ditto. + * mi1-return.exp: Ditto. + * mi1-stack.exp: Ditto. + +2002-10-03 Jeff Johnston <jjohnstn@redhat.com> + + * mi-var-block.exp: Change expected output from -var-update + command to expect list format for "changelist". Fix for + PR gdb/672. + * mi-var-cmd.exp: Ditto. + * mi-var-child: Ditto. + +2002-09-25 Keith Seitz <keiths@redhat.com> + + * mi-pthreads.exp (get_mi_thread_list): Check if expect_out + exists before using it. + (check_mi_and_console_threads): Likewise. + * gdb669.exp (get_mi_thread_list): Likewise. + (check_mi_and_console_threads): Likewise. + +2002-09-24 Keith Seitz <keiths@redhat.com> + + * configure.in: Add config header. + Check for pthread.h. + * configure: Regenerate. + * config.in: New file. + * pthreads.c: New file. + * mi-pthreads.exp: New file to test thread functionality. + * gdb669.exp: New file. + +2002-09-17 Keith Seitz <keiths@redhat.com> + + * mi-var-cmd.exp: Add tests to check when varobj pinned to a + selected frame changes type. + +2002-09-17 Keith Seitz <keiths@redhat.com> + + * mi-console.exp: Update copyright. + * mi-var-block.exp: Likewise. + * mi-var-cmd.exp: Likewise. + * mi-var-display.exp: Likewise. + * mi0-console.exp: Likewise. + * mi0-var-child.exp: Likewise. + * mi0-var-cmd.exp: Likewise. + * mi0-var-display.exp: Likewise. + +2002-09-16 Keith Seitz <keiths@redhat.com> + + * gdb701.exp: New file for testing varobj target type bug. + * gdb701.c: New file. + +2002-09-13 Keith Seitz <keiths@redhat.com> + + * mi-var-child.exp: Use mi_step_to and mi_execute_to instead + of a bunch of repeated send_gdb/gdb_expect statements. + Fix line numbers. + +2002-09-10 Keith Seitz <keiths@redhat.com> + + * mi-simplerun.exp (test_controlled_execution): Follow renaming of + mi_run_to to mi_execute_to. + * mi-var-cmd.exp: Likewise. + * mi0-simplerun.exp: Likewise. + * mi0-var-cmd.exp: Likewise. + +2002-09-03 Keith Seitz <keiths@redhat.com> + + * gdb680.exp: New file to test to check for uiout list/tuple + nesting bug. + +2002-03-04 Michael Chastain <mec@shout.net> + + * mi-var-cmd.exp: In test "create local variable func", + accommodate gcc v3 function signature. + * mi0-var-cmd-exp: Ditto. + +2002-02-05 Jim Blandy <jimb@redhat.com> + + * mi-regs.exp: Various cleanups for SPARC-only tests. + (test_breakpoints_creation_and_listing): Format of breakpoint + table has changed. + (sparc_register_tests): Expand floating-point number regexp to + recognize NaN values, too. Replace ineffectual single backslash + before a hyphen with a double backslash. Don't check the exact + numbers of the registers which have changed, since there's no way + to know which registers changed, exactly; just check that the + result is well-formed. + * mi0-regs.exp: (sparc_register_tests): Same as for + sparc_register_tests in mi-regs.exp. + + * mi-var-child.exp ("get children of struct_declarations", "get + children of struct_declarations.s2.u2.u1s2", "get children of + weird"): Tolerate argument types when they appear in function + types. (Dwarf 2 includes prototype info; STABS does not.) + * mi0-var-child.exp: Same. + +2001-12-19 Keith Seitz <keiths@redhat.com> + + * mi-var-display.exp: char* variables have a child. Update all + occurences. + * mi0-var-display.exp: Likewise. + +2001-08-29 Andrew Cagney <cagney@redhat.com> + + * mi-var-cmd.exp, mi0-var-cmd.exp: Variable lpcharacter has one + child. Soften floating point tests. + +2001-08-09 Andrew Cagney <ac131313@redhat.com> + + * mi0-var-block.exp, mi0-stack.exp, mi0-simplerun.exp, + mi0-regs.exp, mi0-watch.exp, mi0-stepi.exp, mi0-until.exp, + mi0-return.exp, mi0-read-memory.exp, mi0-eval.exp, + mi0-disassemble.exp, mi0-console.exp, mi-watch.exp, + mi-var-display.exp, mi-var-cmd.exp, mi-var-child.exp, + mi-until.exp, mi-var-block.exp, mi-stepi.exp, mi-stack.exp, + mi-simplerun.exp, mi-return.exp, mi-regs.exp, mi-read-memory.exp, + mi-disassemble.exp, mi-eval.exp, mi-console.exp: Replace pattern + matching thread=0 with one to also match thread=1. + Fix PR gdb/190. + +2001-08-18 Andrew Cagney <ac131313@redhat.com> + + * mi0-until.exp, mi-until.exp, mi0-stepi.exp, mi-stepi.exp, + mi-simplerun.exp, mi0-simplerun.exp, mi0-return.exp, + mi-return.exp, mi0-console.exp, mi-console.exp: Recognize an + unexpected run-to-main response. Report as a fail. + +2001-06-27 Andrew Cagney <ac131313@redhat.com> + + * mi-disassemble.exp: Update to accept mi1 breakpoint tables. + * mi-basics.exp: Ditto. + * mi-simplerun.exp: Ditto. + * mi-watch.exp: Ditto. Add check for full header. + * mi-break.exp: Ditto. Add check for full header. + +2001-06-26 Andrew Cagney <ac131313@redhat.com> + + * mi-stack.exp: Update. Output for args=... and + locals=... changed to a list. + +2001-06-26 Andrew Cagney <ac131313@redhat.com> + + * mi-stack.exp: Update. Output for stack=..., args=... and + stack-args=... changed to a list. + +2001-06-25 Andrew Cagney <ac131313@redhat.com> + + * mi-console.exp: Update args=... part of stop-reason + patterns. Output changed to a list of arguments. + * mi-disassemble.exp: Ditto. + * mi-simplerun.exp: Ditto. + * mi-return.exp: Ditto. + * mi-read-memory.exp: Ditto. + * mi-eval.exp: Ditto. + * mi-watch.exp: Ditto. + * mi-var-display.exp: Ditto. + * mi-var-cmd.exp: Ditto. + * mi-var-child.exp: Ditto. + * mi-var-block.exp: Ditto. + * mi-until.exp: Ditto. + * mi-stepi.exp: Ditto. + * mi-stack.exp: Ditto. + * mi-regs.exp: Ditto. + +2001-06-25 Andrew Cagney <ac131313@redhat.com> + + * mi-read-memory.exp: Update patterns matching data-read-memory. + Outputs a list. + +2001-06-25 Andrew Cagney <ac131313@redhat.com> + + * mi-regs.exp: Update patterns matching register-values. Outputs a + list. + +2001-06-25 Andrew Cagney <ac131313@redhat.com> + + * mi-regs.exp: Update patters matching register-names. Now + outputs a list. + +2001-06-25 Andrew Cagney <ac131313@redhat.com> + + * mi-regs.exp: Update patterns matching changed-registers. Now + outputs a list. + +2001-06-23 Andrew Cagney <ac131313@redhat.com> + + * ChangeLog-mi: Rename to ChangeLog. + * mi-basics.exp: Remove local emacs variable defining + change-log-default-name. + * mi-break.exp, mi-console.exp, mi-disassemble.exp: Ditto. + * mi-eval.exp, mi-hack-cli.exp, mi-read-memory.exp: Ditto. + * mi-regs.exp, mi-return.exp, mi-simplerun.exp: Ditto. + * mi-stack.exp, mi-stepi.exp, mi-until.exp: Ditto. + * mi-var-block.exp, mi-var-child.exp, mi-var-cmd.exp: Ditto. + * mi-var-display.exp, mi-watch.exp, mi0-basics.exp: Ditto. + * mi0-break.exp, mi0-console.exp, mi0-disassemble.exp: Ditto. + * mi0-eval.exp, mi0-hack-cli.exp, mi0-read-memory.exp: Ditto. + * mi0-regs.exp, mi0-return.exp, mi0-simplerun.exp: Ditto. + * mi0-stack.exp, mi0-stepi.exp, mi0-until.exp: Ditto. + * mi0-var-block.exp, mi0-var-child.exp, mi0-var-cmd.exp: Ditto. + * mi0-var-display.exp, mi0-watch.exp: Ditto. + +2001-06-23 Andrew Cagney <ac131313@redhat.com> + + * mi-disassemble.exp: Update patterns matching data-disassemble + output. Now produces a list of instructions and a list of + source/assembly lines. + +2001-06-18 Andrew Cagney <ac131313@redhat.com> + + * mi-basics.exp, mi-break.exp, mi-console.exp, mi-disassemble.exp, + mi-eval.exp, mi-hack-cli.exp, mi-read-memory.exp, mi-regs.exp, + mi-return.exp, mi-simplerun.exp, mi-stack.exp, mi-stepi.exp, + mi-until.exp, mi-var-block.exp, mi-var-child.exp, mi-var-cmd.exp, + mi-var-display.exp, mi-watch.exp, mi0-basics.exp, mi0-break.exp, + mi0-console.exp, mi0-disassemble.exp, mi0-eval.exp, + mi0-hack-cli.exp, mi0-read-memory.exp, mi0-regs.exp, + mi0-return.exp, mi0-simplerun.exp, mi0-stack.exp, mi0-stepi.exp, + mi0-until.exp, mi0-var-block.exp, mi0-var-child.exp, + mi0-var-cmd.exp, mi0-var-display.exp, mi0-watch.exp: Use MIFLAGS + to explictly select an interpreter. + +2001-06-16 Andrew Cagney <ac131313@redhat.com> + + MI0 was the never enabled MI interface included in GDB 5.0. + * mi0-basics.exp: Copy mi-basics.exp. + * mi0-break.exp: Copy mi-break.exp. + * mi0-console.exp: Copy mi-console.exp. + * mi0-disassemble.exp: Copy mi-disassemble.exp. + * mi0-eval.exp: Copy mi-eval.exp. + * mi0-hack-cli.exp: Copy mi-hack-cli.exp. + * mi0-read-memory.exp: Copy mi-read-memory.exp. + * mi0-regs.exp: Copy mi-regs.exp. + * mi0-return.exp: Copy mi-return.exp. + * mi0-simplerun.exp: Copy mi-simplerun.exp. + * mi0-stack.exp: Copy mi-stack.exp. + * mi0-stepi.exp: Copy mi-stepi.exp. + * mi0-until.exp: Copy mi-until.exp. + * mi0-var-block.exp: Copy mi-var-block.exp. + * mi0-var-child.exp: Copy mi-var-child.exp. + * mi0-var-cmd.exp: Copy mi-var-cmd.exp. + * mi0-var-display.exp: Copy mi-var-display.exp. + * mi0-watch.exp: Copy mi-watch.exp. + +2001-05-11 Fernando Nasser <fnasser@redhat.com> + + * mi-var-child.exp: Adjust for the fact that now (char *) can be + dereferenced. + +2001-03-06 Kevin Buettner <kevinb@redhat.com> + + * mi-basics.exp, mi-break.exp, mi-disassemble.exp, + mi-eval.exp, mi-hack-cli.exp, mi-read-memory.exp, mi-regs.exp, + mi-return.exp, mi-simplerun.exp, mi-stack.exp, mi-stepi.exp, + mi-until.exp, mi-watch.exp: Update/correct copyright notices. + +2001-01-20 Mark Kettenis <kettenis@gnu.org> + + * mi-support.exp (mi_gdb_start): Skip mi tests if -i flag is + recognized (i.e. if GDB was compiled with UI_OUT, but the mi + interpreter wasn't recognized (because it wasn't compiled in). + +Tue Apr 18 15:36:07 2000 Andrew Cagney <cagney@b1.cygnus.com> + + * Makefile.in (clean mostlyclean): Do not delete $(MISCELLANEOUS). + +Tue Mar 14 15:54:57 2000 Andrew Cagney <cagney@b1.cygnus.com> + + * basics.c: Add EMACS local variable pointing change-log at this + file. + * Makefile.in: Ditto + +2000-03-13 James Ingham <jingham@leda.cygnus.com> + + * mi-var-block.exp: The error report from varobj_create changed + since I am now trapping parse_exp_1 errors. Change the tests to + match the new error message. + * mi-var-child.exp: Ditto. + * mi-var-cmd.exp: Ditto. + +2000-03-06 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-disassemble.exp: Don't assume numbers for the offset + values. They can be different depending on the architecture. + + * mi-watch.exp (test_watchpoint_triggering): In same cases the + type can be 'hw wathcpoint' not just 'watchpoint'. Adjust for that. + + * basics.c (callee4): Make the function return something, + otherwise the return value is undefined. + +2000-03-06 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-basics.exp: Comment out test for a still unimplemented operation. + + * mi-disassemble.exp: Rewrite most of the tests to conform to new + disassemble interface. + +Sat Mar 4 13:55:08 2000 Andrew Cagney <cagney@b1.cygnus.com> + + From Fri 3 Mar 2000 Peter Schauer: + * mi-support.exp (mi_gdb_start): When GDB doesn't recongize -i=mi + option, assume no MI support present. + +2000-02-01 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-support.exp (mi_gdb_start): Update to recognize start up + message with 'UI_OUT' instead of 'HEADLESS'. + +2000-01-27 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-regs.exp (test_running_the_program): Add global var 'hex'. + + * mi-stack.exp, mi-stepi.exp, mi-until.exp, mi-watch.exp, + mi-var-display.exp, mi-var-cmd.exp, mi-var-child.exp, + mi-var-block.exp: Update all stopped messages. + +2000-01-17 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-console.exp, mi-disassemble.exp, mi-eval.exp, + mi-read-memory.exp, mi-regs.exp, mi-return.exp, mi-simplerun.exp: + Update stopped messages, update copyright. + + * mi-disassemble.exp: Update error messages output. + + * mi-support.exp (proc mi_step): Make gdb do a 'step' command, not + a 'next'. Update stopped message. + (proc mi_next): Update stop message. + (proc mi_run_to_main): Update stopped message. + Update copyright. + +2000-01-11 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-simplerun.exp: Remove stack frames tests from here, to: + + * mi-stack.exp: New file, tests for stack commands. + + * mi-support.exp (mi_run_to_main, mi_next, mi_step) : Update to + include thread-id in stopped message. + + * mi-regs.exp: Update break-insert output. + + * (mi-console.exp, mi-disassemble.exp, mi-eval.exp, + mi-read-memory.exp, mi-regs.exp, mi-return.exp, mi-simplerun.exp, + mi-stepi.exp, mi-until.exp, mi-var-block.exp, mi-var-child.exp, + mi-var-cmd.exp, mi-var-display.exp, mi-watch.exp): Update stopped + message to include thread-id. + +Wed Dec 29 22:06:05 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-watch.exp, mi-var-display.exp, mi-var-cmd.exp, + mi-var-child.exp, mi-var-block.exp, mi-until.exp, mi-stepi.exp, + mi-simplerun.exp, mi-return.exp, mi-support.exp, mi-eval.exp, + mi-console.exp, mi-disassemble.exp, mi-break.exp: Update to + reflect extended output from -break-insert command. + + * mi-break.exp (test_rbreak_creation_and_listing): XFAIL regexp + tests. -r flag broken by above. + +Sun Dec 19 19:28:13 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * cpp_variable.cc, cpp_variable.h, c_variable.c: Delete. + +Fri Dec 17 20:59:55 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-read-memory.exp: Test of ``-o <offset>'' now works. + +1999-12-16 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-var-cmd.exp: Fix 2 tests outputs. + + * mi-var-child.exp: Add many more tests. + + * mi-var-display.exp: Add many more tests. + + * var-cmd.c: Change type of incr_a parameter to char. + +1999-12-15 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-var-block.exp: Set up xfails fro known problems. + + * mi-var-display.exp: Set up printing of values of 'e' and 'anone' + as xfails. + + * mi-var-child.exp: Fix typos. + +1999-12-15 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-var-child.exp: Space was missing before ``[10]''. + +Wed Dec 15 19:23:38 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-read-memory.exp: Add test for ``-o <offset>''. Update checks + and match next-row et.al. + +1999-12-14 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-var-display.exp : New file. Tests for format and type, with + unions, structs and enums. + + * mi-var-cmd.exp: Add some var-assign tests. + +1999-12-14 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-var-cmd.exp, mi-var-block.exp, mi-var-child.exp: New files + some tests for -var* commands. + + * var-cmd.c: New source file for var-* commands tests. + * gdb.mi/Makefile.in (PROGS): Add var-cmd. + +Mon Dec 13 18:06:09 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-break.exp: Fix quoting. Changed "srcfile.c":6 to + "\"srcfile.c\":6". + * mi-simplerun.exp: Fix quoting. + +Sat Dec 11 21:33:37 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-simplerun.exp (exec-finish): Fix return value was zero, + should have been three. + + * mi-disassemble.exp: Reduce number of wild card matches in + * patterns. Remove all numeric constants. + +1999-12-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-eval.exp: New file. Some initial tests for + -data-evaluate-expression. + +1999-12-09 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * c_variable.c, cpp_variable.cc, cpp_variable.h: New files. Used + for testing "var" operations. + * Makefile.in: Add reference to the above files. + +1999-12-08 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-regs.exp: Fix test for format 'N' for + data-list-register-values. + +1999-12-07 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-disassemble.exp: Update expected output. Break test of + disassembly in mixed mode into 2 functions. + + * mi-regs.exp: Initial register tests. Works only on sparc right + now. + +1999-12-02 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-stepi.exp: New file. Tests exec-step-instruction and + exec-next-instruction. + * mi-until.exp: New file. Tests exec-until. + * until.c: New file. + * mi-return.exp: New file. Tests exec-return. + +Thu Dec 2 09:38:23 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-hack-cli.exp: New test. Check the hacked up access to the + CLI. + +Wed Dec 1 16:47:40 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-basics.exp: Delete calls to mi_delete_breakpoints, + mi_gdb_reinitialize_dir and mi_gdb_load. This test is checking + that these can work. + + * mi-support.exp (mi_step, mi_next, mi_run_to_main): New + procedures. + + * mi-read-memory.exp, mi-read-memory.c: New files. Test + data-read-memory command. + +Tue Nov 30 23:54:16 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-support.exp: Don't start SID until after GDB has been started + and verified. + +Tue Nov 30 22:21:33 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-support.exp (mi_uncatched_gdb_exit): When SID, call sid_exit. + (mi_gdb_start): When SID, call sid_start. + (mi_gdb_start): Add MIFLAGS to spawn-GDB command. Check for + HEADLESS gdb. Return non-zero when GDB fails to start. + (mi_gdb_load): When SID or SIM, download program. + (mi_run_cmd): Don't do download here. Assume target supports the + 00-exec-run command. + (skip_mi_tests, setup_gdbmi, unset_gdbmi): Delete. Merged into + mi_gdb_start. + + * mi-basics.exp, mi-break.exp, mi-console.exp, mi-disassemble.exp, + mi-simplerun.exp, mi-watch.exp: Update. Check status from + mi_gdb_start indicating that GDB started correctly. + +Tue Nov 30 15:22:08 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-support.exp (setup_gdbmi, unset_gdbmi): New + procedures. Setup/unset dejagnu for mi tests. + * mi-basics.exp, mi-console.exp, mi-simplerun.exp, mi-break.exp, + mi-disassemble.exp, mi-watch.exp: Update. + +1999-11-29 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-simplerun.exp (test_running_the_program): Remove XFAIL. The + output is fixed now. + (test_program_termination): Update output pattern. + +Tue Nov 30 00:19:10 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-console.c, mi-console.exp: New files. Test console output. + +Mon Nov 29 17:59:13 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-support.exp (mi_run_command): Check for exec-run command + failure due to MI not having an active target. + (mi_run_command): Check for and handle a builtin simulator target. + (mi_run_command): Don't check/handle for ``The program has been + started already'', not a valid MI response. + + * mi-simplerun.exp (test_running_the_program): Update all patterns + to match async output. + (test_running_the_program): Mark ``step to callee4'' as XFAIL. MI + output contains {,reason="end-stepping-range"}+. + + * mi-simplerun.exp: Limit the timeout for ``step to callee4'' to + 30 seconds. + +Mon Nov 29 17:30:00 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * mi-support.exp (skip_mi_tests): Print UNTESTED when MI interface + isn't available. Start/stop instead of assuming GDB is running. + (MIFLAGS): Define. + * mi-simplerun.exp, mi-disassemble.exp, mi-break.exp, + mi-basics.exp, mi-watch.exp: Update. + +1999-11-26 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * mi-simplerun.exp: Move break-insert {-t, -r} from here. + * mi-break.exp: To here. New file. + * mi-watch.exp: New file. Tests for watchpoints. + +Wed Nov 24 17:42:07 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * gdb.mi/ChangeLog-mi: MI entries moved to here. + +Wed Nov 24 17:31:04 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * gdb.mi/mi-basics.exp, gdb.mi/mi-disassemble.exp, + gdb.mi/mi-simplerun.exp: Print warning message when test isn't + run. + +1999-11-23 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.mi/mi-simplerun.exp: Update output of break-list to account for + "times" field. + +1999-11-05 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.mi/mi-simplerun.exp: Add tests for temporary breakpoints + and bp based on regular expressions. + * gdb.mi/mi-disassemble.exp: Fix typo. + +1999-11-04 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.mi/mi-disassemble.exp: Update output of execution commands + to reflect new 'reason' field. + * gdb.mi/mi-simplerun.exp: Ditto. + +1999-10-25 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.mi/mi-simplerun.exp: Add more stack-list-frames tests. + + * gdb.mi/mi-disassemble.exp: Update 'run to main' output. + + * gdb.mi/mi-simplerun.exp: Update execution commands + output. Update backtrace output. + +1999-10-18 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.mi/mi-disassemble.exp: Add new tests for the new + disassembly command parameter, number of lines. + +Mon Oct 11 13:57:21 1999 Andrew Cagney <cagney@amy.cygnus.com> + + * lib/mi-support.exp: Break complicated gdb_expect containing + exp_continue into a while within an expect. Don't attempt a start + more than three times. Check return value from gdb_load. + +1999-10-06 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.mi/mi-disassemble.exp: New file. + +Wed Oct 6 12:05:58 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * lib/mi-support.exp (mi_run_cmd): Give up after two restart + attempts. + +1999-09290 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * gdb.mi/mi-basics.exp: Update to current syntax and output formats. + * gdb.mi/mi-simplerun.exp: Ditto. + * lib/mi-support.exp (mi_delete_breakpoints): Ditto. + +1999-06-30 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * gdb.mi/basics.c (main): Fix return code. Add a print "Hello, + World". + * gdb.mi/mi-basics.exp: Fix message texts and numbering. + * gdb.mi/mi-simplerun.exp: Ditto. Also, add new tests and improve + some patterns. + +1999-06-30 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * lib/mi-support.exp (mi_gdb_reinitialize_dir): Remove query as an + acceptable response to the environment-dir command. + +1999-06-30 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * lib/mi-support.exp (mi_delete_breakpoints): Remove references to + gdb-cli. + (mi_run_cmd): Ditto. + +1999-06-25 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * lib/mi-support.exp (skip_mi_tests): Use gdb-version to check for + headless output format. + +1999-06-24 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * gdb.mi/mi-simplerun.exp (test_controlled_execution): Add global + spec for hex. + +1999-06-24 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * lib/mi-support.exp (mi_run_cmd): Fix pattern and add a timeout + clause. + +1999-06-24 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * lib/mi-support.exp: Use mi_gdb_prompt instead of a modified + gdb_prompt. Remove uneeded loading of libgloss. + (mi_gdb_exit): Remove prompt argument. + (mi_uncatched_gdb_exit): Ditto. + (mi_run_cmd): New proc. MI version of gdb_run. + (skip_mi_tests): New proc. Check if gdb is capable of producing + headless formatted output. + * gdb.mi/mi-basics.exp: Use mi_gdb_prompt instead of a modified + gdb_prompt. Eliminate parameter to mi_gdb_exit (as a result of + the above). Test for skip_mi_tests before running. + Note: The above changes are interelated (need each other). + * gdb.mi/mi-simplerun.exp: Same changes as for mi-basics.exe + above. + (test_breakpoint_creation_and_listing): Remove insertion of + breakpoint at callee1 (and renumber tokens). Add tests for + break-list, break-disable and break-info. + (test_running_the_program): Use mi_run_cmd so it can run on remote + targets. + (test_controlled_execution): Fix broken test. + (test_program_termination): Test implemented. + * gdb.mi/basic.c (main): Small change to allow for testing of both + exec-next and exec-step operations. + +1999-06-22 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * lib/mi-support.exp (mi_gdb_test): New proc. MI version of gdb_test. + * gdb.mi/mi-basics.exp: Use the above instead of gdb_test. + * gdb.mi/mi-simplerun.exp: Ditto. + +1999-06-22 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * gdb.mi/mi-simplerun.exp: New file. Tests simple debugging tasks. + * gdb.mi/mi-basics.exp: Remove tests moved to above new file. + * lib/mi-support.exp: New file. Support procedures for mi tests. + +1999-06-08 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * gdb.mi/mi-basics.exp: Skip all tests if the MI interpreter is + not active. + +1999-06-03 Fernando Nasser <fnasser@totem.to.cygnus.com> + + * gdb.mi: New directory. + * configure.in: Configure it. + * configure: Regenerate. + * gdb.mi/{Makefile.in,configure.in,configure}: New files. + * gdb.mi/{mi-basics.exp,basics.c,testcmds}: New files. + + +Local Variables: +mode: indented-text +left-margin: 8 +fill-column: 74 +version-control: never +End: |