diff options
Diffstat (limited to 'gdb/remote-mips.c')
-rw-r--r-- | gdb/remote-mips.c | 177 |
1 files changed, 0 insertions, 177 deletions
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 71e2bef..c757684 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -599,35 +599,6 @@ mips_expect (const char *string) return mips_expect_timeout (string, remote_timeout); } -/* Read the required number of characters into the given buffer (which - is assumed to be large enough). The only failure is a timeout. */ -static int -mips_getstring (char *string, int n) -{ - char *p = string; - int c; - - immediate_quit++; - while (n > 0) - { - c = serial_readchar (mips_desc, remote_timeout); - - if (c == SERIAL_TIMEOUT) - { - fprintf_unfiltered (gdb_stderr, - "Failed to read %d characters from target (TIMEOUT)\n", n); - immediate_quit--; - return 0; - } - - *p++ = c; - n--; - } - - immediate_quit--; - return 1; -} - /* Read a character from the remote, aborting on error. Returns SERIAL_TIMEOUT on timeout (since that's what serial_readchar() returns). FIXME: If we see the string mips_monitor_prompt from the @@ -2270,129 +2241,6 @@ mips_remove_breakpoint (CORE_ADDR addr, char *contents_cache) return memory_remove_breakpoint (addr, contents_cache); } -#if 0 /* currently not used */ -/* PMON does not currently provide support for the debug mode 'b' - commands to manipulate breakpoints. However, if we wanted to use - the monitor breakpoints (rather than the GDB BREAK_INSN version) - then this code performs the work needed to leave debug mode, - set/clear the breakpoint, and then return to debug mode. */ - -#define PMON_MAX_BP (33) /* 32 SW, 1 HW */ -static CORE_ADDR mips_pmon_bp_info[PMON_MAX_BP]; -/* NOTE: The code relies on this vector being zero-initialised by the system */ - -static int -pmon_insert_breakpoint (CORE_ADDR addr, char *contents_cache) -{ - int status; - - if (monitor_supports_breakpoints) - { - char tbuff[12]; /* space for breakpoint command */ - int bpnum; - CORE_ADDR bpaddr; - - /* PMON does not support debug level breakpoint set/remove: */ - if (mips_exit_debug ()) - mips_error ("Failed to exit debug mode"); - - sprintf (tbuff, "b %08x\r", addr); - mips_send_command (tbuff, 0); - - mips_expect ("Bpt "); - - if (!mips_getstring (tbuff, remote_timeout)) - return 1; - tbuff[2] = '\0'; /* terminate the string */ - if (sscanf (tbuff, "%d", &bpnum) != 1) - { - fprintf_unfiltered (gdb_stderr, - "Invalid decimal breakpoint number from target: %s\n", tbuff); - return 1; - } - - mips_expect (" = "); - - /* Lead in the hex number we are expecting: */ - tbuff[0] = '0'; - tbuff[1] = 'x'; - - /* FIXME!! only 8 bytes! need to expand for Bfd64; - which targets return 64-bit addresses? PMON returns only 32! */ - if (!mips_getstring (&tbuff[2], 8)) - return 1; - tbuff[10] = '\0'; /* terminate the string */ - - if (sscanf (tbuff, "0x%08x", &bpaddr) != 1) - { - fprintf_unfiltered (gdb_stderr, - "Invalid hex address from target: %s\n", tbuff); - return 1; - } - - if (bpnum >= PMON_MAX_BP) - { - fprintf_unfiltered (gdb_stderr, - "Error: Returned breakpoint number %d outside acceptable range (0..%d)\n", - bpnum, PMON_MAX_BP - 1); - return 1; - } - - if (bpaddr != addr) - fprintf_unfiltered (gdb_stderr, "Warning: Breakpoint addresses do not match: 0x%x != 0x%x\n", addr, bpaddr); - - mips_pmon_bp_info[bpnum] = bpaddr; - - mips_expect ("\r\n"); - mips_expect (mips_monitor_prompt); - - mips_enter_debug (); - - return 0; - } - - return mips_store_word (addr, BREAK_INSN, contents_cache); -} - -static int -pmon_remove_breakpoint (CORE_ADDR addr, char *contents_cache) -{ - if (monitor_supports_breakpoints) - { - int bpnum; - char tbuff[7]; /* enough for delete breakpoint command */ - - for (bpnum = 0; bpnum < PMON_MAX_BP; bpnum++) - if (mips_pmon_bp_info[bpnum] == addr) - break; - - if (bpnum >= PMON_MAX_BP) - { - fprintf_unfiltered (gdb_stderr, - "pmon_remove_breakpoint: Failed to find breakpoint at address 0x%s\n", - paddr_nz (addr)); - return 1; - } - - if (mips_exit_debug ()) - mips_error ("Failed to exit debug mode"); - - sprintf (tbuff, "db %02d\r", bpnum); - - mips_send_command (tbuff, -1); - /* NOTE: If the breakpoint does not exist then a "Bpt <dd> not - set" message will be returned. */ - - mips_enter_debug (); - - return 0; - } - - return target_write_memory (addr, contents_cache, BREAK_INSN_SIZE); -} -#endif - - /* Tell whether this target can support a hardware breakpoint. CNT is the number of hardware breakpoints already installed. This implements the TARGET_CAN_USE_HARDWARE_WATCHPOINT macro. */ @@ -2427,31 +2275,6 @@ calculate_mask (CORE_ADDR addr, int len) } -/* Insert a hardware breakpoint. This works only on LSI targets, which - implement ordinary breakpoints using hardware facilities. */ - -static int -remote_mips_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache) -{ - if (strcmp (target_shortname, "lsi") == 0) - return mips_insert_breakpoint (addr, contents_cache); - else - return -1; -} - - -/* Remove a hardware breakpoint. This works only on LSI targets, which - implement ordinary breakpoints using hardware facilities. */ - -static int -remote_mips_remove_hw_breakpoint (CORE_ADDR addr, char *contents_cache) -{ - if (strcmp (target_shortname, "lsi") == 0) - return mips_remove_breakpoint (addr, contents_cache); - else - return -1; -} - /* Set a data watchpoint. ADDR and LEN should be obvious. TYPE is 0 for a write watchpoint, 1 for a read watchpoint, or 2 for a read/write watchpoint. */ |