aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog37
-rw-r--r--gdb/alpha-nat.c11
-rw-r--r--gdb/config/i386/nm-i386sol2.h2
-rw-r--r--gdb/config/mips/irix5.mh1
-rw-r--r--gdb/config/mips/irix6.mh1
-rw-r--r--gdb/config/sparc/nm-sol2.h9
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdbint.texinfo5
-rw-r--r--gdb/i386-sol2-nat.c13
-rw-r--r--gdb/irix5-nat.c12
-rw-r--r--gdb/proc-utils.h5
-rw-r--r--gdb/procfs.c24
-rw-r--r--gdb/procfs.h (renamed from gdb/config/mips/nm-irix5.h)23
-rw-r--r--gdb/sol-thread.c3
-rw-r--r--gdb/sparc-sol2-nat.c17
15 files changed, 120 insertions, 48 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a804dad..74f0071 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,40 @@
+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
diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c
index ff8897f..7417776 100644
--- a/gdb/alpha-nat.c
+++ b/gdb/alpha-nat.c
@@ -22,6 +22,7 @@
#include "inferior.h"
#include "gdbcore.h"
#include "target.h"
+#include "procfs.h"
#include "regcache.h"
#include "alpha-tdep.h"
@@ -183,8 +184,16 @@ static struct core_fns alpha_osf_core_fns =
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);
}
diff --git a/gdb/config/i386/nm-i386sol2.h b/gdb/config/i386/nm-i386sol2.h
index ab8ff19..495bd64 100644
--- a/gdb/config/i386/nm-i386sol2.h
+++ b/gdb/config/i386/nm-i386sol2.h
@@ -18,8 +18,6 @@
#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
diff --git a/gdb/config/mips/irix5.mh b/gdb/config/mips/irix5.mh
index 38c9b30..8d07221 100644
--- a/gdb/config/mips/irix5.mh
+++ b/gdb/config/mips/irix5.mh
@@ -1,4 +1,3 @@
# 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
diff --git a/gdb/config/mips/irix6.mh b/gdb/config/mips/irix6.mh
index de14401..de212b2 100644
--- a/gdb/config/mips/irix6.mh
+++ b/gdb/config/mips/irix6.mh
@@ -1,4 +1,3 @@
# 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
diff --git a/gdb/config/sparc/nm-sol2.h b/gdb/config/sparc/nm-sol2.h
index 14fb975..3398e2b 100644
--- a/gdb/config/sparc/nm-sol2.h
+++ b/gdb/config/sparc/nm-sol2.h
@@ -23,13 +23,4 @@
#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 */
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 8f51f17..d4c574a 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+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
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 7acdf2c..b5771cc 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -694,11 +694,6 @@ changed are announced as hit.
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
diff --git a/gdb/i386-sol2-nat.c b/gdb/i386-sol2-nat.c
index 7d6d07b..68be98d 100644
--- a/gdb/i386-sol2-nat.c
+++ b/gdb/i386-sol2-nat.c
@@ -22,6 +22,8 @@
#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
@@ -134,6 +136,15 @@ extern void _initialize_amd64_sol2_nat (void);
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 =
@@ -142,4 +153,6 @@ _initialize_amd64_sol2_nat (void)
amd64_native_gregset64_num_regs =
ARRAY_SIZE (amd64_sol2_gregset64_reg_offset);
#endif
+
+ add_target (t);
}
diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c
index c53c115..91ea948 100644
--- a/gdb/irix5-nat.c
+++ b/gdb/irix5-nat.c
@@ -29,6 +29,7 @@
#include "gdbcore.h"
#include "target.h"
#include "regcache.h"
+#include "procfs.h"
#include "gdb_string.h"
#include <sys/time.h>
@@ -256,8 +257,17 @@ static struct core_fns irix5_core_fns =
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);
}
diff --git a/gdb/proc-utils.h b/gdb/proc-utils.h
index cf52ff6..01e33ee 100644
--- a/gdb/proc-utils.h
+++ b/gdb/proc-utils.h
@@ -96,8 +96,3 @@ typedef PROC_CTL_WORD_TYPE procfs_ctl_t;
#else
typedef long procfs_ctl_t;
#endif
-
-
-/* From procfs.c */
-
-extern ptid_t procfs_first_available (void);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 1e246be..37074b2 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -50,6 +50,7 @@
#include "gdb_assert.h"
#include "inflow.h"
#include "auxv.h"
+#include "procfs.h"
/*
* PROCFS.C
@@ -181,7 +182,7 @@ procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
}
#endif
-static struct target_ops *
+struct target_ops *
procfs_target (void)
{
struct target_ops *t = inf_child_target ();
@@ -212,7 +213,6 @@ procfs_target (void)
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;
@@ -2902,7 +2902,10 @@ procfs_address_to_host_pointer (CORE_ADDR addr)
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 */
@@ -5294,9 +5297,6 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
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
@@ -5312,7 +5312,6 @@ procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
/* Other tests here??? */
return 1;
-#endif
}
/*
@@ -5394,6 +5393,7 @@ procfs_use_watchpoints (struct target_ops *t)
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;
}
/*
@@ -5988,16 +5988,6 @@ proc_untrace_sysexit_cmd (char *args, int from_tty)
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\
diff --git a/gdb/config/mips/nm-irix5.h b/gdb/procfs.h
index 98ff77a..6e8b302 100644
--- a/gdb/config/mips/nm-irix5.h
+++ b/gdb/procfs.h
@@ -1,7 +1,6 @@
-/* Definitions for native support of irix5.
+/* Native debugging support for procfs targets.
- Copyright 1993, 1996, 1998, 1999, 2000, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of GDB.
@@ -18,4 +17,20 @@
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
+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);
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 8c7865b..512239e 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -66,8 +66,7 @@
#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;
diff --git a/gdb/sparc-sol2-nat.c b/gdb/sparc-sol2-nat.c
index 3854fd9..e14af59 100644
--- a/gdb/sparc-sol2-nat.c
+++ b/gdb/sparc-sol2-nat.c
@@ -24,6 +24,8 @@
#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
@@ -94,3 +96,18 @@ fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs, int regnum
{
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);
+}