/* GNU/Linux/MIPS specific low level interface, for the remote server for GDB.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include <sys/ptrace.h>
#include <endian.h>
-#include "mips-linux-watch.h"
+#include "nat/mips-linux-watch.h"
#include "gdb_proc_service.h"
/* Defined in auto-generated file mips-linux.c. */
{
if (have_dsp < 0)
{
- int pid = lwpid_of (current_inferior);
+ int pid = lwpid_of (current_thread);
+ errno = 0;
ptrace (PTRACE_PEEKUSER, pid, DSP_CONTROL, 0);
switch (errno)
{
static CORE_ADDR
mips_reinsert_addr (void)
{
- struct regcache *regcache = get_thread_regcache (current_inferior, 1);
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
union mips_register ra;
collect_register_by_name (regcache, "r31", ra.buf);
return register_size (regcache->tdesc, 0) == 4 ? ra.reg32 : ra.reg64;
}
}
+static int
+mips_supports_z_point_type (char z_type)
+{
+ switch (z_type)
+ {
+ case Z_PACKET_WRITE_WP:
+ case Z_PACKET_READ_WP:
+ case Z_PACKET_ACCESS_WP:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
/* This is the implementation of linux_target_ops method
insert_point. */
static int
-mips_insert_point (char type, CORE_ADDR addr, int len)
+mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
+ int len, struct raw_breakpoint *bp)
{
struct process_info *proc = current_process ();
struct arch_process_info *private = proc->private->arch_private;
enum target_hw_bp_type watch_type;
uint32_t irw;
- /* Breakpoint/watchpoint types:
- '0' - software-breakpoint (not supported)
- '1' - hardware-breakpoint (not supported)
- '2' - write watchpoint (supported)
- '3' - read watchpoint (supported)
- '4' - access watchpoint (supported). */
-
- if (type < '2' || type > '4')
- {
- /* Unsupported. */
- return 1;
- }
-
- lwpid = lwpid_of (current_inferior);
+ lwpid = lwpid_of (current_thread);
if (!mips_linux_read_watch_registers (lwpid,
&private->watch_readback,
&private->watch_readback_valid,
mips_linux_watch_populate_regs (private->current_watches, ®s);
/* Now try to add the new watch. */
- watch_type = Z_packet_to_target_hw_bp_type (type);
+ watch_type = raw_bkpt_type_to_target_hw_bp_type (type);
irw = mips_linux_watch_type_to_irw (watch_type);
if (!mips_linux_watch_try_one_watch (®s, addr, len, irw))
return -1;
remove_point. */
static int
-mips_remove_point (char type, CORE_ADDR addr, int len)
+mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
+ int len, struct raw_breakpoint *bp)
{
struct process_info *proc = current_process ();
struct arch_process_info *private = proc->private->arch_private;
struct mips_watchpoint **pw;
struct mips_watchpoint *w;
- /* Breakpoint/watchpoint types:
- '0' - software-breakpoint (not supported)
- '1' - hardware-breakpoint (not supported)
- '2' - write watchpoint (supported)
- '3' - read watchpoint (supported)
- '4' - access watchpoint (supported). */
-
- if (type < '2' || type > '4')
- {
- /* Unsupported. */
- return 1;
- }
-
/* Search for a known watch that matches. Then unlink and free it. */
- watch_type = Z_packet_to_target_hw_bp_type (type);
+ watch_type = raw_bkpt_type_to_target_hw_bp_type (type);
deleted_one = 0;
pw = &private->current_watches;
while ((w = *pw))
struct arch_process_info *private = proc->private->arch_private;
int n;
int num_valid;
- long lwpid = lwpid_of (current_inferior);
+ long lwpid = lwpid_of (current_thread);
if (!mips_linux_read_watch_registers (lwpid,
&private->watch_readback,
struct arch_process_info *private = proc->private->arch_private;
int n;
int num_valid;
- long lwpid = lwpid_of (current_inferior);
+ long lwpid = lwpid_of (current_thread);
/* On MIPS we don't know the low order 3 bits of the data address.
GDB does not support remote targets that can't report the
mips_reinsert_addr,
0,
mips_breakpoint_at,
+ mips_supports_z_point_type,
mips_insert_point,
mips_remove_point,
mips_stopped_by_watchpoint,