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
This commit is contained in:
Simon Marchi 2021-05-27 15:01:28 -04:00
parent 055c879fcf
commit 01add95bed
29 changed files with 702 additions and 696 deletions

View file

@ -1,3 +1,7 @@
2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
* Fix some indentation mistakes throughout.
2021-05-27 Simon Marchi <simon.marchi@polymtl.ca> 2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
* breakpoint.h (iterate_over_bp_locations): Remove. Update * breakpoint.h (iterate_over_bp_locations): Remove. Update

View file

@ -3663,11 +3663,11 @@ When on, AArch64 specific debugging is enabled."),
{ \ { \
unsigned int mem_len = LENGTH; \ unsigned int mem_len = LENGTH; \
if (mem_len) \ if (mem_len) \
{ \ { \
MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \ MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \
memcpy(&MEMS->len, &RECORD_BUF[0], \ memcpy(&MEMS->len, &RECORD_BUF[0], \
sizeof(struct aarch64_mem_r) * LENGTH); \ sizeof(struct aarch64_mem_r) * LENGTH); \
} \ } \
} \ } \
while (0) while (0)

View file

@ -707,14 +707,14 @@ get_signaled_thread (void)
tid_t ktid = 0; tid_t ktid = 0;
while (1) while (1)
{ {
if (getthrds (inferior_ptid.pid (), &thrinf, if (getthrds (inferior_ptid.pid (), &thrinf,
sizeof (thrinf), &ktid, 1) != 1) sizeof (thrinf), &ktid, 1) != 1)
break; break;
if (thrinf.ti_cursig == SIGTRAP) if (thrinf.ti_cursig == SIGTRAP)
return thrinf.ti_tid; return thrinf.ti_tid;
} }
/* Didn't find any thread stopped on a SIGTRAP signal. */ /* Didn't find any thread stopped on a SIGTRAP signal. */
return 0; return 0;

View file

@ -187,10 +187,10 @@ arm_fbsd_read_description_auxv (struct target_ops *target)
if (arm_hwcap & HWCAP_NEON) if (arm_hwcap & HWCAP_NEON)
return aarch32_read_description (); return aarch32_read_description ();
else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPD32)) else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPD32))
== (HWCAP_VFPv3 | HWCAP_VFPD32)) == (HWCAP_VFPv3 | HWCAP_VFPD32))
return arm_read_description (ARM_FP_TYPE_VFPV3); return arm_read_description (ARM_FP_TYPE_VFPV3);
else else
return arm_read_description (ARM_FP_TYPE_VFPV2); return arm_read_description (ARM_FP_TYPE_VFPV2);
} }
return nullptr; return nullptr;

View file

@ -9697,11 +9697,11 @@ vfp - VFP co-processor."),
{ \ { \
unsigned int mem_len = LENGTH; \ unsigned int mem_len = LENGTH; \
if (mem_len) \ if (mem_len) \
{ \ { \
MEMS = XNEWVEC (struct arm_mem_r, mem_len); \ MEMS = XNEWVEC (struct arm_mem_r, mem_len); \
memcpy(&MEMS->len, &RECORD_BUF[0], \ memcpy(&MEMS->len, &RECORD_BUF[0], \
sizeof(struct arm_mem_r) * LENGTH); \ sizeof(struct arm_mem_r) * LENGTH); \
} \ } \
} \ } \
while (0) while (0)
@ -9997,19 +9997,19 @@ arm_record_extension_space (insn_decode_record *arm_insn_r)
{ {
/* Handle MLA(S) and MUL(S). */ /* Handle MLA(S) and MUL(S). */
if (in_inclusive_range (insn_op1, 0U, 3U)) if (in_inclusive_range (insn_op1, 0U, 3U))
{ {
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15); record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = ARM_PS_REGNUM; record_buf[1] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 2; arm_insn_r->reg_rec_count = 2;
} }
else if (in_inclusive_range (insn_op1, 4U, 15U)) else if (in_inclusive_range (insn_op1, 4U, 15U))
{ {
/* Handle SMLAL(S), SMULL(S), UMLAL(S), UMULL(S). */ /* Handle SMLAL(S), SMULL(S), UMLAL(S), UMULL(S). */
record_buf[0] = bits (arm_insn_r->arm_insn, 16, 19); record_buf[0] = bits (arm_insn_r->arm_insn, 16, 19);
record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15); record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[2] = ARM_PS_REGNUM; record_buf[2] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 3; arm_insn_r->reg_rec_count = 3;
} }
} }
opcode1 = bits (arm_insn_r->arm_insn, 26, 27); 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 /* Note: BLX(1) doesnt fall here but instead it falls into
extension space. */ extension space. */
if (bit (arm_insn_r->arm_insn, 24)) if (bit (arm_insn_r->arm_insn, 24))
{ {
record_buf[0] = ARM_LR_REGNUM; record_buf[0] = ARM_LR_REGNUM;
arm_insn_r->reg_rec_count = 1; arm_insn_r->reg_rec_count = 1;
} }
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf); REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);

View file

