* procfs.h: New.
* proc-utils.h (procfs_first_available): Don't declare here.
* sol-thread.c: Include procfs.h instead of sys/procfs.h and
proc-utils.h.
* procfs.c: Include procfs.h.
(procfs_target): Make it public. Don't register
procfs_can_use_hw_breakpoint here.
(proc_set_watchpoint): Check for PCWATCH or PIOCSWATCH being
defined instead of TARGET_HAS_HARDWARE_WATCHPOINTS.
(procfs_can_use_hw_breakpoint): Remove check of
TARGET_HAS_HARDWARE_WATCHPOINTS.
(procfs_use_watchpoints): Register procfs_can_use_hw_breakpoint
here.
(_initialize_procfs): Don't add the procfs target here.
* i386-sol2-nat.c: Include target.h and procfs.h.
(_initialize_amd64_sol2_nat): Install the procfs target here,
customized with watchpoints support.
* irix5-nat.c: Include target.h.
(_initialize_core_irix5): Rename to ...
(_initialize_irix5_nat): ... this. Install the procfs target
here, customized with watchpoints support.
* alpha-nat.c: Include procfs.h.
(_initialize_core_alpha): Rename to...
(_initialize_alpha_nat): ... this. Install the procfs target
here, customized with watchpoints support.
* sparc-sol2-nat.c: Include target.h and procfs.h.
(_initialize_sparc_sol2_nat): New.
* config/i386/nm-i386sol2.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* config/sparc/nm-sol2.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* config/mips/irix5.mh (NAT_FILE): Delete.
* config/mips/irix6.mh (NAT_FILE): Delete.
* config/mips/nm-irix5.h: Delete.
2009-06-07 Pedro Alves <pedro@codesourcery.com>
* gdbint.texinfo (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete all
references.
+2009-06-07 Pedro Alves <pedro@codesourcery.com>
+
+ * procfs.h: New.
+ * proc-utils.h (procfs_first_available): Don't declare here.
+ * sol-thread.c: Include procfs.h instead of sys/procfs.h and
+ proc-utils.h.
+ * procfs.c: Include procfs.h.
+ (procfs_target): Make it public. Don't register
+ procfs_can_use_hw_breakpoint here.
+ (proc_set_watchpoint): Check for PCWATCH or PIOCSWATCH being
+ defined instead of TARGET_HAS_HARDWARE_WATCHPOINTS.
+ (procfs_can_use_hw_breakpoint): Remove check of
+ TARGET_HAS_HARDWARE_WATCHPOINTS.
+ (procfs_use_watchpoints): Register procfs_can_use_hw_breakpoint
+ here.
+ (_initialize_procfs): Don't add the procfs target here.
+
+ * i386-sol2-nat.c: Include target.h and procfs.h.
+ (_initialize_amd64_sol2_nat): Install the procfs target here,
+ customized with watchpoints support.
+ * irix5-nat.c: Include target.h.
+ (_initialize_core_irix5): Rename to ...
+ (_initialize_irix5_nat): ... this. Install the procfs target
+ here, customized with watchpoints support.
+ * alpha-nat.c: Include procfs.h.
+ (_initialize_core_alpha): Rename to...
+ (_initialize_alpha_nat): ... this. Install the procfs target
+ here, customized with watchpoints support.
+ * sparc-sol2-nat.c: Include target.h and procfs.h.
+ (_initialize_sparc_sol2_nat): New.
+
+ * config/i386/nm-i386sol2.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
+ * config/sparc/nm-sol2.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
+ * config/mips/irix5.mh (NAT_FILE): Delete.
+ * config/mips/irix6.mh (NAT_FILE): Delete.
+ * config/mips/nm-irix5.h: Delete.
+
20009-06-07 Pedro Alves <pedro@codesourcery.com>
* auxv.c (procfs_xfer_auxv): Change type of the `object' argument
#include "inferior.h"
#include "gdbcore.h"
#include "target.h"
+#include "procfs.h"
#include "regcache.h"
#include "alpha-tdep.h"
NULL /* next */
};
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern initialize_file_ftype _initialize_alpha_nat;
+
void
-_initialize_core_alpha (void)
+_initialize_alpha_nat (void)
{
+ struct target_ops *t;
+
+ t = procfs_target ();
+ add_target (t);
+
deprecated_add_core_fns (&alpha_osf_core_fns);
}
#ifdef NEW_PROC_API /* Solaris 6 and above can do HW watchpoints */
-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-
/* Solaris x86 2.6 and 2.7 targets have a kernel bug when stepping
over an instruction that causes a page fault without triggering
a hardware watchpoint. The kernel properly notices that it shouldn't
# Host: SGI Iris running irix 5.x
-NAT_FILE= nm-irix5.h
NATDEPFILES= fork-child.o irix5-nat.o corelow.o procfs.o \
proc-api.o proc-events.o proc-flags.o proc-why.o
# Host: SGI Iris running irix 6.x
-NAT_FILE= nm-irix5.h
NATDEPFILES= fork-child.o irix5-nat.o corelow.o procfs.o \
proc-api.o proc-events.o proc-flags.o proc-why.o
+++ /dev/null
-/* Definitions for native support of irix5.
-
- Copyright 1993, 1996, 1998, 1999, 2000, 2007, 2008, 2009
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 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, see <http://www.gnu.org/licenses/>. */
-
-#define TARGET_HAS_HARDWARE_WATCHPOINTS
#define GDB_GREGSET_T prgregset_t
#define GDB_FPREGSET_T prfpregset_t
-/* Hardware wactchpoints. */
-
-/* Solaris 2.6 and above can do HW watchpoints. */
-#ifdef NEW_PROC_API
-
-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-
-#endif /* NEW_PROC_API */
-
#endif /* nm-sol2.h */
+2009-06-07 Pedro Alves <pedro@codesourcery.com>
+
+ * gdbint.texinfo (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete all
+ references.
+
2009-06-04 Ulrich Weigand <uweigand@de.ibm.com>
* gdbint.texinfo: Rename formal parameters to gdbarch function
watchpoints:
@table @code
-@findex TARGET_HAS_HARDWARE_WATCHPOINTS
-@item TARGET_HAS_HARDWARE_WATCHPOINTS
-If defined, the target supports hardware watchpoints.
-(Currently only used for several native configs.)
-
@findex TARGET_CAN_USE_HARDWARE_WATCHPOINT
@item TARGET_CAN_USE_HARDWARE_WATCHPOINT (@var{type}, @var{count}, @var{other})
Return the number of hardware watchpoints of type @var{type} that are
#include <sys/procfs.h>
#include "gregset.h"
+#include "target.h"
+#include "procfs.h"
/* This file provids the (temporary) glue between the Solaris x86
target dependent code and the machine independent SVR4 /proc
void
_initialize_amd64_sol2_nat (void)
{
+ struct target_ops *t;
+
+ /* Fill in the generic procfs methods. */
+ t = procfs_target ();
+
+#ifdef NEW_PROC_API /* Solaris 6 and above can do HW watchpoints */
+ procfs_use_watchpoints (t);
+#endif
+
#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
amd64_native_gregset32_reg_offset = amd64_sol2_gregset32_reg_offset;
amd64_native_gregset32_num_regs =
amd64_native_gregset64_num_regs =
ARRAY_SIZE (amd64_sol2_gregset64_reg_offset);
#endif
+
+ add_target (t);
}
#include "gdbcore.h"
#include "target.h"
#include "regcache.h"
+#include "procfs.h"
#include "gdb_string.h"
#include <sys/time.h>
NULL /* next */
};
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern initialize_file_ftype _initialize_irix5_nat;
+
void
-_initialize_core_irix5 (void)
+_initialize_irix5_nat (void)
{
+ struct target_ops *t;
+
+ t = procfs_target ();
+ procfs_use_watchpoints (t);
+ add_target (t);
+
deprecated_add_core_fns (&irix5_core_fns);
}
#else
typedef long procfs_ctl_t;
#endif
-
-
-/* From procfs.c */
-
-extern ptid_t procfs_first_available (void);
#include "gdb_assert.h"
#include "inflow.h"
#include "auxv.h"
+#include "procfs.h"
/*
* PROCFS.C
}
#endif
-static struct target_ops *
+struct target_ops *
procfs_target (void)
{
struct target_ops *t = inf_child_target ();
t->to_has_thread_control = tc_schedlock;
t->to_find_memory_regions = proc_find_memory_regions;
t->to_make_corefile_notes = procfs_make_note_section;
- t->to_can_use_hw_breakpoint = procfs_can_use_hw_breakpoint;
#if defined(PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
t->to_auxv_parse = procfs_auxv_parse;
int
proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
{
-#if !defined (TARGET_HAS_HARDWARE_WATCHPOINTS)
+#if !defined (PCWATCH) && !defined (PIOCSWATCH)
+ /* If neither or these is defined, we can't support watchpoints.
+ This just avoids possibly failing to compile the below on such
+ systems. */
return 0;
#else
/* Horrible hack! Detect Solaris 2.5, because this doesn't work on 2.5 */
static int
procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
{
-#ifndef TARGET_HAS_HARDWARE_WATCHPOINTS
- return 0;
-#else
/* Due to the way that proc_set_watchpoint() is implemented, host
and target pointers must be of the same size. If they are not,
we can't use hardware watchpoints. This limitation is due to the
/* Other tests here??? */
return 1;
-#endif
}
/*
t->to_insert_watchpoint = procfs_insert_watchpoint;
t->to_remove_watchpoint = procfs_remove_watchpoint;
t->to_region_ok_for_hw_watchpoint = procfs_region_ok_for_hw_watchpoint;
+ t->to_can_use_hw_breakpoint = procfs_can_use_hw_breakpoint;
}
/*
void
_initialize_procfs (void)
{
- struct target_ops * t;
-
- t = procfs_target ();
-
-#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS
- procfs_use_watchpoints (t);
-#endif
-
- add_target (t);
-
add_info ("proc", info_proc_cmd, _("\
Show /proc process information about any running process.\n\
Specify process id, or use the program being debugged by default.\n\
--- /dev/null
+/* Native debugging support for procfs targets.
+
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 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, see <http://www.gnu.org/licenses/>. */
+
+struct target_ops;
+
+/* Create a prototype generic procfs target. The client can override
+ it with local methods. */
+
+extern struct target_ops *procfs_target (void);
+
+/* Call this in the native _initialize routine that creates and
+ customizes the prototype target returned by procfs_target, if the
+ native debug interface supports procfs watchpoints. */
+
+extern void procfs_use_watchpoints (struct target_ops *t);
+
+/* Return a ptid for which we guarantee we will be able to find a
+ 'live' procinfo. */
+
+extern ptid_t procfs_first_available (void);
#include "symfile.h"
#include "observer.h"
#include "gdb_string.h"
-#include <sys/procfs.h>
-#include "proc-utils.h"
+#include "procfs.h"
struct target_ops sol_thread_ops;
#include "gregset.h"
#include "sparc-tdep.h"
+#include "target.h"
+#include "procfs.h"
/* This file provids the (temporary) glue between the Solaris SPARC
target dependent code and the machine independent SVR4 /proc
{
sparc_collect_fpregset (regcache, regnum, fpregs);
}
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern initialize_file_ftype _initialize_sparc_sol2_nat;
+
+void
+_initialize_sparc_sol2_nat (void)
+{
+ struct target_ops *t;
+
+ t = procfs_target ();
+#ifdef NEW_PROC_API /* Solaris 6 and above can do HW watchpoints */
+ procfs_use_watchpoints (t);
+#endif
+ add_target (t);
+}