From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20239 invoked by alias); 14 Oct 2008 18:11:08 -0000 Received: (qmail 20227 invoked by uid 22791); 14 Oct 2008 18:11:07 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 14 Oct 2008 18:10:32 +0000 Received: (qmail 8573 invoked from network); 14 Oct 2008 18:10:30 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 14 Oct 2008 18:10:30 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: PATCH: Remove dead code, clear breakpoint ignore counts? Date: Tue, 14 Oct 2008 18:11:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_pCO9IXh1/gebiqg" Message-Id: <200810141910.49306.pedro@codesourcery.com> X-IsSubscribed: yes 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: 2008-10/txt/msg00351.txt.bz2 --Boundary-00=_pCO9IXh1/gebiqg Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 878 I think I stared at this one time too many. What do you think of the attached? Would anyone miss this? There's no way the user can request to not show hit counts, so, this is dead code. Perhaps it would make more sense to clear the ignore counts in the same place where we clear the hit counts, which is currently only on run_command_1; or from within clear_breakpoint_hit_counts. Huh, we don't clear hit counts when attaching or connecting to a remote target. Perhaps we should never clear these automatically then, and provide a user command to explicitly do so instead? Too confusing? Come to think of it, I guess clearing on every "run" also sounds confusing to me. (When we go multi-process, it can be more surprising to clear hit counts on each "run" invocation.) My head hurts --- I just wanted to get rid of this 14 year old dead code. :-) ) -- Pedro Alves --Boundary-00=_pCO9IXh1/gebiqg Content-Type: text/x-diff; charset="utf-8"; name="breakpoint_ignore_counts.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="breakpoint_ignore_counts.diff" Content-length: 3618 2008-10-14 Pedro Alves Remove dead code. * breakpoint.c (show_breakpoint_hit_counts): Delete. (print_one_breakpoint_location): Adjust. (breakpoint_clear_ignore_counts): Delete. * breakpoint.h (breakpoint_clear_ignore_counts): Remove declaration. * target.c (generic_mourn_inferior): Don't clear ignore counts (never reached). --- gdb/breakpoint.c | 18 ++---------------- gdb/breakpoint.h | 2 -- gdb/target.c | 8 -------- 3 files changed, 2 insertions(+), 26 deletions(-) Index: src/gdb/breakpoint.c =================================================================== --- src.orig/gdb/breakpoint.c 2008-10-14 18:41:43.000000000 +0100 +++ src/gdb/breakpoint.c 2008-10-14 18:43:57.000000000 +0100 @@ -315,10 +315,6 @@ static int overlay_events_enabled; B ? (TMP=B->global_next, 1): 0; \ B = TMP) -/* True if breakpoint hit counts should be displayed in breakpoint info. */ - -int show_breakpoint_hit_counts = 1; - /* Chains of all breakpoints defined. */ struct breakpoint *breakpoint_chain; @@ -3812,7 +3808,7 @@ print_one_breakpoint_location (struct br ui_out_text (uiout, "\n"); } - if (!part_of_multiple && show_breakpoint_hit_counts && b->hit_count) + if (!part_of_multiple && b->hit_count) { /* FIXME should make an annotation for this */ if (ep_is_catchpoint (b)) @@ -3830,7 +3826,7 @@ print_one_breakpoint_location (struct br /* Output the count also if it is zero, but only if this is mi. FIXME: Should have a better test for this. */ if (ui_out_is_mi_like_p (uiout)) - if (!part_of_multiple && show_breakpoint_hit_counts && b->hit_count == 0) + if (!part_of_multiple && b->hit_count == 0) ui_out_field_int (uiout, "times", b->hit_count); if (!part_of_multiple && b->ignore_count) @@ -7731,16 +7727,6 @@ set_ignore_count (int bptnum, int count, error (_("No breakpoint number %d."), bptnum); } -/* Clear the ignore counts of all breakpoints. */ -void -breakpoint_clear_ignore_counts (void) -{ - struct breakpoint *b; - - ALL_BREAKPOINTS (b) - b->ignore_count = 0; -} - /* Command to set ignore-count of breakpoint N to COUNT. */ static void Index: src/gdb/breakpoint.h =================================================================== --- src.orig/gdb/breakpoint.h 2008-10-14 18:41:43.000000000 +0100 +++ src/gdb/breakpoint.h 2008-10-14 18:43:57.000000000 +0100 @@ -713,8 +713,6 @@ extern void delete_breakpoint (struct br extern void breakpoint_auto_delete (bpstat); -extern void breakpoint_clear_ignore_counts (void); - extern void break_command (char *, int); extern void hbreak_command_wrapper (char *, int); Index: src/gdb/target.c =================================================================== --- src.orig/gdb/target.c 2008-10-14 18:41:43.000000000 +0100 +++ src/gdb/target.c 2008-10-14 18:43:57.000000000 +0100 @@ -2336,7 +2336,6 @@ find_target_beneath (struct target_ops * void generic_mourn_inferior (void) { - extern int show_breakpoint_hit_counts; ptid_t ptid; ptid = inferior_ptid; @@ -2354,13 +2353,6 @@ generic_mourn_inferior (void) reopen_exec_file (); reinit_frame_cache (); - /* It is confusing to the user for ignore counts to stick around - from previous runs of the inferior. So clear them. */ - /* However, it is more confusing for the ignore counts to disappear when - using hit counts. So don't clear them if we're counting hits. */ - if (!show_breakpoint_hit_counts) - breakpoint_clear_ignore_counts (); - if (deprecated_detach_hook) deprecated_detach_hook (); } --Boundary-00=_pCO9IXh1/gebiqg--