From patchwork Fri Oct 3 13:54:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 3087 Received: (qmail 18793 invoked by alias); 3 Oct 2014 13:54:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 18666 invoked by uid 89); 3 Oct 2014 13:54:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 03 Oct 2014 13:54:27 +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 s93DsPNj010489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 3 Oct 2014 09:54:26 -0400 Received: from brno.lan (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 s93DsJ7d025501 for ; Fri, 3 Oct 2014 09:54:25 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 5/8] Remove deprecated_insert_raw_breakpoint and friends Date: Fri, 3 Oct 2014 14:54:15 +0100 Message-Id: <1412344458-31774-6-git-send-email-palves@redhat.com> In-Reply-To: <1412344458-31774-1-git-send-email-palves@redhat.com> References: <1412344458-31774-1-git-send-email-palves@redhat.com> There are no users of deprecated_{insert,remove}_raw_breakpoint left. gdb/ 2014-10-03 Pedro Alves * breakpoint.c (regular_breakpoint_inserted_here_p): Inline ... (breakpoint_inserted_here_p): ... here. Remove special case for software single-step breakpoints. (find_non_raw_software_breakpoint_inserted_here): Inline ... (software_breakpoint_inserted_here_p): ... here. Remove special case for software single-step breakpoints. (bp_target_info_copy_insertion_state) (deprecated_insert_raw_breakpoint) (deprecated_remove_raw_breakpoint): Delete functions. * breakpoint.h (deprecated_insert_raw_breakpoint) (deprecated_remove_raw_breakpoint): Remove declarations. --- gdb/breakpoint.c | 145 +++---------------------------------------------------- gdb/breakpoint.h | 8 --- 2 files changed, 7 insertions(+), 146 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 10010f8..90a8c43 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4240,14 +4240,10 @@ moribund_breakpoint_here_p (struct address_space *aspace, CORE_ADDR pc) return 0; } -/* Returns non-zero if there's a breakpoint inserted at PC, which is - inserted using regular breakpoint_chain / bp_location array - mechanism. This does not check for single-step breakpoints, which - are inserted and removed using direct target manipulation. */ +/* Returns non-zero iff there's a breakpoint inserted at PC. */ int -regular_breakpoint_inserted_here_p (struct address_space *aspace, - CORE_ADDR pc) +breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc) { struct bp_location *bl, **blp_tmp; @@ -4271,27 +4267,12 @@ regular_breakpoint_inserted_here_p (struct address_space *aspace, return 0; } -/* Returns non-zero iff there's either regular breakpoint - or a single step breakpoint inserted at PC. */ +/* This function returns non-zero iff there is a software breakpoint + inserted at PC. */ int -breakpoint_inserted_here_p (struct address_space *aspace, CORE_ADDR pc) -{ - if (regular_breakpoint_inserted_here_p (aspace, pc)) - return 1; - - if (single_step_breakpoint_inserted_here_p (aspace, pc)) - return 1; - - return 0; -} - -/* Ignoring deprecated raw breakpoints, return non-zero iff there is a - software breakpoint inserted at PC. */ - -static struct bp_location * -find_non_raw_software_breakpoint_inserted_here (struct address_space *aspace, - CORE_ADDR pc) +software_breakpoint_inserted_here_p (struct address_space *aspace, + CORE_ADDR pc) { struct bp_location *bl, **blp_tmp; @@ -4309,27 +4290,10 @@ find_non_raw_software_breakpoint_inserted_here (struct address_space *aspace, && !section_is_mapped (bl->section)) continue; /* unmapped overlay -- can't be a match */ else - return bl; + return 1; } } - return NULL; -} - -/* This function returns non-zero iff there is a software breakpoint - inserted at PC. */ - -int -software_breakpoint_inserted_here_p (struct address_space *aspace, - CORE_ADDR pc) -{ - if (find_non_raw_software_breakpoint_inserted_here (aspace, pc) != NULL) - return 1; - - /* Also check for software single-step breakpoints. */ - if (single_step_breakpoint_inserted_here_p (aspace, pc)) - return 1; - return 0; } @@ -13330,20 +13294,6 @@ bkpt_re_set (struct breakpoint *b) breakpoint_re_set_default (b); } -/* Copy SRC's shadow buffer and whatever else we'd set if we actually - inserted DEST, so we can remove it later, in case SRC is removed - first. */ - -static void -bp_target_info_copy_insertion_state (struct bp_target_info *dest, - const struct bp_target_info *src) -{ - dest->shadow_len = src->shadow_len; - memcpy (dest->shadow_contents, src->shadow_contents, src->shadow_len); - dest->placed_address = src->placed_address; - dest->placed_size = src->placed_size; -} - static int bkpt_insert_location (struct bp_location *bl) { @@ -15357,87 +15307,6 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior, } } -/* Create and insert a raw software breakpoint at PC. Return an - identifier, which should be used to remove the breakpoint later. - In general, places which call this should be using something on the - breakpoint chain instead; this function should be eliminated - someday. */ - -void * -deprecated_insert_raw_breakpoint (struct gdbarch *gdbarch, - struct address_space *aspace, CORE_ADDR pc) -{ - struct bp_target_info *bp_tgt; - struct bp_location *bl; - - bp_tgt = XCNEW (struct bp_target_info); - - bp_tgt->placed_address_space = aspace; - bp_tgt->reqstd_address = pc; - - /* If an unconditional non-raw breakpoint is already inserted at - that location, there's no need to insert another. However, with - target-side evaluation of breakpoint conditions, if the - breakpoint that is currently inserted on the target is - conditional, we need to make it unconditional. Note that a - breakpoint with target-side commands is not reported even if - unconditional, so we need to remove the commands from the target - as well. */ - bl = find_non_raw_software_breakpoint_inserted_here (aspace, pc); - if (bl != NULL - && VEC_empty (agent_expr_p, bl->target_info.conditions) - && VEC_empty (agent_expr_p, bl->target_info.tcommands)) - { - bp_target_info_copy_insertion_state (bp_tgt, &bl->target_info); - return bp_tgt; - } - - if (target_insert_breakpoint (gdbarch, bp_tgt) != 0) - { - /* Could not insert the breakpoint. */ - xfree (bp_tgt); - return NULL; - } - - return bp_tgt; -} - -/* Remove a breakpoint BP inserted by - deprecated_insert_raw_breakpoint. */ - -int -deprecated_remove_raw_breakpoint (struct gdbarch *gdbarch, void *bp) -{ - struct bp_target_info *bp_tgt = bp; - struct address_space *aspace = bp_tgt->placed_address_space; - CORE_ADDR address = bp_tgt->reqstd_address; - struct bp_location *bl; - int ret; - - bl = find_non_raw_software_breakpoint_inserted_here (aspace, address); - - /* Only remove the raw breakpoint if there are no other non-raw - breakpoints still inserted at this location. Otherwise, we would - be effectively disabling those breakpoints. */ - if (bl == NULL) - ret = target_remove_breakpoint (gdbarch, bp_tgt); - else if (!VEC_empty (agent_expr_p, bl->target_info.conditions) - || !VEC_empty (agent_expr_p, bl->target_info.tcommands)) - { - /* The target is evaluating conditions, and when we inserted the - software single-step breakpoint, we had made the breakpoint - unconditional and command-less on the target side. Reinsert - to restore the conditions/commands. */ - ret = target_insert_breakpoint (bl->gdbarch, &bl->target_info); - } - else - ret = 0; - - xfree (bp_tgt); - - return ret; -} - /* Create and insert a breakpoint for software single step. */ void diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 7c563c1..8b833bd 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1467,14 +1467,6 @@ extern int single_step_breakpoints_inserted (void); extern void remove_single_step_breakpoints (void); extern void cancel_single_step_breakpoints (void); -/* Manage manual breakpoints, separate from the normal chain of - breakpoints. These functions are used in murky target-specific - ways. Please do not add more uses! */ -extern void *deprecated_insert_raw_breakpoint (struct gdbarch *, - struct address_space *, - CORE_ADDR); -extern int deprecated_remove_raw_breakpoint (struct gdbarch *, void *); - /* Check if any hardware watchpoints have triggered, according to the target. */ int watchpoints_triggered (struct target_waitstatus *);