From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14340 invoked by alias); 10 May 2009 16:15:06 -0000 Received: (qmail 14255 invoked by uid 22791); 10 May 2009 16:15:02 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 10 May 2009 16:14:56 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id n4AGEplh036857 for ; Sun, 10 May 2009 18:14:51 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms2.u-strasbg.fr [IPv6:2001:660:2402:d::11]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n4AGEpq0063539 for ; Sun, 10 May 2009 18:14:51 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n4AGEn8p053838 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sun, 10 May 2009 18:14:50 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: Subject: [RFA] Unify target header macros Date: Sun, 10 May 2009 16:15:00 -0000 Message-ID: <005a01c9d18a$77d3c8b0$677b5a10$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00190.txt.bz2 This RFA is to answer Joel's request formulated in http://sourceware.org/ml/gdb-patches/2009-05/msg00178.html It was done by using a sed script, which means that it is quite mechanical. In particular, I suspect that some of the comments that are changed by that patch are obsolete... Is OK nevertheless? Pierre Muller Pascal language support maintainer for GDB 2009-05-10 Pierre Muller Unify target macros. * target.h (STOPPED_BY_WATCHPOINT): Delete, replaced by ... (target_stoppped_by_watchpoint): New macro. (HAVE_STEPPABLE_WATCHPOINT): Delete, replaced by ... (target_have_steppable_watchpoint): New macro. (HAVE_CONTINUABLE_WATCHPOINT): Delete, replace by ... (target_have_continuable_watchpoint): New macro. (TARGET_CAN_USE_HARDWARE_WATCHPOINT):Delete, replaced by ... (target_can_use_hardware_watchpoint): New macro. (TARGET_REGION_OK_FOR_HW_WATCHPOINT):Delete, replaced by ... (target_region_ok_for_hw_watchpoint): New macro. * breakpoint.c (update_watchpoint): Use new macros. (bpstat_alloc): Likewise. (create_breakpoint): Likewise. (watch_command_1): Likewise. (can_use_hardware_watchpoint): Likewise. (do_enable_breakpoint): Likewise. * infrun.c (handle_inferior_event): Adapt to new macros. * mips-tdep.c (mips_gdbarch_init): Update comments. * procfs.c (procfs_set_watchpoint): Update comment. (procfs_insert_watchpoint): Adapt to new macros. * remote-m32r-sdi.c (m32r_stop): * remote-mips.c (mips_remove_breakpoint): * target.c (debug_to_region_ok_for_hw_watchpoint): Update to new macros. (debug_to_stopped_by_watchpoint): Likewise. Index: target.h =================================================================== RCS file: /cvs/src/src/gdb/target.h,v retrieving revision 1.151 diff -u -p -r1.151 target.h --- target.h 10 May 2009 13:30:53 -0000 1.151 +++ target.h 10 May 2009 14:05:23 -0000 @@ -1053,17 +1053,17 @@ extern char *normal_pid_to_str (ptid_t p /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or write). */ -#define STOPPED_BY_WATCHPOINT(w) \ - (*current_target.to_stopped_by_watchpoint) () +#define target_stopped_by_watchpoint \ + (*current_target.to_stopped_by_watchpoint) /* Non-zero if we have steppable watchpoints */ -#define HAVE_STEPPABLE_WATCHPOINT \ +#define target_have_steppable_watchpoint \ (current_target.to_have_steppable_watchpoint) /* Non-zero if we have continuable watchpoints */ -#define HAVE_CONTINUABLE_WATCHPOINT \ +#define target_have_continuable_watchpoint \ (current_target.to_have_continuable_watchpoint) /* Provide defaults for hardware watchpoint functions. */ @@ -1076,10 +1076,10 @@ extern char *normal_pid_to_str (ptid_t p bp_hardware_breakpoint. CNT is the number of such watchpoints used so far (including this one?). OTHERTYPE is who knows what... */ -#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(TYPE,CNT,OTHERTYPE) \ +#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \ (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE); -#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \ +#define target_region_ok_for_hw_watchpoint(addr, len) \ (*current_target.to_region_ok_for_hw_watchpoint) (addr, len) Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.393 diff -u -p -r1.393 breakpoint.c --- breakpoint.c 5 May 2009 13:24:48 -0000 1.393 +++ breakpoint.c 10 May 2009 14:03:34 -0000 @@ -961,7 +961,7 @@ update_watchpoint (struct breakpoint *b, b->type = bp_watchpoint; else { - int target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT + int target_resources_ok = target_can_use_hardware_watchpoint (bp_hardware_watchpoint, i + mem_cnt, other_type_used); if (target_resources_ok <= 0) b->type = bp_watchpoint; @@ -2602,7 +2602,7 @@ bpstat_alloc (const struct bp_location * int watchpoints_triggered (struct target_waitstatus *ws) { - int stopped_by_watchpoint = STOPPED_BY_WATCHPOINT (*ws); + int stopped_by_watchpoint = target_stopped_by_watchpoint (); CORE_ADDR addr; struct breakpoint *b; @@ -5249,7 +5249,7 @@ create_breakpoint (struct symtabs_and_li { int i = hw_breakpoint_used_count (); int target_resources_ok = - TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint, + target_can_use_hardware_watchpoint (bp_hardware_breakpoint, i + 1, 0); if (target_resources_ok == 0) error (_("No hardware breakpoint support in the target.")); @@ -6170,7 +6170,7 @@ watch_command_1 (char *arg, int accessfl { i = hw_watchpoint_used_count (bp_type, &other_type_used); target_resources_ok = - TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_type, i + mem_cnt, + target_can_use_hardware_watchpoint (bp_type, i + mem_cnt, other_type_used); if (target_resources_ok == 0 && bp_type != bp_hardware_watchpoint) error (_("Target does not support this type of hardware watchpoint.")); @@ -6308,7 +6308,7 @@ can_use_hardware_watchpoint (struct valu CORE_ADDR vaddr = VALUE_ADDRESS (v) + value_offset (v); int len = TYPE_LENGTH (value_type (v)); - if (!TARGET_REGION_OK_FOR_HW_WATCHPOINT (vaddr, len)) + if (!target_region_ok_for_hw_watchpoint (vaddr, len)) return 0; else found_memory_cnt++; @@ -7977,7 +7977,7 @@ do_enable_breakpoint (struct breakpoint int i; i = hw_breakpoint_used_count (); target_resources_ok = - TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint, + target_can_use_hardware_watchpoint (bp_hardware_breakpoint, i + 1, 0); if (target_resources_ok == 0) error (_("No hardware breakpoint support in the target.")); Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.371 diff -u -p -r1.371 infrun.c --- infrun.c 5 May 2009 13:24:48 -0000 1.371 +++ infrun.c 10 May 2009 14:04:21 -0000 @@ -2568,7 +2568,7 @@ targets should add new threads to the th { fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = 0x%s\n", paddr_nz (stop_pc)); - if (STOPPED_BY_WATCHPOINT (&ecs->ws)) + if (target_stopped_by_watchpoint ()) { CORE_ADDR addr; fprintf_unfiltered (gdb_stdlog, "infrun: stopped by watchpoint\n"); @@ -2824,7 +2824,7 @@ targets should add new threads to the th /* If necessary, step over this watchpoint. We'll be back to display it in a moment. */ if (stopped_by_watchpoint - && (HAVE_STEPPABLE_WATCHPOINT + && (target_have_steppable_watchpoint || gdbarch_have_nonsteppable_watchpoint (current_gdbarch))) { /* At this point, we are stopped at an instruction which has @@ -2849,14 +2849,14 @@ targets should add new threads to the th disable all watchpoints and breakpoints. */ int hw_step = 1; - if (!HAVE_STEPPABLE_WATCHPOINT) + if (!target_have_steppable_watchpoint) remove_breakpoints (); /* Single step */ hw_step = maybe_software_singlestep (current_gdbarch, stop_pc); target_resume (ecs->ptid, hw_step, TARGET_SIGNAL_0); registers_changed (); waiton_ptid = ecs->ptid; - if (HAVE_STEPPABLE_WATCHPOINT) + if (target_have_steppable_watchpoint) infwait_state = infwait_step_watch_state; else infwait_state = infwait_nonstep_watch_state; Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.492 diff -u -p -r1.492 mips-tdep.c --- mips-tdep.c 5 May 2009 13:24:49 -0000 1.492 +++ mips-tdep.c 10 May 2009 14:04:40 -0000 @@ -6005,11 +6005,11 @@ mips_gdbarch_init (struct gdbarch_info i else set_gdbarch_print_insn (gdbarch, gdb_print_insn_mips); - /* FIXME: cagney/2003-08-29: The macros HAVE_STEPPABLE_WATCHPOINT, - HAVE_NONSTEPPABLE_WATCHPOINT, and HAVE_CONTINUABLE_WATCHPOINT + /* FIXME: cagney/2003-08-29: The macros target_have_steppable_watchpoint, + HAVE_NONSTEPPABLE_WATCHPOINT, and target_have_continuable_watchpoint need to all be folded into the target vector. Since they are - being used as guards for STOPPED_BY_WATCHPOINT, why not have - STOPPED_BY_WATCHPOINT return the type of watchpoint that the code + being used as guards for target_stopped_by_watchpoint, why not have + target_stopped_by_watchpoint return the type of watchpoint that the code is sitting on? */ set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1); Index: procfs.c =================================================================== RCS file: /cvs/src/src/gdb/procfs.c,v retrieving revision 1.106 diff -u -p -r1.106 procfs.c --- procfs.c 6 May 2009 17:18:52 -0000 1.106 +++ procfs.c 10 May 2009 14:04:52 -0000 @@ -5289,7 +5289,7 @@ procfs_set_watchpoint (ptid_t ptid, CORE Note: procfs_can_use_hw_breakpoint() is not yet used by all procfs.c targets due to the fact that some of them still define - TARGET_CAN_USE_HARDWARE_WATCHPOINT. */ + target_can_use_hardware_watchpoint. */ static int procfs_can_use_hw_breakpoint (int type, int cnt, int othertype) @@ -5352,7 +5352,7 @@ procfs_stopped_by_watchpoint (void) static int procfs_insert_watchpoint (CORE_ADDR addr, int len, int type) { - if (!HAVE_STEPPABLE_WATCHPOINT + if (!target_have_steppable_watchpoint && !gdbarch_have_nonsteppable_watchpoint (current_gdbarch)) { /* When a hardware watchpoint fires off the PC will be left at Index: remote-m32r-sdi.c =================================================================== RCS file: /cvs/src/src/gdb/remote-m32r-sdi.c,v retrieving revision 1.41 diff -u -p -r1.41 remote-m32r-sdi.c --- remote-m32r-sdi.c 5 May 2009 13:24:49 -0000 1.41 +++ remote-m32r-sdi.c 10 May 2009 14:04:54 -0000 @@ -1398,7 +1398,7 @@ m32r_stop (ptid_t ptid) /* Tell whether this target can support a hardware breakpoint. CNT is the number of hardware breakpoints already installed. This - implements the TARGET_CAN_USE_HARDWARE_WATCHPOINT macro. */ + implements the target_can_use_hardware_watchpoint macro. */ static int m32r_can_use_hw_watchpoint (int type, int cnt, int othertype) Index: remote-mips.c =================================================================== RCS file: /cvs/src/src/gdb/remote-mips.c,v retrieving revision 1.100 diff -u -p -r1.100 remote-mips.c --- remote-mips.c 5 May 2009 13:24:49 -0000 1.100 +++ remote-mips.c 10 May 2009 14:04:55 -0000 @@ -2249,7 +2249,7 @@ mips_remove_breakpoint (struct bp_target /* Tell whether this target can support a hardware breakpoint. CNT is the number of hardware breakpoints already installed. This - implements the TARGET_CAN_USE_HARDWARE_WATCHPOINT macro. */ + implements the target_can_use_hardware_watchpoint macro. */ int mips_can_use_watchpoint (int type, int cnt, int othertype) Index: target.c =================================================================== RCS file: /cvs/src/src/gdb/target.c,v retrieving revision 1.206 diff -u -p -r1.206 target.c --- target.c 14 Apr 2009 16:48:07 -0000 1.206 +++ target.c 10 May 2009 14:05:23 -0000 @@ -2889,7 +2889,7 @@ debug_to_region_ok_for_hw_watchpoint (CO retval = debug_target.to_region_ok_for_hw_watchpoint (addr, len); fprintf_unfiltered (gdb_stdlog, - "TARGET_REGION_OK_FOR_HW_WATCHPOINT (%ld, %ld) = 0x%lx\n", + "target_region_ok_for_hw_watchpoint (%ld, %ld) = 0x%lx\n", (unsigned long) addr, (unsigned long) len, (unsigned long) retval); @@ -2904,7 +2904,7 @@ debug_to_stopped_by_watchpoint (void) retval = debug_target.to_stopped_by_watchpoint (); fprintf_unfiltered (gdb_stdlog, - "STOPPED_BY_WATCHPOINT () = %ld\n", + "target_stopped_by_watchpoint () = %ld\n", (unsigned long) retval); return retval; }