@ -1605,28 +1605,29 @@ breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
/* Now do full processing of the found relevant range of elements. */ /* Now do full processing of the found relevant range of elements. */
for (bc = bc_l; bc < bp_locations.size (); bc++) 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. */ /* bp_location array has BL->OWNER always non-NULL. */
if (bl->owner->type == bp_none) if (bl->owner->type == bp_none)
warning (_("reading through apparently deleted breakpoint #%d?"), warning (_("reading through apparently deleted breakpoint #%d?"),
bl->owner->number); bl->owner->number);
/* Performance optimization: any further element can no longer affect BUF /* Performance optimization: any further element can no longer affect BUF
content. */ content. */
if (bl->address >= bp_locations_placed_address_before_address_max if (bl->address >= bp_locations_placed_address_before_address_max
&& memaddr + len <= (bl->address && (memaddr + len
- bp_locations_placed_address_before_address_max)) <= (bl->address
break; - bp_locations_placed_address_before_address_max)))
break;
if (!bp_location_has_shadow (bl)) if (!bp_location_has_shadow (bl))
continue; continue;
one_breakpoint_xfer_memory (readbuf, writebuf, writebuf_org, one_breakpoint_xfer_memory (readbuf, writebuf, writebuf_org,
memaddr, len, &bl->target_info, bl->gdbarch); memaddr, len, &bl->target_info, bl->gdbarch);
} }
} }
/* See breakpoint.h. */ /* See breakpoint.h. */
@ -3079,10 +3080,9 @@ remove_breakpoints (void)
int val = 0; int val = 0;
for (bp_location *bl : all_bp_locations ()) for (bp_location *bl : all_bp_locations ())
{
if (bl->inserted && !is_tracepoint (bl->owner)) if (bl->inserted && !is_tracepoint (bl->owner))
val |= remove_breakpoint (bl); val |= remove_breakpoint (bl);
}
return val; return val;
} }
@ -3116,17 +3116,17 @@ remove_breakpoints_inf (inferior *inf)
int val; int val;
for (bp_location *bl : all_bp_locations ()) for (bp_location *bl : all_bp_locations ())
{ {
if (bl->pspace != inf->pspace) if (bl->pspace != inf->pspace)
continue; continue;
if (bl->inserted && !bl->target_info.persist) if (bl->inserted && !bl->target_info.persist)
{ {
val = remove_breakpoint (bl); val = remove_breakpoint (bl);
if (val != 0) if (val != 0)
return; return;
} }
} }
} }
static int internal_breakpoint_number = -1; static int internal_breakpoint_number = -1;
@ -3612,107 +3612,107 @@ update_breakpoints_after_exec (void)
gdb_assert (!bploc->inserted); gdb_assert (!bploc->inserted);
for (breakpoint *b : all_breakpoints_safe ()) for (breakpoint *b : all_breakpoints_safe ())
{ {
if (b->pspace != current_program_space) 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);
continue; continue;
}
/* JIT breakpoints must be explicitly reset after an exec(). */ /* Solib breakpoints must be explicitly reset after an exec(). */
if (b->type == bp_jit_event) if (b->type == bp_shlib_event)
{ {
delete_breakpoint (b); delete_breakpoint (b);
continue; continue;
} }
/* Thread event breakpoints must be set anew after an exec(), /* JIT breakpoints must be explicitly reset after an exec(). */
as must overlay event and longjmp master breakpoints. */ if (b->type == bp_jit_event)
if (b->type == bp_thread_event || b->type == bp_overlay_event {
|| b->type == bp_longjmp_master || b->type == bp_std_terminate_master delete_breakpoint (b);
|| b->type == bp_exception_master) continue;
{ }
delete_breakpoint (b);
continue;
}
/* Step-resume breakpoints are meaningless after an exec(). */ /* Thread event breakpoints must be set anew after an exec(),
if (b->type == bp_step_resume || b->type == bp_hp_step_resume) as must overlay event and longjmp master breakpoints. */
{ if (b->type == bp_thread_event || b->type == bp_overlay_event
delete_breakpoint (b); || b->type == bp_longjmp_master || b->type == bp_std_terminate_master
continue; || b->type == bp_exception_master)
} {
delete_breakpoint (b);
continue;
}
/* Just like single-step breakpoints. */ /* Step-resume breakpoints are meaningless after an exec(). */
if (b->type == bp_single_step) if (b->type == bp_step_resume || b->type == bp_hp_step_resume)
{ {
delete_breakpoint (b); delete_breakpoint (b);
continue; continue;
} }
/* Longjmp and longjmp-resume breakpoints are also meaningless /* Just like single-step breakpoints. */
after an exec. */ if (b->type == bp_single_step)
if (b->type == bp_longjmp || b->type == bp_longjmp_resume {
|| b->type == bp_longjmp_call_dummy delete_breakpoint (b);
|| b->type == bp_exception || b->type == bp_exception_resume) continue;
{ }
delete_breakpoint (b);
continue;
}
if (b->type == bp_catchpoint) /* Longjmp and longjmp-resume breakpoints are also meaningless
{ after an exec. */
/* For now, none of the bp_catchpoint breakpoints need to if (b->type == bp_longjmp || b->type == bp_longjmp_resume
do anything at this point. In the future, if some of || b->type == bp_longjmp_call_dummy
the catchpoints need to something, we will need to add || b->type == bp_exception || b->type == bp_exception_resume)
a new method, and call this method from here. */ {
continue; delete_breakpoint (b);
} continue;
}
/* bp_finish is a special case. The only way we ought to be able if (b->type == bp_catchpoint)
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 /* For now, none of the bp_catchpoint breakpoints need to
carries them to the call-site of the current callee, by setting do anything at this point. In the future, if some of
a temporary bp there and resuming. But in this case, the finish the catchpoints need to something, we will need to add
will carry them entirely through the vfork & exec. a new method, and call this method from here. */
continue;
}
We don't want to allow a bp_finish to remain inserted now. But /* bp_finish is a special case. The only way we ought to be able
we can't safely delete it, 'cause finish_command has a handle to to see one of these when an exec() has happened, is if the user
the bp on a bpstat, and will later want to delete it. There's a caught a vfork, and then said "finish". Ordinarily a finish just
chance (and I've seen it happen) that if we delete the bp_finish carries them to the call-site of the current callee, by setting
here, that its storage will get reused by the time finish_command a temporary bp there and resuming. But in this case, the finish
gets 'round to deleting the "use to be a bp_finish" breakpoint. will carry them entirely through the vfork & exec.
We really must allow finish_command to delete a bp_finish.
In the absence of a general solution for the "how do we know We don't want to allow a bp_finish to remain inserted now. But
it's safe to delete something others may have handles to?" we can't safely delete it, 'cause finish_command has a handle to
problem, what we'll do here is just uninsert the bp_finish, and the bp on a bpstat, and will later want to delete it. There's a
let finish_command delete it. 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.
(We know the bp_finish is "doomed" in the sense that it's In the absence of a general solution for the "how do we know
momentary, and will be deleted as soon as finish_command sees it's safe to delete something others may have handles to?"
the inferior stopped. So it doesn't matter that the bp's problem, what we'll do here is just uninsert the bp_finish, and
address is probably bogus in the new a.out, unlike e.g., the let finish_command delete it.
solib breakpoints.) */
if (b->type == bp_finish) (We know the bp_finish is "doomed" in the sense that it's
{ momentary, and will be deleted as soon as finish_command sees
continue; 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.) */
/* Without a symbolic address, we have little hope of the if (b->type == bp_finish)
pre-exec() address meaning the same thing in the post-exec() {
a.out. */ continue;
if (breakpoint_event_location_empty_p (b)) }
{
delete_breakpoint (b); /* Without a symbolic address, we have little hope of the
continue; 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 int
@ -3728,22 +3728,22 @@ detach_breakpoints (ptid_t ptid)
/* Set inferior_ptid; remove_breakpoint_1 uses this global. */ /* Set inferior_ptid; remove_breakpoint_1 uses this global. */
inferior_ptid = ptid; inferior_ptid = ptid;
for (bp_location *bl : all_bp_locations ()) for (bp_location *bl : all_bp_locations ())
{ {
if (bl->pspace != inf->pspace) if (bl->pspace != inf->pspace)
continue; continue;
/* This function must physically remove breakpoints locations /* This function must physically remove breakpoints locations
from the specified ptid, without modifying the breakpoint from the specified ptid, without modifying the breakpoint
package's state. Locations of type bp_loc_other are only package's state. Locations of type bp_loc_other are only
maintained at GDB side. So, there is no need to remove maintained at GDB side. So, there is no need to remove
these bp_loc_other locations. Moreover, removing these these bp_loc_other locations. Moreover, removing these
would modify the breakpoint package's state. */ would modify the breakpoint package's state. */
if (bl->loc_type == bp_loc_other) if (bl->loc_type == bp_loc_other)
continue; continue;
if (bl->inserted) if (bl->inserted)
val |= remove_breakpoint_1 (bl, DETACH_BREAKPOINT); val |= remove_breakpoint_1 (bl, DETACH_BREAKPOINT);
} }
return val; return val;
} }
@ -3952,83 +3952,83 @@ breakpoint_init_inferior (enum inf_context context)
mark_breakpoints_out (); mark_breakpoints_out ();
for (breakpoint *b : all_breakpoints_safe ()) for (breakpoint *b : all_breakpoints_safe ())
{ {
if (b->loc && b->loc->pspace != pspace) if (b->loc && b->loc->pspace != pspace)
continue; continue;
switch (b->type) 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. */
case bp_watchpoint_scope:
/* Also get rid of scope breakpoints. */
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.,
(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:
/* Also remove step-resume breakpoints. */
case bp_single_step:
/* Also remove single-step breakpoints. */
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_call_dummy:
case bp_longjmp_call_dummy:
/* Likewise for watchpoints on local expressions. */ /* If the call dummy breakpoint is at the entry point it will
if (w->exp_valid_block != NULL) cause problems when the inferior is rerun, so we better get
delete_breakpoint (b); rid of it. */
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) case bp_watchpoint_scope:
{
/* Reset val field to force reread of starting value in /* Also get rid of scope breakpoints. */
insert_breakpoints. */
w->val.reset (nullptr); case bp_shlib_event:
w->val_valid = false;
} /* 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.
*/
case bp_step_resume:
/* Also remove step-resume breakpoints. */
case bp_single_step:
/* Also remove single-step breakpoints. */
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;
/* 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. */ /* Get rid of the moribund locations. */
for (bp_location *bl : moribund_locations) for (bp_location *bl : moribund_locations)
@ -7394,11 +7394,11 @@ enable_overlay_breakpoints (void)
{ {
for (breakpoint *b : all_breakpoints ()) for (breakpoint *b : all_breakpoints ())
if (b->type == bp_overlay_event) if (b->type == bp_overlay_event)
{ {
b->enable_state = bp_enabled; b->enable_state = bp_enabled;
update_global_location_list (UGLL_MAY_INSERT); update_global_location_list (UGLL_MAY_INSERT);
overlay_events_enabled = 1; overlay_events_enabled = 1;
} }
} }
void void
@ -7406,11 +7406,11 @@ disable_overlay_breakpoints (void)
{ {
for (breakpoint *b : all_breakpoints ()) for (breakpoint *b : all_breakpoints ())
if (b->type == bp_overlay_event) if (b->type == bp_overlay_event)
{ {
b->enable_state = bp_disabled; b->enable_state = bp_disabled;
update_global_location_list (UGLL_DONT_INSERT); update_global_location_list (UGLL_DONT_INSERT);
overlay_events_enabled = 0; overlay_events_enabled = 0;
} }
} }
/* Set an active std::terminate breakpoint for each std::terminate /* Set an active std::terminate breakpoint for each std::terminate
@ -7546,27 +7546,27 @@ void
disable_breakpoints_in_shlibs (void) disable_breakpoints_in_shlibs (void)
{ {
for (bp_location *loc : all_bp_locations ()) for (bp_location *loc : all_bp_locations ())
{ {
/* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */ /* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */
struct breakpoint *b = loc->owner; struct breakpoint *b = loc->owner;
/* We apply the check to all breakpoints, including disabled for /* We apply the check to all breakpoints, including disabled for
those with loc->duplicate set. This is so that when breakpoint those with loc->duplicate set. This is so that when breakpoint
becomes enabled, or the duplicate is removed, gdb will try to becomes enabled, or the duplicate is removed, gdb will try to
insert all breakpoints. If we don't set shlib_disabled here, insert all breakpoints. If we don't set shlib_disabled here,
we'll try to insert those breakpoints and fail. */ we'll try to insert those breakpoints and fail. */
if (((b->type == bp_breakpoint) if (((b->type == bp_breakpoint)
|| (b->type == bp_jit_event) || (b->type == bp_jit_event)
|| (b->type == bp_hardware_breakpoint) || (b->type == bp_hardware_breakpoint)
|| (is_tracepoint (b))) || (is_tracepoint (b)))
&& loc->pspace == current_program_space && loc->pspace == current_program_space
&& !loc->shlib_disabled && !loc->shlib_disabled
&& solib_name_from_address (loc->pspace, loc->address) && solib_name_from_address (loc->pspace, loc->address)
) )
{ {
loc->shlib_disabled = 1; loc->shlib_disabled = 1;
} }
} }
} }
/* Disable any breakpoints and tracepoints that are in SOLIB upon /* 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; int disabled_shlib_breaks = 0;
for (bp_location *loc : all_bp_locations ()) for (bp_location *loc : all_bp_locations ())
{ {
/* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */ /* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */
struct breakpoint *b = loc->owner; struct breakpoint *b = loc->owner;
if (solib->pspace == loc->pspace if (solib->pspace == loc->pspace
&& !loc->shlib_disabled && !loc->shlib_disabled
&& (((b->type == bp_breakpoint && (((b->type == bp_breakpoint
|| b->type == bp_jit_event || b->type == bp_jit_event
|| b->type == bp_hardware_breakpoint) || b->type == bp_hardware_breakpoint)
&& (loc->loc_type == bp_loc_hardware_breakpoint && (loc->loc_type == bp_loc_hardware_breakpoint
|| loc->loc_type == bp_loc_software_breakpoint)) || loc->loc_type == bp_loc_software_breakpoint))
|| is_tracepoint (b)) || is_tracepoint (b))
&& solib_contains_address_p (solib, loc->address)) && solib_contains_address_p (solib, loc->address))
{ {
loc->shlib_disabled = 1; loc->shlib_disabled = 1;
/* At this point, we cannot rely on remove_breakpoint /* At this point, we cannot rely on remove_breakpoint
succeeding so we must mark the breakpoint as not inserted succeeding so we must mark the breakpoint as not inserted
to prevent future errors occurring in remove_breakpoints. */ to prevent future errors occurring in remove_breakpoints. */
loc->inserted = 0; loc->inserted = 0;
/* This may cause duplicate notifications for the same breakpoint. */ /* This may cause duplicate notifications for the same breakpoint. */
gdb::observers::breakpoint_modified.notify (b); gdb::observers::breakpoint_modified.notify (b);
if (!disabled_shlib_breaks) if (!disabled_shlib_breaks)
{ {
target_terminal::ours_for_output (); target_terminal::ours_for_output ();
warning (_("Temporarily disabling breakpoints " warning (_("Temporarily disabling breakpoints "
"for unloaded shared library \"%s\""), "for unloaded shared library \"%s\""),
solib->so_name); solib->so_name);
} }
disabled_shlib_breaks = 1; disabled_shlib_breaks = 1;
} }
} }
} }
/* Disable any breakpoints and tracepoints in OBJFILE upon /* Disable any breakpoints and tracepoints in OBJFILE upon
@ -7975,22 +7975,22 @@ breakpoint_hit_catch_solib (const struct bp_location *bl,
return 1; return 1;
for (breakpoint *other : all_breakpoints ()) for (breakpoint *other : all_breakpoints ())
{ {
if (other == bl->owner) if (other == bl->owner)
continue; continue;
if (other->type != bp_shlib_event) if (other->type != bp_shlib_event)
continue; continue;
if (self->pspace != NULL && other->pspace != self->pspace) if (self->pspace != NULL && other->pspace != self->pspace)
continue; continue;
for (bp_location *other_bl : other->locations ()) for (bp_location *other_bl : other->locations ())
{ {
if (other->ops->breakpoint_hit (other_bl, aspace, bp_addr, ws)) if (other->ops->breakpoint_hit (other_bl, aspace, bp_addr, ws))
return 1; return 1;
} }
} }
return 0; return 0;
} }
@ -13174,10 +13174,10 @@ delete_breakpoint (struct breakpoint *bpt)
for (breakpoint *b : all_breakpoints ()) for (breakpoint *b : all_breakpoints ())
if (b->next == bpt) if (b->next == bpt)
{ {
b->next = bpt->next; b->next = bpt->next;
break; break;
} }
/* Be sure no bpstat's are pointing at the breakpoint after it's /* Be sure no bpstat's are pointing at the breakpoint after it's
been freed. */ been freed. */
@ -13913,33 +13913,33 @@ set_ignore_count (int bptnum, int count, int from_tty)
for (breakpoint *b : all_breakpoints ()) for (breakpoint *b : all_breakpoints ())
if (b->number == bptnum) if (b->number == bptnum)
{ {
if (is_tracepoint (b)) if (is_tracepoint (b))
{ {
if (from_tty && count != 0) if (from_tty && count != 0)
printf_filtered (_("Ignore count ignored for tracepoint %d."), printf_filtered (_("Ignore count ignored for tracepoint %d."),
bptnum); bptnum);
return; return;
} }
b->ignore_count = count; b->ignore_count = count;
if (from_tty) if (from_tty)
{ {
if (count == 0) if (count == 0)
printf_filtered (_("Will stop next time " printf_filtered (_("Will stop next time "
"breakpoint %d is reached."), "breakpoint %d is reached."),
bptnum); bptnum);
else if (count == 1) else if (count == 1)
printf_filtered (_("Will ignore next crossing of breakpoint %d."), printf_filtered (_("Will ignore next crossing of breakpoint %d."),
bptnum); bptnum);
else else
printf_filtered (_("Will ignore next %d " printf_filtered (_("Will ignore next %d "
"crossings of breakpoint %d."), "crossings of breakpoint %d."),
count, bptnum); count, bptnum);
} }
gdb::observers::breakpoint_modified.notify (b); gdb::observers::breakpoint_modified.notify (b);
return; return;
} }
error (_("No breakpoint number %d."), bptnum); 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.")); error (_("Junk at end of arguments."));
for (breakpoint *b : all_tracepoints ()) for (breakpoint *b : all_tracepoints ())
{ {
t1 = (struct tracepoint *) b; t1 = (struct tracepoint *) b;
trace_pass_set_count (t1, count, from_tty); trace_pass_set_count (t1, count, from_tty);
} }
} }
else if (*args == '\0') else if (*args == '\0')
{ {
@ -14931,9 +14931,7 @@ get_tracepoint_by_number (const char **arg,
for (breakpoint *t : all_tracepoints ()) for (breakpoint *t : all_tracepoints ())
if (t->number == tpnum) if (t->number == tpnum)
{
return (struct tracepoint *) t; return (struct tracepoint *) t;
}
printf_unfiltered ("No tracepoint number %d.\n", tpnum); printf_unfiltered ("No tracepoint number %d.\n", tpnum);
return NULL; return NULL;
@ -14968,25 +14966,25 @@ save_breakpoints (const char *filename, int from_tty,
/* See if we have anything to save. */ /* See if we have anything to save. */
for (breakpoint *tp : all_breakpoints ()) for (breakpoint *tp : all_breakpoints ())
{ {
/* Skip internal and momentary breakpoints. */ /* Skip internal and momentary breakpoints. */
if (!user_breakpoint_p (tp)) if (!user_breakpoint_p (tp))
continue; continue;
/* If we have a filter, only save the breakpoints it accepts. */ /* If we have a filter, only save the breakpoints it accepts. */
if (filter && !filter (tp)) if (filter && !filter (tp))
continue; continue;
any = 1; any = 1;
if (is_tracepoint (tp)) if (is_tracepoint (tp))
{ {
extra_trace_bits = 1; extra_trace_bits = 1;
/* We can stop searching. */ /* We can stop searching. */
break; break;
} }
} }
if (!any) if (!any)
{ {
@ -15006,65 +15004,65 @@ save_breakpoints (const char *filename, int from_tty,
save_trace_state_variables (&fp); save_trace_state_variables (&fp);
for (breakpoint *tp : all_breakpoints ()) for (breakpoint *tp : all_breakpoints ())
{ {
/* Skip internal and momentary breakpoints. */ /* Skip internal and momentary breakpoints. */
if (!user_breakpoint_p (tp)) if (!user_breakpoint_p (tp))
continue; continue;
/* If we have a filter, only save the breakpoints it accepts. */ /* If we have a filter, only save the breakpoints it accepts. */
if (filter && !filter (tp)) if (filter && !filter (tp))
continue; 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 /* Note, we can't rely on tp->number for anything, as we can't
assume the recreated breakpoint numbers will match. Use $bpnum assume the recreated breakpoint numbers will match. Use $bpnum
instead. */ instead. */
if (tp->cond_string) if (tp->cond_string)
fp.printf (" condition $bpnum %s\n", tp->cond_string); fp.printf (" condition $bpnum %s\n", tp->cond_string);
if (tp->ignore_count) if (tp->ignore_count)
fp.printf (" ignore $bpnum %d\n", 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 (&fp);
try
{
print_command_lines (current_uiout, tp->commands.get (), 2);
}
catch (const gdb_exception &ex)
{
current_uiout->redirect (NULL); current_uiout->redirect (NULL);
throw; fp.puts (" end\n");
} }
current_uiout->redirect (NULL); if (tp->enable_state == bp_disabled)
fp.puts (" end\n"); fp.puts ("disable $bpnum\n");
}
if (tp->enable_state == bp_disabled) /* If this is a multi-location breakpoint, check if the locations
fp.puts ("disable $bpnum\n"); 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 this is a multi-location breakpoint, check if the locations for (bp_location *loc : tp->locations ())
should be individually disabled. Watchpoint locations are {
special, and not user visible. */ if (!loc->enabled)
if (!is_watchpoint (tp) && tp->loc && tp->loc->next) fp.printf ("disable $bpnum.%d\n", n);
{
int n = 1;
for (bp_location *loc : tp->locations ()) n++;
{ }
if (!loc->enabled) }
fp.printf ("disable $bpnum.%d\n", n); }
n++;
}
}
}
if (extra_trace_bits && *default_collect) if (extra_trace_bits && *default_collect)
fp.printf ("set default-collect %s\n", default_collect); fp.printf ("set default-collect %s\n", default_collect);

View file

@ -1150,10 +1150,10 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
case CTF_K_UNION: case CTF_K_UNION:
case CTF_K_ENUM: case CTF_K_ENUM:
if (type == nullptr) if (type == nullptr)
{ {
complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id); complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id);
type = objfile_type (ccp->of)->builtin_error; type = objfile_type (ccp->of)->builtin_error;
} }
sym = new (&ccp->of->objfile_obstack) symbol; sym = new (&ccp->of->objfile_obstack) symbol;
OBJSTAT (ccp->of, n_syms++); OBJSTAT (ccp->of, n_syms++);
SYMBOL_TYPE (sym) = type; SYMBOL_TYPE (sym) = type;

View file

@ -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), return (sum_ranks (rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL),
REFERENCE_SEE_THROUGH_BADNESS)); REFERENCE_SEE_THROUGH_BADNESS));
if (overload_debug) if (overload_debug)
/* Debugging only. */ {
fprintf_filtered (gdb_stderr, /* Debugging only. */
"------ Arg is %s [%d], parm is %s [%d]\n", fprintf_filtered (gdb_stderr,
arg->name (), arg->code (), "------ Arg is %s [%d], parm is %s [%d]\n",
parm->name (), parm->code ()); arg->name (), arg->code (),
parm->name (), parm->code ());
}
/* x -> y means arg of type x being supplied for parameter of type y. */ /* x -> y means arg of type x being supplied for parameter of type y. */

