diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 15:01:28 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 15:01:28 -0400 |
commit | 01add95bed9afd5e7815439c3967db976be53f80 (patch) | |
tree | a0239dcf29375bf6e4382d419d17117b1665d8ab | |
parent | 055c879fcf242e43a6ef8190f83905109922da93 (diff) | |
download | gdb-01add95bed9afd5e7815439c3967db976be53f80.zip gdb-01add95bed9afd5e7815439c3967db976be53f80.tar.gz gdb-01add95bed9afd5e7815439c3967db976be53f80.tar.bz2 |
gdb: fix some indentation issues
I wrote a small script to spot a pattern of indentation mistakes I saw
happened in breakpoint.c. And while at it I ran it on all files and
fixed what I found. No behavior changes intended, just indentation and
addition / removal of curly braces.
gdb/ChangeLog:
* Fix some indentation mistakes throughout.
gdbserver/ChangeLog:
* Fix some indentation mistakes throughout.
Change-Id: Ia01990c26c38e83a243d8f33da1d494f16315c6e
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/aarch64-tdep.c | 10 | ||||
-rw-r--r-- | gdb/aix-thread.c | 14 | ||||
-rw-r--r-- | gdb/arm-fbsd-tdep.c | 4 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 42 | ||||
-rw-r--r-- | gdb/breakpoint.c | 750 | ||||
-rw-r--r-- | gdb/ctfread.c | 8 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 12 | ||||
-rw-r--r-- | gdb/go32-nat.c | 126 | ||||
-rw-r--r-- | gdb/guile/scm-pretty-print.c | 8 | ||||
-rw-r--r-- | gdb/hppa-linux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-symbol-cmds.c | 10 | ||||
-rw-r--r-- | gdb/nat/aarch64-sve-linux-ptrace.c | 18 | ||||
-rw-r--r-- | gdb/nios2-tdep.c | 38 | ||||
-rw-r--r-- | gdb/ppc-sysv-tdep.c | 8 | ||||
-rw-r--r-- | gdb/python/py-framefilter.c | 20 | ||||
-rw-r--r-- | gdb/python/py-prettyprint.c | 8 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 9 | ||||
-rw-r--r-- | gdb/s390-tdep.c | 12 | ||||
-rw-r--r-- | gdb/stack.c | 12 | ||||
-rw-r--r-- | gdb/symtab.c | 174 | ||||
-rw-r--r-- | gdb/target-float.c | 10 | ||||
-rw-r--r-- | gdb/tracepoint.c | 14 | ||||
-rw-r--r-- | gdb/v850-tdep.c | 14 | ||||
-rw-r--r-- | gdb/windows-tdep.c | 8 | ||||
-rw-r--r-- | gdb/xcoffread.c | 25 | ||||
-rw-r--r-- | gdbserver/ChangeLog | 4 | ||||
-rw-r--r-- | gdbserver/linux-s390-low.cc | 36 |
29 files changed, 704 insertions, 698 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 66a16df..fa3940c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2021-05-27 Simon Marchi <simon.marchi@polymtl.ca> + * Fix some indentation mistakes throughout. + +2021-05-27 Simon Marchi <simon.marchi@polymtl.ca> + * breakpoint.h (iterate_over_bp_locations): Remove. Update users to use all_bp_locations. (all_bp_locations): New. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 44833eb..202b021 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3663,11 +3663,11 @@ When on, AArch64 specific debugging is enabled."), { \ unsigned int mem_len = LENGTH; \ if (mem_len) \ - { \ - MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \ - memcpy(&MEMS->len, &RECORD_BUF[0], \ - sizeof(struct aarch64_mem_r) * LENGTH); \ - } \ + { \ + MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \ + memcpy(&MEMS->len, &RECORD_BUF[0], \ + sizeof(struct aarch64_mem_r) * LENGTH); \ + } \ } \ while (0) diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 889cb65..d414746 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -707,14 +707,14 @@ get_signaled_thread (void) tid_t ktid = 0; while (1) - { - if (getthrds (inferior_ptid.pid (), &thrinf, - sizeof (thrinf), &ktid, 1) != 1) - break; + { + if (getthrds (inferior_ptid.pid (), &thrinf, + sizeof (thrinf), &ktid, 1) != 1) + break; - if (thrinf.ti_cursig == SIGTRAP) - return thrinf.ti_tid; - } + if (thrinf.ti_cursig == SIGTRAP) + return thrinf.ti_tid; + } /* Didn't find any thread stopped on a SIGTRAP signal. */ return 0; diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c index 508e363..3a17918 100644 --- a/gdb/arm-fbsd-tdep.c +++ b/gdb/arm-fbsd-tdep.c @@ -187,10 +187,10 @@ arm_fbsd_read_description_auxv (struct target_ops *target) if (arm_hwcap & HWCAP_NEON) return aarch32_read_description (); else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPD32)) - == (HWCAP_VFPv3 | HWCAP_VFPD32)) + == (HWCAP_VFPv3 | HWCAP_VFPD32)) return arm_read_description (ARM_FP_TYPE_VFPV3); else - return arm_read_description (ARM_FP_TYPE_VFPV2); + return arm_read_description (ARM_FP_TYPE_VFPV2); } return nullptr; diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 7f56d00..f8da638 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9697,11 +9697,11 @@ vfp - VFP co-processor."), { \ unsigned int mem_len = LENGTH; \ if (mem_len) \ - { \ - MEMS = XNEWVEC (struct arm_mem_r, mem_len); \ - memcpy(&MEMS->len, &RECORD_BUF[0], \ - sizeof(struct arm_mem_r) * LENGTH); \ - } \ + { \ + MEMS = XNEWVEC (struct arm_mem_r, mem_len); \ + memcpy(&MEMS->len, &RECORD_BUF[0], \ + sizeof(struct arm_mem_r) * LENGTH); \ + } \ } \ while (0) @@ -9997,19 +9997,19 @@ arm_record_extension_space (insn_decode_record *arm_insn_r) { /* Handle MLA(S) and MUL(S). */ if (in_inclusive_range (insn_op1, 0U, 3U)) - { - record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15); - record_buf[1] = ARM_PS_REGNUM; - arm_insn_r->reg_rec_count = 2; - } + { + record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15); + record_buf[1] = ARM_PS_REGNUM; + arm_insn_r->reg_rec_count = 2; + } else if (in_inclusive_range (insn_op1, 4U, 15U)) - { - /* Handle SMLAL(S), SMULL(S), UMLAL(S), UMULL(S). */ - record_buf[0] = bits (arm_insn_r->arm_insn, 16, 19); - record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15); - record_buf[2] = ARM_PS_REGNUM; - arm_insn_r->reg_rec_count = 3; - } + { + /* Handle SMLAL(S), SMULL(S), UMLAL(S), UMULL(S). */ + record_buf[0] = bits (arm_insn_r->arm_insn, 16, 19); + record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15); + record_buf[2] = ARM_PS_REGNUM; + arm_insn_r->reg_rec_count = 3; + } } opcode1 = bits (arm_insn_r->arm_insn, 26, 27); @@ -11100,10 +11100,10 @@ arm_record_b_bl (insn_decode_record *arm_insn_r) /* Note: BLX(1) doesnt fall here but instead it falls into extension space. */ if (bit (arm_insn_r->arm_insn, 24)) - { - record_buf[0] = ARM_LR_REGNUM; - arm_insn_r->reg_rec_count = 1; - } + { + record_buf[0] = ARM_LR_REGNUM; + arm_insn_r->reg_rec_count = 1; + } REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 4d5c0dd..fd98ded 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1605,28 +1605,29 @@ breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf, /* Now do full processing of the found relevant range of elements. */ for (bc = bc_l; bc < bp_locations.size (); bc++) - { - struct bp_location *bl = bp_locations[bc]; + { + struct bp_location *bl = bp_locations[bc]; - /* bp_location array has BL->OWNER always non-NULL. */ - if (bl->owner->type == bp_none) - warning (_("reading through apparently deleted breakpoint #%d?"), - bl->owner->number); + /* bp_location array has BL->OWNER always non-NULL. */ + if (bl->owner->type == bp_none) + warning (_("reading through apparently deleted breakpoint #%d?"), + bl->owner->number); - /* Performance optimization: any further element can no longer affect BUF - content. */ + /* Performance optimization: any further element can no longer affect BUF + content. */ - if (bl->address >= bp_locations_placed_address_before_address_max - && memaddr + len <= (bl->address - - bp_locations_placed_address_before_address_max)) - break; + if (bl->address >= bp_locations_placed_address_before_address_max + && (memaddr + len + <= (bl->address + - bp_locations_placed_address_before_address_max))) + break; - if (!bp_location_has_shadow (bl)) - continue; + if (!bp_location_has_shadow (bl)) + continue; - one_breakpoint_xfer_memory (readbuf, writebuf, writebuf_org, - memaddr, len, &bl->target_info, bl->gdbarch); - } + one_breakpoint_xfer_memory (readbuf, writebuf, writebuf_org, + memaddr, len, &bl->target_info, bl->gdbarch); + } } /* See breakpoint.h. */ @@ -3079,10 +3080,9 @@ remove_breakpoints (void) int val = 0; for (bp_location *bl : all_bp_locations ()) - { if (bl->inserted && !is_tracepoint (bl->owner)) val |= remove_breakpoint (bl); - } + return val; } @@ -3116,17 +3116,17 @@ remove_breakpoints_inf (inferior *inf) int val; for (bp_location *bl : all_bp_locations ()) - { - if (bl->pspace != inf->pspace) - continue; + { + if (bl->pspace != inf->pspace) + continue; - if (bl->inserted && !bl->target_info.persist) - { - val = remove_breakpoint (bl); - if (val != 0) - return; - } - } + if (bl->inserted && !bl->target_info.persist) + { + val = remove_breakpoint (bl); + if (val != 0) + return; + } + } } static int internal_breakpoint_number = -1; @@ -3612,107 +3612,107 @@ update_breakpoints_after_exec (void) gdb_assert (!bploc->inserted); for (breakpoint *b : all_breakpoints_safe ()) - { - if (b->pspace != current_program_space) - continue; - - /* Solib breakpoints must be explicitly reset after an exec(). */ - if (b->type == bp_shlib_event) - { - delete_breakpoint (b); + { + if (b->pspace != current_program_space) continue; - } - /* JIT breakpoints must be explicitly reset after an exec(). */ - if (b->type == bp_jit_event) - { - delete_breakpoint (b); - continue; - } + /* Solib breakpoints must be explicitly reset after an exec(). */ + if (b->type == bp_shlib_event) + { + delete_breakpoint (b); + continue; + } - /* Thread event breakpoints must be set anew after an exec(), - as must overlay event and longjmp master breakpoints. */ - if (b->type == bp_thread_event || b->type == bp_overlay_event - || b->type == bp_longjmp_master || b->type == bp_std_terminate_master - || b->type == bp_exception_master) - { - delete_breakpoint (b); - continue; - } + /* JIT breakpoints must be explicitly reset after an exec(). */ + if (b->type == bp_jit_event) + { + delete_breakpoint (b); + continue; + } - /* Step-resume breakpoints are meaningless after an exec(). */ - if (b->type == bp_step_resume || b->type == bp_hp_step_resume) - { - delete_breakpoint (b); - continue; - } + /* Thread event breakpoints must be set anew after an exec(), + as must overlay event and longjmp master breakpoints. */ + if (b->type == bp_thread_event || b->type == bp_overlay_event + || b->type == bp_longjmp_master || b->type == bp_std_terminate_master + || b->type == bp_exception_master) + { + delete_breakpoint (b); + continue; + } - /* Just like single-step breakpoints. */ - if (b->type == bp_single_step) - { - delete_breakpoint (b); - continue; - } + /* Step-resume breakpoints are meaningless after an exec(). */ + if (b->type == bp_step_resume || b->type == bp_hp_step_resume) + { + delete_breakpoint (b); + continue; + } - /* Longjmp and longjmp-resume breakpoints are also meaningless - after an exec. */ - if (b->type == bp_longjmp || b->type == bp_longjmp_resume - || b->type == bp_longjmp_call_dummy - || b->type == bp_exception || b->type == bp_exception_resume) - { - delete_breakpoint (b); - continue; - } + /* Just like single-step breakpoints. */ + if (b->type == bp_single_step) + { + delete_breakpoint (b); + continue; + } - if (b->type == bp_catchpoint) - { - /* For now, none of the bp_catchpoint breakpoints need to - do anything at this point. In the future, if some of - the catchpoints need to something, we will need to add - a new method, and call this method from here. */ - continue; - } + /* Longjmp and longjmp-resume breakpoints are also meaningless + after an exec. */ + if (b->type == bp_longjmp || b->type == bp_longjmp_resume + || b->type == bp_longjmp_call_dummy + || b->type == bp_exception || b->type == bp_exception_resume) + { + delete_breakpoint (b); + continue; + } - /* bp_finish is a special case. The only way we ought to be able - to see one of these when an exec() has happened, is if the user - caught a vfork, and then said "finish". Ordinarily a finish just - carries them to the call-site of the current callee, by setting - a temporary bp there and resuming. But in this case, the finish - will carry them entirely through the vfork & exec. - - We don't want to allow a bp_finish to remain inserted now. But - we can't safely delete it, 'cause finish_command has a handle to - the bp on a bpstat, and will later want to delete it. There's a - chance (and I've seen it happen) that if we delete the bp_finish - here, that its storage will get reused by the time finish_command - gets 'round to deleting the "use to be a bp_finish" breakpoint. - We really must allow finish_command to delete a bp_finish. - - In the absence of a general solution for the "how do we know - it's safe to delete something others may have handles to?" - problem, what we'll do here is just uninsert the bp_finish, and - let finish_command delete it. - - (We know the bp_finish is "doomed" in the sense that it's - momentary, and will be deleted as soon as finish_command sees - the inferior stopped. So it doesn't matter that the bp's - address is probably bogus in the new a.out, unlike e.g., the - solib breakpoints.) */ - - if (b->type == bp_finish) - { - continue; - } + if (b->type == bp_catchpoint) + { + /* For now, none of the bp_catchpoint breakpoints need to + do anything at this point. In the future, if some of + the catchpoints need to something, we will need to add + a new method, and call this method from here. */ + continue; + } - /* Without a symbolic address, we have little hope of the - pre-exec() address meaning the same thing in the post-exec() - a.out. */ - if (breakpoint_event_location_empty_p (b)) - { - delete_breakpoint (b); - continue; - } - } + /* bp_finish is a special case. The only way we ought to be able + to see one of these when an exec() has happened, is if the user + caught a vfork, and then said "finish". Ordinarily a finish just + carries them to the call-site of the current callee, by setting + a temporary bp there and resuming. But in this case, the finish + will carry them entirely through the vfork & exec. + + We don't want to allow a bp_finish to remain inserted now. But + we can't safely delete it, 'cause finish_command has a handle to + the bp on a bpstat, and will later want to delete it. There's a + chance (and I've seen it happen) that if we delete the bp_finish + here, that its storage will get reused by the time finish_command + gets 'round to deleting the "use to be a bp_finish" breakpoint. + We really must allow finish_command to delete a bp_finish. + + In the absence of a general solution for the "how do we know + it's safe to delete something others may have handles to?" + problem, what we'll do here is just uninsert the bp_finish, and + let finish_command delete it. + + (We know the bp_finish is "doomed" in the sense that it's + momentary, and will be deleted as soon as finish_command sees + the inferior stopped. So it doesn't matter that the bp's + address is probably bogus in the new a.out, unlike e.g., the + solib breakpoints.) */ + + if (b->type == bp_finish) + { + continue; + } + + /* Without a symbolic address, we have little hope of the + pre-exec() address meaning the same thing in the post-exec() + a.out. */ + if (breakpoint_event_location_empty_p (b)) + { + delete_breakpoint (b); + continue; + } + } } int @@ -3728,22 +3728,22 @@ detach_breakpoints (ptid_t ptid) /* Set inferior_ptid; remove_breakpoint_1 uses this global. */ inferior_ptid = ptid; for (bp_location *bl : all_bp_locations ()) - { - if (bl->pspace != inf->pspace) - continue; - - /* This function must physically remove breakpoints locations - from the specified ptid, without modifying the breakpoint - package's state. Locations of type bp_loc_other are only - maintained at GDB side. So, there is no need to remove - these bp_loc_other locations. Moreover, removing these - would modify the breakpoint package's state. */ - if (bl->loc_type == bp_loc_other) - continue; - - if (bl->inserted) - val |= remove_breakpoint_1 (bl, DETACH_BREAKPOINT); - } + { + if (bl->pspace != inf->pspace) + continue; + + /* This function must physically remove breakpoints locations + from the specified ptid, without modifying the breakpoint + package's state. Locations of type bp_loc_other are only + maintained at GDB side. So, there is no need to remove + these bp_loc_other locations. Moreover, removing these + would modify the breakpoint package's state. */ + if (bl->loc_type == bp_loc_other) + continue; + + if (bl->inserted) + val |= remove_breakpoint_1 (bl, DETACH_BREAKPOINT); + } return val; } @@ -3952,83 +3952,83 @@ breakpoint_init_inferior (enum inf_context context) mark_breakpoints_out (); for (breakpoint *b : all_breakpoints_safe ()) - { - if (b->loc && b->loc->pspace != pspace) - continue; + { + if (b->loc && b->loc->pspace != pspace) + continue; - switch (b->type) - { - case bp_call_dummy: - case bp_longjmp_call_dummy: + switch (b->type) + { + case bp_call_dummy: + case bp_longjmp_call_dummy: - /* If the call dummy breakpoint is at the entry point it will - cause problems when the inferior is rerun, so we better get - rid of it. */ + /* If the call dummy breakpoint is at the entry point it will + cause problems when the inferior is rerun, so we better get + rid of it. */ - case bp_watchpoint_scope: + case bp_watchpoint_scope: - /* Also get rid of scope breakpoints. */ + /* Also get rid of scope breakpoints. */ - case bp_shlib_event: + case bp_shlib_event: - /* Also remove solib event breakpoints. Their addresses may - have changed since the last time we ran the program. - Actually we may now be debugging against different target; - and so the solib backend that installed this breakpoint may - not be used in by the target. E.g., + /* Also remove solib event breakpoints. Their addresses may + have changed since the last time we ran the program. + Actually we may now be debugging against different target; + and so the solib backend that installed this breakpoint may + not be used in by the target. E.g., - (gdb) file prog-linux - (gdb) run # native linux target - ... - (gdb) kill - (gdb) file prog-win.exe - (gdb) tar rem :9999 # remote Windows gdbserver. - */ + (gdb) file prog-linux + (gdb) run # native linux target + ... + (gdb) kill + (gdb) file prog-win.exe + (gdb) tar rem :9999 # remote Windows gdbserver. + */ - case bp_step_resume: + case bp_step_resume: - /* Also remove step-resume breakpoints. */ + /* Also remove step-resume breakpoints. */ - case bp_single_step: + case bp_single_step: - /* Also remove single-step breakpoints. */ + /* Also remove single-step breakpoints. */ - delete_breakpoint (b); - break; + delete_breakpoint (b); + break; - case bp_watchpoint: - case bp_hardware_watchpoint: - case bp_read_watchpoint: - case bp_access_watchpoint: - { - struct watchpoint *w = (struct watchpoint *) b; + case bp_watchpoint: + case bp_hardware_watchpoint: + case bp_read_watchpoint: + case bp_access_watchpoint: + { + struct watchpoint *w = (struct watchpoint *) b; - /* Likewise for watchpoints on local expressions. */ - if (w->exp_valid_block != NULL) - delete_breakpoint (b); - else - { - /* Get rid of existing locations, which are no longer - valid. New ones will be created in - update_watchpoint, when the inferior is restarted. - The next update_global_location_list call will - garbage collect them. */ - b->loc = NULL; - - if (context == inf_starting) - { - /* Reset val field to force reread of starting value in - insert_breakpoints. */ - w->val.reset (nullptr); - w->val_valid = false; - } - } + /* Likewise for watchpoints on local expressions. */ + if (w->exp_valid_block != NULL) + delete_breakpoint (b); + else + { + /* Get rid of existing locations, which are no longer + valid. New ones will be created in + update_watchpoint, when the inferior is restarted. + The next update_global_location_list call will + garbage collect them. */ + b->loc = NULL; + + if (context == inf_starting) + { + /* Reset val field to force reread of starting value in + insert_breakpoints. */ + w->val.reset (nullptr); + w->val_valid = false; + } + } + } + break; + default: + break; } - break; - default: - break; - } - } + } /* Get rid of the moribund locations. */ for (bp_location *bl : moribund_locations) @@ -7394,11 +7394,11 @@ enable_overlay_breakpoints (void) { for (breakpoint *b : all_breakpoints ()) if (b->type == bp_overlay_event) - { - b->enable_state = bp_enabled; - update_global_location_list (UGLL_MAY_INSERT); - overlay_events_enabled = 1; - } + { + b->enable_state = bp_enabled; + update_global_location_list (UGLL_MAY_INSERT); + overlay_events_enabled = 1; + } } void @@ -7406,11 +7406,11 @@ disable_overlay_breakpoints (void) { for (breakpoint *b : all_breakpoints ()) if (b->type == bp_overlay_event) - { - b->enable_state = bp_disabled; - update_global_location_list (UGLL_DONT_INSERT); - overlay_events_enabled = 0; - } + { + b->enable_state = bp_disabled; + update_global_location_list (UGLL_DONT_INSERT); + overlay_events_enabled = 0; + } } /* Set an active std::terminate breakpoint for each std::terminate @@ -7546,27 +7546,27 @@ void disable_breakpoints_in_shlibs (void) { for (bp_location *loc : all_bp_locations ()) - { - /* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */ - struct breakpoint *b = loc->owner; - - /* We apply the check to all breakpoints, including disabled for - those with loc->duplicate set. This is so that when breakpoint - becomes enabled, or the duplicate is removed, gdb will try to - insert all breakpoints. If we don't set shlib_disabled here, - we'll try to insert those breakpoints and fail. */ - if (((b->type == bp_breakpoint) - || (b->type == bp_jit_event) - || (b->type == bp_hardware_breakpoint) - || (is_tracepoint (b))) - && loc->pspace == current_program_space - && !loc->shlib_disabled - && solib_name_from_address (loc->pspace, loc->address) - ) - { - loc->shlib_disabled = 1; - } - } + { + /* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */ + struct breakpoint *b = loc->owner; + + /* We apply the check to all breakpoints, including disabled for + those with loc->duplicate set. This is so that when breakpoint + becomes enabled, or the duplicate is removed, gdb will try to + insert all breakpoints. If we don't set shlib_disabled here, + we'll try to insert those breakpoints and fail. */ + if (((b->type == bp_breakpoint) + || (b->type == bp_jit_event) + || (b->type == bp_hardware_breakpoint) + || (is_tracepoint (b))) + && loc->pspace == current_program_space + && !loc->shlib_disabled + && solib_name_from_address (loc->pspace, loc->address) + ) + { + loc->shlib_disabled = 1; + } + } } /* Disable any breakpoints and tracepoints that are in SOLIB upon @@ -7579,39 +7579,39 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib) int disabled_shlib_breaks = 0; for (bp_location *loc : all_bp_locations ()) - { - /* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */ - struct breakpoint *b = loc->owner; - - if (solib->pspace == loc->pspace - && !loc->shlib_disabled - && (((b->type == bp_breakpoint - || b->type == bp_jit_event - || b->type == bp_hardware_breakpoint) - && (loc->loc_type == bp_loc_hardware_breakpoint - || loc->loc_type == bp_loc_software_breakpoint)) - || is_tracepoint (b)) - && solib_contains_address_p (solib, loc->address)) - { - loc->shlib_disabled = 1; - /* At this point, we cannot rely on remove_breakpoint - succeeding so we must mark the breakpoint as not inserted - to prevent future errors occurring in remove_breakpoints. */ - loc->inserted = 0; - - /* This may cause duplicate notifications for the same breakpoint. */ - gdb::observers::breakpoint_modified.notify (b); - - if (!disabled_shlib_breaks) - { - target_terminal::ours_for_output (); - warning (_("Temporarily disabling breakpoints " - "for unloaded shared library \"%s\""), - solib->so_name); - } - disabled_shlib_breaks = 1; - } - } + { + /* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */ + struct breakpoint *b = loc->owner; + + if (solib->pspace == loc->pspace + && !loc->shlib_disabled + && (((b->type == bp_breakpoint + || b->type == bp_jit_event + || b->type == bp_hardware_breakpoint) + && (loc->loc_type == bp_loc_hardware_breakpoint + || loc->loc_type == bp_loc_software_breakpoint)) + || is_tracepoint (b)) + && solib_contains_address_p (solib, loc->address)) + { + loc->shlib_disabled = 1; + /* At this point, we cannot rely on remove_breakpoint + succeeding so we must mark the breakpoint as not inserted + to prevent future errors occurring in remove_breakpoints. */ + loc->inserted = 0; + + /* This may cause duplicate notifications for the same breakpoint. */ + gdb::observers::breakpoint_modified.notify (b); + + if (!disabled_shlib_breaks) + { + target_terminal::ours_for_output (); + warning (_("Temporarily disabling breakpoints " + "for unloaded shared library \"%s\""), + solib->so_name); + } + disabled_shlib_breaks = 1; + } + } } /* Disable any breakpoints and tracepoints in OBJFILE upon @@ -7975,22 +7975,22 @@ breakpoint_hit_catch_solib (const struct bp_location *bl, return 1; for (breakpoint *other : all_breakpoints ()) - { - if (other == bl->owner) - continue; + { + if (other == bl->owner) + continue; - if (other->type != bp_shlib_event) - continue; + if (other->type != bp_shlib_event) + continue; - if (self->pspace != NULL && other->pspace != self->pspace) - continue; + if (self->pspace != NULL && other->pspace != self->pspace) + continue; - for (bp_location *other_bl : other->locations ()) - { - if (other->ops->breakpoint_hit (other_bl, aspace, bp_addr, ws)) - return 1; - } - } + for (bp_location *other_bl : other->locations ()) + { + if (other->ops->breakpoint_hit (other_bl, aspace, bp_addr, ws)) + return 1; + } + } return 0; } @@ -13174,10 +13174,10 @@ delete_breakpoint (struct breakpoint *bpt) for (breakpoint *b : all_breakpoints ()) if (b->next == bpt) - { - b->next = bpt->next; - break; - } + { + b->next = bpt->next; + break; + } /* Be sure no bpstat's are pointing at the breakpoint after it's been freed. */ @@ -13913,33 +13913,33 @@ set_ignore_count (int bptnum, int count, int from_tty) for (breakpoint *b : all_breakpoints ()) if (b->number == bptnum) - { - if (is_tracepoint (b)) - { - if (from_tty && count != 0) - printf_filtered (_("Ignore count ignored for tracepoint %d."), - bptnum); - return; - } - - b->ignore_count = count; - if (from_tty) - { - if (count == 0) - printf_filtered (_("Will stop next time " - "breakpoint %d is reached."), - bptnum); - else if (count == 1) - printf_filtered (_("Will ignore next crossing of breakpoint %d."), - bptnum); - else - printf_filtered (_("Will ignore next %d " - "crossings of breakpoint %d."), - count, bptnum); - } - gdb::observers::breakpoint_modified.notify (b); - return; - } + { + if (is_tracepoint (b)) + { + if (from_tty && count != 0) + printf_filtered (_("Ignore count ignored for tracepoint %d."), + bptnum); + return; + } + + b->ignore_count = count; + if (from_tty) + { + if (count == 0) + printf_filtered (_("Will stop next time " + "breakpoint %d is reached."), + bptnum); + else if (count == 1) + printf_filtered (_("Will ignore next crossing of breakpoint %d."), + bptnum); + else + printf_filtered (_("Will ignore next %d " + "crossings of breakpoint %d."), + count, bptnum); + } + gdb::observers::breakpoint_modified.notify (b); + return; + } error (_("No breakpoint number %d."), bptnum); } @@ -14846,10 +14846,10 @@ trace_pass_command (const char *args, int from_tty) error (_("Junk at end of arguments.")); for (breakpoint *b : all_tracepoints ()) - { - t1 = (struct tracepoint *) b; - trace_pass_set_count (t1, count, from_tty); - } + { + t1 = (struct tracepoint *) b; + trace_pass_set_count (t1, count, from_tty); + } } else if (*args == '\0') { @@ -14931,9 +14931,7 @@ get_tracepoint_by_number (const char **arg, for (breakpoint *t : all_tracepoints ()) if (t->number == tpnum) - { return (struct tracepoint *) t; - } printf_unfiltered ("No tracepoint number %d.\n", tpnum); return NULL; @@ -14968,25 +14966,25 @@ save_breakpoints (const char *filename, int from_tty, /* See if we have anything to save. */ for (breakpoint *tp : all_breakpoints ()) - { - /* Skip internal and momentary breakpoints. */ - if (!user_breakpoint_p (tp)) - continue; + { + /* Skip internal and momentary breakpoints. */ + if (!user_breakpoint_p (tp)) + continue; - /* If we have a filter, only save the breakpoints it accepts. */ - if (filter && !filter (tp)) - continue; + /* If we have a filter, only save the breakpoints it accepts. */ + if (filter && !filter (tp)) + continue; - any = 1; + any = 1; - if (is_tracepoint (tp)) - { - extra_trace_bits = 1; + if (is_tracepoint (tp)) + { + extra_trace_bits = 1; - /* We can stop searching. */ - break; - } - } + /* We can stop searching. */ + break; + } + } if (!any) { @@ -15006,65 +15004,65 @@ save_breakpoints (const char *filename, int from_tty, save_trace_state_variables (&fp); for (breakpoint *tp : all_breakpoints ()) - { - /* Skip internal and momentary breakpoints. */ - if (!user_breakpoint_p (tp)) - continue; + { + /* Skip internal and momentary breakpoints. */ + if (!user_breakpoint_p (tp)) + continue; - /* If we have a filter, only save the breakpoints it accepts. */ - if (filter && !filter (tp)) - continue; + /* If we have a filter, only save the breakpoints it accepts. */ + if (filter && !filter (tp)) + continue; - tp->ops->print_recreate (tp, &fp); + tp->ops->print_recreate (tp, &fp); - /* Note, we can't rely on tp->number for anything, as we can't - assume the recreated breakpoint numbers will match. Use $bpnum - instead. */ + /* Note, we can't rely on tp->number for anything, as we can't + assume the recreated breakpoint numbers will match. Use $bpnum + instead. */ - if (tp->cond_string) - fp.printf (" condition $bpnum %s\n", tp->cond_string); + if (tp->cond_string) + fp.printf (" condition $bpnum %s\n", tp->cond_string); - if (tp->ignore_count) - fp.printf (" ignore $bpnum %d\n", tp->ignore_count); + if (tp->ignore_count) + fp.printf (" ignore $bpnum %d\n", tp->ignore_count); - if (tp->type != bp_dprintf && tp->commands) - { - fp.puts (" commands\n"); - - current_uiout->redirect (&fp); - try - { - print_command_lines (current_uiout, tp->commands.get (), 2); - } - catch (const gdb_exception &ex) - { - current_uiout->redirect (NULL); - throw; - } + if (tp->type != bp_dprintf && tp->commands) + { + fp.puts (" commands\n"); - current_uiout->redirect (NULL); - fp.puts (" end\n"); - } + current_uiout->redirect (&fp); + try + { + print_command_lines (current_uiout, tp->commands.get (), 2); + } + catch (const gdb_exception &ex) + { + current_uiout->redirect (NULL); + throw; + } - if (tp->enable_state == bp_disabled) - fp.puts ("disable $bpnum\n"); + current_uiout->redirect (NULL); + fp.puts (" end\n"); + } - /* If this is a multi-location breakpoint, check if the locations - should be individually disabled. Watchpoint locations are - special, and not user visible. */ - if (!is_watchpoint (tp) && tp->loc && tp->loc->next) - { - int n = 1; + if (tp->enable_state == bp_disabled) + fp.puts ("disable $bpnum\n"); - for (bp_location *loc : tp->locations ()) - { - if (!loc->enabled) - fp.printf ("disable $bpnum.%d\n", n); + /* If this is a multi-location breakpoint, check if the locations + should be individually disabled. Watchpoint locations are + special, and not user visible. */ + if (!is_watchpoint (tp) && tp->loc && tp->loc->next) + { + int n = 1; - n++; - } - } - } + for (bp_location *loc : tp->locations ()) + { + if (!loc->enabled) + fp.printf ("disable $bpnum.%d\n", n); + + n++; + } + } + } if (extra_trace_bits && *default_collect) fp.printf ("set default-collect %s\n", default_collect); diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 23e859a..ef730df 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -1150,10 +1150,10 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg) case CTF_K_UNION: case CTF_K_ENUM: if (type == nullptr) - { - complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id); - type = objfile_type (ccp->of)->builtin_error; - } + { + complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id); + type = objfile_type (ccp->of)->builtin_error; + } sym = new (&ccp->of->objfile_obstack) symbol; OBJSTAT (ccp->of, n_syms++); SYMBOL_TYPE (sym) = type; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 84c4f34..dbc82f0 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -4792,11 +4792,13 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) return (sum_ranks (rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL), REFERENCE_SEE_THROUGH_BADNESS)); if (overload_debug) - /* Debugging only. */ - fprintf_filtered (gdb_stderr, - "------ Arg is %s [%d], parm is %s [%d]\n", - arg->name (), arg->code (), - parm->name (), parm->code ()); + { + /* Debugging only. */ + fprintf_filtered (gdb_stderr, + "------ Arg is %s [%d], parm is %s [%d]\n", + arg->name (), arg->code (), + parm->name (), parm->code ()); + } /* x -> y means arg of type x being supplied for parameter of type y. */ diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 5aae340..093ed9e 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -401,18 +401,18 @@ go32_nat_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal) resume_is_step = step; if (siggnal != GDB_SIGNAL_0 && siggnal != GDB_SIGNAL_TRAP) - { - for (i = 0, resume_signal = -1; - excepn_map[i].gdb_sig != GDB_SIGNAL_LAST; i++) - if (excepn_map[i].gdb_sig == siggnal) - { - resume_signal = excepn_map[i].djgpp_excepno; - break; - } - if (resume_signal == -1) - printf_unfiltered ("Cannot deliver signal %s on this platform.\n", - gdb_signal_to_name (siggnal)); - } + { + for (i = 0, resume_signal = -1; + excepn_map[i].gdb_sig != GDB_SIGNAL_LAST; i++) + if (excepn_map[i].gdb_sig == siggnal) + { + resume_signal = excepn_map[i].djgpp_excepno; + break; + } + if (resume_signal == -1) + printf_unfiltered ("Cannot deliver signal %s on this platform.\n", + gdb_signal_to_name (siggnal)); + } } static char child_cwd[FILENAME_MAX]; @@ -872,14 +872,14 @@ device_mode (int fd, int raw_p) newmode &= ~0x20; if (oldmode & 0x80) /* Only for character dev. */ - { - regs.x.ax = 0x4401; - regs.x.bx = fd; - regs.x.dx = newmode & 0xff; /* Force upper byte zero, else it fails. */ - __dpmi_int (0x21, ®s); - if (regs.x.flags & 1) - return -1; - } + { + regs.x.ax = 0x4401; + regs.x.bx = fd; + regs.x.dx = newmode & 0xff; /* Force upper byte zero, else it fails. */ + __dpmi_int (0x21, ®s); + if (regs.x.flags & 1) + return -1; + } return (oldmode & 0x20) == 0x20; } @@ -909,24 +909,24 @@ go32_nat_target::terminal_info (const char *args, int from_tty) #if __DJGPP_MINOR__ > 2 if (child_cmd.redirection) - { - int i; - - for (i = 0; i < DBG_HANDLES; i++) { - if (child_cmd.redirection[i]->file_name) - printf_unfiltered ("\tFile handle %d is redirected to `%s'.\n", - i, child_cmd.redirection[i]->file_name); - else if (_get_dev_info (child_cmd.redirection[i]->inf_handle) == -1) - printf_unfiltered - ("\tFile handle %d appears to be closed by inferior.\n", i); - /* Mask off the raw/cooked bit when comparing device info words. */ - else if ((_get_dev_info (child_cmd.redirection[i]->inf_handle) & 0xdf) - != (_get_dev_info (i) & 0xdf)) - printf_unfiltered - ("\tFile handle %d appears to be redirected by inferior.\n", i); + int i; + + for (i = 0; i < DBG_HANDLES; i++) + { + if (child_cmd.redirection[i]->file_name) + printf_unfiltered ("\tFile handle %d is redirected to `%s'.\n", + i, child_cmd.redirection[i]->file_name); + else if (_get_dev_info (child_cmd.redirection[i]->inf_handle) == -1) + printf_unfiltered + ("\tFile handle %d appears to be closed by inferior.\n", i); + /* Mask off the raw/cooked bit when comparing device info words. */ + else if ((_get_dev_info (child_cmd.redirection[i]->inf_handle) & 0xdf) + != (_get_dev_info (i) & 0xdf)) + printf_unfiltered + ("\tFile handle %d appears to be redirected by inferior.\n", i); + } } - } #endif } @@ -936,19 +936,19 @@ go32_nat_target::terminal_inferior () /* Redirect standard handles as child wants them. */ errno = 0; if (redir_to_child (&child_cmd) == -1) - { - redir_to_debugger (&child_cmd); - error (_("Cannot redirect standard handles for program: %s."), - safe_strerror (errno)); - } + { + redir_to_debugger (&child_cmd); + error (_("Cannot redirect standard handles for program: %s."), + safe_strerror (errno)); + } /* Set the console device of the inferior to whatever mode (raw or cooked) we found it last time. */ if (terminal_is_ours) - { - if (inf_mode_valid) - device_mode (0, inf_terminal_mode); - terminal_is_ours = 0; - } + { + if (inf_mode_valid) + device_mode (0, inf_terminal_mode); + terminal_is_ours = 0; + } } void @@ -957,25 +957,25 @@ go32_nat_target::terminal_ours () /* Switch to cooked mode on the gdb terminal and save the inferior terminal mode to be restored when it is resumed. */ if (!terminal_is_ours) - { - inf_terminal_mode = device_mode (0, 0); - if (inf_terminal_mode != -1) - inf_mode_valid = 1; - else - /* If device_mode returned -1, we don't know what happens with - handle 0 anymore, so make the info invalid. */ - inf_mode_valid = 0; - terminal_is_ours = 1; - - /* Restore debugger's standard handles. */ - errno = 0; - if (redir_to_debugger (&child_cmd) == -1) { - redir_to_child (&child_cmd); - error (_("Cannot redirect standard handles for debugger: %s."), - safe_strerror (errno)); + inf_terminal_mode = device_mode (0, 0); + if (inf_terminal_mode != -1) + inf_mode_valid = 1; + else + /* If device_mode returned -1, we don't know what happens with + handle 0 anymore, so make the info invalid. */ + inf_mode_valid = 0; + terminal_is_ours = 1; + + /* Restore debugger's standard handles. */ + errno = 0; + if (redir_to_debugger (&child_cmd) == -1) + { + redir_to_child (&child_cmd); + error (_("Cannot redirect standard handles for debugger: %s."), + safe_strerror (errno)); + } } - } } void diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index 2dd7798..96a3ef5 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -824,10 +824,10 @@ ppscm_print_children (SCM printer, enum display_hint hint, 2. Arrays. Always print a ",". 3. Other. Always print a ",". */ if (i == 0) - { - if (!printed_nothing) - fputs_filtered (" = ", stream); - } + { + if (!printed_nothing) + fputs_filtered (" = ", stream); + } else if (! is_map || i % 2 == 0) fputs_filtered (pretty ? "," : ", ", stream); diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c index ff07b7d..a4d1cee 100644 --- a/gdb/hppa-linux-tdep.c +++ b/gdb/hppa-linux-tdep.c @@ -174,9 +174,7 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc) sp = pc - pcoffs[attempt]; } else - { return 0; - } } /* sp + sfoffs[try] points to a struct rt_sigframe, which contains diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 5e6769a..7f9405c 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -4967,10 +4967,8 @@ static int i386_record_floats (struct gdbarch *gdbarch, else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum) { for (i = I387_ST0_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++) - { if (record_full_arch_list_add_reg (ir->regcache, i)) return -1; - } } else if ((iregnum >= I387_ST0_REGNUM (tdep)) && (iregnum <= I387_FOP_REGNUM (tdep))) diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index 159e7d3..0d7efbc 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -55,11 +55,11 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc) ui_out_emit_list list_emitter (uiout, "lines"); if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0) for (i = 0; i < SYMTAB_LINETABLE (s)->nitems; i++) - { - ui_out_emit_tuple tuple_emitter (uiout, NULL); - uiout->field_core_addr ("pc", gdbarch, SYMTAB_LINETABLE (s)->item[i].pc); - uiout->field_signed ("line", SYMTAB_LINETABLE (s)->item[i].line); - } + { + ui_out_emit_tuple tuple_emitter (uiout, NULL); + uiout->field_core_addr ("pc", gdbarch, SYMTAB_LINETABLE (s)->item[i].pc); + uiout->field_signed ("line", SYMTAB_LINETABLE (s)->item[i].line); + } } /* Used by the -symbol-info-* and -symbol-info-module-* commands to print diff --git a/gdb/nat/aarch64-sve-linux-ptrace.c b/gdb/nat/aarch64-sve-linux-ptrace.c index f344f92..8b162cd 100644 --- a/gdb/nat/aarch64-sve-linux-ptrace.c +++ b/gdb/nat/aarch64-sve-linux-ptrace.c @@ -100,17 +100,17 @@ aarch64_sve_set_vq (int tid, struct reg_buffer_common *reg_buf) inferior function call, and the VG register comes after the Z registers. */ if (reg_buf->get_register_status (AARCH64_SVE_VG_REGNUM) != REG_VALID) - { - /* If vg is not available yet, fetch it from ptrace. The VG value from - ptrace is likely the correct one. */ - uint64_t vq = aarch64_sve_get_vq (tid); + { + /* If vg is not available yet, fetch it from ptrace. The VG value from + ptrace is likely the correct one. */ + uint64_t vq = aarch64_sve_get_vq (tid); - /* If something went wrong, just bail out. */ - if (vq == 0) - return false; + /* If something went wrong, just bail out. */ + if (vq == 0) + return false; - reg_vg = sve_vg_from_vq (vq); - } + reg_vg = sve_vg_from_vq (vq); + } else reg_buf->raw_collect (AARCH64_SVE_VG_REGNUM, ®_vg); diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index 6dce09c..5d4ab5d 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -249,15 +249,15 @@ nios2_setup_default (struct nios2_unwind_cache *cache) int i; for (i = 0; i < NIOS2_NUM_REGS; i++) - { - /* All registers start off holding their previous values. */ - cache->reg_value[i].reg = i; - cache->reg_value[i].offset = 0; - - /* All registers start off not saved. */ - cache->reg_saved[i].basereg = -1; - cache->reg_saved[i].addr = 0; - } + { + /* All registers start off holding their previous values. */ + cache->reg_value[i].reg = i; + cache->reg_value[i].offset = 0; + + /* All registers start off not saved. */ + cache->reg_saved[i].basereg = -1; + cache->reg_saved[i].addr = 0; + } } /* Initialize the unwind cache. */ @@ -1244,16 +1244,16 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc, enum branch_condition cond; if (pc == current_pc) - { - /* When we reach the current PC we must save the current - register state (for the backtrace) but keep analysing - because there might be more to find out (eg. is this an - exception handler). */ - memcpy (temp_value, value, sizeof (temp_value)); - value = temp_value; - if (nios2_debug) - fprintf_unfiltered (gdb_stdlog, "*"); - } + { + /* When we reach the current PC we must save the current + register state (for the backtrace) but keep analysing + because there might be more to find out (eg. is this an + exception handler). */ + memcpy (temp_value, value, sizeof (temp_value)); + value = temp_value; + if (nios2_debug) + fprintf_unfiltered (gdb_stdlog, "*"); + } op = nios2_fetch_insn (gdbarch, pc, &insn); diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 64b3c56..c83d47c 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -276,10 +276,10 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* 32-bit decimal floats are right aligned in the doubleword. */ if (TYPE_LENGTH (type) == 4) - { - memcpy (regval + 4, val, 4); - p = regval; - } + { + memcpy (regval + 4, val, 4); + p = regval; + } else p = val; diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 1807198..54ac907 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -780,16 +780,16 @@ py_print_frame (PyObject *filter, frame_filter_flags flags, get_user_print_options (&opts); if (print_frame_info) - { - gdb::optional<enum print_what> user_frame_info_print_what; - - get_user_print_what_frame_info (&user_frame_info_print_what); - if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ()) - { - /* Use the specific frame information desired by the user. */ - print_what = *user_frame_info_print_what; - } - } + { + gdb::optional<enum print_what> user_frame_info_print_what; + + get_user_print_what_frame_info (&user_frame_info_print_what); + if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ()) + { + /* Use the specific frame information desired by the user. */ + print_what = *user_frame_info_print_what; + } + } /* Get the underlying frame. This is needed to determine GDB architecture, and also, in the cases of frame variables/arguments to diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index fef4dcd..fe33747 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -437,10 +437,10 @@ print_children (PyObject *printer, const char *hint, 2. Arrays. Always print a ",". 3. Other. Always print a ",". */ if (i == 0) - { - if (!is_py_none) - fputs_filtered (" = ", stream); - } + { + if (!is_py_none) + fputs_filtered (" = ", stream); + } else if (! is_map || i % 2 == 0) fputs_filtered (pretty ? "," : ", ", stream); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 57dbe5b..d45a15c 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1065,9 +1065,12 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, else if ((insn & BP_MASK) == BP_INSN) regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), from); else - /* Handle any other instructions that do not fit in the categories above. */ - regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), - from + offset); + { + /* Handle any other instructions that do not fit in the categories + above. */ + regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), + from + offset); + } } /* Implementation of gdbarch_displaced_step_prepare. */ diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 1bd770a..4905bca 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -7143,12 +7143,12 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) cause GDB to crash with an internal error when the user tries to set an unsupported OSABI. */ if (!tdesc_has_registers (tdesc)) - { - if (info.bfd_arch_info->mach == bfd_mach_s390_31) - tdesc = tdesc_s390_linux32; - else - tdesc = tdesc_s390x_linux64; - } + { + if (info.bfd_arch_info->mach == bfd_mach_s390_31) + tdesc = tdesc_s390_linux32; + else + tdesc = tdesc_s390x_linux64; + } tdep->tdesc = tdesc; /* Check any target description for validity. */ diff --git a/gdb/stack.c b/gdb/stack.c index 66a4610..a38fa4d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1005,11 +1005,11 @@ print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, frame_info *frame, std::string flags = gdbarch_get_pc_address_flags (gdbarch, frame, pc); if (!flags.empty ()) - { - uiout->text (" ["); - uiout->field_string ("addr_flags", flags); - uiout->text ("]"); - } + { + uiout->text (" ["); + uiout->field_string ("addr_flags", flags); + uiout->text ("]"); + } } /* See stack.h. */ @@ -1927,7 +1927,7 @@ public: struct frame_info *fid; if (args == NULL) - error (_("Missing address argument to view a frame")); + error (_("Missing address argument to view a frame")); gdb_argv argv (args); diff --git a/gdb/symtab.c b/gdb/symtab.c index 655b3da..cacf2d3 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -5637,55 +5637,55 @@ default_collect_symbol_completion_matches_break_on if (mode == complete_symbol_mode::LINESPEC) sym_text = text; else - { - const char *p; - char quote_found; - const char *quote_pos = NULL; + { + const char *p; + char quote_found; + const char *quote_pos = NULL; - /* First see if this is a quoted string. */ - quote_found = '\0'; - for (p = text; *p != '\0'; ++p) - { - if (quote_found != '\0') - { - if (*p == quote_found) - /* Found close quote. */ - quote_found = '\0'; - else if (*p == '\\' && p[1] == quote_found) - /* A backslash followed by the quote character - doesn't end the string. */ - ++p; - } - else if (*p == '\'' || *p == '"') - { - quote_found = *p; - quote_pos = p; - } - } - if (quote_found == '\'') - /* A string within single quotes can be a symbol, so complete on it. */ - sym_text = quote_pos + 1; - else if (quote_found == '"') - /* A double-quoted string is never a symbol, nor does it make sense - to complete it any other way. */ - { - return; - } - else - { - /* It is not a quoted string. Break it based on the characters - which are in symbols. */ - while (p > text) - { - if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0' - || p[-1] == ':' || strchr (break_on, p[-1]) != NULL) - --p; - else - break; - } - sym_text = p; - } - } + /* First see if this is a quoted string. */ + quote_found = '\0'; + for (p = text; *p != '\0'; ++p) + { + if (quote_found != '\0') + { + if (*p == quote_found) + /* Found close quote. */ + quote_found = '\0'; + else if (*p == '\\' && p[1] == quote_found) + /* A backslash followed by the quote character + doesn't end the string. */ + ++p; + } + else if (*p == '\'' || *p == '"') + { + quote_found = *p; + quote_pos = p; + } + } + if (quote_found == '\'') + /* A string within single quotes can be a symbol, so complete on it. */ + sym_text = quote_pos + 1; + else if (quote_found == '"') + /* A double-quoted string is never a symbol, nor does it make sense + to complete it any other way. */ + { + return; + } + else + { + /* It is not a quoted string. Break it based on the characters + which are in symbols. */ + while (p > text) + { + if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0' + || p[-1] == ':' || strchr (break_on, p[-1]) != NULL) + --p; + else + break; + } + sym_text = p; + } + } lookup_name_info lookup_name (sym_text, name_match_type, true); @@ -5874,46 +5874,46 @@ collect_file_symbol_completion_matches (completion_tracker &tracker, if (mode == complete_symbol_mode::LINESPEC) sym_text = text; else - { - const char *p; - char quote_found; - const char *quote_pos = NULL; + { + const char *p; + char quote_found; + const char *quote_pos = NULL; - /* First see if this is a quoted string. */ - quote_found = '\0'; - for (p = text; *p != '\0'; ++p) - { - if (quote_found != '\0') - { - if (*p == quote_found) - /* Found close quote. */ - quote_found = '\0'; - else if (*p == '\\' && p[1] == quote_found) - /* A backslash followed by the quote character - doesn't end the string. */ - ++p; - } - else if (*p == '\'' || *p == '"') - { - quote_found = *p; - quote_pos = p; - } - } - if (quote_found == '\'') - /* A string within single quotes can be a symbol, so complete on it. */ - sym_text = quote_pos + 1; - else if (quote_found == '"') - /* A double-quoted string is never a symbol, nor does it make sense - to complete it any other way. */ - { - return; - } - else - { - /* Not a quoted string. */ - sym_text = language_search_unquoted_string (text, p); - } - } + /* First see if this is a quoted string. */ + quote_found = '\0'; + for (p = text; *p != '\0'; ++p) + { + if (quote_found != '\0') + { + if (*p == quote_found) + /* Found close quote. */ + quote_found = '\0'; + else if (*p == '\\' && p[1] == quote_found) + /* A backslash followed by the quote character + doesn't end the string. */ + ++p; + } + else if (*p == '\'' || *p == '"') + { + quote_found = *p; + quote_pos = p; + } + } + if (quote_found == '\'') + /* A string within single quotes can be a symbol, so complete on it. */ + sym_text = quote_pos + 1; + else if (quote_found == '"') + /* A double-quoted string is never a symbol, nor does it make sense + to complete it any other way. */ + { + return; + } + else + { + /* Not a quoted string. */ + sym_text = language_search_unquoted_string (text, p); + } + } lookup_name_info lookup_name (sym_text, name_match_type, true); diff --git a/gdb/target-float.c b/gdb/target-float.c index 692af59..86d40d8 100644 --- a/gdb/target-float.c +++ b/gdb/target-float.c @@ -2451,11 +2451,11 @@ target_float_convert (const gdb_byte *from, const struct type *from_type, /* Convert between two different formats in the same category. */ if (!target_float_same_format_p (from_type, to_type)) - { - const target_float_ops *ops = get_target_float_ops (from_type, to_type); - ops->convert (from, from_type, to, to_type); - return; - } + { + const target_float_ops *ops = get_target_float_ops (from_type, to_type); + ops->convert (from, from_type, to, to_type); + return; + } /* The floating-point formats match, so we simply copy the data, ensuring possible padding bytes in the target buffer are zeroed out. */ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index cb8b4cb..f88968a 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2267,7 +2267,7 @@ tfind_command_1 (const char *args, int from_tty) { /* TFIND with no args means find NEXT trace frame. */ if (traceframe_number == -1) frameno = 0; /* "next" is first one. */ - else + else frameno = traceframe_number + 1; } else if (0 == strcmp (args, "-")) @@ -2408,11 +2408,13 @@ tfind_line_command (const char *args, int from_tty) } } else - /* Is there any case in which we get here, and have an address - which the user would want to see? If we have debugging - symbols and no line numbers? */ - error (_("Line number %d is out of range for \"%s\"."), - sal.line, symtab_to_filename_for_display (sal.symtab)); + { + /* Is there any case in which we get here, and have an address + which the user would want to see? If we have debugging + symbols and no line numbers? */ + error (_("Line number %d is out of range for \"%s\"."), + sal.line, symtab_to_filename_for_display (sal.symtab)); + } /* Find within range of stated line. */ if (args && *args) diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 1c46e29..5114c1b 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1025,12 +1025,14 @@ v850_push_dummy_call (struct gdbarch *gdbarch, if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850) stack_offset = 0; else - /* The offset onto the stack at which we will start copying parameters - (after the registers are used up) begins at 16 rather than at zero. - That's how the ABI is defined, though there's no indication that these - 16 bytes are used for anything, not even for saving incoming - argument registers. */ - stack_offset = 16; + { + /* The offset onto the stack at which we will start copying parameters + (after the registers are used up) begins at 16 rather than at zero. + That's how the ABI is defined, though there's no indication that these + 16 bytes are used for anything, not even for saving incoming + argument registers. */ + stack_offset = 16; + } /* Now make space on the stack for the args. */ for (argnum = 0; argnum < nargs; argnum++) diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 88601e1..ca85439 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -761,10 +761,10 @@ create_enum (struct gdbarch *gdbarch, int bit, const char *name, type->set_is_unsigned (true); for (i = 0; i < count; i++) - { - TYPE_FIELD_NAME (type, i) = values[i].name; - SET_FIELD_ENUMVAL (type->field (i), values[i].value); - } + { + TYPE_FIELD_NAME (type, i) = values[i].name; + SET_FIELD_ENUMVAL (type->field (i), values[i].value); + } return type; } diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 3685727..a854d4d 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -482,7 +482,8 @@ arrange_linetable (struct linetable *oldLineTb) newline = 0; if (oldLineTb->item[0].line != 0) for (newline = 0; - newline < oldLineTb->nitems && oldLineTb->item[newline].line; ++newline) + newline < oldLineTb->nitems && oldLineTb->item[newline].line; + ++newline) newLineTb->item[newline] = oldLineTb->item[newline]; /* Now copy function lines one by one. */ @@ -1165,20 +1166,20 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst) to 32(0x20). So we need to read the first function auxiliary entry which contains the size. */ if (cs->c_naux > 1 && ISFCN (cs->c_type)) - { - /* a function entry point. */ + { + /* a function entry point. */ - fcn_start_addr = cs->c_value; + fcn_start_addr = cs->c_value; - /* save the function header info, which will be used - when `.bf' is seen. */ - fcn_cs_saved = *cs; + /* save the function header info, which will be used + when `.bf' is seen. */ + fcn_cs_saved = *cs; - /* Convert the auxent to something we can access. */ - bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, - 0, cs->c_naux, &fcn_aux_saved); - continue; - } + /* Convert the auxent to something we can access. */ + bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, + 0, cs->c_naux, &fcn_aux_saved); + continue; + } /* Read the csect auxiliary header, which is always the last by convention. */ bfd_coff_swap_aux_in (abfd, diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index 79c60b0..f8d7fd6 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2021-05-27 Simon Marchi <simon.marchi@polymtl.ca> + + * Fix some indentation mistakes throughout. + 2021-05-17 Andrew Burgess <andrew.burgess@embecosm.com> * .dir-locals.el: Set sentence-end-double-space for all modes, and diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index 09a9662..b66808e 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -1908,15 +1908,13 @@ s390_emit_const (LONGEST num) 0x98, 0x23, 0x10, 0x00, /* lm %r2, %r3, 0(%r1) */ }; if (num < 0x8000 && num >= 0) - { add_insns (buf_s, sizeof buf_s); - } else - { - s390_emit_litpool (8); - add_insns ((unsigned char *) &n, sizeof n); - add_insns (buf_l, sizeof buf_l); - } + { + s390_emit_litpool (8); + add_insns ((unsigned char *) &n, sizeof n); + add_insns (buf_l, sizeof buf_l); + } } /* The "emit_call" emit_ops method for s390. */ @@ -2027,15 +2025,13 @@ s390_emit_set_r2 (int arg1) 0x58, 0x20, 0x10, 0x00, /* l %r2, 0(%r1) */ }; if (arg1 < 0x8000 && arg1 >= -0x8000) - { add_insns (buf_s, sizeof buf_s); - } else - { - s390_emit_litpool (4); - add_insns ((unsigned char *) &arg1, sizeof arg1); - add_insns (buf_l, sizeof buf_l); - } + { + s390_emit_litpool (4); + add_insns ((unsigned char *) &arg1, sizeof arg1); + add_insns (buf_l, sizeof buf_l); + } } /* The "emit_int_call_1" emit_ops method for s390. */ @@ -2553,15 +2549,13 @@ s390x_emit_const (LONGEST num) 0xe3, 0x20, 0x10, 0x00, 0x00, 0x04, /* lg %r2, 0(%r1) */ }; if (num < 0x8000 && num >= -0x8000) - { add_insns (buf_s, sizeof buf_s); - } else - { - s390_emit_litpool (8); - add_insns ((unsigned char *) &n, sizeof n); - add_insns (buf_l, sizeof buf_l); - } + { + s390_emit_litpool (8); + add_insns ((unsigned char *) &n, sizeof n); + add_insns (buf_l, sizeof buf_l); + } } /* The "emit_call" emit_ops method for s390x. */ |