From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24387 invoked by alias); 15 Mar 2004 20:30:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24373 invoked from network); 15 Mar 2004 20:30:09 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 15 Mar 2004 20:30:09 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i2FKU907016051 for ; Mon, 15 Mar 2004 15:30:09 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i2FKU9S23594 for ; Mon, 15 Mar 2004 15:30:09 -0500 Received: from localhost.localdomain (vpn50-70.rdu.redhat.com [172.16.50.70]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id i2FKU74q015068 for ; Mon, 15 Mar 2004 15:30:08 -0500 Received: from saguaro (saguaro.lan [192.168.64.2]) by localhost.localdomain (8.12.10/8.12.10) with SMTP id i2FKU2cG017674 for ; Mon, 15 Mar 2004 13:30:02 -0700 Date: Mon, 15 Mar 2004 20:30:00 -0000 From: Kevin Buettner To: gdb-patches@sources.redhat.com Subject: [RFC] breakpoint.c: Don't let adjust_breakpoint_address() adjust watchpoints Message-Id: <20040315133002.0d21df91@saguaro> Organization: Red Hat Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03.o/txt/msg00329.txt In the course of running the GDB testsuite on FR-V, I discovered that it's a bad idea to adjust watchpoint addresses. If any adjustment is done, the watchpoint ends up at the wrong address. The patch below simply disables adjustment for watchpoints and some eventpoints. Any comments on this patch? If not, I'll commit it towards the end of the week. Kevin * breakpoint.c (adjust_breakpoint_address): Don't adjust breakpoint address for watchpoints or the catch eventpoints. Add new paramter bptype. Adjust all callers. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.162 diff -u -p -r1.162 breakpoint.c --- breakpoint.c 28 Feb 2004 16:56:12 -0000 1.162 +++ breakpoint.c 15 Mar 2004 20:18:45 -0000 @@ -99,7 +99,8 @@ static void check_duplicates (struct bre static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int); -static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr); +static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr, + enum bptype bptype); static void describe_other_breakpoints (CORE_ADDR, asection *); @@ -3947,13 +3948,25 @@ breakpoint_adjustment_warning (CORE_ADDR this function is simply the identity function. */ static CORE_ADDR -adjust_breakpoint_address (CORE_ADDR bpaddr) +adjust_breakpoint_address (CORE_ADDR bpaddr, enum bptype bptype) { if (!gdbarch_adjust_breakpoint_address_p (current_gdbarch)) { /* Very few targets need any kind of breakpoint adjustment. */ return bpaddr; } + else if (bptype == bp_watchpoint + || bptype == bp_hardware_watchpoint + || bptype == bp_read_watchpoint + || bptype == bp_access_watchpoint + || bptype == bp_catch_fork + || bptype == bp_catch_vfork + || bptype == bp_catch_exec) + { + /* Watchpoints and the various bp_catch_* eventpoints should not + have their addresses modified. */ + return bpaddr; + } else { CORE_ADDR adjusted_bpaddr; @@ -4062,7 +4075,8 @@ set_raw_breakpoint (struct symtab_and_li memset (b, 0, sizeof (*b)); b->loc = allocate_bp_location (b, bptype); b->loc->requested_address = sal.pc; - b->loc->address = adjust_breakpoint_address (b->loc->requested_address); + b->loc->address = adjust_breakpoint_address (b->loc->requested_address, + bptype); if (sal.symtab == NULL) b->source_file = NULL; else @@ -4622,7 +4636,8 @@ set_longjmp_resume_breakpoint (CORE_ADDR if (b->type == bp_longjmp_resume) { b->loc->requested_address = pc; - b->loc->address = adjust_breakpoint_address (b->loc->requested_address); + b->loc->address = adjust_breakpoint_address (b->loc->requested_address, + b->type); b->enable_state = bp_enabled; b->frame_id = frame_id; check_duplicates (b); @@ -5879,7 +5894,8 @@ watch_command_1 (char *arg, int accessfl scope_breakpoint->loc->requested_address = get_frame_pc (prev_frame); scope_breakpoint->loc->address - = adjust_breakpoint_address (scope_breakpoint->loc->requested_address); + = adjust_breakpoint_address (scope_breakpoint->loc->requested_address, + scope_breakpoint->type); /* The scope breakpoint is related to the watchpoint. We will need to act on them together. */ @@ -5894,11 +5910,6 @@ watch_command_1 (char *arg, int accessfl in hardware. If the watchpoint can not be handled in hardware return zero. */ -#if !defined(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT) -#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(BYTE_SIZE) \ - ((BYTE_SIZE) <= (DEPRECATED_REGISTER_SIZE)) -#endif - #if !defined(TARGET_REGION_OK_FOR_HW_WATCHPOINT) #define TARGET_REGION_OK_FOR_HW_WATCHPOINT(ADDR,LEN) \ (TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(LEN)) @@ -7190,7 +7201,8 @@ breakpoint_re_set_one (void *bint) b->line_number = sals.sals[i].line; b->loc->requested_address = sals.sals[i].pc; b->loc->address - = adjust_breakpoint_address (b->loc->requested_address); + = adjust_breakpoint_address (b->loc->requested_address, + b->type); /* Used to check for duplicates here, but that can cause trouble, as it doesn't check for disabled From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24387 invoked by alias); 15 Mar 2004 20:30:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24373 invoked from network); 15 Mar 2004 20:30:09 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 15 Mar 2004 20:30:09 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i2FKU907016051 for ; Mon, 15 Mar 2004 15:30:09 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i2FKU9S23594 for ; Mon, 15 Mar 2004 15:30:09 -0500 Received: from localhost.localdomain (vpn50-70.rdu.redhat.com [172.16.50.70]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id i2FKU74q015068 for ; Mon, 15 Mar 2004 15:30:08 -0500 Received: from saguaro (saguaro.lan [192.168.64.2]) by localhost.localdomain (8.12.10/8.12.10) with SMTP id i2FKU2cG017674 for ; Mon, 15 Mar 2004 13:30:02 -0700 Date: Fri, 19 Mar 2004 00:09:00 -0000 From: Kevin Buettner To: gdb-patches@sources.redhat.com Subject: [RFC] breakpoint.c: Don't let adjust_breakpoint_address() adjust watchpoints Message-ID: <20040315133002.0d21df91@saguaro> Organization: Red Hat Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00329.txt.bz2 Message-ID: <20040319000900.6ddQJtz5x8FF_wGcSVowU9UmzBKEfFoFrMuP2rZgTnw@z> In the course of running the GDB testsuite on FR-V, I discovered that it's a bad idea to adjust watchpoint addresses. If any adjustment is done, the watchpoint ends up at the wrong address. The patch below simply disables adjustment for watchpoints and some eventpoints. Any comments on this patch? If not, I'll commit it towards the end of the week. Kevin * breakpoint.c (adjust_breakpoint_address): Don't adjust breakpoint address for watchpoints or the catch eventpoints. Add new paramter bptype. Adjust all callers. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.162 diff -u -p -r1.162 breakpoint.c --- breakpoint.c 28 Feb 2004 16:56:12 -0000 1.162 +++ breakpoint.c 15 Mar 2004 20:18:45 -0000 @@ -99,7 +99,8 @@ static void check_duplicates (struct bre static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int); -static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr); +static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr, + enum bptype bptype); static void describe_other_breakpoints (CORE_ADDR, asection *); @@ -3947,13 +3948,25 @@ breakpoint_adjustment_warning (CORE_ADDR this function is simply the identity function. */ static CORE_ADDR -adjust_breakpoint_address (CORE_ADDR bpaddr) +adjust_breakpoint_address (CORE_ADDR bpaddr, enum bptype bptype) { if (!gdbarch_adjust_breakpoint_address_p (current_gdbarch)) { /* Very few targets need any kind of breakpoint adjustment. */ return bpaddr; } + else if (bptype == bp_watchpoint + || bptype == bp_hardware_watchpoint + || bptype == bp_read_watchpoint + || bptype == bp_access_watchpoint + || bptype == bp_catch_fork + || bptype == bp_catch_vfork + || bptype == bp_catch_exec) + { + /* Watchpoints and the various bp_catch_* eventpoints should not + have their addresses modified. */ + return bpaddr; + } else { CORE_ADDR adjusted_bpaddr; @@ -4062,7 +4075,8 @@ set_raw_breakpoint (struct symtab_and_li memset (b, 0, sizeof (*b)); b->loc = allocate_bp_location (b, bptype); b->loc->requested_address = sal.pc; - b->loc->address = adjust_breakpoint_address (b->loc->requested_address); + b->loc->address = adjust_breakpoint_address (b->loc->requested_address, + bptype); if (sal.symtab == NULL) b->source_file = NULL; else @@ -4622,7 +4636,8 @@ set_longjmp_resume_breakpoint (CORE_ADDR if (b->type == bp_longjmp_resume) { b->loc->requested_address = pc; - b->loc->address = adjust_breakpoint_address (b->loc->requested_address); + b->loc->address = adjust_breakpoint_address (b->loc->requested_address, + b->type); b->enable_state = bp_enabled; b->frame_id = frame_id; check_duplicates (b); @@ -5879,7 +5894,8 @@ watch_command_1 (char *arg, int accessfl scope_breakpoint->loc->requested_address = get_frame_pc (prev_frame); scope_breakpoint->loc->address - = adjust_breakpoint_address (scope_breakpoint->loc->requested_address); + = adjust_breakpoint_address (scope_breakpoint->loc->requested_address, + scope_breakpoint->type); /* The scope breakpoint is related to the watchpoint. We will need to act on them together. */ @@ -5894,11 +5910,6 @@ watch_command_1 (char *arg, int accessfl in hardware. If the watchpoint can not be handled in hardware return zero. */ -#if !defined(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT) -#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(BYTE_SIZE) \ - ((BYTE_SIZE) <= (DEPRECATED_REGISTER_SIZE)) -#endif - #if !defined(TARGET_REGION_OK_FOR_HW_WATCHPOINT) #define TARGET_REGION_OK_FOR_HW_WATCHPOINT(ADDR,LEN) \ (TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(LEN)) @@ -7190,7 +7201,8 @@ breakpoint_re_set_one (void *bint) b->line_number = sals.sals[i].line; b->loc->requested_address = sals.sals[i].pc; b->loc->address - = adjust_breakpoint_address (b->loc->requested_address); + = adjust_breakpoint_address (b->loc->requested_address, + b->type); /* Used to check for duplicates here, but that can cause trouble, as it doesn't check for disabled