1 /* Dynamic architecture support for GDB, the GNU debugger.
2 Copyright 1998-1999, Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
25 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
27 /* Just include everything in sight so that the every old definition
28 of macro is visible. */
29 #include "gdb_string.h"
34 #include "breakpoint.h"
39 #include "gdbthread.h"
41 #include "symfile.h" /* for overlay functions */
44 #include "floatformat.h"
46 /* Convenience macro for allocting typesafe memory. */
49 #define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
53 /* Use the program counter to determine the contents and size
54 of a breakpoint instruction. If no target-dependent macro
55 BREAKPOINT_FROM_PC has been defined to implement this function,
56 assume that the breakpoint doesn't depend on the PC, and
57 use the values of the BIG_BREAKPOINT and LITTLE_BREAKPOINT macros.
58 Return a pointer to a string of bytes that encode a breakpoint
59 instruction, stores the length of the string to *lenptr,
60 and optionally adjust the pc to point to the correct memory location
61 for inserting the breakpoint. */
64 legacy_breakpoint_from_pc (CORE_ADDR
* pcptr
, int *lenptr
)
66 /* {BIG_,LITTLE_}BREAKPOINT is the sequence of bytes we insert for a
67 breakpoint. On some machines, breakpoints are handled by the
68 target environment and we don't have to worry about them here. */
70 if (TARGET_BYTE_ORDER
== BIG_ENDIAN
)
72 static unsigned char big_break_insn
[] = BIG_BREAKPOINT
;
73 *lenptr
= sizeof (big_break_insn
);
74 return big_break_insn
;
77 #ifdef LITTLE_BREAKPOINT
78 if (TARGET_BYTE_ORDER
!= BIG_ENDIAN
)
80 static unsigned char little_break_insn
[] = LITTLE_BREAKPOINT
;
81 *lenptr
= sizeof (little_break_insn
);
82 return little_break_insn
;
87 static unsigned char break_insn
[] = BREAKPOINT
;
88 *lenptr
= sizeof (break_insn
);
97 generic_frameless_function_invocation_not (struct frame_info
*fi
)
103 generic_return_value_on_stack_not (struct type
*type
)
109 legacy_register_name (int i
)
111 #ifdef REGISTER_NAMES
112 static char *names
[] = REGISTER_NAMES
;
113 if (i
< 0 || i
>= (sizeof (names
) / sizeof (*names
)))
118 internal_error ("legacy_register_name: called.");
123 #if defined (CALL_DUMMY)
124 LONGEST legacy_call_dummy_words
[] = CALL_DUMMY
;
126 LONGEST legacy_call_dummy_words
[1];
128 int legacy_sizeof_call_dummy_words
= sizeof (legacy_call_dummy_words
);
131 generic_remote_translate_xfer_address (CORE_ADDR gdb_addr
, int gdb_len
,
132 CORE_ADDR
* rem_addr
, int *rem_len
)
134 *rem_addr
= gdb_addr
;
139 generic_prologue_frameless_p (CORE_ADDR ip
)
141 #ifdef SKIP_PROLOGUE_FRAMELESS_P
142 return ip
== SKIP_PROLOGUE_FRAMELESS_P (ip
);
144 return ip
== SKIP_PROLOGUE (ip
);
149 /* Helper functions for INNER_THAN */
152 core_addr_lessthan (lhs
, rhs
)
160 core_addr_greaterthan (lhs
, rhs
)
168 /* Helper functions for TARGET_{FLOAT,DOUBLE}_FORMAT */
170 const struct floatformat
*
171 default_float_format (struct gdbarch
*gdbarch
)
174 int byte_order
= gdbarch_byte_order (gdbarch
);
176 int byte_order
= TARGET_BYTE_ORDER
;
181 return &floatformat_ieee_single_big
;
183 return &floatformat_ieee_single_little
;
185 internal_error ("default_float_format: bad byte order");
190 const struct floatformat
*
191 default_double_format (struct gdbarch
*gdbarch
)
194 int byte_order
= gdbarch_byte_order (gdbarch
);
196 int byte_order
= TARGET_BYTE_ORDER
;
201 return &floatformat_ieee_double_big
;
203 return &floatformat_ieee_double_little
;
205 internal_error ("default_double_format: bad byte order");
211 extern initialize_file_ftype __initialize_gdbarch_utils
;
214 __initialize_gdbarch_utils (void)