/* GNU/Linux/MIPS specific low level interface, for the remote server for GDB.
- Copyright (C) 1995-2013 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 (get_thread_lwp (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;
update_watch_registers_callback (struct inferior_list_entry *entry,
void *pid_p)
{
- struct lwp_info *lwp = (struct lwp_info *) entry;
+ struct thread_info *thread = (struct thread_info *) entry;
+ struct lwp_info *lwp = get_thread_lwp (thread);
int pid = *(int *) pid_p;
/* Only update the threads of this process. */
- if (pid_of (lwp) == pid)
+ if (pid_of (thread) == pid)
{
/* The actual update is done later just before resuming the lwp,
we just mark that the registers need updating. */
static void
mips_linux_prepare_to_resume (struct lwp_info *lwp)
{
- ptid_t ptid = ptid_of (lwp);
+ ptid_t ptid = ptid_of (get_lwp_thread (lwp));
struct process_info *proc = find_process_pid (ptid_get_pid (ptid));
struct arch_process_info *private = proc->private->arch_private;
}
}
-/* Translate breakpoint type TYPE in rsp to 'enum target_hw_bp_type'. */
-
-static enum target_hw_bp_type
-rsp_bp_type_to_target_hw_bp_type (char type)
+static int
+mips_supports_z_point_type (char z_type)
{
- switch (type)
+ switch (z_type)
{
- case '2':
- return hw_write;
- case '3':
- return hw_read;
- case '4':
- return hw_access;
+ case Z_PACKET_WRITE_WP:
+ case Z_PACKET_READ_WP:
+ case Z_PACKET_ACCESS_WP:
+ return 1;
+ default:
+ return 0;
}
-
- gdb_assert_not_reached ("unhandled RSP breakpoint type");
}
/* 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 (get_thread_lwp (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 = rsp_bp_type_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;
/* Only update the threads of this process. */
pid = pid_of (proc);
- find_inferior (&all_lwps, update_watch_registers_callback, &pid);
+ find_inferior (&all_threads, update_watch_registers_callback, &pid);
return 0;
}
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 = rsp_bp_type_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))
/* Only update the threads of this process. */
pid = pid_of (proc);
- find_inferior (&all_lwps, update_watch_registers_callback, &pid);
+ find_inferior (&all_threads, update_watch_registers_callback, &pid);
return 0;
}
struct arch_process_info *private = proc->private->arch_private;
int n;
int num_valid;
- long lwpid = lwpid_of (get_thread_lwp (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 (get_thread_lwp (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,