View file

@ -401,18 +401,18 @@ go32_nat_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
resume_is_step = step; resume_is_step = step;
if (siggnal != GDB_SIGNAL_0 && siggnal != GDB_SIGNAL_TRAP) if (siggnal != GDB_SIGNAL_0 && siggnal != GDB_SIGNAL_TRAP)
{ {
for (i = 0, resume_signal = -1; for (i = 0, resume_signal = -1;
excepn_map[i].gdb_sig != GDB_SIGNAL_LAST; i++) excepn_map[i].gdb_sig != GDB_SIGNAL_LAST; i++)
if (excepn_map[i].gdb_sig == siggnal) if (excepn_map[i].gdb_sig == siggnal)
{ {
resume_signal = excepn_map[i].djgpp_excepno; resume_signal = excepn_map[i].djgpp_excepno;
break; break;
} }
if (resume_signal == -1) if (resume_signal == -1)
printf_unfiltered ("Cannot deliver signal %s on this platform.\n", printf_unfiltered ("Cannot deliver signal %s on this platform.\n",
gdb_signal_to_name (siggnal)); gdb_signal_to_name (siggnal));
} }
} }
static char child_cwd[FILENAME_MAX]; static char child_cwd[FILENAME_MAX];
@ -872,14 +872,14 @@ device_mode (int fd, int raw_p)
newmode &= ~0x20; newmode &= ~0x20;
if (oldmode & 0x80) /* Only for character dev. */ if (oldmode & 0x80) /* Only for character dev. */
{ {
regs.x.ax = 0x4401; regs.x.ax = 0x4401;
regs.x.bx = fd; regs.x.bx = fd;
regs.x.dx = newmode & 0xff; /* Force upper byte zero, else it fails. */ regs.x.dx = newmode & 0xff; /* Force upper byte zero, else it fails. */
__dpmi_int (0x21, &regs); __dpmi_int (0x21, &regs);
if (regs.x.flags & 1) if (regs.x.flags & 1)
return -1; return -1;
} }
return (oldmode & 0x20) == 0x20; return (oldmode & 0x20) == 0x20;
} }
@ -909,24 +909,24 @@ go32_nat_target::terminal_info (const char *args, int from_tty)
#if __DJGPP_MINOR__ > 2 #if __DJGPP_MINOR__ > 2
if (child_cmd.redirection) if (child_cmd.redirection)
{
int i;
for (i = 0; i < DBG_HANDLES; i++)
{ {
if (child_cmd.redirection[i]->file_name) int i;
printf_unfiltered ("\tFile handle %d is redirected to `%s'.\n",
i, child_cmd.redirection[i]->file_name); for (i = 0; i < DBG_HANDLES; i++)
else if (_get_dev_info (child_cmd.redirection[i]->inf_handle) == -1) {
printf_unfiltered if (child_cmd.redirection[i]->file_name)
("\tFile handle %d appears to be closed by inferior.\n", i); printf_unfiltered ("\tFile handle %d is redirected to `%s'.\n",
/* Mask off the raw/cooked bit when comparing device info words. */ i, child_cmd.redirection[i]->file_name);
else if ((_get_dev_info (child_cmd.redirection[i]->inf_handle) & 0xdf) else if (_get_dev_info (child_cmd.redirection[i]->inf_handle) == -1)
!= (_get_dev_info (i) & 0xdf)) printf_unfiltered
printf_unfiltered ("\tFile handle %d appears to be closed by inferior.\n", i);
("\tFile handle %d appears to be redirected 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 #endif
} }
@ -936,19 +936,19 @@ go32_nat_target::terminal_inferior ()
/* Redirect standard handles as child wants them. */ /* Redirect standard handles as child wants them. */
errno = 0; errno = 0;
if (redir_to_child (&child_cmd) == -1) if (redir_to_child (&child_cmd) == -1)
{ {
redir_to_debugger (&child_cmd); redir_to_debugger (&child_cmd);
error (_("Cannot redirect standard handles for program: %s."), error (_("Cannot redirect standard handles for program: %s."),
safe_strerror (errno)); safe_strerror (errno));
} }
/* Set the console device of the inferior to whatever mode /* Set the console device of the inferior to whatever mode
(raw or cooked) we found it last time. */ (raw or cooked) we found it last time. */
if (terminal_is_ours) if (terminal_is_ours)
{ {
if (inf_mode_valid) if (inf_mode_valid)
device_mode (0, inf_terminal_mode); device_mode (0, inf_terminal_mode);
terminal_is_ours = 0; terminal_is_ours = 0;
} }
} }
void void
@ -957,25 +957,25 @@ go32_nat_target::terminal_ours ()
/* Switch to cooked mode on the gdb terminal and save the inferior /* Switch to cooked mode on the gdb terminal and save the inferior
terminal mode to be restored when it is resumed. */ terminal mode to be restored when it is resumed. */
if (!terminal_is_ours) 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); inf_terminal_mode = device_mode (0, 0);
error (_("Cannot redirect standard handles for debugger: %s."), if (inf_terminal_mode != -1)
safe_strerror (errno)); 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 void

