Rename gdbarch-utils.[hc] to arch-utils.[hc]
[deliverable/binutils-gdb.git] / gdb / arch-utils.c
1 /* Dynamic architecture support for GDB, the GNU debugger.
2 Copyright 1998-1999, Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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. */
20
21 #include "defs.h"
22
23 #if GDB_MULTI_ARCH
24 #include "gdbcmd.h"
25 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
26 #else
27 /* Just include everything in sight so that the every old definition
28 of macro is visible. */
29 #include "gdb_string.h"
30 #include <ctype.h>
31 #include "symtab.h"
32 #include "frame.h"
33 #include "inferior.h"
34 #include "breakpoint.h"
35 #include "gdb_wait.h"
36 #include "gdbcore.h"
37 #include "gdbcmd.h"
38 #include "target.h"
39 #include "gdbthread.h"
40 #include "annotate.h"
41 #include "symfile.h" /* for overlay functions */
42 #endif
43
44 /* Convenience macro for allocting typesafe memory. */
45
46 #ifndef XMALLOC
47 #define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE))
48 #endif
49
50
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. */
60
61 unsigned char *
62 legacy_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
63 {
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. */
67 #ifdef BIG_BREAKPOINT
68 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
69 {
70 static unsigned char big_break_insn[] = BIG_BREAKPOINT;
71 *lenptr = sizeof (big_break_insn);
72 return big_break_insn;
73 }
74 #endif
75 #ifdef LITTLE_BREAKPOINT
76 if (TARGET_BYTE_ORDER != BIG_ENDIAN)
77 {
78 static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
79 *lenptr = sizeof (little_break_insn);
80 return little_break_insn;
81 }
82 #endif
83 #ifdef BREAKPOINT
84 {
85 static unsigned char break_insn[] = BREAKPOINT;
86 *lenptr = sizeof (break_insn);
87 return break_insn;
88 }
89 #endif
90 *lenptr = 0;
91 return NULL;
92 }
93
94 int
95 generic_frameless_function_invocation_not (struct frame_info *fi)
96 {
97 return 0;
98 }
99
100 char *
101 legacy_register_name (int i)
102 {
103 #ifdef REGISTER_NAMES
104 static char *names[] = REGISTER_NAMES;
105 if (i < 0 || i >= (sizeof (names) / sizeof (*names)))
106 return NULL;
107 else
108 return names[i];
109 #else
110 internal_error ("legacy_register_name: called.");
111 return NULL;
112 #endif
113 }
114
115 #if defined (CALL_DUMMY)
116 LONGEST legacy_call_dummy_words[] = CALL_DUMMY;
117 #else
118 LONGEST legacy_call_dummy_words[1];
119 #endif
120 int legacy_sizeof_call_dummy_words = sizeof (legacy_call_dummy_words);
121
122 void
123 generic_remote_translate_xfer_address (CORE_ADDR gdb_addr, int gdb_len,
124 CORE_ADDR * rem_addr, int *rem_len)
125 {
126 *rem_addr = gdb_addr;
127 *rem_len = gdb_len;
128 }
129
130 /* */
131
132 extern initialize_file_ftype __initialize_gdbarch_utils;
133
134 void
135 __initialize_gdbarch_utils (void)
136 {
137 }
This page took 0.044237 seconds and 4 git commands to generate.