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 /* Convenience macro for allocting typesafe memory. */
47 #define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
51 /* Use the program counter to determine the contents and size
52 of a breakpoint instruction. If no target-dependent macro
53 BREAKPOINT_FROM_PC has been defined to implement this function,
54 assume that the breakpoint doesn't depend on the PC, and
55 use the values of the BIG_BREAKPOINT and LITTLE_BREAKPOINT macros.
56 Return a pointer to a string of bytes that encode a breakpoint
57 instruction, stores the length of the string to *lenptr,
58 and optionally adjust the pc to point to the correct memory location
59 for inserting the breakpoint. */
62 legacy_breakpoint_from_pc (CORE_ADDR
* pcptr
, int *lenptr
)
64 /* {BIG_,LITTLE_}BREAKPOINT is the sequence of bytes we insert for a
65 breakpoint. On some machines, breakpoints are handled by the
66 target environment and we don't have to worry about them here. */
68 if (TARGET_BYTE_ORDER
== BIG_ENDIAN
)
70 static unsigned char big_break_insn
[] = BIG_BREAKPOINT
;
71 *lenptr
= sizeof (big_break_insn
);
72 return big_break_insn
;
75 #ifdef LITTLE_BREAKPOINT
76 if (TARGET_BYTE_ORDER
!= BIG_ENDIAN
)
78 static unsigned char little_break_insn
[] = LITTLE_BREAKPOINT
;
79 *lenptr
= sizeof (little_break_insn
);
80 return little_break_insn
;
85 static unsigned char break_insn
[] = BREAKPOINT
;
86 *lenptr
= sizeof (break_insn
);
95 generic_frameless_function_invocation_not (struct frame_info
*fi
)
101 generic_return_value_on_stack_not (struct type
*type
)
107 legacy_register_name (int i
)
109 #ifdef REGISTER_NAMES
110 static char *names
[] = REGISTER_NAMES
;
111 if (i
< 0 || i
>= (sizeof (names
) / sizeof (*names
)))
116 internal_error ("legacy_register_name: called.");
121 #if defined (CALL_DUMMY)
122 LONGEST legacy_call_dummy_words
[] = CALL_DUMMY
;
124 LONGEST legacy_call_dummy_words
[1];
126 int legacy_sizeof_call_dummy_words
= sizeof (legacy_call_dummy_words
);
129 generic_remote_translate_xfer_address (CORE_ADDR gdb_addr
, int gdb_len
,
130 CORE_ADDR
* rem_addr
, int *rem_len
)
132 *rem_addr
= gdb_addr
;
137 generic_prologue_frameless_p (CORE_ADDR ip
)
139 #ifdef SKIP_PROLOGUE_FRAMELESS_P
140 return ip
== SKIP_PROLOGUE_FRAMELESS_P (ip
);
142 return ip
== SKIP_PROLOGUE (ip
);
149 extern initialize_file_ftype __initialize_gdbarch_utils
;
152 __initialize_gdbarch_utils (void)