View file

@ -824,10 +824,10 @@ ppscm_print_children (SCM printer, enum display_hint hint,
2. Arrays. Always print a ",". 2. Arrays. Always print a ",".
3. Other. Always print a ",". */ 3. Other. Always print a ",". */
if (i == 0) if (i == 0)
{ {
if (!printed_nothing) if (!printed_nothing)
fputs_filtered (" = ", stream); fputs_filtered (" = ", stream);
} }
else if (! is_map || i % 2 == 0) else if (! is_map || i % 2 == 0)
fputs_filtered (pretty ? "," : ", ", stream); fputs_filtered (pretty ? "," : ", ", stream);

View file

@ -174,9 +174,7 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
sp = pc - pcoffs[attempt]; sp = pc - pcoffs[attempt];
} }
else else
{
return 0; return 0;
}
} }
/* sp + sfoffs[try] points to a struct rt_sigframe, which contains /* sp + sfoffs[try] points to a struct rt_sigframe, which contains

View file

@ -4967,10 +4967,8 @@ static int i386_record_floats (struct gdbarch *gdbarch,
else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum) else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum)
{ {
for (i = I387_ST0_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++) for (i = I387_ST0_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
{
if (record_full_arch_list_add_reg (ir->regcache, i)) if (record_full_arch_list_add_reg (ir->regcache, i))
return -1; return -1;
}
} }
else if ((iregnum >= I387_ST0_REGNUM (tdep)) && else if ((iregnum >= I387_ST0_REGNUM (tdep)) &&
(iregnum <= I387_FOP_REGNUM (tdep))) (iregnum <= I387_FOP_REGNUM (tdep)))

View file

@ -55,11 +55,11 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
ui_out_emit_list list_emitter (uiout, "lines"); ui_out_emit_list list_emitter (uiout, "lines");
if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0) if (SYMTAB_LINETABLE (s) != NULL && SYMTAB_LINETABLE (s)->nitems > 0)
for (i = 0; i < SYMTAB_LINETABLE (s)->nitems; i++) for (i = 0; i < SYMTAB_LINETABLE (s)->nitems; i++)
{ {
ui_out_emit_tuple tuple_emitter (uiout, NULL); ui_out_emit_tuple tuple_emitter (uiout, NULL);
uiout->field_core_addr ("pc", gdbarch, SYMTAB_LINETABLE (s)->item[i].pc); uiout->field_core_addr ("pc", gdbarch, SYMTAB_LINETABLE (s)->item[i].pc);
uiout->field_signed ("line", SYMTAB_LINETABLE (s)->item[i].line); uiout->field_signed ("line", SYMTAB_LINETABLE (s)->item[i].line);
} }
} }
/* Used by the -symbol-info-* and -symbol-info-module-* commands to print /* Used by the -symbol-info-* and -symbol-info-module-* commands to print

View file

@ -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 inferior function call, and the VG register comes after the Z
registers. */ registers. */
if (reg_buf->get_register_status (AARCH64_SVE_VG_REGNUM) != REG_VALID) 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 /* If vg is not available yet, fetch it from ptrace. The VG value from
ptrace is likely the correct one. */ ptrace is likely the correct one. */
uint64_t vq = aarch64_sve_get_vq (tid); uint64_t vq = aarch64_sve_get_vq (tid);
/* If something went wrong, just bail out. */ /* If something went wrong, just bail out. */
if (vq == 0) if (vq == 0)
return false; return false;
reg_vg = sve_vg_from_vq (vq); reg_vg = sve_vg_from_vq (vq);
} }
else else
reg_buf->raw_collect (AARCH64_SVE_VG_REGNUM, &reg_vg); reg_buf->raw_collect (AARCH64_SVE_VG_REGNUM, &reg_vg);

