/* Machine independent support for QNX Neutrino /proc (process file system)
for GDB. Written by Colin Burgess at QNX Software Systems Limited.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
Contributed by QNX Software Systems Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "nto-tdep.h"
#include "command.h"
#include "regcache.h"
+#include "solib.h"
#define NULL_PID 0
#define _DEBUG_FLAG_TRACE (_DEBUG_FLAG_TRACE_EXEC|_DEBUG_FLAG_TRACE_RD|\
struct mem_attrib *attrib,
struct target_ops *);
-static void procfs_fetch_registers (int);
+static void procfs_fetch_registers (struct regcache *, int);
static void notice_signals (void);
static int procfs_can_use_hw_breakpoint (int, int, int);
-static int procfs_insert_hw_breakpoint (CORE_ADDR, char *);
-
-static int procfs_remove_hw_breakpoint (CORE_ADDR addr, char *);
-
static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type);
static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type);
else
{
if (sysinfo->type !=
- nto_map_arch_to_cputype (TARGET_ARCHITECTURE->arch_name))
+ nto_map_arch_to_cputype (gdbarch_bfd_arch_info
+ (current_gdbarch)->arch_name))
{
close (fd);
error (_("Invalid target CPU."));
static void
procfs_post_attach (pid_t pid)
{
-#ifdef SOLIB_CREATE_INFERIOR_HOOK
if (exec_bfd)
- SOLIB_CREATE_INFERIOR_HOOK (pid);
-#endif
+ solib_create_inferior_hook ();
}
static ptid_t
general register set and floating point registers (if supported)
and update gdb's idea of their current values. */
static void
-procfs_fetch_registers (int regno)
+procfs_fetch_registers (struct regcache *regcache, int regno)
{
union
{
procfs_set_thread (inferior_ptid);
if (devctl (ctl_fd, DCMD_PROC_GETGREG, ®, sizeof (reg), ®size) == EOK)
- nto_supply_gregset ((char *) ®.greg);
+ nto_supply_gregset (regcache, (char *) ®.greg);
if (devctl (ctl_fd, DCMD_PROC_GETFPREG, ®, sizeof (reg), ®size)
== EOK)
- nto_supply_fpregset ((char *) ®.fpreg);
+ nto_supply_fpregset (regcache, (char *) ®.fpreg);
if (devctl (ctl_fd, DCMD_PROC_GETALTREG, ®, sizeof (reg), ®size)
== EOK)
- nto_supply_altregset ((char *) ®.altreg);
+ nto_supply_altregset (regcache, (char *) ®.altreg);
}
/* Copy LEN bytes to/from inferior's memory starting at MEMADDR
}
static int
-procfs_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_insert_breakpoint (struct bp_target_info *bp_tgt)
{
- return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC, 0);
+ return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, 0);
}
static int
-procfs_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_remove_breakpoint (struct bp_target_info *bp_tgt)
{
- return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC, -1);
+ return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, -1);
}
static int
-procfs_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_insert_hw_breakpoint (struct bp_target_info *bp_tgt)
{
- return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, 0);
+ return procfs_breakpoint (bp_tgt->placed_address,
+ _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, 0);
}
static int
-procfs_remove_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_remove_hw_breakpoint (struct bp_target_info *bp_tgt)
{
- return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1);
+ return procfs_breakpoint (bp_tgt->placed_address,
+ _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1);
}
static void
pid_t pid;
int flags, errn;
char **argv, *args;
- char *in = "", *out = "", *err = "";
+ const char *in = "", *out = "", *err = "";
int fd, fds[3];
sigset_t set;
+ const char *inferior_io_terminal = get_inferior_io_terminal ();
argv = xmalloc (((strlen (allargs) + 1) / (unsigned) 2 + 2) *
sizeof (*argv));
push_target (&procfs_ops);
target_terminal_init ();
-#ifdef SOLIB_CREATE_INFERIOR_HOOK
if (exec_bfd != NULL
|| (symfile_objfile != NULL && symfile_objfile->obfd != NULL))
- SOLIB_CREATE_INFERIOR_HOOK (pid);
-#endif
+ solib_create_inferior_hook ();
stop_soon = 0;
- proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
}
static void
/* Store register REGNO, or all registers if REGNO == -1, from the contents
of REGISTERS. */
static void
-procfs_prepare_to_store (void)
+procfs_prepare_to_store (struct regcache *regcache)
{
}
}
void
-procfs_store_registers (int regno)
+procfs_store_registers (struct regcache *regcache, int regno)
{
union
{
if (dev_set == -1)
continue;
- if (nto_regset_fill (regset, (char *) ®) == -1)
+ if (nto_regset_fill (regcache, regset, (char *) ®) == -1)
continue;
err = devctl (ctl_fd, dev_set, ®, regsize, 0);
if (len < 1)
return;
- regcache_raw_collect (current_regcache, regno, (char *) ® + off);
+ regcache_raw_collect (regcache, regno, (char *) ® + off);
err = devctl (ctl_fd, dev_set, ®, regsize, 0);
if (err != EOK)