From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8753 invoked by alias); 17 Jun 2014 16:56:01 -0000 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 Received: (qmail 8742 invoked by uid 89); 17 Jun 2014 16:56:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Jun 2014 16:55:59 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5HGtwjK008769 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 17 Jun 2014 12:55:58 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5HGtvDg010124; Tue, 17 Jun 2014 12:55:57 -0400 Message-ID: <53A0731C.70202@redhat.com> Date: Tue, 17 Jun 2014 16:56:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Gary Benson , gdb-patches@sourceware.org Subject: Re: [PATCH 14/15] Create nat/i386-dregs.c References: <1403014378-4349-1-git-send-email-gbenson@redhat.com> <1403014378-4349-15-git-send-email-gbenson@redhat.com> In-Reply-To: <1403014378-4349-15-git-send-email-gbenson@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00626.txt.bz2 On 06/17/2014 03:12 PM, Gary Benson wrote: > @@ -596,34 +172,8 @@ i386_remove_watchpoint (struct target_ops *self, > { > struct i386_debug_reg_state *state > = i386_debug_reg_state (ptid_get_pid (inferior_ptid)); > - int retval; > - /* Work on a local copy of the debug registers, and on success, > - commit the change back to the inferior. */ > - struct i386_debug_reg_state local_state = *state; > - > - if (((len != 1 && len != 2 && len != 4) > - && !(TARGET_HAS_DR_LEN_8 && len == 8)) > - || addr % len != 0) > - { > - retval = i386_handle_nonaligned_watchpoint (&local_state, > - WP_REMOVE, > - addr, len, type); > - } > - else > - { > - unsigned len_rw = i386_dr_length_and_rw_bits (len, type); > - > - retval = i386_dr_remove_aligned_watchpoint (&local_state, > - addr, len_rw); > - } > - > - if (retval == 0) > - i386_dr_update_inferior_debug_regs (state, &local_state); > - > - if (debug_hw_points) > - i386_dr_show (state, "remove_watchpoint", addr, len, type); > > - return retval; > + return i386_dr_remove_watchpoint (state, type, addr, len); Hmm, there's still one remaining difference in gdb vs gdbserver, after this, in hw breakpoints. i386_insert_hw_breakpoint and i386_remove_hw_breakpoint on the GDB side still have the "work on a local copy" bits, and the i386_dr_update_inferior_debug_regs and i386_dr_show calls: /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. Return 0 on success, EBUSY on failure. */ static int i386_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { struct i386_debug_reg_state *state = i386_debug_reg_state (ptid_get_pid (inferior_ptid)); unsigned len_rw = i386_dr_length_and_rw_bits (1, hw_execute); CORE_ADDR addr = bp_tgt->placed_address; /* Work on a local copy of the debug registers, and on success, commit the change back to the inferior. */ struct i386_debug_reg_state local_state = *state; int retval = i386_dr_insert_aligned_watchpoint (&local_state, addr, len_rw) ? EBUSY : 0; if (retval == 0) i386_dr_update_inferior_debug_regs (state, &local_state); if (debug_hw_points) i386_dr_show (state, "insert_hwbp", addr, 1, hw_execute); return retval; } While on the gdbserver side, we just call i386_dr_insert_watchpoint: static int x86_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp) { switch (type) { case raw_bkpt_type_hw: ... { ... return i386_dr_insert_watchpoint (state, hw_type, addr, size); Any reason GDB can't do the same? -- Pedro Alves