aboutsummaryrefslogtreecommitdiff
path: root/gdb/procfs.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-06-07 22:33:25 +0000
committerPedro Alves <palves@redhat.com>2009-06-07 22:33:25 +0000
commitd1a7880c7763c73413efe8dd1293d7874b7e0ddd (patch)
tree7edfabbac62352710dbd715f5711af15f1355d8b /gdb/procfs.c
parent17592de300e28b9f2bdcd6d4d8002d8fcab70ccb (diff)
downloadgdb-d1a7880c7763c73413efe8dd1293d7874b7e0ddd.zip
gdb-d1a7880c7763c73413efe8dd1293d7874b7e0ddd.tar.gz
gdb-d1a7880c7763c73413efe8dd1293d7874b7e0ddd.tar.bz2
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. 2009-06-07 Pedro Alves <pedro@codesourcery.com> * gdbint.texinfo (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete all references.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r--gdb/procfs.c24
1 files changed, 7 insertions, 17 deletions
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\