View file

@ -249,15 +249,15 @@ nios2_setup_default (struct nios2_unwind_cache *cache)
int i; int i;
for (i = 0; i < NIOS2_NUM_REGS; i++) for (i = 0; i < NIOS2_NUM_REGS; i++)
{ {
/* All registers start off holding their previous values. */ /* All registers start off holding their previous values. */
cache->reg_value[i].reg = i; cache->reg_value[i].reg = i;
cache->reg_value[i].offset = 0; cache->reg_value[i].offset = 0;
/* All registers start off not saved. */ /* All registers start off not saved. */
cache->reg_saved[i].basereg = -1; cache->reg_saved[i].basereg = -1;
cache->reg_saved[i].addr = 0; cache->reg_saved[i].addr = 0;
} }
} }
/* Initialize the unwind cache. */ /* Initialize the unwind cache. */
@ -1244,16 +1244,16 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
enum branch_condition cond; enum branch_condition cond;
if (pc == current_pc) if (pc == current_pc)
{ {
/* When we reach the current PC we must save the current /* When we reach the current PC we must save the current
register state (for the backtrace) but keep analysing register state (for the backtrace) but keep analysing
because there might be more to find out (eg. is this an because there might be more to find out (eg. is this an
exception handler). */ exception handler). */
memcpy (temp_value, value, sizeof (temp_value)); memcpy (temp_value, value, sizeof (temp_value));
value = temp_value; value = temp_value;
if (nios2_debug) if (nios2_debug)
fprintf_unfiltered (gdb_stdlog, "*"); fprintf_unfiltered (gdb_stdlog, "*");
} }
op = nios2_fetch_insn (gdbarch, pc, &insn); op = nios2_fetch_insn (gdbarch, pc, &insn);

