1 /* Copyright (C) 2014-2018 Free Software Foundation, Inc.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 /* NOP instruction: must have the same size as the breakpoint
27 #if defined(__s390__) || defined(__s390x__)
28 #define NOP asm("nopr 0")
29 #elif defined(__or1k__)
30 #define NOP asm("l.nop")
32 #define NOP asm("nop")
35 /* Buffer holding the breakpoint instruction. */
36 unsigned char buffer[16];
38 volatile unsigned char *addr_bp;
39 volatile unsigned char *addr_after_bp;
48 NOP; /* write permanent bp here */
49 NOP; /* after permanent bp */
62 memcpy (buffer, (void *) addr_bp, addr_after_bp - addr_bp);
68 test (); /* for SIGTRAP */
69 test (); /* for breakpoint once */
70 test (); /* for breakpoint twice */
71 test (); /* for disabled bp SIGTRAP */
72 test (); /* for breakpoint thrice */
78 test (); /* for next */
79 counter = 0; /* after next */
85 test_signal_handler (int sig)
90 test_signal_with_handler (void)
92 signal (SIGUSR1, test_signal_handler);
97 test_signal_no_handler (void)
99 signal (SIGUSR1, SIG_IGN);
104 test_signal_nested_handler ()
110 test_signal_nested_done (void)
115 test_signal_nested (void)
118 signal (SIGALRM, test_signal_nested_handler);
121 test_signal_nested_done ();
133 test_signal_nested ();
134 test_signal_with_handler ();
135 test_signal_no_handler ();