* mips-linux-tdep.c: Adjust formatting throughout.

This commit is contained in:
Maciej W. Rozycki 2013-05-30 17:23:05 +00:00
parent 0f900f54b5
commit 7d26658403
2 changed files with 60 additions and 59 deletions

View file

@ -1,3 +1,7 @@
2013-05-30 Maciej W. Rozycki <macro@codesourcery.com>
* mips-linux-tdep.c: Adjust formatting throughout.
2013-05-30 Tom Tromey <tromey@redhat.com> 2013-05-30 Tom Tromey <tromey@redhat.com>
* mipsread.c (read_alphacoff_dynamic_symtab): Call do_cleanups * mipsread.c (read_alphacoff_dynamic_symtab): Call do_cleanups

View file

@ -63,8 +63,8 @@ mips_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM); jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
if (target_read_memory (jb_addr if (target_read_memory ((jb_addr
+ MIPS_LINUX_JB_PC * MIPS_LINUX_JB_ELEMENT_SIZE, + MIPS_LINUX_JB_PC * MIPS_LINUX_JB_ELEMENT_SIZE),
buf, gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT)) buf, gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
return 0; return 0;
@ -86,7 +86,7 @@ supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[MAX_REGISTER_SIZE]; gdb_byte buf[MAX_REGISTER_SIZE];
store_signed_integer (buf, register_size (gdbarch, regnum), byte_order, store_signed_integer (buf, register_size (gdbarch, regnum), byte_order,
extract_signed_integer (addr, 4, byte_order)); extract_signed_integer (addr, 4, byte_order));
regcache_raw_supply (regcache, regnum, buf); regcache_raw_supply (regcache, regnum, buf);
} }
@ -126,8 +126,8 @@ mips_supply_gregset (struct regcache *regcache,
static void static void
mips_supply_gregset_wrapper (const struct regset *regset, mips_supply_gregset_wrapper (const struct regset *regset,
struct regcache *regcache, struct regcache *regcache,
int regnum, const void *gregs, size_t len) int regnum, const void *gregs, size_t len)
{ {
gdb_assert (len == sizeof (mips_elf_gregset_t)); gdb_assert (len == sizeof (mips_elf_gregset_t));
@ -231,8 +231,8 @@ mips_supply_fpregset (struct regcache *regcache,
static void static void
mips_supply_fpregset_wrapper (const struct regset *regset, mips_supply_fpregset_wrapper (const struct regset *regset,
struct regcache *regcache, struct regcache *regcache,
int regnum, const void *gregs, size_t len) int regnum, const void *gregs, size_t len)
{ {
gdb_assert (len == sizeof (mips_elf_fpregset_t)); gdb_assert (len == sizeof (mips_elf_fpregset_t));
@ -350,11 +350,11 @@ mips64_supply_gregset (struct regcache *regcache,
for (regi = MIPS64_EF_REG0 + 1; regi <= MIPS64_EF_REG31; regi++) for (regi = MIPS64_EF_REG0 + 1; regi <= MIPS64_EF_REG31; regi++)
supply_64bit_reg (regcache, regi - MIPS64_EF_REG0, supply_64bit_reg (regcache, regi - MIPS64_EF_REG0,
(const gdb_byte *)(regp + regi)); (const gdb_byte *) (regp + regi));
if (mips_linux_restart_reg_p (gdbarch)) if (mips_linux_restart_reg_p (gdbarch))
supply_64bit_reg (regcache, MIPS_RESTART_REGNUM, supply_64bit_reg (regcache, MIPS_RESTART_REGNUM,
(const gdb_byte *)(regp + MIPS64_EF_REG0)); (const gdb_byte *) (regp + MIPS64_EF_REG0));
supply_64bit_reg (regcache, mips_regnum (gdbarch)->lo, supply_64bit_reg (regcache, mips_regnum (gdbarch)->lo,
(const gdb_byte *) (regp + MIPS64_EF_LO)); (const gdb_byte *) (regp + MIPS64_EF_LO));
@ -376,8 +376,8 @@ mips64_supply_gregset (struct regcache *regcache,
static void static void
mips64_supply_gregset_wrapper (const struct regset *regset, mips64_supply_gregset_wrapper (const struct regset *regset,
struct regcache *regcache, struct regcache *regcache,
int regnum, const void *gregs, size_t len) int regnum, const void *gregs, size_t len)
{ {
gdb_assert (len == sizeof (mips64_elf_gregset_t)); gdb_assert (len == sizeof (mips64_elf_gregset_t));
@ -400,7 +400,7 @@ mips64_fill_gregset (const struct regcache *regcache,
{ {
memset (regp, 0, sizeof (mips64_elf_gregset_t)); memset (regp, 0, sizeof (mips64_elf_gregset_t));
for (regi = 1; regi < 32; regi++) for (regi = 1; regi < 32; regi++)
mips64_fill_gregset (regcache, gregsetp, regi); mips64_fill_gregset (regcache, gregsetp, regi);
mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->lo); mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->lo);
mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->hi); mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->hi);
mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->pc); mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->pc);
@ -469,7 +469,8 @@ mips64_supply_fpregset (struct regcache *regcache,
if (register_size (gdbarch, gdbarch_fp0_regnum (gdbarch)) == 4) if (register_size (gdbarch, gdbarch_fp0_regnum (gdbarch)) == 4)
for (regi = 0; regi < 32; regi++) for (regi = 0; regi < 32; regi++)
{ {
const gdb_byte *reg_ptr = (const gdb_byte *)(*fpregsetp + (regi & ~1)); const gdb_byte *reg_ptr
= (const gdb_byte *) (*fpregsetp + (regi & ~1));
if ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) != (regi & 1)) if ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) != (regi & 1))
reg_ptr += 4; reg_ptr += 4;
regcache_raw_supply (regcache, regcache_raw_supply (regcache,
@ -480,23 +481,23 @@ mips64_supply_fpregset (struct regcache *regcache,
for (regi = 0; regi < 32; regi++) for (regi = 0; regi < 32; regi++)
regcache_raw_supply (regcache, regcache_raw_supply (regcache,
gdbarch_fp0_regnum (gdbarch) + regi, gdbarch_fp0_regnum (gdbarch) + regi,
(const char *)(*fpregsetp + regi)); (const char *) (*fpregsetp + regi));
supply_32bit_reg (regcache, mips_regnum (gdbarch)->fp_control_status, supply_32bit_reg (regcache, mips_regnum (gdbarch)->fp_control_status,
(const gdb_byte *)(*fpregsetp + 32)); (const gdb_byte *) (*fpregsetp + 32));
/* The ABI doesn't tell us how to supply FCRIR, and core dumps don't /* The ABI doesn't tell us how to supply FCRIR, and core dumps don't
include it - but the result of PTRACE_GETFPREGS does. The best we include it - but the result of PTRACE_GETFPREGS does. The best we
can do is to assume that its value is present. */ can do is to assume that its value is present. */
supply_32bit_reg (regcache, supply_32bit_reg (regcache,
mips_regnum (gdbarch)->fp_implementation_revision, mips_regnum (gdbarch)->fp_implementation_revision,
(const gdb_byte *)(*fpregsetp + 32) + 4); (const gdb_byte *) (*fpregsetp + 32) + 4);
} }
static void static void
mips64_supply_fpregset_wrapper (const struct regset *regset, mips64_supply_fpregset_wrapper (const struct regset *regset,
struct regcache *regcache, struct regcache *regcache,
int regnum, const void *gregs, size_t len) int regnum, const void *gregs, size_t len)
{ {
gdb_assert (len == sizeof (mips64_elf_fpregset_t)); gdb_assert (len == sizeof (mips64_elf_fpregset_t));
@ -567,8 +568,7 @@ mips64_fill_fpregset (const struct regcache *regcache,
mips64_fill_fpregset (regcache, fpregsetp, mips64_fill_fpregset (regcache, fpregsetp,
mips_regnum (gdbarch)->fp_control_status); mips_regnum (gdbarch)->fp_control_status);
mips64_fill_fpregset (regcache, fpregsetp, mips64_fill_fpregset (regcache, fpregsetp,
(mips_regnum (gdbarch) mips_regnum (gdbarch)->fp_implementation_revision);
->fp_implementation_revision));
} }
} }
@ -584,7 +584,7 @@ mips64_fill_fpregset_wrapper (const struct regset *regset,
static const struct regset * static const struct regset *
mips_linux_regset_from_core_section (struct gdbarch *gdbarch, mips_linux_regset_from_core_section (struct gdbarch *gdbarch,
const char *sect_name, size_t sect_size) const char *sect_name, size_t sect_size)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
mips_elf_gregset_t gregset; mips_elf_gregset_t gregset;
@ -598,16 +598,16 @@ mips_linux_regset_from_core_section (struct gdbarch *gdbarch,
{ {
if (tdep->gregset == NULL) if (tdep->gregset == NULL)
tdep->gregset = regset_alloc (gdbarch, tdep->gregset = regset_alloc (gdbarch,
mips_supply_gregset_wrapper, mips_supply_gregset_wrapper,
mips_fill_gregset_wrapper); mips_fill_gregset_wrapper);
return tdep->gregset; return tdep->gregset;
} }
else if (sect_size == sizeof (gregset64)) else if (sect_size == sizeof (gregset64))
{ {
if (tdep->gregset64 == NULL) if (tdep->gregset64 == NULL)
tdep->gregset64 = regset_alloc (gdbarch, tdep->gregset64 = regset_alloc (gdbarch,
mips64_supply_gregset_wrapper, mips64_supply_gregset_wrapper,
mips64_fill_gregset_wrapper); mips64_fill_gregset_wrapper);
return tdep->gregset64; return tdep->gregset64;
} }
else else
@ -621,16 +621,16 @@ mips_linux_regset_from_core_section (struct gdbarch *gdbarch,
{ {
if (tdep->fpregset == NULL) if (tdep->fpregset == NULL)
tdep->fpregset = regset_alloc (gdbarch, tdep->fpregset = regset_alloc (gdbarch,
mips_supply_fpregset_wrapper, mips_supply_fpregset_wrapper,
mips_fill_fpregset_wrapper); mips_fill_fpregset_wrapper);
return tdep->fpregset; return tdep->fpregset;
} }
else if (sect_size == sizeof (fpregset64)) else if (sect_size == sizeof (fpregset64))
{ {
if (tdep->fpregset64 == NULL) if (tdep->fpregset64 == NULL)
tdep->fpregset64 = regset_alloc (gdbarch, tdep->fpregset64 = regset_alloc (gdbarch,
mips64_supply_fpregset_wrapper, mips64_supply_fpregset_wrapper,
mips64_fill_fpregset_wrapper); mips64_fill_fpregset_wrapper);
return tdep->fpregset64; return tdep->fpregset64;
} }
else else
@ -999,10 +999,10 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self,
for (ireg = 1; ireg < 32; ireg++) for (ireg = 1; ireg < 32; ireg++)
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
ireg + MIPS_ZERO_REGNUM (ireg + MIPS_ZERO_REGNUM
+ gdbarch_num_regs (gdbarch), + gdbarch_num_regs (gdbarch)),
regs_base + SIGCONTEXT_REGS (regs_base + SIGCONTEXT_REGS
+ ireg * SIGCONTEXT_REG_SIZE); + ireg * SIGCONTEXT_REG_SIZE));
/* The way that floating point registers are saved, unfortunately, /* The way that floating point registers are saved, unfortunately,
depends on the architecture the kernel is built for. For the r3000 and depends on the architecture the kernel is built for. For the r3000 and
@ -1015,24 +1015,22 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self,
for (ireg = 0; ireg < 32; ireg++) for (ireg = 0; ireg < 32; ireg++)
if ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) != (ireg & 1)) if ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) != (ireg & 1))
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
ireg + regs->fp0 + ireg + regs->fp0 + gdbarch_num_regs (gdbarch),
gdbarch_num_regs (gdbarch), (sigcontext_base + SIGCONTEXT_FPREGS + 4
sigcontext_base + SIGCONTEXT_FPREGS + 4 + (ireg & ~1) * SIGCONTEXT_REG_SIZE));
+ (ireg & ~1) * SIGCONTEXT_REG_SIZE);
else else
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
ireg + regs->fp0 ireg + regs->fp0 + gdbarch_num_regs (gdbarch),
+ gdbarch_num_regs (gdbarch), (sigcontext_base + SIGCONTEXT_FPREGS
sigcontext_base + SIGCONTEXT_FPREGS + (ireg & ~1) * SIGCONTEXT_REG_SIZE));
+ (ireg & ~1) * SIGCONTEXT_REG_SIZE);
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
regs->pc + gdbarch_num_regs (gdbarch), regs->pc + gdbarch_num_regs (gdbarch),
regs_base + SIGCONTEXT_PC); regs_base + SIGCONTEXT_PC);
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
regs->fp_control_status (regs->fp_control_status
+ gdbarch_num_regs (gdbarch), + gdbarch_num_regs (gdbarch)),
sigcontext_base + SIGCONTEXT_FPCSR); sigcontext_base + SIGCONTEXT_FPCSR);
if (regs->dspctl != -1) if (regs->dspctl != -1)
@ -1192,25 +1190,24 @@ mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
for (ireg = 1; ireg < 32; ireg++) for (ireg = 1; ireg < 32; ireg++)
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
ireg + MIPS_ZERO_REGNUM (ireg + MIPS_ZERO_REGNUM
+ gdbarch_num_regs (gdbarch), + gdbarch_num_regs (gdbarch)),
sigcontext_base + N64_SIGCONTEXT_REGS (sigcontext_base + N64_SIGCONTEXT_REGS
+ ireg * N64_SIGCONTEXT_REG_SIZE); + ireg * N64_SIGCONTEXT_REG_SIZE));
for (ireg = 0; ireg < 32; ireg++) for (ireg = 0; ireg < 32; ireg++)
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
ireg + regs->fp0 ireg + regs->fp0 + gdbarch_num_regs (gdbarch),
+ gdbarch_num_regs (gdbarch), (sigcontext_base + N64_SIGCONTEXT_FPREGS
sigcontext_base + N64_SIGCONTEXT_FPREGS + ireg * N64_SIGCONTEXT_REG_SIZE));
+ ireg * N64_SIGCONTEXT_REG_SIZE);
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
regs->pc + gdbarch_num_regs (gdbarch), regs->pc + gdbarch_num_regs (gdbarch),
sigcontext_base + N64_SIGCONTEXT_PC); sigcontext_base + N64_SIGCONTEXT_PC);
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
regs->fp_control_status (regs->fp_control_status
+ gdbarch_num_regs (gdbarch), + gdbarch_num_regs (gdbarch)),
sigcontext_base + N64_SIGCONTEXT_FPCSR); sigcontext_base + N64_SIGCONTEXT_FPCSR);
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
@ -1331,13 +1328,13 @@ mips_linux_get_syscall_number (struct gdbarch *gdbarch,
return ret; return ret;
} }
/* Translate signals based on MIPS signal values. /* Translate signals based on MIPS signal values.
Adapted from gdb/common/signals.c. */ Adapted from gdb/common/signals.c. */
static enum gdb_signal static enum gdb_signal
mips_gdb_signal_from_target (struct gdbarch *gdbarch, int signo) mips_gdb_signal_from_target (struct gdbarch *gdbarch, int signo)
{ {
switch (signo) switch (signo)
{ {
case 0: case 0:
return GDB_SIGNAL_0; return GDB_SIGNAL_0;
@ -1440,7 +1437,7 @@ mips_linux_init_abi (struct gdbarch_info info,
{ {
case MIPS_ABI_O32: case MIPS_ABI_O32:
set_gdbarch_get_longjmp_target (gdbarch, set_gdbarch_get_longjmp_target (gdbarch,
mips_linux_get_longjmp_target); mips_linux_get_longjmp_target);
set_solib_svr4_fetch_link_map_offsets set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets); (gdbarch, svr4_ilp32_fetch_link_map_offsets);
tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_sigframe); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_sigframe);
@ -1449,7 +1446,7 @@ mips_linux_init_abi (struct gdbarch_info info,
break; break;
case MIPS_ABI_N32: case MIPS_ABI_N32:
set_gdbarch_get_longjmp_target (gdbarch, set_gdbarch_get_longjmp_target (gdbarch,
mips_linux_get_longjmp_target); mips_linux_get_longjmp_target);
set_solib_svr4_fetch_link_map_offsets set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets); (gdbarch, svr4_ilp32_fetch_link_map_offsets);
set_gdbarch_long_double_bit (gdbarch, 128); set_gdbarch_long_double_bit (gdbarch, 128);
@ -1463,7 +1460,7 @@ mips_linux_init_abi (struct gdbarch_info info,
break; break;
case MIPS_ABI_N64: case MIPS_ABI_N64:
set_gdbarch_get_longjmp_target (gdbarch, set_gdbarch_get_longjmp_target (gdbarch,
mips64_linux_get_longjmp_target); mips64_linux_get_longjmp_target);
set_solib_svr4_fetch_link_map_offsets set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets); (gdbarch, svr4_lp64_fetch_link_map_offsets);
set_gdbarch_long_double_bit (gdbarch, 128); set_gdbarch_long_double_bit (gdbarch, 128);
@ -1485,7 +1482,7 @@ mips_linux_init_abi (struct gdbarch_info info,
/* Enable TLS support. */ /* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch, set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map); svr4_fetch_objfile_link_map);
/* Initialize this lazily, to avoid an initialization order /* Initialize this lazily, to avoid an initialization order
dependency on solib-svr4.c's _initialize routine. */ dependency on solib-svr4.c's _initialize routine. */