diff options
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/call-signal-resume.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/stale-infcall.c | 63 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/stale-infcall.exp | 57 |
4 files changed, 140 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2b55c3e..be5f0f6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2012-06-18 Jan Kratochvil <jan.kratochvil@redhat.com> + + Remove stale dummy frames. + * gdb.base/call-signal-resume.exp (maintenance print dummy-frames) + (maintenance info breakpoints): New tests. + * gdb.base/stale-infcall.c: New file. + * gdb.base/stale-infcall.exp: New file. + 2012-06-17 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.arch/amd64-entry-value-param.S: New file. diff --git a/gdb/testsuite/gdb.base/call-signal-resume.exp b/gdb/testsuite/gdb.base/call-signal-resume.exp index d383f5c..2baa3f6 100644 --- a/gdb/testsuite/gdb.base/call-signal-resume.exp +++ b/gdb/testsuite/gdb.base/call-signal-resume.exp @@ -101,6 +101,18 @@ gdb_test "frame $frame_number" ".*" gdb_test_no_output "set confirm off" gdb_test "return" "" +# Verify there are no remains of the dummy frame. +gdb_test_no_output "maintenance print dummy-frames" +set test "maintenance info breakpoints" +gdb_test_multiple $test $test { + -re " call dummy .*\r\n$gdb_prompt $" { + fail $test + } + -re "\r\n$gdb_prompt $" { + pass $test + } +} + # Resume execution, the program should continue without any signal. gdb_test "break stop_two" "Breakpoint \[0-9\]* at .*" diff --git a/gdb/testsuite/gdb.base/stale-infcall.c b/gdb/testsuite/gdb.base/stale-infcall.c new file mode 100644 index 0000000..1f5169a --- /dev/null +++ b/gdb/testsuite/gdb.base/stale-infcall.c @@ -0,0 +1,63 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2012 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 3 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, see <http://www.gnu.org/licenses/>. */ + +#include <setjmp.h> +#include <string.h> +#include <stdlib.h> + +#define BUFSIZE 0x1000 + +static jmp_buf jmp; + +void +infcall (void) +{ + longjmp (jmp, 1); +} + +static void +run1 (void) +{ + char buf[BUFSIZE / 2]; + int dummy = 0; + + dummy++; /* break-run1 */ +} + +static char buf_zero[BUFSIZE]; + +static void +run2 (void) +{ + char buf[BUFSIZE]; + + memset (buf, 0, sizeof (buf)); + + if (memcmp (buf, buf_zero, sizeof (buf)) != 0) /* break-run2 */ + abort (); /* break-fail */ +} + +int +main () +{ + if (setjmp (jmp) == 0) + run1 (); + else + run2 (); + + return 0; /* break-exit */ +} diff --git a/gdb/testsuite/gdb.base/stale-infcall.exp b/gdb/testsuite/gdb.base/stale-infcall.exp new file mode 100644 index 0000000..bb22339 --- /dev/null +++ b/gdb/testsuite/gdb.base/stale-infcall.exp @@ -0,0 +1,57 @@ +# Copyright (C) 2012 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 3 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, see <http://www.gnu.org/licenses/>. + +set testfile stale-infcall +set srcfile ${testfile}.c +if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { + return -1 +} + +if ![runto_main] { + return -1 +} + +gdb_breakpoint [gdb_get_line_number "break-run1"] +gdb_breakpoint [gdb_get_line_number "break-run2"] +gdb_breakpoint [gdb_get_line_number "break-exit"] +gdb_breakpoint [gdb_get_line_number "break-fail"] + +gdb_continue_to_breakpoint "break-run1" ".* break-run1 .*" + +gdb_test "print infcall ()" " break-run2 .*The program being debugged stopped while in a function called from GDB\\..*When the function is done executing, GDB will silently stop\\." + +set test "stack corrupted" +gdb_test_multiple "continue" $test { + -re " break-exit .*\r\n$gdb_prompt $" { + pass $test + } + -re " break-fail .*\r\n$gdb_prompt $" { + fail $test + } +} + +gdb_test "bt" "#0 \[^\r\n\]* main \[^\r\n\]*" + +# Verify there are no remains of the dummy frame. +gdb_test_no_output "maintenance print dummy-frames" +set test "maintenance info breakpoints" +gdb_test_multiple $test $test { + -re " call dummy .*\r\n$gdb_prompt $" { + fail $test + } + -re "\r\n$gdb_prompt $" { + pass $test + } +} |