xref: /openbsd-src/gnu/usr.bin/binutils/gdb/config/alpha/tm-alphalinux.h (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1 /* Definitions to make GDB run on an Alpha box under Linux.  The
2    definitions here are used when the _target_ system is running Linux.
3    Copyright 1996 Free Software Foundation, Inc.
4 
5 This file is part of GDB.
6 
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20 
21 #ifndef TM_LINUXALPHA_H
22 #define TM_LINUXALPHA_H
23 
24 #include "alpha/tm-alpha.h"
25 
26 /* Are we currently handling a signal ?  */
27 
28 extern long alpha_linux_sigtramp_offset PARAMS ((CORE_ADDR);
29 #undef IN_SIGTRAMP
30 #define IN_SIGTRAMP(pc, name)	(alpha_linux_sigtramp_offset (pc) >= 0)
31 
32 /* Get start and end address of sigtramp handler.  */
33 
34 #define SIGTRAMP_START(pc)	(pc - alpha_linux_sigtramp_offset (pc))
35 #define SIGTRAMP_END(pc)	(SIGTRAMP_START(pc) + 3*4)
36 
37 
38 /* Number of traps that happen between exec'ing the shell to run an
39    inferior, and when we finally get to the inferior code.  This is 2
40    on Linux and most implementations.  */
41 
42 #undef START_INFERIOR_TRAPS_EXPECTED
43 #define START_INFERIOR_TRAPS_EXPECTED 2
44 
45 /* Return TRUE if procedure descriptor PROC is a procedure descriptor
46    that refers to a dynamically generated sigtramp function.  */
47 
48 #undef PROC_DESC_IS_DYN_SIGTRAMP
49 #define PROC_SIGTRAMP_MAGIC	0x0e0f0f0f
50 #define PROC_DESC_IS_DYN_SIGTRAMP(proc) ((proc)->pdr.isym		\
51 					 == PROC_SIGTRAMP_MAGIC)
52 #undef SET_PROC_DESC_IS_DYN_SIGTRAMP
53 #define SET_PROC_DESC_IS_DYN_SIGTRAMP(proc) ((proc)->pdr.isym		\
54 					     = PROC_SIGTRAMP_MAGIC)
55 
56 /* If PC is inside a dynamically generated sigtramp function, return
57    how many bytes the program counter is beyond the start of that
58    function.  Otherwise, return a negative value.  */
59 
60 #undef DYNAMIC_SIGTRAMP_OFFSET
61 #define DYNAMIC_SIGTRAMP_OFFSET(pc)	(alpha_linux_sigtramp_offset (pc))
62 
63 /* Translate a signal handler frame into the address of the sigcontext
64    structure.  */
65 
66 #undef SIGCONTEXT_ADDR
67 #define SIGCONTEXT_ADDR(frame)			((frame)->frame - 0x298)
68 
69 /* If FRAME refers to a sigtramp frame, return the address of the next frame.
70 
71    Under Linux, sigtramp handlers have dynamically generated procedure
72    descriptors that make this hack unnecessary.  */
73 
74 #undef FRAME_PAST_SIGTRAMP_FRAME
75 #define FRAME_PAST_SIGTRAMP_FRAME(frame, pc)	(0)
76 
77 #endif /* TM_LINUXALPHA_H */
78