projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2004-07-21 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git]
/
gdb
/
dve3900-rom.c
diff --git
a/gdb/dve3900-rom.c
b/gdb/dve3900-rom.c
index 4cd035fbf3468852592ec94191efe0fd061132f3..82da6ecaa9f850e9a109a3cadf7a56021b79dced 100644
(file)
--- a/
gdb/dve3900-rom.c
+++ b/
gdb/dve3900-rom.c
@@
-1,6
+1,6
@@
/* Remote debugging interface for Densan DVE-R3900 ROM monitor for
GDB, the GNU debugger.
/* Remote debugging interface for Densan DVE-R3900 ROM monitor for
GDB, the GNU debugger.
- Copyright 1997 Free Software Foundation, Inc.
+ Copyright 1997
, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-28,10
+28,12
@@
#include "command.h"
#include "gdb_string.h"
#include <time.h>
#include "command.h"
#include "gdb_string.h"
#include <time.h>
+#include "regcache.h"
+#include "mips-tdep.h"
/* Type of function passed to bfd_map_over_sections. */
/* Type of function passed to bfd_map_over_sections. */
-typedef void (*section_map_func) (bfd * abfd, asection * sect,
PTR
obj);
+typedef void (*section_map_func) (bfd * abfd, asection * sect,
void *
obj);
/* Packet escape character used by Densan monitor. */
/* Packet escape character used by Densan monitor. */
@@
-112,7
+114,7
@@
static int ethernet = 0;
different names than GDB does, and don't support all the registers
either. */
different names than GDB does, and don't support all the registers
either. */
-static char *r3900_regnames[
NUM_REGS
] =
+static char *r3900_regnames[] =
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@
-120,11
+122,11
@@
static char *r3900_regnames[NUM_REGS] =
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
"S", /* PS_REGNUM */
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
"S", /* PS_REGNUM */
- "l", /* LO_REGNUM */
- "h", /* HI_REGNUM */
- "B", /* BADVADDR_REGNUM */
- "Pcause", /* CAUSE_REGNUM */
- "p" /* PC_REGNUM */
+ "l", /*
MIPS_EMBED_
LO_REGNUM */
+ "h", /*
MIPS_EMBED_
HI_REGNUM */
+ "B", /*
MIPS_EMBED_
BADVADDR_REGNUM */
+ "Pcause", /*
MIPS_EMBED_
CAUSE_REGNUM */
+ "p" /*
MIPS_EMBED_
PC_REGNUM */
};
};
@@
-266,19
+268,19
@@
reg_table[] =
}
,
{
}
,
{
- "HI", HI_REGNUM
+ "HI",
MIPS_EMBED_
HI_REGNUM
}
,
{
}
,
{
- "LO", LO_REGNUM
+ "LO",
MIPS_EMBED_
LO_REGNUM
}
,
{
}
,
{
- "PC", PC_REGNUM
+ "PC",
MIPS_EMBED_
PC_REGNUM
}
,
{
}
,
{
- "BadV", BADVADDR_REGNUM
+ "BadV",
MIPS_EMBED_
BADVADDR_REGNUM
}
,
{
}
,
{
@@
-373,11
+375,7
@@
static struct bit_field cause_fields[] =
the hex value before passing it to monitor_supply_register. */
static void
the hex value before passing it to monitor_supply_register. */
static void
-r3900_supply_register (regname, regnamelen, val, vallen)
- char *regname;
- int regnamelen;
- char *val;
- int vallen;
+r3900_supply_register (char *regname, int regnamelen, char *val, int vallen)
{
int regno = -1;
int i;
{
int regno = -1;
int i;
@@
-416,14
+414,14
@@
r3900_supply_register (regname, regnamelen, val, vallen)
you modify it. */
static void
you modify it. */
static void
-fetch_bad_vaddr ()
+fetch_bad_vaddr (
void
)
{
char buf[20];
monitor_printf ("xB\r");
monitor_expect ("BadV=", NULL, 0);
monitor_expect_prompt (buf, sizeof (buf));
{
char buf[20];
monitor_printf ("xB\r");
monitor_expect ("BadV=", NULL, 0);
monitor_expect_prompt (buf, sizeof (buf));
- monitor_supply_register (
BADVADDR_REGNUM
, buf);
+ monitor_supply_register (
mips_regnum (current_gdbarch)->badvaddr
, buf);
}
}
@@
-431,8
+429,7
@@
fetch_bad_vaddr ()
combined binary value. */
static unsigned long
combined binary value. */
static unsigned long
-fetch_fields (bf)
- struct bit_field *bf;
+fetch_fields (struct bit_field *bf)
{
char buf[20];
unsigned long val = 0;
{
char buf[20];
unsigned long val = 0;
@@
-456,22
+453,27
@@
fetch_fields (bf)
static void
static void
-fetch_bitmapped_register (regno, bf)
- int regno;
- struct bit_field *bf;
+fetch_bitmapped_register (int regno, struct bit_field *bf)
{
unsigned long val;
{
unsigned long val;
- unsigned char regbuf[MAX_REGISTER_RAW_SIZE];
+ unsigned char regbuf[MAX_REGISTER_SIZE];
+ char *regname = NULL;
- monitor_printf ("x%s\r", r3900_regnames[regno]);
+ if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
+ internal_error (__FILE__, __LINE__,
+ "fetch_bitmapped_register: regno out of bounds");
+ else
+ regname = r3900_regnames[regno];
+
+ monitor_printf ("x%s\r", regname);
val = fetch_fields (bf);
monitor_printf (".\r");
monitor_expect_prompt (NULL, 0);
/* supply register stores in target byte order, so swap here */
val = fetch_fields (bf);
monitor_printf (".\r");
monitor_expect_prompt (NULL, 0);
/* supply register stores in target byte order, so swap here */
- store_unsigned_integer (regbuf, REGISTER_RAW_SIZE (regno), val);
-
supply_register (
regno, regbuf);
+ store_unsigned_integer (regbuf,
DEPRECATED_
REGISTER_RAW_SIZE (regno), val);
+
regcache_raw_supply (current_regcache,
regno, regbuf);
}
}
@@
-482,37
+484,36
@@
fetch_bitmapped_register (regno, bf)
a very unusual fashion by the monitor, and must be handled specially. */
static void
a very unusual fashion by the monitor, and must be handled specially. */
static void
-r3900_fetch_registers (regno)
- int regno;
+r3900_fetch_registers (int regno)
{
{
- switch (regno)
- {
- case BADVADDR_REGNUM:
- fetch_bad_vaddr ();
- return;
- case PS_REGNUM:
- fetch_bitmapped_register (PS_REGNUM, status_fields);
- return;
- case CAUSE_REGNUM:
- fetch_bitmapped_register (CAUSE_REGNUM, cause_fields);
- return;
- default:
- orig_monitor_fetch_registers (regno);
- }
+ if (regno == mips_regnum (current_gdbarch)->badvaddr)
+ fetch_bad_vaddr ();
+ else if (regno == PS_REGNUM)
+ fetch_bitmapped_register (PS_REGNUM, status_fields);
+ else if (regno == mips_regnum (current_gdbarch)->cause)
+ fetch_bitmapped_register (mips_regnum (current_gdbarch)->cause,
+ cause_fields);
+ else
+ orig_monitor_fetch_registers (regno);
}
/* Write the new value of the bitmapped register to the monitor. */
static void
}
/* Write the new value of the bitmapped register to the monitor. */
static void
-store_bitmapped_register (regno, bf)
- int regno;
- struct bit_field *bf;
+store_bitmapped_register (int regno, struct bit_field *bf)
{
unsigned long oldval, newval;
{
unsigned long oldval, newval;
+ char *regname = NULL;
+
+ if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
+ internal_error (__FILE__, __LINE__,
+ "fetch_bitmapped_register: regno out of bounds");
+ else
+ regname = r3900_regnames[regno];
/* Fetch the current value of the register. */
/* Fetch the current value of the register. */
- monitor_printf ("x%s\r", r
3900_regnames[regno]
);
+ monitor_printf ("x%s\r", r
egname
);
oldval = fetch_fields (bf);
newval = read_register (regno);
oldval = fetch_fields (bf);
newval = read_register (regno);
@@
-537,29
+538,22
@@
store_bitmapped_register (regno, bf)
static void
static void
-r3900_store_registers (regno)
- int regno;
+r3900_store_registers (int regno)
{
{
- switch (regno)
- {
- case PS_REGNUM:
- store_bitmapped_register (PS_REGNUM, status_fields);
- return;
- case CAUSE_REGNUM:
- store_bitmapped_register (CAUSE_REGNUM, cause_fields);
- return;
- default:
- orig_monitor_store_registers (regno);
- }
+ if (regno == PS_REGNUM)
+ store_bitmapped_register (PS_REGNUM, status_fields);
+ else if (regno == mips_regnum (current_gdbarch)->cause)
+ store_bitmapped_register (mips_regnum (current_gdbarch)->cause,
+ cause_fields);
+ else
+ orig_monitor_store_registers (regno);
}
/* Write a 4-byte integer to the buffer in big-endian order. */
static void
}
/* Write a 4-byte integer to the buffer in big-endian order. */
static void
-write_long (buf, n)
- char *buf;
- long n;
+write_long (char *buf, long n)
{
buf[0] = (n >> 24) & 0xff;
buf[1] = (n >> 16) & 0xff;
{
buf[0] = (n >> 24) & 0xff;
buf[1] = (n >> 16) & 0xff;
@@
-571,9
+565,7
@@
write_long (buf, n)
/* Write a 4-byte integer to the buffer in little-endian order. */
static void
/* Write a 4-byte integer to the buffer in little-endian order. */
static void
-write_long_le (buf, n)
- char *buf;
- long n;
+write_long_le (char *buf, long n)
{
buf[0] = n & 0xff;
buf[1] = (n >> 8) & 0xff;
{
buf[0] = n & 0xff;
buf[1] = (n >> 8) & 0xff;
@@
-587,8
+579,7
@@
write_long_le (buf, n)
character in hexadecimal; otherwise, print it in ASCII. */
static int
character in hexadecimal; otherwise, print it in ASCII. */
static int
-debug_readchar (hex)
- int hex;
+debug_readchar (int hex)
{
char buf[10];
int c = monitor_readchar ();
{
char buf[10];
int c = monitor_readchar ();
@@
-614,9
+605,7
@@
debug_readchar (hex)
print the sent buffer in hex. */
static void
print the sent buffer in hex. */
static void
-debug_write (buf, buflen)
- unsigned char *buf;
- int buflen;
+debug_write (unsigned char *buf, int buflen)
{
char s[10];
{
char s[10];
@@
-649,9
+638,9
@@
debug_write (buf, buflen)
*/
static void
*/
static void
-ignore_packet ()
+ignore_packet (
void
)
{
{
- int c;
+ int c
= -1
;
int len;
/* Ignore lots of trash (messages about section addresses, for example)
int len;
/* Ignore lots of trash (messages about section addresses, for example)
@@
-688,10
+677,7
@@
ignore_packet ()
*/
static void
*/
static void
-send_packet (type, buf, buflen, seq)
- char type;
- unsigned char *buf;
- int buflen, seq;
+send_packet (char type, unsigned char *buf, int buflen, int seq)
{
unsigned char hdr[4];
int len = buflen;
{
unsigned char hdr[4];
int len = buflen;
@@
-764,9
+750,7
@@
send_packet (type, buf, buflen, seq)
*/
static void
*/
static void
-process_read_request (buf, buflen)
- unsigned char *buf;
- int buflen;
+process_read_request (unsigned char *buf, int buflen)
{
unsigned char len[4];
int i, chunk;
{
unsigned char len[4];
int i, chunk;
@@
-802,10
+786,7
@@
process_read_request (buf, buflen)
/* Count loadable sections (helper function for r3900_load). */
static void
/* Count loadable sections (helper function for r3900_load). */
static void
-count_section (abfd, s, section_count)
- bfd *abfd;
- asection *s;
- unsigned int *section_count;
+count_section (bfd *abfd, asection *s, unsigned int *section_count)
{
if (s->flags & SEC_LOAD && bfd_section_size (abfd, s) != 0)
(*section_count)++;
{
if (s->flags & SEC_LOAD && bfd_section_size (abfd, s) != 0)
(*section_count)++;
@@
-827,10
+808,7
@@
count_section (abfd, s, section_count)
*/
static void
*/
static void
-load_section (abfd, s, data_count)
- bfd *abfd;
- asection *s;
- unsigned int *data_count;
+load_section (bfd *abfd, asection *s, unsigned int *data_count)
{
if (s->flags & SEC_LOAD)
{
{
if (s->flags & SEC_LOAD)
{
@@
-862,7
+840,7
@@
load_section (abfd, s, data_count)
buffer = (unsigned char *) xmalloc (section_size);
bfd_get_section_contents (abfd, s, buffer, 0, section_size);
process_read_request (buffer, section_size);
buffer = (unsigned char *) xmalloc (section_size);
bfd_get_section_contents (abfd, s, buffer, 0, section_size);
process_read_request (buffer, section_size);
- free (buffer);
+
x
free (buffer);
}
}
}
}
@@
-886,9
+864,7
@@
load_section (abfd, s, data_count)
*/
static void
*/
static void
-r3900_load (filename, from_tty)
- char *filename;
- int from_tty;
+r3900_load (char *filename, int from_tty)
{
bfd *abfd;
unsigned int data_count = 0;
{
bfd *abfd;
unsigned int data_count = 0;
@@
-957,7
+933,7
@@
r3900_load (filename, from_tty)
if (exec_bfd)
write_pc (bfd_get_start_address (exec_bfd));
if (exec_bfd)
write_pc (bfd_get_start_address (exec_bfd));
- inferior_p
id = 0;
/* No process now */
+ inferior_p
tid = null_ptid;
/* No process now */
/* This is necessary because many things were based on the PC at the
time that we attached to the monitor, which is no longer valid
/* This is necessary because many things were based on the PC at the
time that we attached to the monitor, which is no longer valid
@@
-990,9
+966,7
@@
static struct target_ops r3900_ops;
static struct monitor_ops r3900_cmds;
static void
static struct monitor_ops r3900_cmds;
static void
-r3900_open (args, from_tty)
- char *args;
- int from_tty;
+r3900_open (char *args, int from_tty)
{
char buf[64];
int i;
{
char buf[64];
int i;
@@
-1023,7
+997,7
@@
r3900_open (args, from_tty)
}
void
}
void
-_initialize_r3900_rom ()
+_initialize_r3900_rom (
void
)
{
r3900_cmds.flags = MO_NO_ECHO_ON_OPEN |
MO_ADDR_BITS_REMOVE |
{
r3900_cmds.flags = MO_NO_ECHO_ON_OPEN |
MO_ADDR_BITS_REMOVE |
This page took
0.027667 seconds
and
4
git commands to generate.