/* Machine independent support for SVR4 /proc (process file system) for GDB.
- Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2015 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
#include "gdbthread.h"
#include "regcache.h"
#include "inf-child.h"
+#include "filestuff.h"
#if defined (NEW_PROC_API)
#define _STRUCTURED_PROC 1 /* Should be done by configure script. */
static void procfs_detach (struct target_ops *, const char *, int);
static void procfs_resume (struct target_ops *,
ptid_t, int, enum gdb_signal);
-static void procfs_stop (struct target_ops *self, ptid_t);
+static void procfs_interrupt (struct target_ops *self, ptid_t);
static void procfs_files_info (struct target_ops *);
static void procfs_fetch_registers (struct target_ops *,
struct regcache *, int);
bfd *, int *);
static int procfs_can_use_hw_breakpoint (struct target_ops *self,
- int, int, int);
+ enum bptype, int, int);
static void procfs_info_proc (struct target_ops *, const char *,
enum info_proc_what);
t->to_xfer_partial = procfs_xfer_partial;
t->to_pass_signals = procfs_pass_signals;
t->to_files_info = procfs_files_info;
- t->to_stop = procfs_stop;
+ t->to_interrupt = procfs_interrupt;
t->to_update_thread_list = procfs_update_thread_list;
t->to_thread_alive = procfs_thread_alive;
create it if it
doesn't exist yet? */
- pi = (procinfo *) xmalloc (sizeof (procinfo));
+ pi = XNEW (procinfo);
memset (pi, 0, sizeof (procinfo));
pi->pid = pid;
pi->tid = tid;
maxcall = syscalls[i].pr_number;
pi->num_syscalls = maxcall+1;
- pi->syscall_names = xmalloc (pi->num_syscalls * sizeof (char *));
+ pi->syscall_names = XNEWVEC (char *, pi->num_syscalls);
for (i = 0; i < pi->num_syscalls; i++)
pi->syscall_names[i] = NULL;
/* Allocate space for one LDT entry.
This alloc must persist, because we return a pointer to it. */
if (ldt_entry == NULL)
- ldt_entry = (struct ssd *) xmalloc (sizeof (struct ssd));
+ ldt_entry = XNEW (struct ssd);
/* Open the file descriptor for the LDT table. */
sprintf (pathname, "/proc/%d/ldt", pi->pid);
if ((nlwp = proc_get_nthreads (pi)) <= 1)
return 1; /* Process is not multi-threaded; nothing to do. */
- prstatus = xmalloc (sizeof (gdb_prstatus_t) * (nlwp + 1));
+ prstatus = XNEWVEC (gdb_prstatus_t, nlwp + 1);
old_chain = make_cleanup (xfree, prstatus);
if (ioctl (pi->ctl_fd, PIOCLSTATUS, prstatus) < 0)
if (nthreads < 2)
return 0; /* Nothing to do for 1 or fewer threads. */
- threads = xmalloc (nthreads * sizeof (tid_t));
+ threads = XNEWVEC (tid_t, nthreads);
if (ioctl (pi->ctl_fd, PIOCTLIST, threads) < 0)
proc_error (pi, "procfs: update_threads (PIOCTLIST)", __LINE__);
kill(SIGINT) to the child's process group. */
static void
-procfs_stop (struct target_ops *self, ptid_t ptid)
+procfs_interrupt (struct target_ops *self, ptid_t ptid)
{
kill (-inferior_process_group (), SIGINT);
}
static int
procfs_can_use_hw_breakpoint (struct target_ops *self,
- int type, int cnt, int othertype)
+ enum bptype type,
+ int cnt, int othertype)
{
/* Due to the way that proc_set_watchpoint() is implemented, host
and target pointers must be of the same size. If they are not,
static int
procfs_insert_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len, int type,
+ CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
struct expression *cond)
{
if (!target_have_steppable_watchpoint
static int
procfs_remove_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len, int type,
+ CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
struct expression *cond)
{
return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0);