View file

@ -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 /* 32-bit decimal floats are right aligned in the
doubleword. */ doubleword. */
if (TYPE_LENGTH (type) == 4) if (TYPE_LENGTH (type) == 4)
{ {
memcpy (regval + 4, val, 4); memcpy (regval + 4, val, 4);
p = regval; p = regval;
} }
else else
p = val; p = val;

View file

@ -780,16 +780,16 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
get_user_print_options (&opts); get_user_print_options (&opts);
if (print_frame_info) if (print_frame_info)
{ {
gdb::optional<enum 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); get_user_print_what_frame_info (&user_frame_info_print_what);
if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ()) if (!out->is_mi_like_p () && user_frame_info_print_what.has_value ())
{ {
/* Use the specific frame information desired by the user. */ /* Use the specific frame information desired by the user. */
print_what = *user_frame_info_print_what; print_what = *user_frame_info_print_what;
} }
} }
/* Get the underlying frame. This is needed to determine GDB /* Get the underlying frame. This is needed to determine GDB
architecture, and also, in the cases of frame variables/arguments to architecture, and also, in the cases of frame variables/arguments to

View file

@ -437,10 +437,10 @@ print_children (PyObject *printer, const char *hint,
2. Arrays. Always print a ",". 2. Arrays. Always print a ",".
3. Other. Always print a ",". */ 3. Other. Always print a ",". */
if (i == 0) if (i == 0)
{ {
if (!is_py_none) if (!is_py_none)
fputs_filtered (" = ", stream); fputs_filtered (" = ", stream);
} }
else if (! is_map || i % 2 == 0) else if (! is_map || i % 2 == 0)
fputs_filtered (pretty ? "," : ", ", stream); fputs_filtered (pretty ? "," : ", ", stream);

