This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Some whitespace tweaks
- From: Michael Snyder <msnyder at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 22 Apr 2002 16:11:16 -0700
- Subject: [PATCH] Some whitespace tweaks
Break up some long lines, reformat some comments, move comments
from the ends of long lines (coding standard).
Checked in as obvious.
2002-04-22 Michael Snyder <msnyder@redhat.com>
* arm-tdep.c: Some whitespace and coding standards tweaks.
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.50
diff -c -3 -p -r1.50 arm-tdep.c
*** arm-tdep.c 21 Apr 2002 19:58:35 -0000 1.50
--- arm-tdep.c 22 Apr 2002 23:20:16 -0000
*************** static const char **valid_flavors;
*** 134,140 ****
/* Disassembly flavor to use. Default to "std" register names. */
static const char *disassembly_flavor;
! static int current_option; /* Index to that option in the opcodes table. */
/* This is used to keep the bfd arch_info in sync with the disassembly
flavor. */
--- 134,141 ----
/* Disassembly flavor to use. Default to "std" register names. */
static const char *disassembly_flavor;
! /* Index to that option in the opcodes table. */
! static int current_option;
/* This is used to keep the bfd arch_info in sync with the disassembly
flavor. */
*************** static CORE_ADDR
*** 348,360 ****
thumb_skip_prologue (CORE_ADDR pc, CORE_ADDR func_end)
{
CORE_ADDR current_pc;
! int findmask = 0; /* findmask:
! bit 0 - push { rlist }
! bit 1 - mov r7, sp OR add r7, sp, #imm (setting of r7)
! bit 2 - sub sp, #simm OR add sp, #simm (adjusting of sp)
! */
! for (current_pc = pc; current_pc + 2 < func_end && current_pc < pc + 40; current_pc += 2)
{
unsigned short insn = read_memory_unsigned_integer (current_pc, 2);
--- 349,364 ----
thumb_skip_prologue (CORE_ADDR pc, CORE_ADDR func_end)
{
CORE_ADDR current_pc;
! /* findmask:
! bit 0 - push { rlist }
! bit 1 - mov r7, sp OR add r7, sp, #imm (setting of r7)
! bit 2 - sub sp, #simm OR add sp, #simm (adjusting of sp)
! */
! int findmask = 0;
! for (current_pc = pc;
! current_pc + 2 < func_end && current_pc < pc + 40;
! current_pc += 2)
{
unsigned short insn = read_memory_unsigned_integer (current_pc, 2);
*************** thumb_skip_prologue (CORE_ADDR pc, CORE_
*** 362,368 ****
{
findmask |= 1; /* push found */
}
! else if ((insn & 0xff00) == 0xb000) /* add sp, #simm OR sub sp, #simm */
{
if ((findmask & 1) == 0) /* before push ? */
continue;
--- 366,373 ----
{
findmask |= 1; /* push found */
}
! else if ((insn & 0xff00) == 0xb000) /* add sp, #simm OR
! sub sp, #simm */
{
if ((findmask & 1) == 0) /* before push ? */
continue;
*************** thumb_skip_prologue (CORE_ADDR pc, CORE_
*** 379,396 ****
}
else if (findmask == (4+2+1))
{
! break; /* We have found one of each type of prologue instruction */
}
else
! continue; /* something in the prolog that we don't care about or some
! instruction from outside the prolog scheduled here for optimization */
}
return current_pc;
}
! /* Advance the PC across any function entry prologue instructions to reach
! some "real" code.
The APCS (ARM Procedure Call Standard) defines the following
prologue:
--- 384,404 ----
}
else if (findmask == (4+2+1))
{
! /* We have found one of each type of prologue instruction */
! break;
}
else
! /* something in the prolog that we don't care about or some
! instruction from outside the prolog scheduled here for
! optimization */
! continue;
}
return current_pc;
}
! /* Advance the PC across any function entry prologue instructions to
! reach some "real" code.
The APCS (ARM Procedure Call Standard) defines the following
prologue:
*************** arm_skip_prologue (CORE_ADDR pc)
*** 500,507 ****
The frame size would thus be 36 bytes, and the frame offset would be
12 bytes. The frame register is R7.
! The comments for thumb_skip_prolog() describe the algorithm we use to detect
! the end of the prolog */
/* *INDENT-ON* */
static void
--- 508,515 ----
The frame size would thus be 36 bytes, and the frame offset would be
12 bytes. The frame register is R7.
! The comments for thumb_skip_prolog() describe the algorithm we use
! to detect the end of the prolog. */
/* *INDENT-ON* */
static void
*************** thumb_scan_prologue (struct frame_info *
*** 510,521 ****
CORE_ADDR prologue_start;
CORE_ADDR prologue_end;
CORE_ADDR current_pc;
! int saved_reg[16]; /* which register has been copied to register n? */
! int findmask = 0; /* findmask:
! bit 0 - push { rlist }
! bit 1 - mov r7, sp OR add r7, sp, #imm (setting of r7)
! bit 2 - sub sp, #simm OR add sp, #simm (adjusting of sp)
! */
int i;
if (find_pc_partial_function (fi->pc, NULL, &prologue_start, &prologue_end))
--- 518,531 ----
CORE_ADDR prologue_start;
CORE_ADDR prologue_end;
CORE_ADDR current_pc;
! /* Which register has been copied to register n? */
! int saved_reg[16];
! /* findmask:
! bit 0 - push { rlist }
! bit 1 - mov r7, sp OR add r7, sp, #imm (setting of r7)
! bit 2 - sub sp, #simm OR add sp, #simm (adjusting of sp)
! */
! int findmask = 0;
int i;
if (find_pc_partial_function (fi->pc, NULL, &prologue_start, &prologue_end))
*************** thumb_scan_prologue (struct frame_info *
*** 528,535 ****
prologue_end = sal.end; /* (probably means no prologue) */
}
else
! prologue_end = prologue_start + 40; /* We're in the boondocks: allow for */
! /* 16 pushes, an add, and "mv fp,sp" */
prologue_end = min (prologue_end, fi->pc);
--- 538,546 ----
prologue_end = sal.end; /* (probably means no prologue) */
}
else
! /* We're in the boondocks: allow for
! 16 pushes, an add, and "mv fp,sp". */
! prologue_end = prologue_start + 40;
prologue_end = min (prologue_end, fi->pc);
*************** thumb_scan_prologue (struct frame_info *
*** 568,577 ****
fi->extra_info->framesize += 4;
fi->saved_regs[saved_reg[regno]] =
-(fi->extra_info->framesize);
! saved_reg[regno] = regno; /* reset saved register map */
}
}
! else if ((insn & 0xff00) == 0xb000) /* add sp, #simm OR sub sp, #simm */
{
if ((findmask & 1) == 0) /* before push ? */
continue;
--- 579,590 ----
fi->extra_info->framesize += 4;
fi->saved_regs[saved_reg[regno]] =
-(fi->extra_info->framesize);
! /* Reset saved register map. */
! saved_reg[regno] = regno;
}
}
! else if ((insn & 0xff00) == 0xb000) /* add sp, #simm OR
! sub sp, #simm */
{
if ((findmask & 1) == 0) /* before push ? */
continue;
*************** thumb_scan_prologue (struct frame_info *
*** 602,614 ****
}
else if ((insn & 0xffc0) == 0x4640) /* mov r0-r7, r8-r15 */
{
! int lo_reg = insn & 7; /* dest. register (r0-r7) */
int hi_reg = ((insn >> 3) & 7) + 8; /* source register (r8-15) */
saved_reg[lo_reg] = hi_reg; /* remember hi reg was saved */
}
else
! continue; /* something in the prolog that we don't care about or some
! instruction from outside the prolog scheduled here for optimization */
}
}
--- 615,629 ----
}
else if ((insn & 0xffc0) == 0x4640) /* mov r0-r7, r8-r15 */
{
! int lo_reg = insn & 7; /* dest. register (r0-r7) */
int hi_reg = ((insn >> 3) & 7) + 8; /* source register (r8-15) */
saved_reg[lo_reg] = hi_reg; /* remember hi reg was saved */
}
else
! /* Something in the prolog that we don't care about or some
! instruction from outside the prolog scheduled here for
! optimization. */
! continue;
}
}
*************** arm_find_callers_reg (struct frame_info
*** 936,942 ****
{
for (; fi; fi = fi->next)
! #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
return generic_read_register_dummy (fi->pc, fi->frame, regnum);
else
--- 951,957 ----
{
for (; fi; fi = fi->next)
! #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
return generic_read_register_dummy (fi->pc, fi->frame, regnum);
else
*************** arm_find_callers_reg (struct frame_info
*** 955,961 ****
static CORE_ADDR
arm_frame_chain (struct frame_info *fi)
{
! #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
CORE_ADDR fn_start, callers_pc, fp;
/* is this a dummy frame? */
--- 970,976 ----
static CORE_ADDR
arm_frame_chain (struct frame_info *fi)
{
! #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
CORE_ADDR fn_start, callers_pc, fp;
/* is this a dummy frame? */
*************** arm_init_extra_frame_info (int fromleaf,
*** 1053,1063 ****
memset (fi->saved_regs, '\000', sizeof fi->saved_regs);
! #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
{
! /* We need to setup fi->frame here because run_stack_dummy gets it wrong
! by assuming it's always FP. */
fi->frame = generic_read_register_dummy (fi->pc, fi->frame,
ARM_SP_REGNUM);
fi->extra_info->framesize = 0;
--- 1068,1078 ----
memset (fi->saved_regs, '\000', sizeof fi->saved_regs);
! #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
{
! /* We need to setup fi->frame here because run_stack_dummy gets
! it wrong by assuming it's always FP. */
fi->frame = generic_read_register_dummy (fi->pc, fi->frame,
ARM_SP_REGNUM);
fi->extra_info->framesize = 0;
*************** arm_init_extra_frame_info (int fromleaf,
*** 1067,1074 ****
else
#endif
! /* Compute stack pointer for this frame. We use this value for both the
! sigtramp and call dummy cases. */
if (!fi->next)
sp = read_sp();
else
--- 1082,1089 ----
else
#endif
! /* Compute stack pointer for this frame. We use this value for both
! the sigtramp and call dummy cases. */
if (!fi->next)
sp = read_sp();
else
*************** arm_init_extra_frame_info (int fromleaf,
*** 1168,1174 ****
static CORE_ADDR
arm_frame_saved_pc (struct frame_info *fi)
{
! #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
return generic_read_register_dummy (fi->pc, fi->frame, ARM_PC_REGNUM);
else
--- 1183,1189 ----
static CORE_ADDR
arm_frame_saved_pc (struct frame_info *fi)
{
! #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
return generic_read_register_dummy (fi->pc, fi->frame, ARM_PC_REGNUM);
else
*************** arm_push_arguments (int nargs, struct va
*** 1456,1465 ****
return sp;
}
! /* Pop the current frame. So long as the frame info has been initialized
! properly (see arm_init_extra_frame_info), this code works for dummy frames
! as well as regular frames. I.e, there's no need to have a special case
! for dummy frames. */
static void
arm_pop_frame (void)
{
--- 1471,1480 ----
return sp;
}
! /* Pop the current frame. So long as the frame info has been
! initialized properly (see arm_init_extra_frame_info), this code
! works for dummy frames as well as regular frames. I.e, there's no
! need to have a special case for dummy frames. */
static void
arm_pop_frame (void)
{
*************** gdb_print_insn_arm (bfd_vma memaddr, dis
*** 2022,2031 ****
if (csym.native == NULL)
{
! /* Create a fake symbol vector containing a Thumb symbol. This is
! solely so that the code in print_insn_little_arm() and
! print_insn_big_arm() in opcodes/arm-dis.c will detect the presence
! of a Thumb symbol and switch to decoding Thumb instructions. */
fake_target.flavour = bfd_target_coff_flavour;
fake_bfd.xvec = &fake_target;
--- 2037,2047 ----
if (csym.native == NULL)
{
! /* Create a fake symbol vector containing a Thumb symbol.
! This is solely so that the code in print_insn_little_arm()
! and print_insn_big_arm() in opcodes/arm-dis.c will detect
! the presence of a Thumb symbol and switch to decoding
! Thumb instructions. */
fake_target.flavour = bfd_target_coff_flavour;
fake_bfd.xvec = &fake_target;
*************** arm_skip_stub (CORE_ADDR pc)
*** 2381,2390 ****
return 0; /* not a stub */
}
! /* If the user changes the register disassembly flavor used for info register
! and other commands, we have to also switch the flavor used in opcodes
! for disassembly output.
! This function is run in the set disassembly_flavor command, and does that. */
static void
set_disassembly_flavor_sfunc (char *args, int from_tty,
--- 2397,2406 ----
return 0; /* not a stub */
}
! /* If the user changes the register disassembly flavor used for info
! register and other commands, we have to also switch the flavor used
! in opcodes for disassembly output. This function is run in the set
! disassembly_flavor command, and does that. */
static void
set_disassembly_flavor_sfunc (char *args, int from_tty,
*************** arm_gdbarch_register_os_abi (enum arm_ab
*** 2732,2743 ****
(*handler_p)->init_abi = init_abi;
}
! /* Initialize the current architecture based on INFO. If possible, re-use an
! architecture from ARCHES, which is a list of architectures already created
! during this debugging session.
! Called e.g. at program startup, when reading a core file, and when reading
! a binary file. */
static struct gdbarch *
arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
--- 2748,2759 ----
(*handler_p)->init_abi = init_abi;
}
! /* Initialize the current architecture based on INFO. If possible,
! re-use an architecture from ARCHES, which is a list of
! architectures already created during this debugging session.
! Called e.g. at program startup, when reading a core file, and when
! reading a binary file. */
static struct gdbarch *
arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)