diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-06-18 17:28:38 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-06-18 17:28:38 +0000 |
commit | e2e4d78b2216962789c8a982d3e889ba6933321a (patch) | |
tree | cd9aa71e52f6bb308e2b82e5b23ec1949d043518 /gdb/testsuite/gdb.base/stale-infcall.c | |
parent | 2012-06-18 Greta Yorsh <Greta.Yorsh@arm.com> (diff) | |
download | binutils-gdb-e2e4d78b2216962789c8a982d3e889ba6933321a.tar.gz binutils-gdb-e2e4d78b2216962789c8a982d3e889ba6933321a.tar.bz2 binutils-gdb-e2e4d78b2216962789c8a982d3e889ba6933321a.zip |
gdb/
Remove stale dummy frames.
* breakpoint.c: Include dummy-frame.h.
(longjmp_breakpoint_ops): New variable.
(update_breakpoints_after_exec, breakpoint_init_inferior): Delete also
bp_longjmp_call_dummy.
(bpstat_what, bptype_string, print_one_breakpoint_location)
(init_bp_location): Support bp_longjmp_call_dummy.
(set_longjmp_breakpoint): Use longjmp_breakpoint_ops. Comment why.
(set_longjmp_breakpoint_for_call_dummy)
(check_longjmp_breakpoint_for_call_dummy, longjmp_bkpt_dtor): New
functions.
(initialize_breakpoint_ops): Initialize longjmp_breakpoint_ops.
* breakpoint.h (enum bptype): New item bp_longjmp_call_dummy. Delete
FIXME comment and extend the other comment for bp_call_dummy.
(set_longjmp_breakpoint_for_call_dummy)
(check_longjmp_breakpoint_for_call_dummy): New declarations.
* dummy-frame.c: Include gdbthread.h.
(pop_dummy_frame_bpt): New function.
(pop_dummy_frame): Call pop_dummy_frame_bpt.
(dummy_frame_discard): New function.
(cleanup_dummy_frames): Update the comment about longjmps.
* dummy-frame.h (dummy_frame_discard): New declaration.
* gdbthread.h (struct thread_info): Extend initiating_frame comment.
* infcall.c (call_function_by_hand): New variable longjmp_b. Call
set_longjmp_breakpoint_for_call_dummy. Chain its breakpoints with BPT.
* infrun.c (handle_inferior_event) <BPSTAT_WHAT_CLEAR_LONGJMP_RESUME>:
Add case 4 comment. Call check_longjmp_breakpoint_for_call_dummy and
keep_going if IS_LONGJMP and there is no other reason to stop.
gdb/testsuite/
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.
Diffstat (limited to 'gdb/testsuite/gdb.base/stale-infcall.c')
-rw-r--r-- | gdb/testsuite/gdb.base/stale-infcall.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/stale-infcall.c b/gdb/testsuite/gdb.base/stale-infcall.c new file mode 100644 index 00000000000..1f5169a7c8e --- /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 */ +} |