Replace <sys/dir.h> (and <dirent.h>) with "gdb_dirent.h".
[deliverable/binutils-gdb.git] / gdb / arch-utils.c
CommitLineData
c0e8c252
AC
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
61unsigned char *
62legacy_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
94int
95generic_frameless_function_invocation_not (struct frame_info *fi)
96{
97 return 0;
98}
99
71a9f22e
JB
100int
101generic_return_value_on_stack_not (struct type *type)
102{
103 return 0;
104}
105
c0e8c252
AC
106char *
107legacy_register_name (int i)
108{
109#ifdef REGISTER_NAMES
110 static char *names[] = REGISTER_NAMES;
111 if (i < 0 || i >= (sizeof (names) / sizeof (*names)))
112 return NULL;
113 else
114 return names[i];
115#else
116 internal_error ("legacy_register_name: called.");
117 return NULL;
118#endif
119}
120
121#if defined (CALL_DUMMY)
122LONGEST legacy_call_dummy_words[] = CALL_DUMMY;
123#else
124LONGEST legacy_call_dummy_words[1];
125#endif
126int legacy_sizeof_call_dummy_words = sizeof (legacy_call_dummy_words);
127
128void
129generic_remote_translate_xfer_address (CORE_ADDR gdb_addr, int gdb_len,
130 CORE_ADDR * rem_addr, int *rem_len)
131{
132 *rem_addr = gdb_addr;
133 *rem_len = gdb_len;
134}
135
dad41f9a
AC
136int
137generic_prologue_frameless_p (CORE_ADDR ip)
138{
139#ifdef SKIP_PROLOGUE_FRAMELESS_P
140 return ip == SKIP_PROLOGUE_FRAMELESS_P (ip);
141#else
142 return ip == SKIP_PROLOGUE (ip);
143#endif
144}
145
146
3339cf8b
AC
147/* Helper functions for INNER_THAN */
148
149int
150core_addr_lessthan (lhs, rhs)
151 CORE_ADDR lhs;
152 CORE_ADDR rhs;
153{
154 return (lhs < rhs);
155}
156
157int
158core_addr_greaterthan (lhs, rhs)
159 CORE_ADDR lhs;
160 CORE_ADDR rhs;
161{
162 return (lhs > rhs);
163}
164
165
c0e8c252
AC
166/* */
167
168extern initialize_file_ftype __initialize_gdbarch_utils;
169
170void
171__initialize_gdbarch_utils (void)
172{
173}
This page took 0.03749 seconds and 4 git commands to generate.