From 059fb39f2af3a0c8c101c622644cf65279c0b48b Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Wed, 10 Jun 2009 04:32:08 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 18 +++++++++++ gdb/breakpoint.c | 82 +++++++++++++++++++++++++----------------------- 2 files changed, 61 insertions(+), 39 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e2629a4183..dbe9a55b57 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +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. + 2009-06-08 Pierre Muller * breakpoint.c (_initialize_breakpoint): Remove "bu" command alias of diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index ffff09bb44..c4c0819953 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1478,7 +1478,8 @@ create_overlay_event_breakpoint (char *func_name, struct objfile *objfile) 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 (bpstat bsp) 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, ptid_t ptid) 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 breakpoint *b, 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, struct obj_section *section, 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_name) { 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 type, int *other_type_used) { 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_line sal) 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 *cond_string, int thread, /* 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 exception_event_kind ex_event, char *arg, 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 *bpt, enum bpdisp disposition) 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 from_tty) { 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 from_tty) 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);