View file

@ -1065,9 +1065,12 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch,
else if ((insn & BP_MASK) == BP_INSN) else if ((insn & BP_MASK) == BP_INSN)
regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), from); regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), from);
else else
/* Handle any other instructions that do not fit in the categories above. */ {
regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), /* Handle any other instructions that do not fit in the categories
from + offset); above. */
regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch),
from + offset);
}
} }
/* Implementation of gdbarch_displaced_step_prepare. */ /* Implementation of gdbarch_displaced_step_prepare. */

View file

@ -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 cause GDB to crash with an internal error when the user tries to set
an unsupported OSABI. */ an unsupported OSABI. */
if (!tdesc_has_registers (tdesc)) if (!tdesc_has_registers (tdesc))
{ {
if (info.bfd_arch_info->mach == bfd_mach_s390_31) if (info.bfd_arch_info->mach == bfd_mach_s390_31)
tdesc = tdesc_s390_linux32; tdesc = tdesc_s390_linux32;
else else
tdesc = tdesc_s390x_linux64; tdesc = tdesc_s390x_linux64;
} }
tdep->tdesc = tdesc; tdep->tdesc = tdesc;
/* Check any target description for validity. */ /* Check any target description for validity. */

View file

@ -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); std::string flags = gdbarch_get_pc_address_flags (gdbarch, frame, pc);
if (!flags.empty ()) if (!flags.empty ())
{ {
uiout->text (" ["); uiout->text (" [");
uiout->field_string ("addr_flags", flags); uiout->field_string ("addr_flags", flags);
uiout->text ("]"); uiout->text ("]");
} }
} }
/* See stack.h. */ /* See stack.h. */
@ -1927,7 +1927,7 @@ public:
struct frame_info *fid; struct frame_info *fid;
if (args == NULL) if (args == NULL)
error (_("Missing address argument to view a frame")); error (_("Missing address argument to view a frame"));
gdb_argv argv (args); gdb_argv argv (args);

View file

@ -5637,55 +5637,55 @@ default_collect_symbol_completion_matches_break_on
if (mode == complete_symbol_mode::LINESPEC) if (mode == complete_symbol_mode::LINESPEC)
sym_text = text; sym_text = text;
else else
{ {
const char *p; const char *p;
char quote_found; char quote_found;
const char *quote_pos = NULL; const char *quote_pos = NULL;
/* First see if this is a quoted string. */ /* First see if this is a quoted string. */
quote_found = '\0'; quote_found = '\0';
for (p = text; *p != '\0'; ++p) for (p = text; *p != '\0'; ++p)
{ {
if (quote_found != '\0') if (quote_found != '\0')
{ {
if (*p == quote_found) if (*p == quote_found)
/* Found close quote. */ /* Found close quote. */
quote_found = '\0'; quote_found = '\0';
else if (*p == '\\' && p[1] == quote_found) else if (*p == '\\' && p[1] == quote_found)
/* A backslash followed by the quote character /* A backslash followed by the quote character
doesn't end the string. */ doesn't end the string. */
++p; ++p;
} }
else if (*p == '\'' || *p == '"') else if (*p == '\'' || *p == '"')
{ {
quote_found = *p; quote_found = *p;
quote_pos = p; quote_pos = p;
} }
} }
if (quote_found == '\'') if (quote_found == '\'')
/* A string within single quotes can be a symbol, so complete on it. */ /* A string within single quotes can be a symbol, so complete on it. */
sym_text = quote_pos + 1; sym_text = quote_pos + 1;
else if (quote_found == '"') else if (quote_found == '"')
/* A double-quoted string is never a symbol, nor does it make sense /* A double-quoted string is never a symbol, nor does it make sense
to complete it any other way. */ to complete it any other way. */
{ {
return; return;
} }
else else
{ {
/* It is not a quoted string. Break it based on the characters /* It is not a quoted string. Break it based on the characters
which are in symbols. */ which are in symbols. */
while (p > text) while (p > text)
{ {
if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0' if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0'
|| p[-1] == ':' || strchr (break_on, p[-1]) != NULL) || p[-1] == ':' || strchr (break_on, p[-1]) != NULL)
--p; --p;
else else
break; break;
} }
sym_text = p; sym_text = p;
} }
} }
lookup_name_info lookup_name (sym_text, name_match_type, true); 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) if (mode == complete_symbol_mode::LINESPEC)
sym_text = text; sym_text = text;
else else
{ {
const char *p; const char *p;
char quote_found; char quote_found;
const char *quote_pos = NULL; const char *quote_pos = NULL;
/* First see if this is a quoted string. */ /* First see if this is a quoted string. */
quote_found = '\0'; quote_found = '\0';
for (p = text; *p != '\0'; ++p) for (p = text; *p != '\0'; ++p)
{ {
if (quote_found != '\0') if (quote_found != '\0')
{ {
if (*p == quote_found) if (*p == quote_found)
/* Found close quote. */ /* Found close quote. */
quote_found = '\0'; quote_found = '\0';
else if (*p == '\\' && p[1] == quote_found) else if (*p == '\\' && p[1] == quote_found)
/* A backslash followed by the quote character /* A backslash followed by the quote character
doesn't end the string. */ doesn't end the string. */
++p; ++p;
} }
else if (*p == '\'' || *p == '"') else if (*p == '\'' || *p == '"')
{ {
quote_found = *p; quote_found = *p;
quote_pos = p; quote_pos = p;
} }
} }
if (quote_found == '\'') if (quote_found == '\'')
/* A string within single quotes can be a symbol, so complete on it. */ /* A string within single quotes can be a symbol, so complete on it. */
sym_text = quote_pos + 1; sym_text = quote_pos + 1;
else if (quote_found == '"') else if (quote_found == '"')
/* A double-quoted string is never a symbol, nor does it make sense /* A double-quoted string is never a symbol, nor does it make sense
to complete it any other way. */ to complete it any other way. */
{ {
return; return;
} }
else else
{ {
/* Not a quoted string. */ /* Not a quoted string. */
sym_text = language_search_unquoted_string (text, p); sym_text = language_search_unquoted_string (text, p);
} }
} }
lookup_name_info lookup_name (sym_text, name_match_type, true); lookup_name_info lookup_name (sym_text, name_match_type, true);

