64 static int mips_cksum (
const unsigned char *hdr,
65 const char *data,
int len);
74 int *perr,
int timeout,
char *buff);
102 static int pmon_makeb64 (
unsigned long v,
char *p,
int n,
unsigned int *chksum);
104 static int pmon_zeroset (
int recsize,
char **buff,
unsigned int *amount,
105 unsigned int *chksum);
110 int *inptr,
int inamount,
int *recsize,
111 unsigned int *csum,
unsigned int *zerofill);
124 unsigned char *myaddr,
int len);
212 #define HDR_OFFSET 0x40
215 #define HDR_INDX_SYN 0
216 #define HDR_INDX_TYPE_LEN 1
217 #define HDR_INDX_LEN1 2
218 #define HDR_INDX_SEQ 3
222 #define TYPE_LEN_DA_BIT 0x20
223 #define TYPE_LEN_DATA 0
224 #define TYPE_LEN_ACK TYPE_LEN_DA_BIT
227 #define HDR_SET_SYN(data, len, seq) (SYN)
228 #define HDR_SET_TYPE_LEN(data, len, seq) \
230 + ((data) ? TYPE_LEN_DATA : TYPE_LEN_ACK) \
231 + (((len) >> 6) & 0x1f))
232 #define HDR_SET_LEN1(data, len, seq) (HDR_OFFSET + ((len) & 0x3f))
233 #define HDR_SET_SEQ(data, len, seq) (HDR_OFFSET + (seq))
236 #define HDR_CHECK(ch) (((ch) & HDR_OFFSET) == HDR_OFFSET)
240 #define HDR_IS_DATA(hdr) \
241 (((hdr)[HDR_INDX_TYPE_LEN] & TYPE_LEN_DA_BIT) == TYPE_LEN_DATA)
242 #define HDR_GET_LEN(hdr) \
243 ((((hdr)[HDR_INDX_TYPE_LEN] & 0x1f) << 6) + (((hdr)[HDR_INDX_LEN1] & 0x3f)))
244 #define HDR_GET_SEQ(hdr) ((unsigned int)(hdr)[HDR_INDX_SEQ] & 0x3f)
247 #define DATA_MAXLEN 1023
250 #define TRLR_OFFSET HDR_OFFSET
253 #define TRLR_INDX_CSUM1 0
254 #define TRLR_INDX_CSUM2 1
255 #define TRLR_INDX_CSUM3 2
256 #define TRLR_LENGTH 3
259 #define TRLR_SET_CSUM1(cksum) (TRLR_OFFSET + (((cksum) >> 12) & 0x3f))
260 #define TRLR_SET_CSUM2(cksum) (TRLR_OFFSET + (((cksum) >> 6) & 0x3f))
261 #define TRLR_SET_CSUM3(cksum) (TRLR_OFFSET + (((cksum) ) & 0x3f))
264 #define TRLR_CHECK(ch) (((ch) & TRLR_OFFSET) == TRLR_OFFSET)
268 #define TRLR_GET_CKSUM(trlr) \
269 ((((trlr)[TRLR_INDX_CSUM1] & 0x3f) << 12) \
270 + (((trlr)[TRLR_INDX_CSUM2] & 0x3f) << 6) \
271 + ((trlr)[TRLR_INDX_CSUM3] & 0x3f))
274 #define SEQ_MODULOS (64)
277 #define LOAD_CMD "load -b -s tty0\r"
278 #define LOAD_CMD_UDP "load -b -s udp\r"
380 static DCACHE *mips_dcache;
390 #define MAX_LSI_BREAKPOINTS 256
428 {
W_MSK,
"Range feature is supported via mask"},
429 {
W_VAL,
"Value check is not supported in hardware"},
430 {
W_QAL,
"Requested qualifiers are not supported in hardware"},
436 {
E_BPT,
"No such breakpoint number"},
437 {
E_RGE,
"Range is not supported"},
438 {
E_QAL,
"The requested qualifiers can not be used"},
439 {
E_OUT,
"Out of hardware resources"},
440 {
E_NON,
"Hardware breakpoint not supported"},
476 static void ATTRIBUTE_NORETURN
495 fmt = concat (
_(
"Ending remote MIPS debugging: "),
496 string, (
char *) NULL);
499 va_start (args,
string);
531 while ((c = *
string++) !=
'\0')
548 if (*p >=
'0' && *p <=
'9')
550 else if (*p >=
'A' && *p <=
'F')
551 retval |= *p -
'A' + 10;
552 else if (*p >=
'a' && *p <=
'f')
553 retval |= *p -
'a' + 10;
646 static int state = 0;
657 if (state == mips_monitor_prompt_len)
664 error (
_(
"Watchdog has expired. Target detached."));
687 && state == mips_monitor_prompt_len
695 "Reinitializing MIPS debugging mode\n");
705 error (
_(
"Remote board reset, debug protocol re-initialized."));
746 if (isprint (ch) || isspace (ch))
758 if (! (isprint (ch) || isspace (ch)))
764 "than %d characters before a sync."),
820 const unsigned char *p;
821 const unsigned char *data = (
const unsigned char *) datastr;
847 unsigned char *packet;
853 mips_error (
_(
"MIPS protocol data packet too long: %s"), s);
926 for (i = 0; i <
len; i++)
998 mips_error (
_(
"Remote did not acknowledge packet"));
1029 mips_error (
_(
"Timed out waiting for remote packet"));
1056 for (i = 0; i <
len; i++)
1069 mips_error (
_(
"Timed out waiting for remote packet"));
1082 "Got new SYN after %d chars (wanted %d)\n",
1111 "Ignoring sequence number %d (want %d)\n",
1235 char response_string[17];
1242 if (buff == (
char *) NULL)
1249 _(
"mips_request: Trying to send "
1250 "command before reply"));
1254 sprintf (buff,
"0x0 %c 0x%s 0x%s", cmd,
1257 sprintf (buff,
"0x0 %c 0x%s 0x%s", cmd,
1264 if (perr == (
int *) NULL)
1269 _(
"mips_request: Trying to get reply before command"));
1276 if (sscanf (buff,
"0x%x %c 0x%x 0x%16s",
1277 &rpid, &rcmd, &rerrflg, response_string) != 4
1279 || (cmd !=
'\0' && rcmd != cmd))
1356 mips_error (
_(
"Failed to initialize (didn't receive packet)."));
1412 warning (
_(
"internal error: mips_initialize called twice"));
1458 sprintf (tbuff,
"\r/E/E\r");
1476 for (i = 1; i <= 33; i++)
1536 const char *new_monitor_prompt)
1538 char *serial_port_name;
1539 char *remote_name = 0;
1540 char *local_name = 0;
1546 To open a MIPS remote debugging connection, you need to specify what\n\
1547 serial device is attached to the target board (e.g., /dev/ttya).\n\
1548 If you want to use TFTP to download to the board, specify the name of a\n\
1549 temporary file to be used by GDB for downloads as the second argument.\n\
1550 This filename must be in the form host:filename, where host is the name\n\
1551 of the host running the TFTP server, and the file must be readable by the\n\
1552 world. If the local name of the temporary file differs from the name as\n\
1553 seen from the board via TFTP, specify that name as the third parameter.\n"));
1560 serial_port_name = xstrdup (argv[0]);
1563 remote_name = argv[1];
1565 local_name = argv[2];
1575 if (mips_desc == NULL)
1595 if (strchr (remote_name,
'#'))
1611 if (local_name == NULL)
1612 if ((local_name = strchr (remote_name,
':')) != NULL)
1614 if (local_name == NULL)
1615 local_name = remote_name;
1654 xfree (serial_port_name);
1664 const char *monitor_prompt = NULL;
1670 case bfd_mach_mips4100:
1671 case bfd_mach_mips4300:
1672 case bfd_mach_mips4600:
1673 case bfd_mach_mips4650:
1674 case bfd_mach_mips5000:
1675 monitor_prompt =
"<RISQ> ";
1679 if (monitor_prompt == NULL)
1680 monitor_prompt =
"<IDT>";
1744 error (
_(
"Argument given to \"detach\" when remotely debugging."));
1758 ptid_t ptid,
int step,
enum gdb_signal siggnal)
1772 static enum gdb_signal
1780 return GDB_SIGNAL_UNKNOWN;
1786 return (
enum gdb_signal) sig;
1803 && (regno ==
mips_regnum (gdbarch)->pc || regno < 32))
1827 char pc_string[17], fp_string[17], sp_string[17],
flags[20];
1839 status->
value.
sig = GDB_SIGNAL_TRAP;
1867 nfields = sscanf (buff,
1868 "0x%*x %*c 0x%*x 0x%*x 0x%16s 0x%16s 0x%16s 0x%*x %s",
1869 pc_string, fp_string, sp_string, flags);
1886 for (i = 0; i <= 2; i++)
1887 if (flags[i] ==
'r' || flags[i] ==
'w')
1889 else if (flags[i] ==
'\000')
1922 if (nfields == 1 && rpc == 1)
1939 if ((rstatus & 0xff) == 0)
1944 else if ((rstatus & 0xff) == 0x7f)
1954 const char *func_name;
1959 if (func_name != NULL && strcmp (func_name,
"_exit") == 0
1960 && func_start == pc)
1976 #define REGNO_OFFSET 96
1994 else if (regno ==
mips_regnum (gdbarch)->fp_control_status)
1996 else if (regno ==
mips_regnum (gdbarch)->fp_implementation_revision)
2032 if (regno != 0 && pmon_reg == 0)
2046 mips_error (
_(
"Can't read register %d: %s"), regno,
2085 mips_error (
_(
"Can't write register %d: %s"), regno,
2117 unsigned int oldcontents;
2129 if (old_contents != NULL)
2130 *old_contents = oldcontents;
2159 addr = memaddr & ~3;
2161 count = (((memaddr +
len) - addr) + 3) / 4;
2163 buffer = alloca (count * 4);
2165 if (writebuf != NULL)
2168 if (addr != memaddr || len < 4)
2189 4, byte_order, val);
2194 memcpy ((
char *) buffer + (memaddr & 3), writebuf, len);
2198 for (i = 0; i < count; i++, addr += 4)
2220 for (i = 0; i < count; i++, addr += 4)
2232 memcpy (readbuf, buffer + (memaddr & 3), len);
2242 const char *annex,
gdb_byte *readbuf,
2253 readbuf, writebuf, offset, len,
2288 if (
query (
_(
"Interrupted while waiting for the program.\n\
2289 Give up (and stop debugging it)? ")))
2330 char *args,
char **env,
int from_tty)
2337 Can't pass arguments to remote MIPS board; arguments ignored."));
2342 if (execfile == 0 ||
exec_bfd == 0)
2343 error (
_(
"No executable file specified"));
2358 if (current_ops != NULL)
2405 int type,
int cnt,
int othertype)
2414 static unsigned long
2420 mask = addr ^ (addr + len - 1);
2422 for (i = 32; i >= 0; i--)
2428 mask = (
unsigned long) 0xffffffff >> i;
2513 for (err = lsi_warning_table; err->
code != 0; err++)
2515 if ((err->
code & rerrflg) == err->
code)
2519 mips_common_breakpoint (%s): Warning: %s\n",
2526 mips_common_breakpoint (%s): Unknown warning: 0x%x\n",
2534 for (err = lsi_error_table; err->
code != 0; err++)
2536 if ((err->
code & rerrflg) == err->
code)
2539 mips_common_breakpoint (%s): Error: %s\n",
2546 mips_common_breakpoint (%s): Unknown error: 0x%x\n",
2572 int rpid, rerrflg, rresponse, rlen;
2599 if (i == MAX_LSI_BREAKPOINTS)
2602 mips_common_breakpoint: Attempt to clear bogus breakpoint at %s"),
2608 sprintf (buf,
"0x0 b 0x%x 0x0", i);
2614 nfields = sscanf (buf,
"0x%x b 0x0 0x%x", &rpid, &rerrflg);
2617 "Bad response from remote board: %s"),
2650 sprintf (buf,
"0x0 B 0x%s 0x0",
phex_nz (addr, addr_size));
2656 sprintf (buf,
"0x0 A 0x%s 0x%x 0x%s",
2659 phex_nz (addr + len - 1, addr_size));
2666 nfields = sscanf (buf,
"0x%x %c 0x%x 0x%x",
2667 &rpid, &rcmd, &rresponse, &rerrflg);
2668 if (nfields != 4 || rcmd != cmd || rresponse > 255)
2670 "Bad response from remote board: %s"),
2719 _(
"failed internal consistency check"));
2723 sprintf (buf,
"0x0 B 0x%s 0x%s %s",
phex_nz (addr, addr_size),
2724 phex_nz (mask, addr_size), flags);
2729 sprintf (buf,
"0x0 b 0x%s",
phex_nz (addr, addr_size));
2737 nfields = sscanf (buf,
"0x%x %c 0x%x 0x%x",
2738 &rpid, &rcmd, &rerrflg, &rresponse);
2740 if (nfields != 4 || rcmd != cmd)
2742 "Bad response from remote board: %s"),
2750 rresponse = rerrflg;
2751 if (rresponse != 22)
2753 mips_common_breakpoint (%s): Got error: 0x%x\n",
2780 error (
_(
"Timeout during download."));
2786 "Download got a NACK at byte %s! Retrying.\n",
2790 error (
_(
"Download got unexpected ack char: 0x%x, retrying."),
2806 unsigned int srec_frame = 200;
2811 buffer = alloca (srec_frame * 2 + 256);
2821 if (bfd_check_format (abfd, bfd_object) == 0)
2831 for (s = abfd->sections; s; s = s->next)
2833 if (s->flags & SEC_LOAD)
2835 unsigned int numbytes;
2840 (
long) (s->vma + bfd_get_section_size (s)));
2843 for (i = 0; i < bfd_get_section_size (s); i += numbytes)
2845 numbytes =
min (srec_frame, bfd_get_section_size (s) - i);
2847 bfd_get_section_contents (abfd, s, buffer, i, numbytes);
2873 reclen =
mips_make_srec (srec,
'7', abfd->start_address, NULL, 0);
2875 send_srec (srec, reclen, abfd->start_address);
2929 unsigned char checksum;
2938 buf[2] = len + 4 + 1;
2942 buf[3] = memaddr >> 24;
2943 buf[4] = memaddr >> 16;
2944 buf[5] = memaddr >> 8;
2946 memcpy (&buf[7], myaddr, len);
2953 for (i = 0; i < len + 4 + 1; i++)
2964 #define DOETXACK (1)
2989 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.";
2999 int count = (n / 6);
3004 "Fast encoding bitcount must be a "
3005 "multiple of 12bits: %dbit%s\n",
3006 n, (n == 1) ?
"" :
"s");
3012 "Fast encoding cannot process more "
3013 "than 36bits at the moment: %dbits\n", n);
3023 *chksum += ((v >> 24) & 0xFFF);
3025 *chksum += ((v >> 12) & 0xFFF);
3027 *chksum += ((v >> 0) & 0xFFF);
3046 unsigned int *amount,
unsigned int *chksum)
3050 sprintf (*buff,
"/Z");
3051 count =
pmon_makeb64 (*amount, (*buff + 2), 12, chksum);
3052 *buff += (count + 2);
3054 return (recsize + count + 2);
3077 sprintf (*buff,
"/C");
3079 *buff += (count + 2);
3080 sprintf (*buff,
"\n");
3084 return (recsize + count + 3);
3089 #define CHECKSIZE (4 + 4 + 4 + 2)
3094 #define BINCHUNK (1024)
3097 #define MAXRECSIZE (550)
3129 int inamount,
int *recsize,
unsigned int *csum,
3130 unsigned int *zerofill)
3142 if ((inamount - *inptr) < 3)
3145 *recsize =
pmon_zeroset (*recsize, &p, zerofill, csum);
3149 *recsize += (2 + count);
3154 unsigned int value = ((inbuf[*inptr + 0] << 16)
3155 | (inbuf[*inptr + 1] << 8)
3156 | (inbuf[*inptr + 2]));
3165 if (value == 0x00000000)
3168 if (*zerofill == 0xFFF)
3169 *recsize =
pmon_zeroset (*recsize, &p, zerofill, csum);
3174 *recsize =
pmon_zeroset (*recsize, &p, zerofill, csum);
3194 #if defined(DOETXACK)
3204 "Failed to receive valid ACK for %s\n", mesg);
3268 sprintf (hexnumber,
"%x",
final);
3283 sprintf (hexnumber,
"%x", bintotal);
3302 static char *load_cmd_prefix =
"load -b -s ";
3320 strcpy (cmd, load_cmd_prefix);
3372 written = fwrite (buffer, 1, length,
tftp_file);
3373 if (written < length)
3388 unsigned char *binbuf;
3391 unsigned int csum = 0;
3409 if (bfd_check_format (abfd, bfd_object) == 0)
3426 sprintf (buffer,
"/Kxx\n");
3427 reclen = strlen (buffer);
3431 for (s = abfd->sections; s && !finished; s = s->next)
3432 if (s->flags & SEC_LOAD)
3434 bintotal += bfd_get_section_size (s);
3435 final = (s->vma + bfd_get_section_size (s));
3438 (
unsigned int) s->vma,
3439 (
unsigned int) (s->vma + bfd_get_section_size (s)));
3443 sprintf (buffer,
"/A");
3445 buffer[2 + reclen] =
'\n';
3446 buffer[3 + reclen] =
'\0';
3453 unsigned int binamount;
3454 unsigned int zerofill = 0;
3461 i < bfd_get_section_size (s) && !finished;
3466 binamount =
min (
BINCHUNK, bfd_get_section_size (s) - i);
3468 bfd_get_section_contents (abfd, s, binbuf, i, binamount);
3472 for (; ((binamount - binptr) > 0);)
3475 &reclen, &csum, &zerofill);
3523 sprintf (buffer,
"/E/E\n");
3524 reclen = strlen (buffer);
3549 error (
_(
"mips_load: Couldn't get into monitor mode."));
3590 static char buf[64];
3594 xsnprintf (buf,
sizeof buf,
"Thread <main>");
3609 sprintf (buf,
"0x0 %s", args);
3665 Debug a board using the MIPS remote debugging protocol over a serial line.\n\
3666 The argument is the device it is connected to or, if it contains a colon,\n\
3667 HOST:PORT to access a board over a network";
3673 Debug a board using the PMON MIPS remote debugging protocol over a serial\n\
3674 line. The argument is the device it is connected to or, if it contains a\n\
3675 colon, HOST:PORT to access a board over a network";
3681 Debug a board using the PMON MIPS remote debugging protocol over a serial\n\
3682 line. The first argument is the device it is connected to or, if it contains\n\
3683 a colon, HOST:PORT to access a board over a network. The optional second\n\
3684 parameter is the temporary file in the form HOST:FILENAME to be used for\n\
3685 TFTP downloads to the board. The optional third parameter is the local name\n\
3686 of the TFTP temporary file, if it differs from the filename seen by the board.";
3708 Set timeout in seconds for remote MIPS serial I/O."),
_(
"\
3709 Show timeout in seconds for remote MIPS serial I/O."), NULL,
3716 Set retransmit timeout in seconds for remote MIPS serial I/O."),
_(
"\
3717 Show retransmit timeout in seconds for remote MIPS serial I/O."),
_(
"\
3718 This is the number of seconds to wait for an acknowledgement to a packet\n\
3719 before resending the packet."),
3726 Set the maximum number of characters to ignore when scanning for a SYN."),
_(
"\
3727 Show the maximum number of characters to ignore when scanning for a SYN."),
_(
"\
3728 This is the maximum number of characters GDB will ignore when trying to\n\
3729 synchronize with the remote system. A value of -1 means that there is no\n\
3730 limit. (Note that these characters are printed out even though they are\n\
3738 Set the prompt that GDB expects from the monitor."),
_(
"\
3739 Show the prompt that GDB expects from the monitor."), NULL,
3746 Set printing of monitor warnings."),
_(
"\
3747 Show printing of monitor warnings."),
_(
"\
3748 When enabled, monitor warnings about hardware breakpoints will be displayed."),
3754 _(
"Send a packet to PMON (must be in debug mode)."));
3757 Set zeroing of upper 32 bits of 64-bit addresses when talking to PMON targets."),
_(
"\
3758 Show zeroing of upper 32 bits of 64-bit addresses when talking to PMON targets."),
_(
"\
3759 Use \"on\" to enable the masking and \"off\" to disable it."),
3763 remote_mips_ptid =
ptid_build (42000, 0, 42000);
struct gdbarch * target_gdbarch(void)
struct cleanup * make_cleanup_freeargv(char **arg)
static int pmon_makeb64(unsigned long v, char *p, int n, unsigned int *chksum)
void add_target(struct target_ops *t)
static struct serial * mips_desc
int default_child_has_stack(struct target_ops *ops)
void target_terminal_ours(void)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
static int mips_receive_trailer(unsigned char *trlr, int *pgarbage, int *pch, int timeout)
static int mips_remove_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, int type, struct expression *cond)
int putchar_unfiltered(int c)
static void mips_enter_debug(void)
static enum gdb_signal mips_signal_from_protocol(int sig)
static void mips_load(struct target_ops *self, const char *file, int from_tty)
struct frame_info * get_selected_frame(const char *message)
#define HDR_SET_LEN1(data, len, seq)
void add_setshow_zinteger_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static char * mips_pid_to_str(struct target_ops *ops, ptid_t ptid)
static int pmon_checkset(int recsize, char **buff, unsigned int *value)
int ptid_equal(ptid_t ptid1, ptid_t ptid2)
struct target_ops mips_ops pmon_ops ddb_ops rockhopper_ops lsi_ops
void store_signed_integer(gdb_byte *, int, enum bfd_endian, LONGEST)
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
static int mips_remove_breakpoint(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
int(* to_has_memory)(struct target_ops *)
void warning(const char *fmt,...)
char *(* to_pid_to_str)(struct target_ops *, ptid_t) TARGET_DEFAULT_FUNC(default_pid_to_str)
static enum target_xfer_status mips_xfer_partial(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
int query(const char *ctlstr,...)
void init_wait_for_inferior(void)
static void pmon_check_entry_address(char *entry_address, int final)
static int mips_fetch_word(CORE_ADDR addr, unsigned int *valp)
int(* to_has_stack)(struct target_ops *)
void push_target(struct target_ops *t)
int(* to_insert_breakpoint)(struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_FUNC(memory_insert_breakpoint)
int gdbarch_deprecated_fp_regnum(struct gdbarch *gdbarch)
static unsigned int mips_send_seq
struct ui_file * gdb_stdout
int unpush_target(struct target_ops *t)
void internal_error(const char *file, int line, const char *fmt,...)
static int mips_check_lsi_error(CORE_ADDR addr, int rerrflg)
void generic_mourn_inferior(void)
void(* to_close)(struct target_ops *)
int serial_write(struct serial *scb, const void *buf, size_t count)
static int mips_insert_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, int type, struct expression *cond)
static int mips_exit_debug(void)
struct target_ops rockhopper_ops
static char * mips_monitor_prompt
int(* to_remove_breakpoint)(struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_FUNC(memory_remove_breakpoint)
int gdbarch_num_regs(struct gdbarch *gdbarch)
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_NORETURN(noprocess())
static int mips_need_reply
void execute_command(char *, int)
struct bfd * gdb_bfd_open(const char *name, const char *target, int fd)
static void mips_send_command(const char *cmd, int prompt)
const struct mips_regnum * mips_regnum(struct gdbarch *gdbarch)
static void mips_exit_cleanups(void *arg)
int default_child_has_execution(struct target_ops *ops, ptid_t the_ptid)
void regcache_write_pc(struct regcache *regcache, CORE_ADDR pc)
static void pmon_end_download(int final, int bintotal)
struct regcache * get_current_regcache(void)
static void mips_send_packet(const char *s, int get_ack)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
void printf_filtered(const char *format,...)
static int mips_insert_breakpoint(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
static int mips_map_regno(struct gdbarch *, int)
ptid_t ptid_build(int pid, long lwp, long tid)
initialize_file_ftype _initialize_remote_mips
static enum target_xfer_status mips_xfer_memory(gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
void(* to_files_info)(struct target_ops *) TARGET_DEFAULT_IGNORE()
static void fputs_readable(const char *string, struct ui_file *file)
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
static int mips_receive_packet(char *buff, int throw_error, int timeout)
int default_child_has_memory(struct target_ops *ops)
static void common_open(struct target_ops *ops, const char *name, int from_tty, enum mips_monitor_type new_monitor, const char *new_monitor_prompt)
static int mips_set_breakpoint(CORE_ADDR addr, int len, enum break_type type)
int(* to_insert_watchpoint)(struct target_ops *, CORE_ADDR, int, int, struct expression *) TARGET_DEFAULT_RETURN(-1)
struct cmd_list_element * setlist
static int monitor_supports_breakpoints
void serial_log_command(struct target_ops *self, const char *cmd)
static ULONGEST mips_request(int cmd, ULONGEST addr, ULONGEST data, int *perr, int timeout, char *buff)
static int mips_clear_breakpoint(CORE_ADDR addr, int len, enum break_type type)
int fputc_unfiltered(int c, struct ui_file *stream)
static int mips_syn_garbage
#define MAX_LSI_BREAKPOINTS
CORE_ADDR gdbarch_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
void initialize_file_ftype(void)
static int read_hex_value(const char *p, ULONGEST *result)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t err
static void mips_open(const char *name, int from_tty)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
static int mips_thread_alive(struct target_ops *ops, ptid_t ptid)
int(* to_remove_watchpoint)(struct target_ops *, CORE_ADDR, int, int, struct expression *) TARGET_DEFAULT_RETURN(-1)
void target_terminal_inferior(void)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
void(* to_resume)(struct target_ops *, ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
struct cmd_list_element * showlist
int serial_setbaudrate(struct serial *scb, int rate)
int serial_flush_input(struct serial *scb)
static int pmon_check_total(int bintotal)
static int mips_expect_download(char *string)
static void rockhopper_open(const char *name, int from_tty)
int default_child_has_all_memory(struct target_ops *ops)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
union target_waitstatus::@161 value
static int interrupt_count
static void ddb_open(const char *name, int from_tty)
int(* to_has_execution)(struct target_ops *, ptid_t)
static void ATTRIBUTE_NORETURN mips_error(char *string,...)
static enum mips_monitor_type mips_monitor
static void mips_set_register(int regno, ULONGEST value)
#define TRLR_SET_CSUM1(cksum)
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
#define HDR_SET_SYN(data, len, seq)
static ptid_t mips_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *status, int options)
int serial_send_break(struct serial *scb)
void deprecated_mips_set_processor_regs_hack(void)
static struct target_ops * current_ops
static int mips_receive_wait
void add_setshow_string_cmd(const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void target_mourn_inferior(void)
static int mips_initializing
void serial_raw(struct serial *scb)
static void pmon_make_fastrec(char **outbuf, unsigned char *inbuf, int *inptr, int inamount, int *recsize, unsigned int *csum, unsigned int *zerofill)
static unsigned long calculate_mask(CORE_ADDR addr, int len)
struct thread_info * add_thread_silent(ptid_t ptid)
int gdbarch_addr_bit(struct gdbarch *gdbarch)
enum target_xfer_status(* to_xfer_partial)(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) TARGET_DEFAULT_RETURN(TARGET_XFER_E_IO)
void wrap_here(char *indent)
void printf_unfiltered(const char *format,...)
void(* to_detach)(struct target_ops *ops, const char *, int) TARGET_DEFAULT_IGNORE()
static void pmon_load_fast(const char *file)
static int mips_make_srec(char *buffer, int type, CORE_ADDR memaddr, unsigned char *myaddr, int len)
struct cleanup * make_cleanup_bfd_unref(bfd *abfd)
struct ui_file * gdb_stdlog
static void mips_create_inferior(struct target_ops *ops, char *execfile, char *args, char **env, int from_tty)
void serial_close(struct serial *scb)
static int mips_send_retries
static int pmon_check_ack(char *mesg)
char * normal_pid_to_str(ptid_t ptid)
struct serial * serial_open(const char *name)
static unsigned int mips_receive_seq
static int monitor_warnings
static void mips_close(struct target_ops *self)
void(* to_log_command)(struct target_ops *, const char *) TARGET_DEFAULT_IGNORE()
int ptid_get_pid(ptid_t ptid)
void regcache_invalidate(struct regcache *regcache, int regnum)
static int mips_expect(const char *string)
void print_stack_frame(struct frame_info *, int print_level, enum print_what print_what, int set_current_sal)
static void pmon_command(char *args, int from_tty)
#define TRLR_SET_CSUM2(cksum)
static int mips_cksum(const unsigned char *hdr, const char *data, int len)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
void(* to_mourn_inferior)(struct target_ops *) TARGET_DEFAULT_FUNC(default_mourn_inferior)
char * phex_nz(ULONGEST l, int sizeof_l)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
static int hit_watchpoint
static void mips_mourn_inferior(struct target_ops *ops)
int(* to_can_use_hw_breakpoint)(struct target_ops *, int, int, int) TARGET_DEFAULT_RETURN(0)
int default_child_has_registers(struct target_ops *ops)
void throw_verror(enum errors error, const char *fmt, va_list ap)
int xsnprintf(char *str, size_t size, const char *format,...)
static int mips_retransmit_wait
enum target_waitkind kind
static int mips_store_word(CORE_ADDR addr, unsigned int value, int *old_contents)
void(* to_kill)(struct target_ops *) TARGET_DEFAULT_NORETURN(noprocess())
static int mips_stopped_by_watchpoint(struct target_ops *ops)
struct ui_file * gdb_stderr
CORE_ADDR regcache_read_pc(struct regcache *regcache)
int serial_flush_output(struct serial *scb)
static ptid_t remote_mips_ptid
char * safe_strerror(int)
struct target_ops mips_ops
void(* to_open)(const char *, int)
struct target_ops pmon_ops
void registers_changed(void)
void(* to_create_inferior)(struct target_ops *, char *, char *, char **, int)
static void mips_load_srec(const char *args)
char ** gdb_buildargv(const char *s)
static void send_srec(char *srec, int len, CORE_ADDR addr)
#define HDR_SET_SEQ(data, len, seq)
static void pmon_start_download(void)
int(* to_stopped_by_watchpoint)(struct target_ops *) TARGET_DEFAULT_RETURN(0)
static void mips_initialize_cleanups(void *arg)
#define HDR_INDX_TYPE_LEN
static int mips_wait_flag
struct ui_file * gdb_stdtarg
static void mips_fetch_registers(struct target_ops *ops, struct regcache *regcache, int regno)
static int pmon_zeroset(int recsize, char **buff, unsigned int *amount, unsigned int *chksum)
#define HDR_SET_TYPE_LEN(data, len, seq)
static struct serial * udp_desc
static void fputc_readable(int ch, struct ui_file *file)
static void mips_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal siggnal)
struct inferior * current_inferior(void)
#define TRLR_SET_CSUM3(cksum)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
const char * to_shortname
struct target_ops ddb_ops
unsigned long long ULONGEST
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static void pmon_open(const char *name, int from_tty)
int register_size(struct gdbarch *gdbarch, int regnum)
static void mips_prepare_to_store(struct target_ops *self, struct regcache *regcache)
int memory_insert_breakpoint(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
int(* to_has_all_memory)(struct target_ops *)
int memory_remove_breakpoint(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
const struct bfd_arch_info * gdbarch_bfd_arch_info(struct gdbarch *gdbarch)
static int mips_expect_timeout(const char *string, int timeout)
static void pmon_download(char *buffer, int length)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
static char * tftp_localname
static int mips_receive_header(unsigned char *hdr, int *pgarbage, int ch, int timeout)
int(* to_thread_alive)(struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN(0)
void target_preopen(int from_tty)
void reinit_frame_cache(void)
static int mips_common_breakpoint(int set, CORE_ADDR addr, int len, enum break_type type)
static void mips_store_registers(struct target_ops *ops, struct regcache *regcache, int regno)
int serial_readchar(struct serial *scb, int timeout)
static void mips_files_info(struct target_ops *ignore)
static void mips_initialize(void)
void gdb_flush(struct ui_file *file)
int(* deprecated_ui_load_progress_hook)(const char *section, unsigned long num)
static int mips_readchar(int timeout)
struct lsi_breakpoint_info lsi_breakpoints[MAX_LSI_BREAKPOINTS]
void(* to_prepare_to_store)(struct target_ops *, struct regcache *) TARGET_DEFAULT_NORETURN(noprocess())
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
int(* to_has_registers)(struct target_ops *)
static int mask_address_p
static void close_ports(void)
enum bfd_endian byte_order
static void lsi_open(const char *name, int from_tty)
static void mips_detach(struct target_ops *ops, const char *args, int from_tty)
void error(const char *fmt,...)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc)
#define TRLR_GET_CKSUM(trlr)
void throw_error(enum errors error, const char *fmt,...)
struct target_ops * beneath
static void mips_kill(struct target_ops *ops)
void inferior_appeared(struct inferior *inf, int pid)
void(* to_load)(struct target_ops *, const char *, int) TARGET_DEFAULT_NORETURN(tcomplain())
void do_cleanups(struct cleanup *old_chain)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static int mips_can_use_watchpoint(struct target_ops *self, int type, int cnt, int othertype)
const ULONGEST const LONGEST len