1999-04-16 09:35:26 +08:00
|
|
|
/* Remote debugging interface for Densan DVE-R3900 ROM monitor for
|
|
|
|
GDB, the GNU debugger.
|
2001-03-06 16:22:02 +08:00
|
|
|
Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
This file is part of GDB.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "monitor.h"
|
|
|
|
#include "serial.h"
|
|
|
|
#include "inferior.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "gdb_string.h"
|
|
|
|
#include <time.h>
|
2001-03-01 09:39:22 +08:00
|
|
|
#include "regcache.h"
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
#include "mips-tdep.h"
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Type of function passed to bfd_map_over_sections. */
|
|
|
|
|
2003-01-18 Andrew Cagney <ac131313@redhat.com>
* ada-valprint.c: Eliminate PTR.
* breakpoint.c, corelow.c, cris-tdep.c, dbxread.c: Ditto.
* defs.h, dve3900-rom.c, dwarf2read.c, dwarfread.c: Ditto.
* exec.c, hppa-tdep.c, hpread.c, infcmd.c, mdebugread.c: Ditto.
* objfiles.c, objfiles.h, ocd.c, remote-es.c: Ditto.
* remote-mips.c, remote-sds.c, remote-vx.c: Ditto.
* solib-svr4.c, solib.c, stack.c, symfile.c, symfile.h: Ditto.
* symmisc.c, v850ice.c, xcoffread.c, cli/cli-script.c: Ditto.
2003-01-18 23:55:53 +08:00
|
|
|
typedef void (*section_map_func) (bfd * abfd, asection * sect, void *obj);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Packet escape character used by Densan monitor. */
|
|
|
|
|
|
|
|
#define PESC 0xdc
|
|
|
|
|
|
|
|
/* Maximum packet size. This is actually smaller than necessary
|
|
|
|
just to be safe. */
|
|
|
|
|
|
|
|
#define MAXPSIZE 1024
|
|
|
|
|
|
|
|
/* External functions. */
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
extern void report_transfer_performance (unsigned long, time_t, time_t);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Certain registers are "bitmapped", in that the monitor can only display
|
|
|
|
them or let the user modify them as a series of named bitfields.
|
|
|
|
This structure describes a field in a bitmapped register. */
|
|
|
|
|
|
|
|
struct bit_field
|
1999-07-08 04:19:36 +08:00
|
|
|
{
|
|
|
|
char *prefix; /* string appearing before the value */
|
|
|
|
char *suffix; /* string appearing after the value */
|
|
|
|
char *user_name; /* name used by human when entering field value */
|
|
|
|
int length; /* number of bits in the field */
|
|
|
|
int start; /* starting (least significant) bit number of field */
|
|
|
|
};
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
/* Local functions for register manipulation. */
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
static void r3900_supply_register (char *regname, int regnamelen,
|
|
|
|
char *val, int vallen);
|
|
|
|
static void fetch_bad_vaddr (void);
|
|
|
|
static unsigned long fetch_fields (struct bit_field *bf);
|
|
|
|
static void fetch_bitmapped_register (int regno, struct bit_field *bf);
|
|
|
|
static void r3900_fetch_registers (int regno);
|
|
|
|
static void store_bitmapped_register (int regno, struct bit_field *bf);
|
|
|
|
static void r3900_store_registers (int regno);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Local functions for fast binary loading. */
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
static void write_long (char *buf, long n);
|
|
|
|
static void write_long_le (char *buf, long n);
|
|
|
|
static int debug_readchar (int hex);
|
|
|
|
static void debug_write (unsigned char *buf, int buflen);
|
|
|
|
static void ignore_packet (void);
|
|
|
|
static void send_packet (char type, unsigned char *buf, int buflen, int seq);
|
|
|
|
static void process_read_request (unsigned char *buf, int buflen);
|
|
|
|
static void count_section (bfd * abfd, asection * s,
|
|
|
|
unsigned int *section_count);
|
|
|
|
static void load_section (bfd * abfd, asection * s, unsigned int *data_count);
|
|
|
|
static void r3900_load (char *filename, int from_tty);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Miscellaneous local functions. */
|
|
|
|
|
2000-05-28 09:12:42 +08:00
|
|
|
static void r3900_open (char *args, int from_tty);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* Pointers to static functions in monitor.c for fetching and storing
|
|
|
|
registers. We can't use these function in certain cases where the Densan
|
|
|
|
monitor acts perversely: for registers that it displays in bit-map
|
|
|
|
format, and those that can't be modified at all. In those cases
|
|
|
|
we have to use our own functions to fetch and store their values. */
|
|
|
|
|
2000-06-04 08:41:10 +08:00
|
|
|
static void (*orig_monitor_fetch_registers) (int regno);
|
|
|
|
static void (*orig_monitor_store_registers) (int regno);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Pointer to static function in monitor. for loading programs.
|
|
|
|
We use this function for loading S-records via the serial link. */
|
|
|
|
|
2000-06-04 08:41:10 +08:00
|
|
|
static void (*orig_monitor_load) (char *file, int from_tty);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* This flag is set if a fast ethernet download should be used. */
|
|
|
|
|
|
|
|
static int ethernet = 0;
|
|
|
|
|
|
|
|
/* This array of registers needs to match the indexes used by GDB. The
|
|
|
|
whole reason this exists is because the various ROM monitors use
|
|
|
|
different names than GDB does, and don't support all the registers
|
|
|
|
either. */
|
|
|
|
|
2002-12-18 07:13:31 +08:00
|
|
|
static char *r3900_regnames[] =
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
|
|
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
|
|
|
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
|
|
|
|
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
|
|
|
|
|
|
|
|
"S", /* PS_REGNUM */
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
"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 */
|
1999-04-16 09:35:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Table of register names produced by monitor's register dump command. */
|
|
|
|
|
|
|
|
static struct reg_entry
|
1999-07-08 04:19:36 +08:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
int regno;
|
|
|
|
}
|
|
|
|
reg_table[] =
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
{
|
|
|
|
"r0_zero", 0
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r1_at", 1
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r2_v0", 2
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r3_v1", 3
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r4_a0", 4
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r5_a1", 5
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r6_a2", 6
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r7_a3", 7
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r8_t0", 8
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r9_t1", 9
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r10_t2", 10
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r11_t3", 11
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r12_t4", 12
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r13_t5", 13
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r14_t6", 14
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r15_t7", 15
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r16_s0", 16
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r17_s1", 17
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r18_s2", 18
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r19_s3", 19
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r20_s4", 20
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r21_s5", 21
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r22_s6", 22
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r23_s7", 23
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r24_t8", 24
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r25_t9", 25
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r26_k0", 26
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r27_k1", 27
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r28_gp", 28
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r29_sp", 29
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r30_fp", 30
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"r31_ra", 31
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
"HI", MIPS_EMBED_HI_REGNUM
|
1999-07-08 04:19:36 +08:00
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
"LO", MIPS_EMBED_LO_REGNUM
|
1999-07-08 04:19:36 +08:00
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
"PC", MIPS_EMBED_PC_REGNUM
|
1999-07-08 04:19:36 +08:00
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
"BadV", MIPS_EMBED_BADVADDR_REGNUM
|
1999-07-08 04:19:36 +08:00
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
NULL, 0
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* The monitor displays the cache register along with the status register,
|
|
|
|
as if they were a single register. So when we want to fetch the
|
|
|
|
status register, parse but otherwise ignore the fields of the
|
|
|
|
cache register that the monitor displays. Register fields that should
|
|
|
|
be ignored have a length of zero in the tables below. */
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
static struct bit_field status_fields[] =
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
/* Status register portion */
|
1999-07-08 04:19:36 +08:00
|
|
|
{"SR[<CU=", " ", "cu", 4, 28},
|
|
|
|
{"RE=", " ", "re", 1, 25},
|
|
|
|
{"BEV=", " ", "bev", 1, 22},
|
|
|
|
{"TS=", " ", "ts", 1, 21},
|
|
|
|
{"Nmi=", " ", "nmi", 1, 20},
|
|
|
|
{"INT=", " ", "int", 6, 10},
|
|
|
|
{"SW=", ">]", "sw", 2, 8},
|
|
|
|
{"[<KUO=", " ", "kuo", 1, 5},
|
|
|
|
{"IEO=", " ", "ieo", 1, 4},
|
|
|
|
{"KUP=", " ", "kup", 1, 3},
|
|
|
|
{"IEP=", " ", "iep", 1, 2},
|
|
|
|
{"KUC=", " ", "kuc", 1, 1},
|
|
|
|
{"IEC=", ">]", "iec", 1, 0},
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Cache register portion (dummy for parsing only) */
|
1999-07-08 04:19:36 +08:00
|
|
|
{"CR[<IalO=", " ", "ialo", 0, 13},
|
|
|
|
{"DalO=", " ", "dalo", 0, 12},
|
|
|
|
{"IalP=", " ", "ialp", 0, 11},
|
|
|
|
{"DalP=", " ", "dalp", 0, 10},
|
|
|
|
{"IalC=", " ", "ialc", 0, 9},
|
|
|
|
{"DalC=", ">] ", "dalc", 0, 8},
|
|
|
|
|
|
|
|
{NULL, NULL, 0, 0} /* end of table marker */
|
1999-04-16 09:35:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
#if 0 /* FIXME: Enable when we add support for modifying cache register. */
|
|
|
|
static struct bit_field cache_fields[] =
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
/* Status register portion (dummy for parsing only) */
|
1999-07-08 04:19:36 +08:00
|
|
|
{"SR[<CU=", " ", "cu", 0, 28},
|
|
|
|
{"RE=", " ", "re", 0, 25},
|
|
|
|
{"BEV=", " ", "bev", 0, 22},
|
|
|
|
{"TS=", " ", "ts", 0, 21},
|
|
|
|
{"Nmi=", " ", "nmi", 0, 20},
|
|
|
|
{"INT=", " ", "int", 0, 10},
|
|
|
|
{"SW=", ">]", "sw", 0, 8},
|
|
|
|
{"[<KUO=", " ", "kuo", 0, 5},
|
|
|
|
{"IEO=", " ", "ieo", 0, 4},
|
|
|
|
{"KUP=", " ", "kup", 0, 3},
|
|
|
|
{"IEP=", " ", "iep", 0, 2},
|
|
|
|
{"KUC=", " ", "kuc", 0, 1},
|
|
|
|
{"IEC=", ">]", "iec", 0, 0},
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Cache register portion */
|
1999-07-08 04:19:36 +08:00
|
|
|
{"CR[<IalO=", " ", "ialo", 1, 13},
|
|
|
|
{"DalO=", " ", "dalo", 1, 12},
|
|
|
|
{"IalP=", " ", "ialp", 1, 11},
|
|
|
|
{"DalP=", " ", "dalp", 1, 10},
|
|
|
|
{"IalC=", " ", "ialc", 1, 9},
|
|
|
|
{"DalC=", ">] ", "dalc", 1, 8},
|
|
|
|
|
|
|
|
{NULL, NULL, NULL, 0, 0} /* end of table marker */
|
1999-04-16 09:35:26 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
static struct bit_field cause_fields[] =
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
{"<BD=", " ", "bd", 1, 31},
|
|
|
|
{"CE=", " ", "ce", 2, 28},
|
|
|
|
{"IP=", " ", "ip", 6, 10},
|
|
|
|
{"SW=", " ", "sw", 2, 8},
|
|
|
|
{"EC=", ">]", "ec", 5, 2},
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
{NULL, NULL, NULL, 0, 0} /* end of table marker */
|
1999-04-16 09:35:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* The monitor prints register values in the form
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
regname = xxxx xxxx
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
We look up the register name in a table, and remove the embedded space in
|
|
|
|
the hex value before passing it to monitor_supply_register. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
r3900_supply_register (char *regname, int regnamelen, char *val, int vallen)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int regno = -1;
|
|
|
|
int i;
|
|
|
|
char valbuf[10];
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
/* Perform some sanity checks on the register name and value. */
|
|
|
|
if (regnamelen < 2 || regnamelen > 7 || vallen != 9)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Look up the register name. */
|
|
|
|
for (i = 0; reg_table[i].name != NULL; i++)
|
|
|
|
{
|
|
|
|
int rlen = strlen (reg_table[i].name);
|
|
|
|
if (rlen == regnamelen && strncmp (regname, reg_table[i].name, rlen) == 0)
|
|
|
|
{
|
|
|
|
regno = reg_table[i].regno;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (regno == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Copy the hex value to a buffer and eliminate the embedded space. */
|
|
|
|
for (i = 0, p = valbuf; i < vallen; i++)
|
|
|
|
if (val[i] != ' ')
|
|
|
|
*p++ = val[i];
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
monitor_supply_register (regno, valbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Fetch the BadVaddr register. Unlike the other registers, this
|
|
|
|
one can't be modified, and the monitor won't even prompt to let
|
|
|
|
you modify it. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
fetch_bad_vaddr (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
char buf[20];
|
|
|
|
|
|
|
|
monitor_printf ("xB\r");
|
|
|
|
monitor_expect ("BadV=", NULL, 0);
|
1999-07-08 04:19:36 +08:00
|
|
|
monitor_expect_prompt (buf, sizeof (buf));
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
monitor_supply_register (mips_regnum (current_gdbarch)->badvaddr, buf);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
/* Read a series of bit fields from the monitor, and return their
|
|
|
|
combined binary value. */
|
|
|
|
|
|
|
|
static unsigned long
|
2000-07-30 09:48:28 +08:00
|
|
|
fetch_fields (struct bit_field *bf)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
char buf[20];
|
|
|
|
unsigned long val = 0;
|
|
|
|
unsigned long bits;
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
for (; bf->prefix != NULL; bf++)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
monitor_expect (bf->prefix, NULL, 0); /* get prefix */
|
1999-04-16 09:35:26 +08:00
|
|
|
monitor_expect (bf->suffix, buf, sizeof (buf)); /* hex value, suffix */
|
|
|
|
if (bf->length != 0)
|
1999-07-08 04:19:36 +08:00
|
|
|
{
|
1999-04-16 09:35:26 +08:00
|
|
|
bits = strtoul (buf, NULL, 16); /* get field value */
|
|
|
|
bits &= ((1 << bf->length) - 1); /* mask out useless bits */
|
1999-07-08 04:19:36 +08:00
|
|
|
val |= bits << bf->start; /* insert into register */
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
1999-07-08 04:19:36 +08:00
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
fetch_bitmapped_register (int regno, struct bit_field *bf)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
unsigned long val;
|
2003-05-08 Andrew Cagney <cagney@redhat.com>
* regcache.h (max_register_size): Delete declaration.
* regcache.c (max_register_size): Delete function.
(struct regcache_descr): Delete field "max_register_size".
(init_regcache_descr, init_legacy_regcache_descr): Assert that all
registers fit in MAX_REGISTER_SIZE.
(regcache_save): Replace max_register_size with MAX_REGISTER_SIZE.
(regcache_restore, regcache_xfer_part, regcache_dump): Ditto.
* thread-db.c: Replace max_register_size with MAX_REGISTER_SIZE.
* sh-tdep.c, rom68k-rom.c, remote-sim.c, remote-mips.c: Ditto.
* remote-e7000.c, monitor.c, mipsv4-nat.c, mips-nat.c: Ditto.
* m68klinux-nat.c, lynx-nat.c, irix4-nat.c: Ditto.
* hpux-thread.c, hppah-nat.c, hppab-nat.c, hppa-tdep.c: Ditto.
* dve3900-rom.c, hppa-tdep.c: Ditto.
2003-05-09 06:33:14 +08:00
|
|
|
unsigned char regbuf[MAX_REGISTER_SIZE];
|
2002-12-18 07:13:31 +08:00
|
|
|
char *regname = NULL;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2002-12-18 07:13:31 +08:00
|
|
|
if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-12 02:13:55 +08:00
|
|
|
_("fetch_bitmapped_register: regno out of bounds"));
|
2002-12-18 07:13:31 +08:00
|
|
|
else
|
|
|
|
regname = r3900_regnames[regno];
|
|
|
|
|
|
|
|
monitor_printf ("x%s\r", regname);
|
1999-04-16 09:35:26 +08:00
|
|
|
val = fetch_fields (bf);
|
|
|
|
monitor_printf (".\r");
|
|
|
|
monitor_expect_prompt (NULL, 0);
|
|
|
|
|
|
|
|
/* supply register stores in target byte order, so swap here */
|
|
|
|
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 08:57:27 +08:00
|
|
|
store_unsigned_integer (regbuf, register_size (current_gdbarch, regno), val);
|
2004-07-21 Andrew Cagney <cagney@gnu.org>
Use regcache_raw_supply instead of supply_register.
* regcache.h (supply_register): Delete declaration.
* regcache.c (supply_register): Delete function.
* wince.c (do_child_fetch_inferior_registers): Update.
* win32-nat.c (do_child_fetch_inferior_registers)
(fetch_elf_core_registers): Update.
* v850ice.c (v850ice_fetch_registers): Update.
* thread-db.c (thread_db_store_registers): Update.
* sol-thread.c (sol_thread_store_registers): Update.
* shnbsd-tdep.c (shnbsd_supply_reg): Update.
* rs6000-nat.c (fetch_register): Update.
* rom68k-rom.c (rom68k_supply_one_register): Update.
* remote.c (remote_wait, remote_async_wait): Update.
* remote-st.c (get_hex_regs): Update.
* remote-sim.c (gdbsim_fetch_register): Update.
* remote-sds.c (sds_fetch_registers): Update.
* remote-rdp.c (remote_rdp_fetch_register): Update.
* remote-rdi.c (arm_rdi_fetch_registers): Update.
* remote-mips.c (mips_wait, mips_fetch_registers): Update.
* remote-m32r-sdi.c (m32r_fetch_register): Update.
* remote-hms.c (init_hms_cmds): Update.
* remote-est.c (init_est_cmds): Update.
* remote-e7000.c (get_hex_regs, fetch_regs_from_dump)
(e7000_fetch_registers, sub2_from_pc, e7000_wait): Update.
* ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_supply_fpreg): Update.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, supply_vrregset)
(fetch_spe_registers): Update.
* ppc-bdm.c (bdm_ppc_fetch_registers): Update.
* monitor.c (monitor_supply_register): Update.
* mipsv4-nat.c (supply_gregset, supply_fpregset): Update.
* mipsnbsd-tdep.c (mipsnbsd_supply_reg)
(mipsnbsd_supply_fpreg): Update.
* mips-nat.c (fetch_inferior_registers)
(fetch_core_registers): Update.
* mips-linux-tdep.c (supply_32bit_reg, supply_gregset)
(supply_fpregset, mips64_supply_gregset)
(mips64_supply_fpregset): Update.
* m68klinux-nat.c (fetch_register, supply_gregset)
(supply_fpregset): Update.
* m68k-tdep.c (supply_gregset, supply_fpregset): Update.
* m32r-rom.c (init_m32r_cmds, init_mon2000_cmds): Update.
* lynx-nat.c (fetch_inferior_registers, fetch_core_registers): Update.
* irix5-nat.c (supply_gregset, supply_fpregset): Update.
* infptrace.c (fetch_register): Update.
* ia64-linux-nat.c (supply_gregset, supply_fpregset): Update.
* ia64-aix-nat.c (supply_gregset, supply_fpregset): Update.
* i386gnu-nat.c (fetch_fpregs, supply_gregset)
(gnu_fetch_registers, gnu_store_registers): Update.
* i386-nto-tdep.c (i386nto_supply_gregset): Update.
* i386-linux-nat.c (fetch_register, supply_gregset)
(dummy_sse_values): Update.
* hpux-thread.c (hpux_thread_fetch_registers): Update.
* hppah-nat.c (fetch_register): Update.
* hppa-linux-nat.c (fetch_register, supply_gregset)
(supply_fpregset): Update.
* go32-nat.c (fetch_register): Update.
* dve3900-rom.c (fetch_bitmapped_register)
(_initialize_r3900_rom): Update.
* cris-tdep.c (supply_gregset): Update.
* abug-rom.c (init_abug_cmds): Update.
* core-aout.c (fetch_core_registers): Update.
* armnbsd-nat.c (supply_gregset, supply_fparegset)
(fetch_register, fetch_fp_register): Update.
* arm-linux-nat.c (fetch_nwfpe_single, fetch_nwfpe_none)
(fetch_nwfpe_extended, fetch_fpregister, fetch_fpregs)
(fetch_register, fetch_regs, supply_gregset, supply_fpregset): Update.
* alphanbsd-tdep.c (fetch_core_registers): Update.
* alpha-tdep.c (alpha_supply_int_regs, alpha_supply_fp_regs): Update.
* alpha-nat.c (fetch_osf_core_registers)
(fetch_osf_core_registers, fetch_osf_core_registers): Update.
* aix-thread.c (supply_gprs64, supply_reg32, supply_fprs)
(supply_sprs64, supply_sprs32, fetch_regs_kernel_thread): Update.
2004-07-22 09:31:49 +08:00
|
|
|
regcache_raw_supply (current_regcache, regno, regbuf);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Fetch all registers (if regno is -1), or one register from the
|
|
|
|
monitor. For most registers, we can use the generic monitor_
|
|
|
|
monitor_fetch_registers function. But others are displayed in
|
|
|
|
a very unusual fashion by the monitor, and must be handled specially. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
r3900_fetch_registers (int regno)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
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);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Write the new value of the bitmapped register to the monitor. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
store_bitmapped_register (int regno, struct bit_field *bf)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
unsigned long oldval, newval;
|
2002-12-18 07:13:31 +08:00
|
|
|
char *regname = NULL;
|
|
|
|
|
|
|
|
if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-12 02:13:55 +08:00
|
|
|
_("fetch_bitmapped_register: regno out of bounds"));
|
2002-12-18 07:13:31 +08:00
|
|
|
else
|
|
|
|
regname = r3900_regnames[regno];
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Fetch the current value of the register. */
|
2002-12-18 07:13:31 +08:00
|
|
|
monitor_printf ("x%s\r", regname);
|
1999-04-16 09:35:26 +08:00
|
|
|
oldval = fetch_fields (bf);
|
|
|
|
newval = read_register (regno);
|
|
|
|
|
|
|
|
/* To save time, write just the fields that have changed. */
|
1999-07-08 04:19:36 +08:00
|
|
|
for (; bf->prefix != NULL; bf++)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (bf->length != 0)
|
1999-07-08 04:19:36 +08:00
|
|
|
{
|
1999-04-16 09:35:26 +08:00
|
|
|
unsigned long oldbits, newbits, mask;
|
|
|
|
|
|
|
|
mask = (1 << bf->length) - 1;
|
|
|
|
oldbits = (oldval >> bf->start) & mask;
|
|
|
|
newbits = (newval >> bf->start) & mask;
|
|
|
|
if (oldbits != newbits)
|
1999-09-09 08:02:17 +08:00
|
|
|
monitor_printf ("%s %lx ", bf->user_name, newbits);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
monitor_printf (".\r");
|
|
|
|
monitor_expect_prompt (NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
r3900_store_registers (int regno)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
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);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Write a 4-byte integer to the buffer in big-endian order. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
write_long (char *buf, long n)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
buf[0] = (n >> 24) & 0xff;
|
|
|
|
buf[1] = (n >> 16) & 0xff;
|
|
|
|
buf[2] = (n >> 8) & 0xff;
|
|
|
|
buf[3] = n & 0xff;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Write a 4-byte integer to the buffer in little-endian order. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
write_long_le (char *buf, long n)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
buf[0] = n & 0xff;
|
|
|
|
buf[1] = (n >> 8) & 0xff;
|
|
|
|
buf[2] = (n >> 16) & 0xff;
|
|
|
|
buf[3] = (n >> 24) & 0xff;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Read a character from the monitor. If remote debugging is on,
|
|
|
|
print the received character. If HEX is non-zero, print the
|
|
|
|
character in hexadecimal; otherwise, print it in ASCII. */
|
|
|
|
|
|
|
|
static int
|
2000-07-30 09:48:28 +08:00
|
|
|
debug_readchar (int hex)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
char buf[10];
|
1999-04-16 09:35:26 +08:00
|
|
|
int c = monitor_readchar ();
|
|
|
|
|
|
|
|
if (remote_debug > 0)
|
|
|
|
{
|
|
|
|
if (hex)
|
|
|
|
sprintf (buf, "[%02x]", c & 0xff);
|
|
|
|
else if (c == '\0')
|
|
|
|
strcpy (buf, "\\0");
|
1999-07-08 04:19:36 +08:00
|
|
|
else
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
buf[0] = c;
|
|
|
|
buf[1] = '\0';
|
|
|
|
}
|
|
|
|
puts_debug ("Read -->", buf, "<--");
|
|
|
|
}
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Send a buffer of characters to the monitor. If remote debugging is on,
|
|
|
|
print the sent buffer in hex. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
debug_write (unsigned char *buf, int buflen)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
char s[10];
|
|
|
|
|
|
|
|
monitor_write (buf, buflen);
|
|
|
|
|
|
|
|
if (remote_debug > 0)
|
|
|
|
{
|
|
|
|
while (buflen-- > 0)
|
|
|
|
{
|
|
|
|
sprintf (s, "[%02x]", *buf & 0xff);
|
|
|
|
puts_debug ("Sent -->", s, "<--");
|
|
|
|
buf++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Ignore a packet sent to us by the monitor. It send packets
|
|
|
|
when its console is in "communications interface" mode. A packet
|
|
|
|
is of this form:
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
start of packet flag (one byte: 0xdc)
|
|
|
|
packet type (one byte)
|
|
|
|
length (low byte)
|
|
|
|
length (high byte)
|
|
|
|
data (length bytes)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
The last two bytes of the data field are a checksum, but we don't
|
|
|
|
bother to verify it.
|
1999-07-08 04:19:36 +08:00
|
|
|
*/
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
ignore_packet (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2003-11-16 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (struct gdbarch_tdep): Add field "regnum".
(mips_fpa0_regnum, mips_regnum): New function.
(mips_gdbarch_init): Fill in the "regnum" fields.
* mips-tdep.h (struct mips_regnum): Define.
(mips_regnum): Declare.
* config/mips/tm-mips.h (BADVADDR_REGNUM): Delete macro.
(LO_REGNUM, HI_REGNUM, BADVADDR_REGNUM): Ditto.
(CAUSE_REGNUM, PC_REGNUM, FP0_REGNUM): Ditto.
(FCRCS_REGNUM, FCRIR_REGNUM, FPA0_REGNUM): Ditto.
* config/mips/tm-irix6.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* config/mips/tm-irix5.h (FP0_REGNUM): Delete macro.
(PC_REGNUM, CAUSE_REGNUM, BADVADDR_REGNUM): Ditto.
(HI_REGNUM, LO_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): Ditto.
* remote-mips.c: Include "mips-tdep.h". Update.
* mipsnbsd-tdep.c: Update.
* mipsv4-nat.c: Update.
* mips-tdep.c: Update.
* mips-nat.c: Update.
* mips-linux-tdep.c: Update.
* mips-linux-nat.c: Update.
* irix5-nat.c: Update.
* dve3900-rom.c: Include "mips-tdep.h". Update.
(ignore_packet): Supress GCC warning.
* config/mips/nm-riscos.h: Update.
* Makefile.in (dve3900-rom.o, remote-mips.o): Update dependencies.
2003-11-17 03:24:05 +08:00
|
|
|
int c = -1;
|
1999-07-08 04:19:36 +08:00
|
|
|
int len;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Ignore lots of trash (messages about section addresses, for example)
|
|
|
|
until we see the start of a packet. */
|
|
|
|
for (len = 0; len < 256; len++)
|
|
|
|
{
|
|
|
|
c = debug_readchar (0);
|
|
|
|
if (c == PESC)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (len == 8)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("Packet header byte not found; %02x seen instead."), c);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Read the packet type and length. */
|
1999-07-08 04:19:36 +08:00
|
|
|
c = debug_readchar (1); /* type */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
c = debug_readchar (1); /* low byte of length */
|
1999-04-16 09:35:26 +08:00
|
|
|
len = c & 0xff;
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
c = debug_readchar (1); /* high byte of length */
|
1999-04-16 09:35:26 +08:00
|
|
|
len += (c & 0xff) << 8;
|
|
|
|
|
|
|
|
/* Ignore the rest of the packet. */
|
|
|
|
while (len-- > 0)
|
|
|
|
c = debug_readchar (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Encapsulate some data into a packet and send it to the monitor.
|
|
|
|
|
|
|
|
The 'p' packet is a special case. This is a packet we send
|
|
|
|
in response to a read ('r') packet from the monitor. This function
|
|
|
|
appends a one-byte sequence number to the data field of such a packet.
|
1999-07-08 04:19:36 +08:00
|
|
|
*/
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
send_packet (char type, unsigned char *buf, int buflen, int seq)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
unsigned char hdr[4];
|
|
|
|
int len = buflen;
|
|
|
|
int sum, i;
|
|
|
|
|
|
|
|
/* If this is a 'p' packet, add one byte for a sequence number. */
|
|
|
|
if (type == 'p')
|
|
|
|
len++;
|
|
|
|
|
|
|
|
/* If the buffer has a non-zero length, add two bytes for a checksum. */
|
|
|
|
if (len > 0)
|
|
|
|
len += 2;
|
|
|
|
|
|
|
|
/* Write the packet header. */
|
|
|
|
hdr[0] = PESC;
|
|
|
|
hdr[1] = type;
|
|
|
|
hdr[2] = len & 0xff;
|
|
|
|
hdr[3] = (len >> 8) & 0xff;
|
|
|
|
debug_write (hdr, sizeof (hdr));
|
|
|
|
|
|
|
|
if (len)
|
|
|
|
{
|
|
|
|
/* Write the packet data. */
|
|
|
|
debug_write (buf, buflen);
|
|
|
|
|
|
|
|
/* Write the sequence number if this is a 'p' packet. */
|
|
|
|
if (type == 'p')
|
|
|
|
{
|
|
|
|
hdr[0] = seq;
|
|
|
|
debug_write (hdr, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write the checksum. */
|
|
|
|
sum = 0;
|
|
|
|
for (i = 0; i < buflen; i++)
|
|
|
|
{
|
|
|
|
int tmp = (buf[i] & 0xff);
|
|
|
|
if (i & 1)
|
|
|
|
sum += tmp;
|
|
|
|
else
|
|
|
|
sum += tmp << 8;
|
|
|
|
}
|
|
|
|
if (type == 'p')
|
1999-07-08 04:19:36 +08:00
|
|
|
{
|
1999-04-16 09:35:26 +08:00
|
|
|
if (buflen & 1)
|
|
|
|
sum += (seq & 0xff);
|
|
|
|
else
|
|
|
|
sum += (seq & 0xff) << 8;
|
|
|
|
}
|
|
|
|
sum = (sum & 0xffff) + ((sum >> 16) & 0xffff);
|
|
|
|
sum += (sum >> 16) & 1;
|
1999-07-08 04:19:36 +08:00
|
|
|
sum = ~sum;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
hdr[0] = (sum >> 8) & 0xff;
|
|
|
|
hdr[1] = sum & 0xff;
|
|
|
|
debug_write (hdr, 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Respond to an expected read request from the monitor by sending
|
|
|
|
data in chunks. Handle all acknowledgements and handshaking packets.
|
|
|
|
|
|
|
|
The monitor expects a response consisting of a one or more 'p' packets,
|
|
|
|
each followed by a portion of the data requested. The 'p' packet
|
|
|
|
contains only a four-byte integer, the value of which is the number
|
|
|
|
of bytes of data we are about to send. Following the 'p' packet,
|
|
|
|
the monitor expects the data bytes themselves in raw, unpacketized,
|
|
|
|
form, without even a checksum.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
process_read_request (unsigned char *buf, int buflen)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
unsigned char len[4];
|
|
|
|
int i, chunk;
|
|
|
|
unsigned char seq;
|
|
|
|
|
|
|
|
/* Discard the read request. FIXME: we have to hope it's for
|
|
|
|
the exact number of bytes we want to send; should check for this. */
|
|
|
|
ignore_packet ();
|
|
|
|
|
|
|
|
for (i = chunk = 0, seq = 0; i < buflen; i += chunk, seq++)
|
|
|
|
{
|
|
|
|
/* Don't send more than MAXPSIZE bytes at a time. */
|
|
|
|
chunk = buflen - i;
|
|
|
|
if (chunk > MAXPSIZE)
|
|
|
|
chunk = MAXPSIZE;
|
|
|
|
|
|
|
|
/* Write a packet containing the number of bytes we are sending. */
|
|
|
|
write_long_le (len, chunk);
|
|
|
|
send_packet ('p', len, sizeof (len), seq);
|
|
|
|
|
|
|
|
/* Write the data in raw form following the packet. */
|
|
|
|
debug_write (&buf[i], chunk);
|
|
|
|
|
|
|
|
/* Discard the ACK packet. */
|
|
|
|
ignore_packet ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send an "end of data" packet. */
|
|
|
|
send_packet ('e', "", 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Count loadable sections (helper function for r3900_load). */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
count_section (bfd *abfd, asection *s, unsigned int *section_count)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (s->flags & SEC_LOAD && bfd_section_size (abfd, s) != 0)
|
|
|
|
(*section_count)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Load a single BFD section (helper function for r3900_load).
|
|
|
|
|
|
|
|
WARNING: this code is filled with assumptions about how
|
|
|
|
the Densan monitor loads programs. The monitor issues
|
|
|
|
packets containing read requests, but rather than respond
|
|
|
|
to them in an general way, we expect them to following
|
|
|
|
a certain pattern.
|
1999-07-08 04:19:36 +08:00
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
For example, we know that the monitor will start loading by
|
|
|
|
issuing an 8-byte read request for the binary file header.
|
|
|
|
We know this is coming and ignore the actual contents
|
|
|
|
of the read request packet.
|
1999-07-08 04:19:36 +08:00
|
|
|
*/
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
load_section (bfd *abfd, asection *s, unsigned int *data_count)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
if (s->flags & SEC_LOAD)
|
|
|
|
{
|
|
|
|
bfd_size_type section_size = bfd_section_size (abfd, s);
|
1999-07-08 04:19:36 +08:00
|
|
|
bfd_vma section_base = bfd_section_lma (abfd, s);
|
1999-04-16 09:35:26 +08:00
|
|
|
unsigned char *buffer;
|
|
|
|
unsigned char header[8];
|
|
|
|
|
|
|
|
/* Don't output zero-length sections. */
|
|
|
|
if (section_size == 0)
|
1999-07-08 04:19:36 +08:00
|
|
|
return;
|
1999-04-16 09:35:26 +08:00
|
|
|
if (data_count)
|
|
|
|
*data_count += section_size;
|
|
|
|
|
|
|
|
/* Print some fluff about the section being loaded. */
|
|
|
|
printf_filtered ("Loading section %s, size 0x%lx lma ",
|
1999-07-08 04:19:36 +08:00
|
|
|
bfd_section_name (abfd, s), (long) section_size);
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
* utils.c (paddress): New function.
* defs.h (paddress): Declare.
* printcmd.c (deprecated_print_address_numeric): Rename
print_address_numeric, call paddress.
* valprint.c, ui-out.c, tui/tui-stack.c, tracepoint.c: Update.
* symmisc.c, symfile.c stack.c, p-valprint.c, printcmd.c: Update.
* maint.c, m32r-rom.c, infcmd.c, f-valprint.c, exec.c: Update.
* dwarf2read.c, dve3900-rom.c, defs.h, c-valprint.c: Update.
* corefile.c, cli/cli-cmds.c, breakpoint.c, annotate.c: Update.
* ada-valprint.c: Update.
2005-02-14 22:37:38 +08:00
|
|
|
deprecated_print_address_numeric (section_base, 1, gdb_stdout);
|
1999-04-16 09:35:26 +08:00
|
|
|
printf_filtered ("\n");
|
|
|
|
gdb_flush (gdb_stdout);
|
|
|
|
|
|
|
|
/* Write the section header (location and size). */
|
1999-07-08 04:19:36 +08:00
|
|
|
write_long (&header[0], (long) section_base);
|
|
|
|
write_long (&header[4], (long) section_size);
|
1999-04-16 09:35:26 +08:00
|
|
|
process_read_request (header, sizeof (header));
|
|
|
|
|
|
|
|
/* Read the section contents into a buffer, write it out,
|
|
|
|
then free the buffer. */
|
|
|
|
buffer = (unsigned char *) xmalloc (section_size);
|
|
|
|
bfd_get_section_contents (abfd, s, buffer, 0, section_size);
|
|
|
|
process_read_request (buffer, section_size);
|
2000-12-15 09:01:51 +08:00
|
|
|
xfree (buffer);
|
1999-07-08 04:19:36 +08:00
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* When the ethernet is used as the console port on the Densan board,
|
|
|
|
we can use the "Rm" command to do a fast binary load. The format
|
|
|
|
of the download data is:
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
number of sections (4 bytes)
|
|
|
|
starting address (4 bytes)
|
|
|
|
repeat for each section:
|
|
|
|
location address (4 bytes)
|
|
|
|
section size (4 bytes)
|
|
|
|
binary data
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
The 4-byte fields are all in big-endian order.
|
|
|
|
|
|
|
|
Using this command is tricky because we have to put the monitor
|
|
|
|
into a special funky "communications interface" mode, in which
|
|
|
|
it sends and receives packets of data along with the normal prompt.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
r3900_load (char *filename, int from_tty)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
bfd *abfd;
|
|
|
|
unsigned int data_count = 0;
|
|
|
|
time_t start_time, end_time; /* for timing of download */
|
|
|
|
int section_count = 0;
|
|
|
|
unsigned char buffer[8];
|
|
|
|
|
|
|
|
/* If we are not using the ethernet, use the normal monitor load,
|
|
|
|
which sends S-records over the serial link. */
|
|
|
|
if (!ethernet)
|
|
|
|
{
|
|
|
|
orig_monitor_load (filename, from_tty);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Open the file. */
|
|
|
|
if (filename == NULL || filename[0] == 0)
|
|
|
|
filename = get_exec_file (1);
|
|
|
|
abfd = bfd_openr (filename, 0);
|
|
|
|
if (!abfd)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("Unable to open file %s."), filename);
|
1999-04-16 09:35:26 +08:00
|
|
|
if (bfd_check_format (abfd, bfd_object) == 0)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 12:06:14 +08:00
|
|
|
error (_("File is not an object file."));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* Output the "vconsi" command to get the monitor in the communication
|
|
|
|
state where it will accept a load command. This will cause
|
|
|
|
the monitor to emit a packet before each prompt, so ignore the packet. */
|
|
|
|
monitor_printf ("vconsi\r");
|
|
|
|
ignore_packet ();
|
|
|
|
monitor_expect_prompt (NULL, 0);
|
|
|
|
|
|
|
|
/* Output the "Rm" (load) command and respond to the subsequent "open"
|
|
|
|
packet by sending an ACK packet. */
|
|
|
|
monitor_printf ("Rm\r");
|
|
|
|
ignore_packet ();
|
|
|
|
send_packet ('a', "", 0, 0);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
/* Output the fast load header (number of sections and starting address). */
|
|
|
|
bfd_map_over_sections ((bfd *) abfd, (section_map_func) count_section,
|
|
|
|
§ion_count);
|
1999-07-08 04:19:36 +08:00
|
|
|
write_long (&buffer[0], (long) section_count);
|
1999-04-16 09:35:26 +08:00
|
|
|
if (exec_bfd)
|
1999-07-08 04:19:36 +08:00
|
|
|
write_long (&buffer[4], (long) bfd_get_start_address (exec_bfd));
|
1999-04-16 09:35:26 +08:00
|
|
|
else
|
|
|
|
write_long (&buffer[4], 0);
|
|
|
|
process_read_request (buffer, sizeof (buffer));
|
|
|
|
|
|
|
|
/* Output the section data. */
|
|
|
|
start_time = time (NULL);
|
|
|
|
bfd_map_over_sections (abfd, (section_map_func) load_section, &data_count);
|
|
|
|
end_time = time (NULL);
|
|
|
|
|
|
|
|
/* Acknowledge the close packet and put the monitor back into
|
|
|
|
"normal" mode so it won't send packets any more. */
|
|
|
|
ignore_packet ();
|
|
|
|
send_packet ('a', "", 0, 0);
|
|
|
|
monitor_expect_prompt (NULL, 0);
|
|
|
|
monitor_printf ("vconsx\r");
|
|
|
|
monitor_expect_prompt (NULL, 0);
|
|
|
|
|
|
|
|
/* Print start address and download performance information. */
|
1999-07-08 04:19:36 +08:00
|
|
|
printf_filtered ("Start address 0x%lx\n", (long) bfd_get_start_address (abfd));
|
1999-04-16 09:35:26 +08:00
|
|
|
report_transfer_performance (data_count, start_time, end_time);
|
|
|
|
|
|
|
|
/* Finally, make the PC point at the start address */
|
|
|
|
if (exec_bfd)
|
|
|
|
write_pc (bfd_get_start_address (exec_bfd));
|
|
|
|
|
2001-05-04 12:15:33 +08:00
|
|
|
inferior_ptid = null_ptid; /* No process now */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
now that we have loaded new code (and just changed the PC).
|
|
|
|
Another way to do this might be to call normal_stop, except that
|
|
|
|
the stack may not be valid, and things would get horribly
|
|
|
|
confused... */
|
|
|
|
clear_symtab_users ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Commands to send to the monitor when first connecting:
|
1999-07-08 04:19:36 +08:00
|
|
|
* The bare carriage return forces a prompt from the monitor
|
|
|
|
(monitor doesn't prompt immediately after a reset).
|
|
|
|
* The "vconsx" switches the monitor back to interactive mode
|
|
|
|
in case an aborted download had left it in packet mode.
|
|
|
|
* The "Xtr" command causes subsequent "t" (trace) commands to display
|
|
|
|
the general registers only.
|
|
|
|
* The "Xxr" command does the same thing for the "x" (examine
|
|
|
|
registers) command.
|
|
|
|
* The "bx" command clears all breakpoints.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static char *r3900_inits[] =
|
|
|
|
{"\r", "vconsx\r", "Xtr\r", "Xxr\r", "bx\r", NULL};
|
|
|
|
static char *dummy_inits[] =
|
|
|
|
{NULL};
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
static struct target_ops r3900_ops;
|
|
|
|
static struct monitor_ops r3900_cmds;
|
|
|
|
|
|
|
|
static void
|
2000-07-30 09:48:28 +08:00
|
|
|
r3900_open (char *args, int from_tty)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
char buf[64];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
monitor_open (args, &r3900_cmds, from_tty);
|
|
|
|
|
|
|
|
/* We have to handle sending the init strings ourselves, because
|
|
|
|
the first two strings we send (carriage returns) may not be echoed
|
|
|
|
by the monitor, but the rest will be. */
|
|
|
|
monitor_printf_noecho ("\r\r");
|
|
|
|
for (i = 0; r3900_inits[i] != NULL; i++)
|
|
|
|
{
|
|
|
|
monitor_printf (r3900_inits[i]);
|
|
|
|
monitor_expect_prompt (NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Attempt to determine whether the console device is ethernet or serial.
|
|
|
|
This will tell us which kind of load to use (S-records over a serial
|
|
|
|
link, or the Densan fast binary multi-section format over the net). */
|
|
|
|
|
|
|
|
ethernet = 0;
|
|
|
|
monitor_printf ("v\r");
|
|
|
|
if (monitor_expect ("console device :", NULL, 0) != -1)
|
1999-07-08 04:19:36 +08:00
|
|
|
if (monitor_expect ("\n", buf, sizeof (buf)) != -1)
|
|
|
|
if (strstr (buf, "ethernet") != NULL)
|
|
|
|
ethernet = 1;
|
1999-04-16 09:35:26 +08:00
|
|
|
monitor_expect_prompt (NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 09:48:28 +08:00
|
|
|
_initialize_r3900_rom (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
r3900_cmds.flags = MO_NO_ECHO_ON_OPEN |
|
1999-07-08 04:19:36 +08:00
|
|
|
MO_ADDR_BITS_REMOVE |
|
|
|
|
MO_CLR_BREAK_USES_ADDR |
|
|
|
|
MO_GETMEM_READ_SINGLE |
|
|
|
|
MO_PRINT_PROGRAM_OUTPUT;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
r3900_cmds.init = dummy_inits;
|
|
|
|
r3900_cmds.cont = "g\r";
|
|
|
|
r3900_cmds.step = "t\r";
|
1999-07-08 04:19:36 +08:00
|
|
|
r3900_cmds.set_break = "b %A\r"; /* COREADDR */
|
|
|
|
r3900_cmds.clr_break = "b %A,0\r"; /* COREADDR */
|
|
|
|
r3900_cmds.fill = "fx %A s %x %x\r"; /* COREADDR, len, val */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
r3900_cmds.setmem.cmdb = "sx %A %x\r"; /* COREADDR, val */
|
|
|
|
r3900_cmds.setmem.cmdw = "sh %A %x\r"; /* COREADDR, val */
|
|
|
|
r3900_cmds.setmem.cmdl = "sw %A %x\r"; /* COREADDR, val */
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
r3900_cmds.getmem.cmdb = "sx %A\r"; /* COREADDR */
|
|
|
|
r3900_cmds.getmem.cmdw = "sh %A\r"; /* COREADDR */
|
|
|
|
r3900_cmds.getmem.cmdl = "sw %A\r"; /* COREADDR */
|
1999-04-16 09:35:26 +08:00
|
|
|
r3900_cmds.getmem.resp_delim = " : ";
|
|
|
|
r3900_cmds.getmem.term = " ";
|
|
|
|
r3900_cmds.getmem.term_cmd = ".\r";
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
r3900_cmds.setreg.cmd = "x%s %x\r"; /* regname, val */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
r3900_cmds.getreg.cmd = "x%s\r"; /* regname */
|
1999-04-16 09:35:26 +08:00
|
|
|
r3900_cmds.getreg.resp_delim = "=";
|
|
|
|
r3900_cmds.getreg.term = " ";
|
|
|
|
r3900_cmds.getreg.term_cmd = ".\r";
|
|
|
|
|
|
|
|
r3900_cmds.dump_registers = "x\r";
|
|
|
|
r3900_cmds.register_pattern =
|
1999-07-08 04:19:36 +08:00
|
|
|
"\\([a-zA-Z0-9_]+\\) *=\\([0-9a-f]+ [0-9a-f]+\\b\\)";
|
1999-04-16 09:35:26 +08:00
|
|
|
r3900_cmds.supply_register = r3900_supply_register;
|
|
|
|
/* S-record download, via "keyboard port". */
|
|
|
|
r3900_cmds.load = "r0\r";
|
|
|
|
r3900_cmds.prompt = "#";
|
|
|
|
r3900_cmds.line_term = "\r";
|
|
|
|
r3900_cmds.target = &r3900_ops;
|
|
|
|
r3900_cmds.stopbits = SERIAL_1_STOPBITS;
|
|
|
|
r3900_cmds.regnames = r3900_regnames;
|
|
|
|
r3900_cmds.magic = MONITOR_OPS_MAGIC;
|
|
|
|
|
|
|
|
init_monitor_ops (&r3900_ops);
|
|
|
|
|
|
|
|
r3900_ops.to_shortname = "r3900";
|
|
|
|
r3900_ops.to_longname = "R3900 monitor";
|
|
|
|
r3900_ops.to_doc = "Debug using the DVE R3900 monitor.\n\
|
|
|
|
Specify the serial device it is connected to (e.g. /dev/ttya).";
|
|
|
|
r3900_ops.to_open = r3900_open;
|
|
|
|
|
|
|
|
/* Override the functions to fetch and store registers. But save the
|
|
|
|
addresses of the default functions, because we will use those functions
|
|
|
|
for "normal" registers. */
|
|
|
|
|
|
|
|
orig_monitor_fetch_registers = r3900_ops.to_fetch_registers;
|
|
|
|
orig_monitor_store_registers = r3900_ops.to_store_registers;
|
|
|
|
r3900_ops.to_fetch_registers = r3900_fetch_registers;
|
|
|
|
r3900_ops.to_store_registers = r3900_store_registers;
|
|
|
|
|
|
|
|
/* Override the load function, but save the address of the default
|
|
|
|
function to use when loading S-records over a serial link. */
|
|
|
|
orig_monitor_load = r3900_ops.to_load;
|
|
|
|
r3900_ops.to_load = r3900_load;
|
|
|
|
|
|
|
|
add_target (&r3900_ops);
|
|
|
|
}
|