View file

@ -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. */ /* Convert between two different formats in the same category. */
if (!target_float_same_format_p (from_type, to_type)) if (!target_float_same_format_p (from_type, to_type))
{ {
const target_float_ops *ops = get_target_float_ops (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); ops->convert (from, from_type, to, to_type);
return; return;
} }
/* The floating-point formats match, so we simply copy the data, ensuring /* The floating-point formats match, so we simply copy the data, ensuring
possible padding bytes in the target buffer are zeroed out. */ possible padding bytes in the target buffer are zeroed out. */

View file

@ -2267,7 +2267,7 @@ tfind_command_1 (const char *args, int from_tty)
{ /* TFIND with no args means find NEXT trace frame. */ { /* TFIND with no args means find NEXT trace frame. */
if (traceframe_number == -1) if (traceframe_number == -1)
frameno = 0; /* "next" is first one. */ frameno = 0; /* "next" is first one. */
else else
frameno = traceframe_number + 1; frameno = traceframe_number + 1;
} }
else if (0 == strcmp (args, "-")) else if (0 == strcmp (args, "-"))
@ -2408,11 +2408,13 @@ tfind_line_command (const char *args, int from_tty)
} }
} }
else 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 /* Is there any case in which we get here, and have an address
symbols and no line numbers? */ which the user would want to see? If we have debugging
error (_("Line number %d is out of range for \"%s\"."), symbols and no line numbers? */
sal.line, symtab_to_filename_for_display (sal.symtab)); 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. */ /* Find within range of stated line. */
if (args && *args) if (args && *args)

View file

@ -1025,12 +1025,14 @@ v850_push_dummy_call (struct gdbarch *gdbarch,
if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850) if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850)
stack_offset = 0; stack_offset = 0;
else 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. /* The offset onto the stack at which we will start copying parameters
That's how the ABI is defined, though there's no indication that these (after the registers are used up) begins at 16 rather than at zero.
16 bytes are used for anything, not even for saving incoming That's how the ABI is defined, though there's no indication that these
argument registers. */ 16 bytes are used for anything, not even for saving incoming
stack_offset = 16; argument registers. */
stack_offset = 16;
}
/* Now make space on the stack for the args. */ /* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++) for (argnum = 0; argnum < nargs; argnum++)

View file

@ -761,10 +761,10 @@ create_enum (struct gdbarch *gdbarch, int bit, const char *name,
type->set_is_unsigned (true); type->set_is_unsigned (true);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
TYPE_FIELD_NAME (type, i) = values[i].name; TYPE_FIELD_NAME (type, i) = values[i].name;
SET_FIELD_ENUMVAL (type->field (i), values[i].value); SET_FIELD_ENUMVAL (type->field (i), values[i].value);
} }
return type; return type;
} }

View file

@ -482,7 +482,8 @@ arrange_linetable (struct linetable *oldLineTb)
newline = 0; newline = 0;
if (oldLineTb->item[0].line != 0) if (oldLineTb->item[0].line != 0)
for (newline = 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]; newLineTb->item[newline] = oldLineTb->item[newline];
/* Now copy function lines one by one. */ /* 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 to 32(0x20). So we need to read the first function auxiliary entry
which contains the size. */ which contains the size. */
if (cs->c_naux > 1 && ISFCN (cs->c_type)) 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 /* save the function header info, which will be used
when `.bf' is seen. */ when `.bf' is seen. */
fcn_cs_saved = *cs; fcn_cs_saved = *cs;
/* Convert the auxent to something we can access. */ /* Convert the auxent to something we can access. */
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
0, cs->c_naux, &fcn_aux_saved); 0, cs->c_naux, &fcn_aux_saved);
continue; continue;
} }
/* Read the csect auxiliary header, which is always the last by /* Read the csect auxiliary header, which is always the last by
convention. */ convention. */
bfd_coff_swap_aux_in (abfd, bfd_coff_swap_aux_in (abfd,

View file

@ -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> 2021-05-17 Andrew Burgess <andrew.burgess@embecosm.com>
* .dir-locals.el: Set sentence-end-double-space for all modes, and * .dir-locals.el: Set sentence-end-double-space for all modes, and

View file

@ -1908,15 +1908,13 @@ s390_emit_const (LONGEST num)
0x98, 0x23, 0x10, 0x00, /* lm %r2, %r3, 0(%r1) */ 0x98, 0x23, 0x10, 0x00, /* lm %r2, %r3, 0(%r1) */
}; };
if (num < 0x8000 && num >= 0) if (num < 0x8000 && num >= 0)
{
add_insns (buf_s, sizeof buf_s); add_insns (buf_s, sizeof buf_s);
}
else else
{ {
s390_emit_litpool (8); s390_emit_litpool (8);
add_insns ((unsigned char *) &n, sizeof n); add_insns ((unsigned char *) &n, sizeof n);
add_insns (buf_l, sizeof buf_l); add_insns (buf_l, sizeof buf_l);
} }
} }
/* The "emit_call" emit_ops method for s390. */ /* 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) */ 0x58, 0x20, 0x10, 0x00, /* l %r2, 0(%r1) */
}; };
if (arg1 < 0x8000 && arg1 >= -0x8000) if (arg1 < 0x8000 && arg1 >= -0x8000)
{
add_insns (buf_s, sizeof buf_s); add_insns (buf_s, sizeof buf_s);
}
else else
{ {
s390_emit_litpool (4); s390_emit_litpool (4);
add_insns ((unsigned char *) &arg1, sizeof arg1); add_insns ((unsigned char *) &arg1, sizeof arg1);
add_insns (buf_l, sizeof buf_l); add_insns (buf_l, sizeof buf_l);
} }
} }
/* The "emit_int_call_1" emit_ops method for s390. */ /* 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) */ 0xe3, 0x20, 0x10, 0x00, 0x00, 0x04, /* lg %r2, 0(%r1) */
}; };
if (num < 0x8000 && num >= -0x8000) if (num < 0x8000 && num >= -0x8000)
{
add_insns (buf_s, sizeof buf_s); add_insns (buf_s, sizeof buf_s);
}
else else
{ {
s390_emit_litpool (8); s390_emit_litpool (8);
add_insns ((unsigned char *) &n, sizeof n); add_insns ((unsigned char *) &n, sizeof n);
add_insns (buf_l, sizeof buf_l); add_insns (buf_l, sizeof buf_l);
} }
} }
/* The "emit_call" emit_ops method for s390x. */ /* The "emit_call" emit_ops method for s390x. */