From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14560 invoked by alias); 10 Jun 2009 04:34:47 -0000 Received: (qmail 14551 invoked by uid 22791); 10 Jun 2009 04:34:46 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Jun 2009 04:34:40 +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 n5A4YKJj052220 ; Wed, 10 Jun 2009 06:34:20 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n5A4YK6D013888 ; Wed, 10 Jun 2009 06:34:20 +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 n5A4YIZx033160 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Wed, 10 Jun 2009 06:34:19 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: Cc: References: <000301c9e8cb$e8592050$b90b60f0$@u-strasbg.fr> In-Reply-To: Subject: RE: [RFA] breakpoint.c ARI fixes Date: Wed, 10 Jun 2009 04:34:00 -0000 Message-ID: <000001c9e984$ba6e8590$2f4b90b0$@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-06/txt/msg00249.txt.bz2 > Pierre> Is this OK? > > Yes. Thanks for working on this. Thanks, patch committed. > Pierre> I would like to know if the minimal ChangeLog > Pierre> below is enough or if I should use the long version > Pierre> listing all modified functions. > > You must list them all, I'm afraid. > > Pierre> + if ((bsp->breakpoint_at != NULL) > Pierre> + && (bsp->breakpoint_at->owner->type == bp_step_resume) > Pierre> + && (bsp->breakpoint_at->owner->thread == current_thread > Pierre> + || bsp->breakpoint_at->owner->thread == -1)) > > Pierre> + if ((ex_event != EX_EVENT_THROW) > Pierre> + && (ex_event != EX_EVENT_CATCH)) > > As long as you are fixing some formatting stuff, you might as well > remove the extra parens from these expressions. Added to the patch. Pierre For the record, here is what I checked in: Index: ChangeLog 2009-06-10 Pierre Muller * breakpoint.c: ARI fixes. (create_overlay_event_breakpoint): Avoid assignment inside if statement. (print_one_breakpoint_location): Likewise. (create_longjmp_breakpoint): Likewise. (tracepoint_save_command): Likewise (bpstat_find_step_resume_breakpoint): No operator at end of line. (bpstat_stop_status): Likewise. (describe_other_breakpoints): Likewise. (hw_watchpoint_used_count): Likewise. (expand_line_sal_maybe): Likewise. (break_command_really): Likewise. (delete_command): Likewise. (do_enable_breakpoint): Likewise. (delete_trace_command): Likewise. (catch_exception_command_1): Likewise and remove extra parentheses. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.403 diff -u -p -r1.403 breakpoint.c --- breakpoint.c 8 Jun 2009 16:05:14 -0000 1.403 +++ breakpoint.c 10 Jun 2009 04:31:39 -0000 @@ -1478,7 +1478,8 @@ create_overlay_event_breakpoint (char *f struct breakpoint *b; struct minimal_symbol *m; - if ((m = lookup_minimal_symbol_text (func_name, objfile)) == NULL) + m = lookup_minimal_symbol_text (func_name, objfile); + if (m == NULL) return; b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), @@ -2128,10 +2129,10 @@ bpstat_find_step_resume_breakpoint (bpst for (; bsp != NULL; bsp = bsp->next) { - if ((bsp->breakpoint_at != NULL) && - (bsp->breakpoint_at->owner->type == bp_step_resume) && - (bsp->breakpoint_at->owner->thread == current_thread || - bsp->breakpoint_at->owner->thread == -1)) + if ((bsp->breakpoint_at != NULL) + && (bsp->breakpoint_at->owner->type == bp_step_resume) + && (bsp->breakpoint_at->owner->thread == current_thread + || bsp->breakpoint_at->owner->thread == -1)) return bsp->breakpoint_at->owner; } @@ -3132,9 +3133,9 @@ bpstat_stop_status (CORE_ADDR bp_addr, p if (b->silent) bs->print = 0; bs->commands = b->commands; - if (bs->commands && - (strcmp ("silent", bs->commands->line) == 0 - || (xdb_commands && strcmp ("Q", bs->commands->line) == 0))) + if (bs->commands + && (strcmp ("silent", bs->commands->line) == 0 + || (xdb_commands && strcmp ("Q", bs->commands->line) == 0))) { bs->commands = bs->commands->next; bs->print = 0; @@ -3747,8 +3748,9 @@ print_one_breakpoint_location (struct br ui_out_field_int (uiout, "ignore", b->ignore_count); ui_out_text (uiout, " hits\n"); } - - if (!part_of_multiple && (l = b->commands)) + + l = b->commands; + if (!part_of_multiple && l) { struct cleanup *script_chain; @@ -4043,8 +4045,8 @@ describe_other_breakpoints (CORE_ADDR pc else if (b->thread != -1) printf_filtered (" (thread %d)", b->thread); printf_filtered ("%s%s ", - ((b->enable_state == bp_disabled || - b->enable_state == bp_call_disabled) + ((b->enable_state == bp_disabled + || b->enable_state == bp_call_disabled) ? " (disabled)" : b->enable_state == bp_permanent ? " (permanent)" @@ -4425,7 +4427,8 @@ create_longjmp_breakpoint (char *func_na { struct minimal_symbol *m; - if ((m = lookup_minimal_symbol_text (func_name, NULL)) == NULL) + m = lookup_minimal_symbol_text (func_name, NULL); + if (m == NULL) return; set_momentary_breakpoint_at_pc (SYMBOL_VALUE_ADDRESS (m), bp_longjmp); update_global_location_list (1); @@ -4931,9 +4934,9 @@ hw_watchpoint_used_count (enum bptype ty { if (b->type == type) i++; - else if ((b->type == bp_hardware_watchpoint || - b->type == bp_read_watchpoint || - b->type == bp_access_watchpoint)) + else if ((b->type == bp_hardware_watchpoint + || b->type == bp_read_watchpoint + || b->type == bp_access_watchpoint)) *other_type_used = 1; } } @@ -5403,8 +5406,8 @@ expand_line_sal_maybe (struct symtab_and if (find_pc_partial_function (pc, &this_function, &func_addr, &func_end)) { - if (this_function && - strcmp (this_function, original_function) != 0) + if (this_function + && strcmp (this_function, original_function) != 0) { remove_sal (&expanded, i); --i; @@ -5725,8 +5728,8 @@ break_command_really (char *arg, char *c /* If pending breakpoint support is auto query and the user selects no, then simply return the error code. */ - if (pending_break_support == AUTO_BOOLEAN_AUTO && - !nquery ("Make breakpoint pending on future shared library load? ")) + if (pending_break_support == AUTO_BOOLEAN_AUTO + && !nquery ("Make breakpoint pending on future shared library load? ")) return; /* At this point, either the user was queried about setting @@ -6772,8 +6775,8 @@ catch_exception_command_1 (enum exceptio if ((*arg != '\0') && !isspace (*arg)) error (_("Junk at end of arguments.")); - if ((ex_event != EX_EVENT_THROW) && - (ex_event != EX_EVENT_CATCH)) + if (ex_event != EX_EVENT_THROW + && ex_event != EX_EVENT_CATCH) error (_("Unsupported or unknown exception event; cannot catch it")); if (handle_gnu_v3_exceptions (tempflag, cond_string, ex_event, from_tty)) @@ -7396,11 +7399,11 @@ delete_command (char *arg, int from_tty) have to be deleted with an explicit breakpoint number argument. */ ALL_BREAKPOINTS (b) { - if (b->type != bp_call_dummy && - b->type != bp_shlib_event && - b->type != bp_thread_event && - b->type != bp_overlay_event && - b->number >= 0) + if (b->type != bp_call_dummy + && b->type != bp_shlib_event + && b->type != bp_thread_event + && b->type != bp_overlay_event + && b->number >= 0) { breaks_to_delete = 1; break; @@ -7413,11 +7416,11 @@ delete_command (char *arg, int from_tty) { ALL_BREAKPOINTS_SAFE (b, temp) { - if (b->type != bp_call_dummy && - b->type != bp_shlib_event && - b->type != bp_thread_event && - b->type != bp_overlay_event && - b->number >= 0) + if (b->type != bp_call_dummy + && b->type != bp_shlib_event + && b->type != bp_thread_event + && b->type != bp_overlay_event + && b->number >= 0) delete_breakpoint (b); } } @@ -8028,10 +8031,10 @@ do_enable_breakpoint (struct breakpoint error (_("Hardware breakpoints used exceeds limit.")); } - if (bpt->type == bp_watchpoint || - bpt->type == bp_hardware_watchpoint || - bpt->type == bp_read_watchpoint || - bpt->type == bp_access_watchpoint) + if (bpt->type == bp_watchpoint + || bpt->type == bp_hardware_watchpoint + || bpt->type == bp_read_watchpoint + || bpt->type == bp_access_watchpoint) { struct gdb_exception e; @@ -8366,8 +8369,8 @@ delete_trace_command (char *arg, int fro { ALL_BREAKPOINTS_SAFE (b, temp) { - if (b->type == bp_tracepoint && - b->number >= 0) + if (b->type == bp_tracepoint + && b->number >= 0) delete_breakpoint (b); } } @@ -8514,7 +8517,8 @@ tracepoint_save_command (char *args, int pathname = tilde_expand (args); cleanup = make_cleanup (xfree, pathname); - if (!(fp = fopen (pathname, "w"))) + fp = fopen (pathname, "w"); + if (!fp) error (_("Unable to open file '%s' for saving tracepoints (%s)"), args, safe_strerror (errno)); make_cleanup_fclose (fp);