+2020-11-02 Simon Marchi <simon.marchi@efficios.com>
+
+ * aarch64-linux-tdep.c: Fix indentation.
+ * aarch64-ravenscar-thread.c: Fix indentation.
+ * aarch64-tdep.c: Fix indentation.
+ * aarch64-tdep.h: Fix indentation.
+ * ada-lang.c: Fix indentation.
+ * ada-lang.h: Fix indentation.
+ * ada-tasks.c: Fix indentation.
+ * ada-typeprint.c: Fix indentation.
+ * ada-valprint.c: Fix indentation.
+ * ada-varobj.c: Fix indentation.
+ * addrmap.c: Fix indentation.
+ * addrmap.h: Fix indentation.
+ * agent.c: Fix indentation.
+ * aix-thread.c: Fix indentation.
+ * alpha-bsd-nat.c: Fix indentation.
+ * alpha-linux-tdep.c: Fix indentation.
+ * alpha-mdebug-tdep.c: Fix indentation.
+ * alpha-nbsd-tdep.c: Fix indentation.
+ * alpha-obsd-tdep.c: Fix indentation.
+ * alpha-tdep.c: Fix indentation.
+ * amd64-bsd-nat.c: Fix indentation.
+ * amd64-darwin-tdep.c: Fix indentation.
+ * amd64-linux-nat.c: Fix indentation.
+ * amd64-linux-tdep.c: Fix indentation.
+ * amd64-nat.c: Fix indentation.
+ * amd64-obsd-tdep.c: Fix indentation.
+ * amd64-tdep.c: Fix indentation.
+ * amd64-windows-tdep.c: Fix indentation.
+ * annotate.c: Fix indentation.
+ * arc-tdep.c: Fix indentation.
+ * arch-utils.c: Fix indentation.
+ * arch/arm-get-next-pcs.c: Fix indentation.
+ * arch/arm.c: Fix indentation.
+ * arm-linux-nat.c: Fix indentation.
+ * arm-linux-tdep.c: Fix indentation.
+ * arm-nbsd-tdep.c: Fix indentation.
+ * arm-pikeos-tdep.c: Fix indentation.
+ * arm-tdep.c: Fix indentation.
+ * arm-tdep.h: Fix indentation.
+ * arm-wince-tdep.c: Fix indentation.
+ * auto-load.c: Fix indentation.
+ * auxv.c: Fix indentation.
+ * avr-tdep.c: Fix indentation.
+ * ax-gdb.c: Fix indentation.
+ * ax-general.c: Fix indentation.
+ * bfin-linux-tdep.c: Fix indentation.
+ * block.c: Fix indentation.
+ * block.h: Fix indentation.
+ * blockframe.c: Fix indentation.
+ * bpf-tdep.c: Fix indentation.
+ * break-catch-sig.c: Fix indentation.
+ * break-catch-syscall.c: Fix indentation.
+ * break-catch-throw.c: Fix indentation.
+ * breakpoint.c: Fix indentation.
+ * breakpoint.h: Fix indentation.
+ * bsd-uthread.c: Fix indentation.
+ * btrace.c: Fix indentation.
+ * build-id.c: Fix indentation.
+ * buildsym-legacy.h: Fix indentation.
+ * buildsym.c: Fix indentation.
+ * c-typeprint.c: Fix indentation.
+ * c-valprint.c: Fix indentation.
+ * c-varobj.c: Fix indentation.
+ * charset.c: Fix indentation.
+ * cli/cli-cmds.c: Fix indentation.
+ * cli/cli-decode.c: Fix indentation.
+ * cli/cli-decode.h: Fix indentation.
+ * cli/cli-script.c: Fix indentation.
+ * cli/cli-setshow.c: Fix indentation.
+ * coff-pe-read.c: Fix indentation.
+ * coffread.c: Fix indentation.
+ * compile/compile-cplus-types.c: Fix indentation.
+ * compile/compile-object-load.c: Fix indentation.
+ * compile/compile-object-run.c: Fix indentation.
+ * completer.c: Fix indentation.
+ * corefile.c: Fix indentation.
+ * corelow.c: Fix indentation.
+ * cp-abi.h: Fix indentation.
+ * cp-namespace.c: Fix indentation.
+ * cp-support.c: Fix indentation.
+ * cp-valprint.c: Fix indentation.
+ * cris-linux-tdep.c: Fix indentation.
+ * cris-tdep.c: Fix indentation.
+ * darwin-nat-info.c: Fix indentation.
+ * darwin-nat.c: Fix indentation.
+ * darwin-nat.h: Fix indentation.
+ * dbxread.c: Fix indentation.
+ * dcache.c: Fix indentation.
+ * disasm.c: Fix indentation.
+ * dtrace-probe.c: Fix indentation.
+ * dwarf2/abbrev.c: Fix indentation.
+ * dwarf2/attribute.c: Fix indentation.
+ * dwarf2/expr.c: Fix indentation.
+ * dwarf2/frame.c: Fix indentation.
+ * dwarf2/index-cache.c: Fix indentation.
+ * dwarf2/index-write.c: Fix indentation.
+ * dwarf2/line-header.c: Fix indentation.
+ * dwarf2/loc.c: Fix indentation.
+ * dwarf2/macro.c: Fix indentation.
+ * dwarf2/read.c: Fix indentation.
+ * dwarf2/read.h: Fix indentation.
+ * elfread.c: Fix indentation.
+ * eval.c: Fix indentation.
+ * event-top.c: Fix indentation.
+ * exec.c: Fix indentation.
+ * exec.h: Fix indentation.
+ * expprint.c: Fix indentation.
+ * f-lang.c: Fix indentation.
+ * f-typeprint.c: Fix indentation.
+ * f-valprint.c: Fix indentation.
+ * fbsd-nat.c: Fix indentation.
+ * fbsd-tdep.c: Fix indentation.
+ * findvar.c: Fix indentation.
+ * fork-child.c: Fix indentation.
+ * frame-unwind.c: Fix indentation.
+ * frame-unwind.h: Fix indentation.
+ * frame.c: Fix indentation.
+ * frv-linux-tdep.c: Fix indentation.
+ * frv-tdep.c: Fix indentation.
+ * frv-tdep.h: Fix indentation.
+ * ft32-tdep.c: Fix indentation.
+ * gcore.c: Fix indentation.
+ * gdb_bfd.c: Fix indentation.
+ * gdbarch.sh: Fix indentation.
+ * gdbarch.c: Re-generate
+ * gdbarch.h: Re-generate.
+ * gdbcore.h: Fix indentation.
+ * gdbthread.h: Fix indentation.
+ * gdbtypes.c: Fix indentation.
+ * gdbtypes.h: Fix indentation.
+ * glibc-tdep.c: Fix indentation.
+ * gnu-nat.c: Fix indentation.
+ * gnu-nat.h: Fix indentation.
+ * gnu-v2-abi.c: Fix indentation.
+ * gnu-v3-abi.c: Fix indentation.
+ * go32-nat.c: Fix indentation.
+ * guile/guile-internal.h: Fix indentation.
+ * guile/scm-cmd.c: Fix indentation.
+ * guile/scm-frame.c: Fix indentation.
+ * guile/scm-iterator.c: Fix indentation.
+ * guile/scm-math.c: Fix indentation.
+ * guile/scm-ports.c: Fix indentation.
+ * guile/scm-pretty-print.c: Fix indentation.
+ * guile/scm-value.c: Fix indentation.
+ * h8300-tdep.c: Fix indentation.
+ * hppa-linux-nat.c: Fix indentation.
+ * hppa-linux-tdep.c: Fix indentation.
+ * hppa-nbsd-nat.c: Fix indentation.
+ * hppa-nbsd-tdep.c: Fix indentation.
+ * hppa-obsd-nat.c: Fix indentation.
+ * hppa-tdep.c: Fix indentation.
+ * hppa-tdep.h: Fix indentation.
+ * i386-bsd-nat.c: Fix indentation.
+ * i386-darwin-nat.c: Fix indentation.
+ * i386-darwin-tdep.c: Fix indentation.
+ * i386-dicos-tdep.c: Fix indentation.
+ * i386-gnu-nat.c: Fix indentation.
+ * i386-linux-nat.c: Fix indentation.
+ * i386-linux-tdep.c: Fix indentation.
+ * i386-nto-tdep.c: Fix indentation.
+ * i386-obsd-tdep.c: Fix indentation.
+ * i386-sol2-nat.c: Fix indentation.
+ * i386-tdep.c: Fix indentation.
+ * i386-tdep.h: Fix indentation.
+ * i386-windows-tdep.c: Fix indentation.
+ * i387-tdep.c: Fix indentation.
+ * i387-tdep.h: Fix indentation.
+ * ia64-libunwind-tdep.c: Fix indentation.
+ * ia64-libunwind-tdep.h: Fix indentation.
+ * ia64-linux-nat.c: Fix indentation.
+ * ia64-linux-tdep.c: Fix indentation.
+ * ia64-tdep.c: Fix indentation.
+ * ia64-tdep.h: Fix indentation.
+ * ia64-vms-tdep.c: Fix indentation.
+ * infcall.c: Fix indentation.
+ * infcmd.c: Fix indentation.
+ * inferior.c: Fix indentation.
+ * infrun.c: Fix indentation.
+ * iq2000-tdep.c: Fix indentation.
+ * language.c: Fix indentation.
+ * linespec.c: Fix indentation.
+ * linux-fork.c: Fix indentation.
+ * linux-nat.c: Fix indentation.
+ * linux-tdep.c: Fix indentation.
+ * linux-thread-db.c: Fix indentation.
+ * lm32-tdep.c: Fix indentation.
+ * m2-lang.c: Fix indentation.
+ * m2-typeprint.c: Fix indentation.
+ * m2-valprint.c: Fix indentation.
+ * m32c-tdep.c: Fix indentation.
+ * m32r-linux-tdep.c: Fix indentation.
+ * m32r-tdep.c: Fix indentation.
+ * m68hc11-tdep.c: Fix indentation.
+ * m68k-bsd-nat.c: Fix indentation.
+ * m68k-linux-nat.c: Fix indentation.
+ * m68k-linux-tdep.c: Fix indentation.
+ * m68k-tdep.c: Fix indentation.
+ * machoread.c: Fix indentation.
+ * macrocmd.c: Fix indentation.
+ * macroexp.c: Fix indentation.
+ * macroscope.c: Fix indentation.
+ * macrotab.c: Fix indentation.
+ * macrotab.h: Fix indentation.
+ * main.c: Fix indentation.
+ * mdebugread.c: Fix indentation.
+ * mep-tdep.c: Fix indentation.
+ * mi/mi-cmd-catch.c: Fix indentation.
+ * mi/mi-cmd-disas.c: Fix indentation.
+ * mi/mi-cmd-env.c: Fix indentation.
+ * mi/mi-cmd-stack.c: Fix indentation.
+ * mi/mi-cmd-var.c: Fix indentation.
+ * mi/mi-cmds.c: Fix indentation.
+ * mi/mi-main.c: Fix indentation.
+ * mi/mi-parse.c: Fix indentation.
+ * microblaze-tdep.c: Fix indentation.
+ * minidebug.c: Fix indentation.
+ * minsyms.c: Fix indentation.
+ * mips-linux-nat.c: Fix indentation.
+ * mips-linux-tdep.c: Fix indentation.
+ * mips-nbsd-tdep.c: Fix indentation.
+ * mips-tdep.c: Fix indentation.
+ * mn10300-linux-tdep.c: Fix indentation.
+ * mn10300-tdep.c: Fix indentation.
+ * moxie-tdep.c: Fix indentation.
+ * msp430-tdep.c: Fix indentation.
+ * namespace.h: Fix indentation.
+ * nat/fork-inferior.c: Fix indentation.
+ * nat/gdb_ptrace.h: Fix indentation.
+ * nat/linux-namespaces.c: Fix indentation.
+ * nat/linux-osdata.c: Fix indentation.
+ * nat/netbsd-nat.c: Fix indentation.
+ * nat/x86-dregs.c: Fix indentation.
+ * nbsd-nat.c: Fix indentation.
+ * nbsd-tdep.c: Fix indentation.
+ * nios2-linux-tdep.c: Fix indentation.
+ * nios2-tdep.c: Fix indentation.
+ * nto-procfs.c: Fix indentation.
+ * nto-tdep.c: Fix indentation.
+ * objfiles.c: Fix indentation.
+ * objfiles.h: Fix indentation.
+ * opencl-lang.c: Fix indentation.
+ * or1k-tdep.c: Fix indentation.
+ * osabi.c: Fix indentation.
+ * osabi.h: Fix indentation.
+ * osdata.c: Fix indentation.
+ * p-lang.c: Fix indentation.
+ * p-typeprint.c: Fix indentation.
+ * p-valprint.c: Fix indentation.
+ * parse.c: Fix indentation.
+ * ppc-linux-nat.c: Fix indentation.
+ * ppc-linux-tdep.c: Fix indentation.
+ * ppc-nbsd-nat.c: Fix indentation.
+ * ppc-nbsd-tdep.c: Fix indentation.
+ * ppc-obsd-nat.c: Fix indentation.
+ * ppc-ravenscar-thread.c: Fix indentation.
+ * ppc-sysv-tdep.c: Fix indentation.
+ * ppc64-tdep.c: Fix indentation.
+ * printcmd.c: Fix indentation.
+ * proc-api.c: Fix indentation.
+ * producer.c: Fix indentation.
+ * producer.h: Fix indentation.
+ * prologue-value.c: Fix indentation.
+ * prologue-value.h: Fix indentation.
+ * psymtab.c: Fix indentation.
+ * python/py-arch.c: Fix indentation.
+ * python/py-bpevent.c: Fix indentation.
+ * python/py-event.c: Fix indentation.
+ * python/py-event.h: Fix indentation.
+ * python/py-finishbreakpoint.c: Fix indentation.
+ * python/py-frame.c: Fix indentation.
+ * python/py-framefilter.c: Fix indentation.
+ * python/py-inferior.c: Fix indentation.
+ * python/py-infthread.c: Fix indentation.
+ * python/py-objfile.c: Fix indentation.
+ * python/py-prettyprint.c: Fix indentation.
+ * python/py-registers.c: Fix indentation.
+ * python/py-signalevent.c: Fix indentation.
+ * python/py-stopevent.c: Fix indentation.
+ * python/py-stopevent.h: Fix indentation.
+ * python/py-threadevent.c: Fix indentation.
+ * python/py-tui.c: Fix indentation.
+ * python/py-unwind.c: Fix indentation.
+ * python/py-value.c: Fix indentation.
+ * python/py-xmethods.c: Fix indentation.
+ * python/python-internal.h: Fix indentation.
+ * python/python.c: Fix indentation.
+ * ravenscar-thread.c: Fix indentation.
+ * record-btrace.c: Fix indentation.
+ * record-full.c: Fix indentation.
+ * record.c: Fix indentation.
+ * reggroups.c: Fix indentation.
+ * regset.h: Fix indentation.
+ * remote-fileio.c: Fix indentation.
+ * remote.c: Fix indentation.
+ * reverse.c: Fix indentation.
+ * riscv-linux-tdep.c: Fix indentation.
+ * riscv-ravenscar-thread.c: Fix indentation.
+ * riscv-tdep.c: Fix indentation.
+ * rl78-tdep.c: Fix indentation.
+ * rs6000-aix-tdep.c: Fix indentation.
+ * rs6000-lynx178-tdep.c: Fix indentation.
+ * rs6000-nat.c: Fix indentation.
+ * rs6000-tdep.c: Fix indentation.
+ * rust-lang.c: Fix indentation.
+ * rx-tdep.c: Fix indentation.
+ * s12z-tdep.c: Fix indentation.
+ * s390-linux-tdep.c: Fix indentation.
+ * score-tdep.c: Fix indentation.
+ * ser-base.c: Fix indentation.
+ * ser-mingw.c: Fix indentation.
+ * ser-uds.c: Fix indentation.
+ * ser-unix.c: Fix indentation.
+ * serial.c: Fix indentation.
+ * sh-linux-tdep.c: Fix indentation.
+ * sh-nbsd-tdep.c: Fix indentation.
+ * sh-tdep.c: Fix indentation.
+ * skip.c: Fix indentation.
+ * sol-thread.c: Fix indentation.
+ * solib-aix.c: Fix indentation.
+ * solib-darwin.c: Fix indentation.
+ * solib-frv.c: Fix indentation.
+ * solib-svr4.c: Fix indentation.
+ * solib.c: Fix indentation.
+ * source.c: Fix indentation.
+ * sparc-linux-tdep.c: Fix indentation.
+ * sparc-nbsd-tdep.c: Fix indentation.
+ * sparc-obsd-tdep.c: Fix indentation.
+ * sparc-ravenscar-thread.c: Fix indentation.
+ * sparc-tdep.c: Fix indentation.
+ * sparc64-linux-tdep.c: Fix indentation.
+ * sparc64-nbsd-tdep.c: Fix indentation.
+ * sparc64-obsd-tdep.c: Fix indentation.
+ * sparc64-tdep.c: Fix indentation.
+ * stabsread.c: Fix indentation.
+ * stack.c: Fix indentation.
+ * stap-probe.c: Fix indentation.
+ * stubs/ia64vms-stub.c: Fix indentation.
+ * stubs/m32r-stub.c: Fix indentation.
+ * stubs/m68k-stub.c: Fix indentation.
+ * stubs/sh-stub.c: Fix indentation.
+ * stubs/sparc-stub.c: Fix indentation.
+ * symfile-mem.c: Fix indentation.
+ * symfile.c: Fix indentation.
+ * symfile.h: Fix indentation.
+ * symmisc.c: Fix indentation.
+ * symtab.c: Fix indentation.
+ * symtab.h: Fix indentation.
+ * target-float.c: Fix indentation.
+ * target.c: Fix indentation.
+ * target.h: Fix indentation.
+ * tic6x-tdep.c: Fix indentation.
+ * tilegx-linux-tdep.c: Fix indentation.
+ * tilegx-tdep.c: Fix indentation.
+ * top.c: Fix indentation.
+ * tracefile-tfile.c: Fix indentation.
+ * tracepoint.c: Fix indentation.
+ * tui/tui-disasm.c: Fix indentation.
+ * tui/tui-io.c: Fix indentation.
+ * tui/tui-regs.c: Fix indentation.
+ * tui/tui-stack.c: Fix indentation.
+ * tui/tui-win.c: Fix indentation.
+ * tui/tui-winsource.c: Fix indentation.
+ * tui/tui.c: Fix indentation.
+ * typeprint.c: Fix indentation.
+ * ui-out.h: Fix indentation.
+ * unittests/copy_bitwise-selftests.c: Fix indentation.
+ * unittests/memory-map-selftests.c: Fix indentation.
+ * utils.c: Fix indentation.
+ * v850-tdep.c: Fix indentation.
+ * valarith.c: Fix indentation.
+ * valops.c: Fix indentation.
+ * valprint.c: Fix indentation.
+ * valprint.h: Fix indentation.
+ * value.c: Fix indentation.
+ * value.h: Fix indentation.
+ * varobj.c: Fix indentation.
+ * vax-tdep.c: Fix indentation.
+ * windows-nat.c: Fix indentation.
+ * windows-tdep.c: Fix indentation.
+ * xcoffread.c: Fix indentation.
+ * xml-syscall.c: Fix indentation.
+ * xml-tdesc.c: Fix indentation.
+ * xstormy16-tdep.c: Fix indentation.
+ * xtensa-config.c: Fix indentation.
+ * xtensa-linux-nat.c: Fix indentation.
+ * xtensa-linux-tdep.c: Fix indentation.
+ * xtensa-tdep.c: Fix indentation.
+
2020-11-02 Andrew Burgess <andrew.burgess@embecosm.com>
Craig Blackmore <craig.blackmore@embecosm.com>
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
static void
supply_register_at_address (struct regcache *regcache, int regnum,
- CORE_ADDR register_addr)
+ CORE_ADDR register_addr)
{
struct gdbarch *gdbarch = regcache->arch ();
int buf_size = register_size (gdbarch, regnum);
for (current_regnum = 0; current_regnum < num_regs; current_regnum++)
{
if (register_in_thread_descriptor_p (reg_info, current_regnum))
- {
- current_address = thread_descriptor_address
- + reg_info->context_offsets[current_regnum];
- supply_register_at_address (regcache, current_regnum,
- current_address);
- }
+ {
+ current_address = thread_descriptor_address
+ + reg_info->context_offsets[current_regnum];
+ supply_register_at_address (regcache, current_regnum,
+ current_address);
+ }
}
}
regcache->raw_collect (regnum, buf);
write_memory (register_address,
- buf,
- buf_size);
+ buf,
+ buf_size);
}
/* The ravenscar_reg_info for most Aarch64 targets. */
static void
show_aarch64_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("AArch64 debugging is %s.\n"), value);
}
identified by the next frame's stack pointer at the time of the
call. The value was already reconstructed into PREV_SP. */
/*
- +----------+ ^
- | saved lr | |
+ +----------+ ^
+ | saved lr | |
+->| saved fp |--+
| | |
| | | <- Previous SP
| +----------+
| | saved lr |
+--| saved fp |<- FP
- | |
- | |<- SP
- +----------+ */
+ | |
+ | |<- SP
+ +----------+ */
if (prev_regnum == AARCH64_SP_REGNUM)
return frame_unwind_got_constant (this_frame, prev_regnum,
cache->prev_sp);
else
{
/* For a structure or union the behaviour is as if the value had
- been stored to word-aligned memory and then loaded into
- registers with 64-bit load instruction(s). */
+ been stored to word-aligned memory and then loaded into
+ registers with 64-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int regno = AARCH64_X0_REGNUM;
bfd_byte buf[X_REGISTER_SIZE];
if (TYPE_LENGTH (type) > 16)
{
/* PCS B.6 Aggregates larger than 16 bytes are passed by
- invisible reference. */
+ invisible reference. */
return 1;
}
/* AArch64 process record-replay related structures, defines etc. */
#define REG_ALLOC(REGS, LENGTH, RECORD_BUF) \
- do \
- { \
- unsigned int reg_len = LENGTH; \
- if (reg_len) \
- { \
- REGS = XNEWVEC (uint32_t, reg_len); \
- memcpy(®S[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
- } \
- } \
- while (0)
+ do \
+ { \
+ unsigned int reg_len = LENGTH; \
+ if (reg_len) \
+ { \
+ REGS = XNEWVEC (uint32_t, reg_len); \
+ memcpy(®S[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
+ } \
+ } \
+ while (0)
#define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \
- do \
- { \
- 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); \
- } \
- } \
- while (0)
+ do \
+ { \
+ 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); \
+ } \
+ } \
+ while (0)
/* AArch64 record/replay structures and enumerations. */
uint8_t sindex, scale, selem, esize, replicate = 0;
scale = opcode_bits >> 2;
selem = ((opcode_bits & 0x02) |
- bit (aarch64_insn_r->aarch64_insn, 21)) + 1;
+ bit (aarch64_insn_r->aarch64_insn, 21)) + 1;
switch (scale)
- {
- case 1:
- if (size_bits & 0x01)
- return AARCH64_RECORD_UNKNOWN;
- break;
- case 2:
- if ((size_bits >> 1) & 0x01)
- return AARCH64_RECORD_UNKNOWN;
- if (size_bits & 0x01)
- {
- if (!((opcode_bits >> 1) & 0x01))
- scale = 3;
- else
- return AARCH64_RECORD_UNKNOWN;
- }
- break;
- case 3:
- if (bit (aarch64_insn_r->aarch64_insn, 22) && !(opcode_bits & 0x01))
- {
- scale = size_bits;
- replicate = 1;
- break;
- }
- else
- return AARCH64_RECORD_UNKNOWN;
- default:
- break;
- }
+ {
+ case 1:
+ if (size_bits & 0x01)
+ return AARCH64_RECORD_UNKNOWN;
+ break;
+ case 2:
+ if ((size_bits >> 1) & 0x01)
+ return AARCH64_RECORD_UNKNOWN;
+ if (size_bits & 0x01)
+ {
+ if (!((opcode_bits >> 1) & 0x01))
+ scale = 3;
+ else
+ return AARCH64_RECORD_UNKNOWN;
+ }
+ break;
+ case 3:
+ if (bit (aarch64_insn_r->aarch64_insn, 22) && !(opcode_bits & 0x01))
+ {
+ scale = size_bits;
+ replicate = 1;
+ break;
+ }
+ else
+ return AARCH64_RECORD_UNKNOWN;
+ default:
+ break;
+ }
esize = 8 << scale;
if (replicate)
- for (sindex = 0; sindex < selem; sindex++)
- {
- record_buf[reg_index++] = reg_rt + AARCH64_V0_REGNUM;
- reg_rt = (reg_rt + 1) % 32;
- }
+ for (sindex = 0; sindex < selem; sindex++)
+ {
+ record_buf[reg_index++] = reg_rt + AARCH64_V0_REGNUM;
+ reg_rt = (reg_rt + 1) % 32;
+ }
else
- {
- for (sindex = 0; sindex < selem; sindex++)
+ {
+ for (sindex = 0; sindex < selem; sindex++)
{
if (bit (aarch64_insn_r->aarch64_insn, 22))
record_buf[reg_index++] = reg_rt + AARCH64_V0_REGNUM;
addr_offset = addr_offset + (esize / 8);
reg_rt = (reg_rt + 1) % 32;
}
- }
+ }
}
/* Load/store multiple structure. */
else
esize = 8 << size_bits;
if (bit (aarch64_insn_r->aarch64_insn, 30))
- elements = 128 / esize;
+ elements = 128 / esize;
else
- elements = 64 / esize;
+ elements = 64 / esize;
switch (opcode_bits)
- {
- /*LD/ST4 (4 Registers). */
- case 0:
- rpt = 1;
- selem = 4;
- break;
- /*LD/ST1 (4 Registers). */
- case 2:
- rpt = 4;
- selem = 1;
- break;
- /*LD/ST3 (3 Registers). */
- case 4:
- rpt = 1;
- selem = 3;
- break;
- /*LD/ST1 (3 Registers). */
- case 6:
- rpt = 3;
- selem = 1;
- break;
- /*LD/ST1 (1 Register). */
- case 7:
- rpt = 1;
- selem = 1;
- break;
- /*LD/ST2 (2 Registers). */
- case 8:
- rpt = 1;
- selem = 2;
- break;
- /*LD/ST1 (2 Registers). */
- case 10:
- rpt = 2;
- selem = 1;
- break;
- default:
- return AARCH64_RECORD_UNSUPPORTED;
- break;
- }
+ {
+ /*LD/ST4 (4 Registers). */
+ case 0:
+ rpt = 1;
+ selem = 4;
+ break;
+ /*LD/ST1 (4 Registers). */
+ case 2:
+ rpt = 4;
+ selem = 1;
+ break;
+ /*LD/ST3 (3 Registers). */
+ case 4:
+ rpt = 1;
+ selem = 3;
+ break;
+ /*LD/ST1 (3 Registers). */
+ case 6:
+ rpt = 3;
+ selem = 1;
+ break;
+ /*LD/ST1 (1 Register). */
+ case 7:
+ rpt = 1;
+ selem = 1;
+ break;
+ /*LD/ST2 (2 Registers). */
+ case 8:
+ rpt = 1;
+ selem = 2;
+ break;
+ /*LD/ST1 (2 Registers). */
+ case 10:
+ rpt = 2;
+ selem = 1;
+ break;
+ default:
+ return AARCH64_RECORD_UNSUPPORTED;
+ break;
+ }
for (rindex = 0; rindex < rpt; rindex++)
- for (eindex = 0; eindex < elements; eindex++)
- {
- uint8_t reg_tt, sindex;
- reg_tt = (reg_rt + rindex) % 32;
- for (sindex = 0; sindex < selem; sindex++)
- {
- if (bit (aarch64_insn_r->aarch64_insn, 22))
- record_buf[reg_index++] = reg_tt + AARCH64_V0_REGNUM;
- else
- {
- record_buf_mem[mem_index++] = esize / 8;
- record_buf_mem[mem_index++] = address + addr_offset;
- }
- addr_offset = addr_offset + (esize / 8);
- reg_tt = (reg_tt + 1) % 32;
- }
- }
+ for (eindex = 0; eindex < elements; eindex++)
+ {
+ uint8_t reg_tt, sindex;
+ reg_tt = (reg_rt + rindex) % 32;
+ for (sindex = 0; sindex < selem; sindex++)
+ {
+ if (bit (aarch64_insn_r->aarch64_insn, 22))
+ record_buf[reg_index++] = reg_tt + AARCH64_V0_REGNUM;
+ else
+ {
+ record_buf_mem[mem_index++] = esize / 8;
+ record_buf_mem[mem_index++] = address + addr_offset;
+ }
+ addr_offset = addr_offset + (esize / 8);
+ reg_tt = (reg_tt + 1) % 32;
+ }
+ }
}
if (bit (aarch64_insn_r->aarch64_insn, 23))
aarch64_insn_r->reg_rec_count = reg_index;
aarch64_insn_r->mem_rec_count = mem_index / 2;
MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
REG_ALLOC (aarch64_insn_r->aarch64_regs, aarch64_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return AARCH64_RECORD_SUCCESS;
}
if (record_debug)
debug_printf ("Process record: load register (literal)\n");
if (vector_flag)
- record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
+ record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
else
- record_buf[0] = reg_rt;
+ record_buf[0] = reg_rt;
aarch64_insn_r->reg_rec_count = 1;
}
/* All types of load/store pair instructions decoding. */
debug_printf ("Process record: load/store pair\n");
if (ld_flag)
- {
- if (vector_flag)
- {
- record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
- record_buf[1] = reg_rt2 + AARCH64_V0_REGNUM;
- }
- else
- {
- record_buf[0] = reg_rt;
- record_buf[1] = reg_rt2;
- }
- aarch64_insn_r->reg_rec_count = 2;
- }
+ {
+ if (vector_flag)
+ {
+ record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
+ record_buf[1] = reg_rt2 + AARCH64_V0_REGNUM;
+ }
+ else
+ {
+ record_buf[0] = reg_rt;
+ record_buf[1] = reg_rt2;
+ }
+ aarch64_insn_r->reg_rec_count = 2;
+ }
else
- {
- uint16_t imm7_off;
- imm7_off = bits (aarch64_insn_r->aarch64_insn, 15, 21);
- if (!vector_flag)
- size_bits = size_bits >> 1;
- datasize = 8 << (2 + size_bits);
- offset = (imm7_off & 0x40) ? (~imm7_off & 0x007f) + 1 : imm7_off;
- offset = offset << (2 + size_bits);
- regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
- &address);
- if (!((insn_bits24_27 & 0x0b) == 0x08 && insn_bit23))
- {
- if (imm7_off & 0x40)
- address = address - offset;
- else
- address = address + offset;
- }
-
- record_buf_mem[0] = datasize / 8;
- record_buf_mem[1] = address;
- record_buf_mem[2] = datasize / 8;
- record_buf_mem[3] = address + (datasize / 8);
- aarch64_insn_r->mem_rec_count = 2;
- }
+ {
+ uint16_t imm7_off;
+ imm7_off = bits (aarch64_insn_r->aarch64_insn, 15, 21);
+ if (!vector_flag)
+ size_bits = size_bits >> 1;
+ datasize = 8 << (2 + size_bits);
+ offset = (imm7_off & 0x40) ? (~imm7_off & 0x007f) + 1 : imm7_off;
+ offset = offset << (2 + size_bits);
+ regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
+ &address);
+ if (!((insn_bits24_27 & 0x0b) == 0x08 && insn_bit23))
+ {
+ if (imm7_off & 0x40)
+ address = address - offset;
+ else
+ address = address + offset;
+ }
+
+ record_buf_mem[0] = datasize / 8;
+ record_buf_mem[1] = address;
+ record_buf_mem[2] = datasize / 8;
+ record_buf_mem[3] = address + (datasize / 8);
+ aarch64_insn_r->mem_rec_count = 2;
+ }
if (bit (aarch64_insn_r->aarch64_insn, 23))
- record_buf[aarch64_insn_r->reg_rec_count++] = reg_rn;
+ record_buf[aarch64_insn_r->reg_rec_count++] = reg_rn;
}
/* Load/store register (unsigned immediate) instructions. */
else if ((insn_bits24_27 & 0x0b) == 0x09 && insn_bits28_29 == 0x03)
}
if (!ld_flag)
- {
- offset = bits (aarch64_insn_r->aarch64_insn, 10, 21);
- datasize = 8 << size_bits;
- regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
- &address);
- offset = offset << size_bits;
- address = address + offset;
-
- record_buf_mem[0] = datasize >> 3;
- record_buf_mem[1] = address;
- aarch64_insn_r->mem_rec_count = 1;
- }
+ {
+ offset = bits (aarch64_insn_r->aarch64_insn, 10, 21);
+ datasize = 8 << size_bits;
+ regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
+ &address);
+ offset = offset << size_bits;
+ address = address + offset;
+
+ record_buf_mem[0] = datasize >> 3;
+ record_buf_mem[1] = address;
+ aarch64_insn_r->mem_rec_count = 1;
+ }
else
- {
- if (vector_flag)
- record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
- else
- record_buf[0] = reg_rt;
- aarch64_insn_r->reg_rec_count = 1;
- }
+ {
+ if (vector_flag)
+ record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
+ else
+ record_buf[0] = reg_rt;
+ aarch64_insn_r->reg_rec_count = 1;
+ }
}
/* Load/store register (register offset) instructions. */
else if ((insn_bits24_27 & 0x0b) == 0x08 && insn_bits28_29 == 0x03
debug_printf ("Process record: load/store (register offset)\n");
opc = bits (aarch64_insn_r->aarch64_insn, 22, 23);
if (!(opc >> 1))
- if (opc & 0x01)
- ld_flag = 0x01;
- else
- ld_flag = 0x0;
+ if (opc & 0x01)
+ ld_flag = 0x01;
+ else
+ ld_flag = 0x0;
else
- if (size_bits != 0x03)
- ld_flag = 0x01;
- else
- return AARCH64_RECORD_UNKNOWN;
+ if (size_bits != 0x03)
+ ld_flag = 0x01;
+ else
+ return AARCH64_RECORD_UNKNOWN;
if (!ld_flag)
- {
- ULONGEST reg_rm_val;
-
- regcache_raw_read_unsigned (aarch64_insn_r->regcache,
- bits (aarch64_insn_r->aarch64_insn, 16, 20), ®_rm_val);
- if (bit (aarch64_insn_r->aarch64_insn, 12))
- offset = reg_rm_val << size_bits;
- else
- offset = reg_rm_val;
- datasize = 8 << size_bits;
- regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
- &address);
- address = address + offset;
- record_buf_mem[0] = datasize >> 3;
- record_buf_mem[1] = address;
- aarch64_insn_r->mem_rec_count = 1;
- }
+ {
+ ULONGEST reg_rm_val;
+
+ regcache_raw_read_unsigned (aarch64_insn_r->regcache,
+ bits (aarch64_insn_r->aarch64_insn, 16, 20), ®_rm_val);
+ if (bit (aarch64_insn_r->aarch64_insn, 12))
+ offset = reg_rm_val << size_bits;
+ else
+ offset = reg_rm_val;
+ datasize = 8 << size_bits;
+ regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
+ &address);
+ address = address + offset;
+ record_buf_mem[0] = datasize >> 3;
+ record_buf_mem[1] = address;
+ aarch64_insn_r->mem_rec_count = 1;
+ }
else
- {
- if (vector_flag)
- record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
- else
- record_buf[0] = reg_rt;
- aarch64_insn_r->reg_rec_count = 1;
- }
+ {
+ if (vector_flag)
+ record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
+ else
+ record_buf[0] = reg_rt;
+ aarch64_insn_r->reg_rec_count = 1;
+ }
}
/* Load/store register (immediate and unprivileged) instructions. */
else if ((insn_bits24_27 & 0x0b) == 0x08 && insn_bits28_29 == 0x03
}
opc = bits (aarch64_insn_r->aarch64_insn, 22, 23);
if (!(opc >> 1))
- if (opc & 0x01)
- ld_flag = 0x01;
- else
- ld_flag = 0x0;
+ if (opc & 0x01)
+ ld_flag = 0x01;
+ else
+ ld_flag = 0x0;
else
- if (size_bits != 0x03)
- ld_flag = 0x01;
- else
- return AARCH64_RECORD_UNKNOWN;
+ if (size_bits != 0x03)
+ ld_flag = 0x01;
+ else
+ return AARCH64_RECORD_UNKNOWN;
if (!ld_flag)
- {
- uint16_t imm9_off;
- imm9_off = bits (aarch64_insn_r->aarch64_insn, 12, 20);
- offset = (imm9_off & 0x0100) ? (((~imm9_off) & 0x01ff) + 1) : imm9_off;
- datasize = 8 << size_bits;
- regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
- &address);
- if (insn_bits10_11 != 0x01)
- {
- if (imm9_off & 0x0100)
- address = address - offset;
- else
- address = address + offset;
- }
- record_buf_mem[0] = datasize >> 3;
- record_buf_mem[1] = address;
- aarch64_insn_r->mem_rec_count = 1;
- }
+ {
+ uint16_t imm9_off;
+ imm9_off = bits (aarch64_insn_r->aarch64_insn, 12, 20);
+ offset = (imm9_off & 0x0100) ? (((~imm9_off) & 0x01ff) + 1) : imm9_off;
+ datasize = 8 << size_bits;
+ regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
+ &address);
+ if (insn_bits10_11 != 0x01)
+ {
+ if (imm9_off & 0x0100)
+ address = address - offset;
+ else
+ address = address + offset;
+ }
+ record_buf_mem[0] = datasize >> 3;
+ record_buf_mem[1] = address;
+ aarch64_insn_r->mem_rec_count = 1;
+ }
else
- {
- if (vector_flag)
- record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
- else
- record_buf[0] = reg_rt;
- aarch64_insn_r->reg_rec_count = 1;
- }
+ {
+ if (vector_flag)
+ record_buf[0] = reg_rt + AARCH64_V0_REGNUM;
+ else
+ record_buf[0] = reg_rt;
+ aarch64_insn_r->reg_rec_count = 1;
+ }
if (insn_bits10_11 == 0x01 || insn_bits10_11 == 0x03)
- record_buf[aarch64_insn_r->reg_rec_count++] = reg_rn;
+ record_buf[aarch64_insn_r->reg_rec_count++] = reg_rn;
}
/* Advanced SIMD load/store instructions. */
else
return aarch64_record_asimd_load_store (aarch64_insn_r);
MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
REG_ALLOC (aarch64_insn_r->aarch64_regs, aarch64_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return AARCH64_RECORD_SUCCESS;
}
record_buf[0] = AARCH64_CPSR_REGNUM;
}
/* Floating point - data processing (2-source) and
- conditional select instructions. */
+ conditional select instructions. */
else if (insn_bits10_11 == 0x02 || insn_bits10_11 == 0x03)
{
if (record_debug)
}
else
return AARCH64_RECORD_UNKNOWN;
- }
+ }
else
return AARCH64_RECORD_UNKNOWN;
- }
+ }
else
return AARCH64_RECORD_UNKNOWN;
}
const target_desc *aarch64_read_description (uint64_t vq, bool pauth_p);
extern int aarch64_process_record (struct gdbarch *gdbarch,
- struct regcache *regcache, CORE_ADDR addr);
+ struct regcache *regcache, CORE_ADDR addr);
displaced_step_closure_up
aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
write_exp_elt_opcode (pstate, OP_FUNCALL);
write_exp_elt_longcst (pstate, $3);
write_exp_elt_opcode (pstate, OP_FUNCALL);
- }
+ }
| var_or_type '(' arglist ')'
{
if ($1 != NULL)
{ write_exp_elt_opcode (pstate, TERNOP_SLICE); }
| var_or_type '(' simple_exp DOTDOT simple_exp ')'
{ if ($1 == NULL)
- write_exp_elt_opcode (pstate, TERNOP_SLICE);
+ write_exp_elt_opcode (pstate, TERNOP_SLICE);
else
error (_("Cannot slice a type"));
}
;
primary : aggregate
- ;
+ ;
simple_exp : primary
;
relation : simple_exp IN simple_exp DOTDOT simple_exp
{ write_exp_elt_opcode (pstate, TERNOP_IN_RANGE); }
- | simple_exp IN primary TICK_RANGE tick_arglist
+ | simple_exp IN primary TICK_RANGE tick_arglist
{ write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
write_exp_elt_longcst (pstate, (LONGEST) $5);
write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
if ($3 == NULL)
error (_("Right operand of 'in' must be type"));
write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
- write_exp_elt_type (pstate, $3);
- write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
+ write_exp_elt_type (pstate, $3);
+ write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
}
| simple_exp NOT IN simple_exp DOTDOT simple_exp
{ write_exp_elt_opcode (pstate, TERNOP_IN_RANGE);
- write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
+ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
}
- | simple_exp NOT IN primary TICK_RANGE tick_arglist
+ | simple_exp NOT IN primary TICK_RANGE tick_arglist
{ write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
write_exp_elt_longcst (pstate, (LONGEST) $6);
write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
- write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
+ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
}
| simple_exp NOT IN var_or_type %prec TICK_ACCESS
{
if ($4 == NULL)
error (_("Right operand of 'in' must be type"));
write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
- write_exp_elt_type (pstate, $4);
- write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
- write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
+ write_exp_elt_type (pstate, $4);
+ write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
+ write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
}
;
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
| and_then_exp _AND_ THEN relation
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
- ;
+ ;
or_exp :
relation OR relation
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
| or_else_exp OR ELSE relation
{ write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
- ;
+ ;
xor_exp : relation XOR relation
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
| xor_exp XOR relation
{ write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
- ;
+ ;
/* Primaries can denote types (OP_TYPE). In cases such as
primary TICK_ADDRESS, where a type would be invalid, it will be
| primary TICK_LENGTH tick_arglist
{ write_int (pstate, $3, type_int (pstate));
write_exp_elt_opcode (pstate, OP_ATR_LENGTH); }
- | primary TICK_SIZE
+ | primary TICK_SIZE
{ write_exp_elt_opcode (pstate, OP_ATR_SIZE); }
| primary TICK_TAG
{ write_exp_elt_opcode (pstate, OP_ATR_TAG); }
- | opt_type_prefix TICK_MIN '(' exp ',' exp ')'
+ | opt_type_prefix TICK_MIN '(' exp ',' exp ')'
{ write_exp_elt_opcode (pstate, OP_ATR_MIN); }
- | opt_type_prefix TICK_MAX '(' exp ',' exp ')'
+ | opt_type_prefix TICK_MAX '(' exp ',' exp ')'
{ write_exp_elt_opcode (pstate, OP_ATR_MAX); }
| opt_type_prefix TICK_POS '(' exp ')'
{ write_exp_elt_opcode (pstate, OP_ATR_POS); }
;
type_prefix :
- var_or_type
+ var_or_type
{
if ($1 == NULL)
error (_("Prefix must be type"));
;
primary : CHARLIT
- { write_int (pstate,
+ { write_int (pstate,
convert_char_literal (type_qualifier, $1.val),
(type_qualifier == NULL)
? $1.type : type_qualifier);
primary : TRUEKEYWORD
{ write_int (pstate, 1, type_boolean (pstate)); }
- | FALSEKEYWORD
+ | FALSEKEYWORD
{ write_int (pstate, 0, type_boolean (pstate)); }
;
var_or_type: NAME %prec VAR
{ $$ = write_var_or_type (pstate, NULL, $1); }
| block NAME %prec VAR
- { $$ = write_var_or_type (pstate, $1, $2); }
+ { $$ = write_var_or_type (pstate, $1, $2); }
| NAME TICK_ACCESS
{
$$ = write_var_or_type (pstate, NULL, $1);
write_exp_elt_opcode (pstate, OP_AGGREGATE);
write_exp_elt_longcst (pstate, $2);
write_exp_elt_opcode (pstate, OP_AGGREGATE);
- }
+ }
;
aggregate_component_list :
write_exp_elt_opcode (pstate, OP_CHOICES);
write_exp_elt_longcst (pstate, $1);
write_exp_elt_opcode (pstate, OP_CHOICES);
- }
+ }
;
/* We use this somewhat obscure definition in order to handle NAME => and
}
exp { $$ = 1; }
| NAME '|'
- { write_name_assoc (pstate, $1); }
+ { write_name_assoc (pstate, $1); }
component_associations { $$ = $4 + 1; }
| simple_exp '|'
- component_associations { $$ = $3 + 1; }
+ component_associations { $$ = $3 + 1; }
| simple_exp DOTDOT simple_exp '|'
{ write_exp_elt_opcode (pstate, OP_DISCRETE_RANGE); }
component_associations { $$ = $6 + 1; }
switch (*renaming_expr) {
case 'A':
- renaming_expr += 1;
- write_exp_elt_opcode (par_state, UNOP_IND);
- break;
+ renaming_expr += 1;
+ write_exp_elt_opcode (par_state, UNOP_IND);
+ break;
case 'L':
slice_state = LOWER_BOUND;
/* FALLTHROUGH */
static int
ada_nget_field_index (const struct type *type, const char *field_name0,
- int field_name_len, int maybe_missing)
+ int field_name_len, int maybe_missing)
{
char *field_name = (char *) alloca ((field_name_len + 1) * sizeof (char));
fieldno = ada_get_field_index (type, field_name, 1);
if (fieldno >= 0)
- return type->field (fieldno).type ();
+ return type->field (fieldno).type ();
subfield_name = field_name;
while (*subfield_name != '\0' && *subfield_name != '.'
subfield_name += 1;
if (subfield_name[0] == '\0')
- return NULL;
+ return NULL;
fieldno = ada_nget_field_index (type, field_name,
- subfield_name - field_name, 1);
+ subfield_name - field_name, 1);
if (fieldno < 0)
- return NULL;
+ return NULL;
type = type->field (fieldno).type ();
field_name = subfield_name;
case ADA_EXCEPTION_RENAMING:
case ADA_SUBPROGRAM_RENAMING:
{
- int alloc_len = renaming_len + name_len - tail_index + 1;
+ int alloc_len = renaming_len + name_len - tail_index + 1;
char *new_name
= (char *) obstack_alloc (&temp_parse_space, alloc_len);
strncpy (new_name, renaming, renaming_len);
if (type_sym != NULL)
{
- struct type *field_type;
-
- if (tail_index == name_len)
+ struct type *field_type;
+
+ if (tail_index == name_len)
return SYMBOL_TYPE (type_sym);
- /* We have some extraneous characters after the type name.
- If this is an expression "TYPE_NAME.FIELD0.[...].FIELDN",
- then try to get the type of FIELDN. */
- field_type
- = get_symbol_field_type (type_sym, encoded_name + tail_index);
- if (field_type != NULL)
+ /* We have some extraneous characters after the type name.
+ If this is an expression "TYPE_NAME.FIELD0.[...].FIELDN",
+ then try to get the type of FIELDN. */
+ field_type
+ = get_symbol_field_type (type_sym, encoded_name + tail_index);
+ if (field_type != NULL)
return field_type;
else
error (_("Invalid attempt to select from type: \"%s\"."),
- name0.ptr);
+ name0.ptr);
}
else if (tail_index == name_len && nsyms == 0)
{
static int is_nonfunction (struct block_symbol *, int);
static void add_defn_to_vec (struct obstack *, struct symbol *,
- const struct block *);
+ const struct block *);
static int num_defns_collected (struct obstack *);
static struct block_symbol *defns_collected (struct obstack *, int);
static struct value *resolve_subexp (expression_up *, int *, int,
- struct type *, int,
+ struct type *, int,
innermost_block_tracker *);
static void replace_operator_with_call (expression_up *, int, int, int,
- struct symbol *, const struct block *);
+ struct symbol *, const struct block *);
static int possible_user_operator_p (enum exp_opcode, struct value **);
static int discrete_type_p (struct type *);
static struct type *ada_lookup_struct_elt_type (struct type *, const char *,
- int, int);
+ int, int);
static struct value *evaluate_subexp_type (struct expression *, int *);
static struct type *ada_find_parallel_type_with_name (struct type *,
- const char *);
+ const char *);
static int is_dynamic_field (struct type *, int);
static struct type *to_fixed_variant_branch_type (struct type *,
const gdb_byte *,
- CORE_ADDR, struct value *);
+ CORE_ADDR, struct value *);
static struct type *to_fixed_array_type (struct type *, struct value *, int);
static int ada_is_unconstrained_packed_array_type (struct type *);
static struct value *value_subscript_packed (struct value *, int,
- struct value **);
+ struct value **);
static struct value *coerce_unspec_val_to_type (struct value *,
- struct type *);
+ struct type *);
static int lesseq_defined_than (struct symbol *, struct symbol *);
static struct value *value_val_atr (struct type *, struct value *);
static struct symbol *standard_lookup (const char *, const struct block *,
- domain_enum);
+ domain_enum);
static struct value *ada_search_struct_field (const char *, struct value *, int,
- struct type *);
+ struct type *);
static int find_struct_field (const char *, struct type *, int,
- struct type **, int *, int *, int *, int *);
+ struct type **, int *, int *, int *, int *);
static int ada_resolve_function (struct block_symbol *, int,
- struct value **, int, const char *,
- struct type *, int);
+ struct value **, int, const char *,
+ struct type *, int);
static int ada_is_direct_array_type (struct type *);
return data;
}
- /* Utilities */
+ /* Utilities */
/* If TYPE is a TYPE_CODE_TYPEDEF type, return the target type after
all typedef layers have been peeled. Otherwise, return TYPE.
{
*size *= 2;
if (*size < min_size)
- *size = min_size;
+ *size = min_size;
vect = xrealloc (vect, *size * element_size);
}
return vect;
return
(strncmp (field_name, target, len) == 0
&& (field_name[len] == '\0'
- || (startswith (field_name + len, "___")
- && strcmp (field_name + strlen (field_name) - 6,
- "___XVN") != 0)));
+ || (startswith (field_name + len, "___")
+ && strcmp (field_name + strlen (field_name) - 6,
+ "___XVN") != 0)));
}
int
ada_get_field_index (const struct type *type, const char *field_name,
- int maybe_missing)
+ int maybe_missing)
{
int fieldno;
struct type *struct_type = check_typedef ((struct type *) type);
if (!maybe_missing)
error (_("Unable to find field %s in struct %s. Aborting"),
- field_name, struct_type->name ());
+ field_name, struct_type->name ());
return -1;
}
const char *p = strstr (name, "___");
if (p == NULL)
- return strlen (name);
+ return strlen (name);
else
- return p - name;
+ return p - name;
}
}
struct value *result;
/* Make sure that the object size is not unreasonable before
- trying to allocate some memory for it. */
+ trying to allocate some memory for it. */
ada_ensure_varsize_limit (type);
if (value_lazy (val)
- || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
+ || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
result = allocate_value_lazy (type);
else
{
while (type != NULL && type->code () == TYPE_CODE_RANGE)
{
if (type == TYPE_TARGET_TYPE (type) || TYPE_TARGET_TYPE (type) == NULL)
- return type;
+ return type;
type = TYPE_TARGET_TYPE (type);
}
return type;
if (ada_is_array_descriptor_type (type)
|| (ada_is_constrained_packed_array_type (type)
- && type->code () != TYPE_CODE_PTR))
+ && type->code () != TYPE_CODE_PTR))
{
if (type->code () == TYPE_CODE_TYPEDEF) /* array access type. */
- value = ada_coerce_to_simple_array_ptr (value);
+ value = ada_coerce_to_simple_array_ptr (value);
else
- value = ada_coerce_to_simple_array (value);
+ value = ada_coerce_to_simple_array (value);
}
else
value = ada_to_fixed_value (value);
\f
- /* Language Selection */
+ /* Language Selection */
/* If the main program is in Ada, return language_ada, otherwise return LANG
(the main program is in Ada iif the adainit symbol is found). */
{
CORE_ADDR main_program_name_addr = BMSYMBOL_VALUE_ADDRESS (msym);
if (main_program_name_addr == 0)
- error (_("Invalid address for Ada main program name."));
+ error (_("Invalid address for Ada main program name."));
main_program_name = target_read_string (main_program_name_addr, 1024);
return main_program_name.get ();
return NULL;
}
\f
- /* Symbols */
+ /* Symbols */
/* Table of Ada operators and their GNAT-encoded names. Last entry is pair
of NULLs. */
if (*p == '.')
encoding_buffer.append ("__");
else if (*p == '"')
- {
- const struct ada_opname_map *mapping;
-
- for (mapping = ada_opname_table;
- mapping->encoded != NULL
- && !startswith (p, mapping->decoded); mapping += 1)
- ;
- if (mapping->encoded == NULL)
+ {
+ const struct ada_opname_map *mapping;
+
+ for (mapping = ada_opname_table;
+ mapping->encoded != NULL
+ && !startswith (p, mapping->decoded); mapping += 1)
+ ;
+ if (mapping->encoded == NULL)
{
if (throw_errors)
error (_("invalid Ada operator name: %s"), p);
return {};
}
encoding_buffer.append (mapping->encoded);
- break;
- }
+ break;
+ }
else
encoding_buffer.push_back (*p);
}
int i;
for (i = 0; i <= len; i += 1)
- fold_buffer[i] = tolower (name[i]);
+ fold_buffer[i] = tolower (name[i]);
}
return fold_buffer;
int i = *len - 2;
while (i > 0 && isdigit (encoded[i]))
- i--;
+ i--;
if (i >= 0 && encoded[i] == '.')
- *len = i;
+ *len = i;
else if (i >= 0 && encoded[i] == '$')
- *len = i;
+ *len = i;
else if (i >= 2 && startswith (encoded + i - 2, "___"))
- *len = i - 2;
+ *len = i - 2;
else if (i >= 1 && startswith (encoded + i - 1, "__"))
- *len = i - 1;
+ *len = i - 1;
}
}
if (p != NULL && p - encoded < len0 - 3)
{
if (p[3] == 'X')
- len0 = p - encoded;
+ len0 = p - encoded;
else
- goto Suppress;
+ goto Suppress;
}
/* Remove any trailing TKB suffix. It tells us that this symbol
{
i = len0 - 2;
while ((i >= 0 && isdigit (encoded[i]))
- || (i >= 1 && encoded[i] == '_' && isdigit (encoded[i - 1])))
- i -= 1;
+ || (i >= 1 && encoded[i] == '_' && isdigit (encoded[i - 1])))
+ i -= 1;
if (i > 1 && encoded[i] == '_' && encoded[i - 1] == '_')
- len0 = i - 1;
+ len0 = i - 1;
else if (encoded[i] == '$')
- len0 = i;
+ len0 = i;
}
/* The first few characters that are not alphabetic are not part
{
/* Is this a symbol function? */
if (at_start_name && encoded[i] == 'O')
- {
- int k;
-
- for (k = 0; ada_opname_table[k].encoded != NULL; k += 1)
- {
- int op_len = strlen (ada_opname_table[k].encoded);
- if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1,
- op_len - 1) == 0)
- && !isalnum (encoded[i + op_len]))
- {
- strcpy (&decoded.front() + j, ada_opname_table[k].decoded);
- at_start_name = 0;
- i += op_len;
- j += strlen (ada_opname_table[k].decoded);
- break;
- }
- }
- if (ada_opname_table[k].encoded != NULL)
- continue;
- }
+ {
+ int k;
+
+ for (k = 0; ada_opname_table[k].encoded != NULL; k += 1)
+ {
+ int op_len = strlen (ada_opname_table[k].encoded);
+ if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1,
+ op_len - 1) == 0)
+ && !isalnum (encoded[i + op_len]))
+ {
+ strcpy (&decoded.front() + j, ada_opname_table[k].decoded);
+ at_start_name = 0;
+ i += op_len;
+ j += strlen (ada_opname_table[k].decoded);
+ break;
+ }
+ }
+ if (ada_opname_table[k].encoded != NULL)
+ continue;
+ }
at_start_name = 0;
/* Replace "TK__" with "__", which will eventually be translated
- into "." (just below). */
+ into "." (just below). */
if (i < len0 - 4 && startswith (encoded + i, "TK__"))
- i += 2;
+ i += 2;
/* Replace "__B_{DIGITS}+__" sequences by "__", which will eventually
- be translated into "." (just below). These are internal names
- generated for anonymous blocks inside which our symbol is nested. */
+ be translated into "." (just below). These are internal names
+ generated for anonymous blocks inside which our symbol is nested. */
if (len0 - i > 5 && encoded [i] == '_' && encoded [i+1] == '_'
- && encoded [i+2] == 'B' && encoded [i+3] == '_'
- && isdigit (encoded [i+4]))
- {
- int k = i + 5;
-
- while (k < len0 && isdigit (encoded[k]))
- k++; /* Skip any extra digit. */
-
- /* Double-check that the "__B_{DIGITS}+" sequence we found
- is indeed followed by "__". */
- if (len0 - k > 2 && encoded [k] == '_' && encoded [k+1] == '_')
- i = k;
- }
+ && encoded [i+2] == 'B' && encoded [i+3] == '_'
+ && isdigit (encoded [i+4]))
+ {
+ int k = i + 5;
+
+ while (k < len0 && isdigit (encoded[k]))
+ k++; /* Skip any extra digit. */
+
+ /* Double-check that the "__B_{DIGITS}+" sequence we found
+ is indeed followed by "__". */
+ if (len0 - k > 2 && encoded [k] == '_' && encoded [k+1] == '_')
+ i = k;
+ }
/* Remove _E{DIGITS}+[sb] */
/* Just as for protected object subprograms, there are 2 categories
- of subprograms created by the compiler for each entry. The first
- one implements the actual entry code, and has a suffix following
- the convention above; the second one implements the barrier and
- uses the same convention as above, except that the 'E' is replaced
- by a 'B'.
+ of subprograms created by the compiler for each entry. The first
+ one implements the actual entry code, and has a suffix following
+ the convention above; the second one implements the barrier and
+ uses the same convention as above, except that the 'E' is replaced
+ by a 'B'.
- Just as above, we do not decode the name of barrier functions
- to give the user a clue that the code he is debugging has been
- internally generated. */
+ Just as above, we do not decode the name of barrier functions
+ to give the user a clue that the code he is debugging has been
+ internally generated. */
if (len0 - i > 3 && encoded [i] == '_' && encoded[i+1] == 'E'
- && isdigit (encoded[i+2]))
- {
- int k = i + 3;
-
- while (k < len0 && isdigit (encoded[k]))
- k++;
-
- if (k < len0
- && (encoded[k] == 'b' || encoded[k] == 's'))
- {
- k++;
- /* Just as an extra precaution, make sure that if this
- suffix is followed by anything else, it is a '_'.
- Otherwise, we matched this sequence by accident. */
- if (k == len0
- || (k < len0 && encoded[k] == '_'))
- i = k;
- }
- }
+ && isdigit (encoded[i+2]))
+ {
+ int k = i + 3;
+
+ while (k < len0 && isdigit (encoded[k]))
+ k++;
+
+ if (k < len0
+ && (encoded[k] == 'b' || encoded[k] == 's'))
+ {
+ k++;
+ /* Just as an extra precaution, make sure that if this
+ suffix is followed by anything else, it is a '_'.
+ Otherwise, we matched this sequence by accident. */
+ if (k == len0
+ || (k < len0 && encoded[k] == '_'))
+ i = k;
+ }
+ }
/* Remove trailing "N" in [a-z0-9]+N__. The N is added by
- the GNAT front-end in protected object subprograms. */
+ the GNAT front-end in protected object subprograms. */
if (i < len0 + 3
- && encoded[i] == 'N' && encoded[i+1] == '_' && encoded[i+2] == '_')
- {
- /* Backtrack a bit up until we reach either the begining of
- the encoded name, or "__". Make sure that we only find
- digits or lowercase characters. */
- const char *ptr = encoded + i - 1;
-
- while (ptr >= encoded && is_lower_alphanum (ptr[0]))
- ptr--;
- if (ptr < encoded
- || (ptr > encoded && ptr[0] == '_' && ptr[-1] == '_'))
- i++;
- }
+ && encoded[i] == 'N' && encoded[i+1] == '_' && encoded[i+2] == '_')
+ {
+ /* Backtrack a bit up until we reach either the begining of
+ the encoded name, or "__". Make sure that we only find
+ digits or lowercase characters. */
+ const char *ptr = encoded + i - 1;
+
+ while (ptr >= encoded && is_lower_alphanum (ptr[0]))
+ ptr--;
+ if (ptr < encoded
+ || (ptr > encoded && ptr[0] == '_' && ptr[-1] == '_'))
+ i++;
+ }
if (encoded[i] == 'X' && i != 0 && isalnum (encoded[i - 1]))
- {
- /* This is a X[bn]* sequence not separated from the previous
- part of the name with a non-alpha-numeric character (in other
- words, immediately following an alpha-numeric character), then
- verify that it is placed at the end of the encoded name. If
- not, then the encoding is not valid and we should abort the
- decoding. Otherwise, just skip it, it is used in body-nested
- package names. */
- do
- i += 1;
- while (i < len0 && (encoded[i] == 'b' || encoded[i] == 'n'));
- if (i < len0)
- goto Suppress;
- }
+ {
+ /* This is a X[bn]* sequence not separated from the previous
+ part of the name with a non-alpha-numeric character (in other
+ words, immediately following an alpha-numeric character), then
+ verify that it is placed at the end of the encoded name. If
+ not, then the encoding is not valid and we should abort the
+ decoding. Otherwise, just skip it, it is used in body-nested
+ package names. */
+ do
+ i += 1;
+ while (i < len0 && (encoded[i] == 'b' || encoded[i] == 'n'));
+ if (i < len0)
+ goto Suppress;
+ }
else if (i < len0 - 2 && encoded[i] == '_' && encoded[i + 1] == '_')
- {
- /* Replace '__' by '.'. */
- decoded[j] = '.';
- at_start_name = 1;
- i += 2;
- j += 1;
- }
+ {
+ /* Replace '__' by '.'. */
+ decoded[j] = '.';
+ at_start_name = 1;
+ i += 2;
+ j += 1;
+ }
else
- {
- /* It's a character part of the decoded name, so just copy it
- over. */
- decoded[j] = encoded[i];
- i += 1;
- j += 1;
- }
+ {
+ /* It's a character part of the decoded name, so just copy it
+ over. */
+ decoded[j] = encoded[i];
+ i += 1;
+ j += 1;
+ }
}
decoded.resize (j);
if (obstack != NULL)
*resultp = obstack_strdup (obstack, decoded.c_str ());
else
- {
+ {
/* Sometimes, we can't find a corresponding objfile, in
which case, we put the result on the heap. Since we only
decode when needed, we hope this usually does not cause a
significant memory leak (FIXME). */
- char **slot = (char **) htab_find_slot (decoded_names_store,
- decoded.c_str (), INSERT);
+ char **slot = (char **) htab_find_slot (decoded_names_store,
+ decoded.c_str (), INSERT);
- if (*slot == NULL)
- *slot = xstrdup (decoded.c_str ());
- *resultp = *slot;
- }
+ if (*slot == NULL)
+ *slot = xstrdup (decoded.c_str ());
+ *resultp = *slot;
+ }
}
return *resultp;
\f
- /* Arrays */
+ /* Arrays */
/* Assuming that INDEX_DESC_TYPE is an ___XA structure, a structure
generated by the GNAT compiler to describe the index type used
is not equal to the field name. */
if (index_desc_type->field (0).type ()->name () != NULL
&& strcmp (index_desc_type->field (0).type ()->name (),
- TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
+ TYPE_FIELD_NAME (index_desc_type, 0)) == 0)
return;
/* Fixup each field of INDEX_DESC_TYPE. */
if (type != NULL
&& (type->code () == TYPE_CODE_PTR
- || type->code () == TYPE_CODE_REF))
+ || type->code () == TYPE_CODE_REF))
return ada_check_typedef (TYPE_TARGET_TYPE (type));
else
return type;
struct type *alt_type = ada_find_parallel_type (base_type, "___XVE");
if (alt_type == NULL)
- return base_type;
+ return base_type;
else
- return alt_type;
+ return alt_type;
}
}
{
type = desc_base_type (type);
return (type != NULL && type->code () == TYPE_CODE_STRUCT
- && lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL);
+ && lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL);
}
/* If TYPE is the type of an array descriptor (fat or thin pointer) or a
{
type = thin_descriptor_type (type);
if (type == NULL)
- return NULL;
+ return NULL;
r = lookup_struct_elt_type (type, "BOUNDS", 1);
if (r != NULL)
- return ada_check_typedef (r);
+ return ada_check_typedef (r);
}
else if (type->code () == TYPE_CODE_STRUCT)
{
r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
if (r != NULL)
- return ada_check_typedef (TYPE_TARGET_TYPE (ada_check_typedef (r)));
+ return ada_check_typedef (TYPE_TARGET_TYPE (ada_check_typedef (r)));
}
return NULL;
}
if (is_thin_pntr (type))
{
struct type *bounds_type =
- desc_bounds_type (thin_descriptor_type (type));
+ desc_bounds_type (thin_descriptor_type (type));
LONGEST addr;
if (bounds_type == NULL)
- error (_("Bad GNAT array descriptor"));
+ error (_("Bad GNAT array descriptor"));
/* NOTE: The following calculation is not really kosher, but
- since desc_type is an XVE-encoded type (and shouldn't be),
- the correct calculation is a real pain. FIXME (and fix GCC). */
+ since desc_type is an XVE-encoded type (and shouldn't be),
+ the correct calculation is a real pain. FIXME (and fix GCC). */
if (type->code () == TYPE_CODE_PTR)
- addr = value_as_long (arr);
+ addr = value_as_long (arr);
else
- addr = value_address (arr);
+ addr = value_address (arr);
return
- value_from_longest (lookup_pointer_type (bounds_type),
- addr - TYPE_LENGTH (bounds_type));
+ value_from_longest (lookup_pointer_type (bounds_type),
+ addr - TYPE_LENGTH (bounds_type));
}
else if (is_thick_pntr (type))
return thin_data_pntr (arr);
else if (is_thick_pntr (type))
return value_struct_elt (&arr, NULL, "P_ARRAY", NULL,
- _("Bad GNAT array descriptor"));
+ _("Bad GNAT array descriptor"));
else
return NULL;
}
xsnprintf (bound_name, sizeof (bound_name), "%cB%d",
which ? 'U' : 'L', i - 1);
return value_struct_elt (&bounds, NULL, bound_name, NULL,
- _("Bad GNAT array descriptor bounds"));
+ _("Bad GNAT array descriptor bounds"));
}
/* If BOUNDS is an array-bounds structure type, return the bit position
return 0;
type = ada_check_typedef (type);
return (type->code () == TYPE_CODE_ARRAY
- || ada_is_array_descriptor_type (type));
+ || ada_is_array_descriptor_type (type));
}
/* Non-zero iff TYPE represents any kind of array in Ada, or a pointer
type != NULL
&& type->code () == TYPE_CODE_STRUCT
&& (lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL
- || lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL)
+ || lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL)
&& !ada_is_array_descriptor_type (type);
}
arity = ada_array_arity (value_type (arr));
if (elt_type == NULL || arity == 0)
- return ada_check_typedef (value_type (arr));
+ return ada_check_typedef (value_type (arr));
descriptor = desc_bounds (arr);
if (value_as_long (descriptor) == 0)
- return NULL;
+ return NULL;
while (arity > 0)
- {
- struct type *range_type = alloc_type_copy (value_type (arr));
- struct type *array_type = alloc_type_copy (value_type (arr));
- struct value *low = desc_one_bound (descriptor, arity, 0);
- struct value *high = desc_one_bound (descriptor, arity, 1);
-
- arity -= 1;
- create_static_range_type (range_type, value_type (low),
+ {
+ struct type *range_type = alloc_type_copy (value_type (arr));
+ struct type *array_type = alloc_type_copy (value_type (arr));
+ struct value *low = desc_one_bound (descriptor, arity, 0);
+ struct value *high = desc_one_bound (descriptor, arity, 1);
+
+ arity -= 1;
+ create_static_range_type (range_type, value_type (low),
longest_to_int (value_as_long (low)),
longest_to_int (value_as_long (high)));
- elt_type = create_array_type (array_type, elt_type, range_type);
+ elt_type = create_array_type (array_type, elt_type, range_type);
if (ada_is_unconstrained_packed_array_type (value_type (arr)))
{
/* We need to store the element packed bitsize, as well as
- recompute the array size, because it was previously
+ recompute the array size, because it was previously
computed based on the unpacked element size. */
LONGEST lo = value_as_long (low);
LONGEST hi = value_as_long (high);
TYPE_FIELD_BITSIZE (elt_type, 0) =
decode_packed_array_bitsize (value_type (arr));
/* If the array has no element, then the size is already
- zero, and does not need to be recomputed. */
+ zero, and does not need to be recomputed. */
if (lo < hi)
{
int array_bitsize =
- (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0);
+ (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0);
TYPE_LENGTH (array_type) = (array_bitsize + 7) / 8;
}
}
- }
+ }
return lookup_pointer_type (elt_type);
}
struct type *arrType = ada_type_of_array (arr, 1);
if (arrType == NULL)
- return NULL;
+ return NULL;
return value_cast (arrType, value_copy (desc_data (arr)));
}
else if (ada_is_constrained_packed_array_type (value_type (arr)))
struct value *arrVal = ada_coerce_to_simple_array_ptr (arr);
if (arrVal == NULL)
- error (_("Bounds unavailable for null array pointer."));
+ error (_("Bounds unavailable for null array pointer."));
ada_ensure_varsize_limit (TYPE_TARGET_TYPE (value_type (arrVal)));
return value_ind (arrVal);
}
{
*elt_bits *= (high_bound - low_bound + 1);
TYPE_LENGTH (new_type) =
- (*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
+ (*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
}
new_type->set_is_fixed_instance (true);
for (i = 0; i < arity; i += 1)
{
if (elt_type->code () != TYPE_CODE_ARRAY
- || TYPE_FIELD_BITSIZE (elt_type, 0) == 0)
- error
- (_("attempt to do packed indexing of "
+ || TYPE_FIELD_BITSIZE (elt_type, 0) == 0)
+ error
+ (_("attempt to do packed indexing of "
"something other than a packed array"));
else
- {
- struct type *range_type = elt_type->index_type ();
- LONGEST lowerbound, upperbound;
- LONGEST idx;
-
- if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
- {
- lim_warning (_("don't know bounds of array"));
- lowerbound = upperbound = 0;
- }
-
- idx = pos_atr (ind[i]);
- if (idx < lowerbound || idx > upperbound)
- lim_warning (_("packed array index %ld out of bounds"),
+ {
+ struct type *range_type = elt_type->index_type ();
+ LONGEST lowerbound, upperbound;
+ LONGEST idx;
+
+ if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
+ {
+ lim_warning (_("don't know bounds of array"));
+ lowerbound = upperbound = 0;
+ }
+
+ idx = pos_atr (ind[i]);
+ if (idx < lowerbound || idx > upperbound)
+ lim_warning (_("packed array index %ld out of bounds"),
(long) idx);
- bits = TYPE_FIELD_BITSIZE (elt_type, 0);
- elt_total_bit_offset += (idx - lowerbound) * bits;
- elt_type = ada_check_typedef (TYPE_TARGET_TYPE (elt_type));
- }
+ bits = TYPE_FIELD_BITSIZE (elt_type, 0);
+ elt_total_bit_offset += (idx - lowerbound) * bits;
+ elt_type = ada_check_typedef (TYPE_TARGET_TYPE (elt_type));
+ }
}
elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
bit_off = elt_total_bit_offset % HOST_CHAR_BIT;
v = ada_value_primitive_packed_val (arr, NULL, elt_off, bit_off,
- bits, elt_type);
+ bits, elt_type);
return v;
}
int src_bytes_left; /* Number of source bytes left to process. */
int srcBitsLeft; /* Number of source bits left to move */
int unusedLS; /* Number of bits in next significant
- byte of source that are unused */
+ byte of source that are unused */
int unpacked_idx; /* Index into the unpacked buffer */
int unpacked_bytes_left; /* Number of bytes left to set in unpacked. */
src_idx = src_len - 1;
if (is_signed_type
&& ((src[0] << bit_offset) & (1 << (HOST_CHAR_BIT - 1))))
- sign = ~0;
+ sign = ~0;
unusedLS =
- (HOST_CHAR_BIT - (bit_size + bit_offset) % HOST_CHAR_BIT)
- % HOST_CHAR_BIT;
+ (HOST_CHAR_BIT - (bit_size + bit_offset) % HOST_CHAR_BIT)
+ % HOST_CHAR_BIT;
if (is_scalar)
{
- accumSize = 0;
- unpacked_idx = unpacked_len - 1;
+ accumSize = 0;
+ unpacked_idx = unpacked_len - 1;
}
else
{
- /* Non-scalar values must be aligned at a byte boundary... */
- accumSize =
- (HOST_CHAR_BIT - bit_size % HOST_CHAR_BIT) % HOST_CHAR_BIT;
- /* ... And are placed at the beginning (most-significant) bytes
- of the target. */
- unpacked_idx = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT - 1;
- unpacked_bytes_left = unpacked_idx + 1;
+ /* Non-scalar values must be aligned at a byte boundary... */
+ accumSize =
+ (HOST_CHAR_BIT - bit_size % HOST_CHAR_BIT) % HOST_CHAR_BIT;
+ /* ... And are placed at the beginning (most-significant) bytes
+ of the target. */
+ unpacked_idx = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT - 1;
+ unpacked_bytes_left = unpacked_idx + 1;
}
}
else
accumSize = 0;
if (is_signed_type && (src[src_len - 1] & (1 << sign_bit_offset)))
- sign = ~0;
+ sign = ~0;
}
accum = 0;
while (src_bytes_left > 0)
{
/* Mask for removing bits of the next source byte that are not
- part of the value. */
+ part of the value. */
unsigned int unusedMSMask =
- (1 << (srcBitsLeft >= HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft)) -
- 1;
+ (1 << (srcBitsLeft >= HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft)) -
+ 1;
/* Sign-extend bits for this byte. */
unsigned int signMask = sign & ~unusedMSMask;
accum |=
- (((src[src_idx] >> unusedLS) & unusedMSMask) | signMask) << accumSize;
+ (((src[src_idx] >> unusedLS) & unusedMSMask) | signMask) << accumSize;
accumSize += HOST_CHAR_BIT - unusedLS;
if (accumSize >= HOST_CHAR_BIT)
- {
- unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT);
- accumSize -= HOST_CHAR_BIT;
- accum >>= HOST_CHAR_BIT;
- unpacked_bytes_left -= 1;
- unpacked_idx += delta;
- }
+ {
+ unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT);
+ accumSize -= HOST_CHAR_BIT;
+ accum >>= HOST_CHAR_BIT;
+ unpacked_bytes_left -= 1;
+ unpacked_idx += delta;
+ }
srcBitsLeft -= HOST_CHAR_BIT - unusedLS;
unusedLS = 0;
src_bytes_left -= 1;
struct value *
ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
long offset, int bit_offset, int bit_size,
- struct type *type)
+ struct type *type)
{
struct value *v;
const gdb_byte *src; /* First byte containing data to unpack */
staging.resize (staging_len);
ada_unpack_from_contents (src, bit_offset, bit_size,
- staging.data (), staging.size (),
+ staging.data (), staging.size (),
is_big_endian, has_negatives (type),
is_scalar);
type = resolve_dynamic_type (type, staging, 0);
set_value_bitpos (v, bit_offset + value_bitpos (obj));
set_value_bitsize (v, bit_size);
if (value_bitpos (v) >= HOST_CHAR_BIT)
- {
+ {
++new_offset;
- set_value_bitpos (v, value_bitpos (v) - HOST_CHAR_BIT);
- }
+ set_value_bitpos (v, value_bitpos (v) - HOST_CHAR_BIT);
+ }
set_value_offset (v, new_offset);
/* Also set the parent value. This is needed when trying to
if (VALUE_LVAL (toval) == lval_memory
&& bits > 0
&& (type->code () == TYPE_CODE_FLT
- || type->code () == TYPE_CODE_STRUCT))
+ || type->code () == TYPE_CODE_STRUCT))
{
int len = (value_bitpos (toval)
+ bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
CORE_ADDR to_addr = value_address (toval);
if (type->code () == TYPE_CODE_FLT)
- fromval = value_cast (type, fromval);
+ fromval = value_cast (type, fromval);
read_memory (to_addr, buffer, len);
from_size = value_bitsize (fromval);
val = value_copy (toval);
memcpy (value_contents_raw (val), value_contents (fromval),
- TYPE_LENGTH (type));
+ TYPE_LENGTH (type));
deprecated_set_value_type (val, type);
return val;
int src_offset;
if (is_scalar_type (check_typedef (value_type (component))))
- src_offset
+ src_offset
= TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits;
else
src_offset = 0;
struct type *saved_elt_type = TYPE_TARGET_TYPE (elt_type);
if (elt_type->code () != TYPE_CODE_ARRAY)
- error (_("too many subscripts (%d expected)"), k);
+ error (_("too many subscripts (%d expected)"), k);
elt = value_subscript (elt, pos_atr (ind[k]));
LONGEST lwb, upb;
if (type->code () != TYPE_CODE_ARRAY)
- error (_("too many subscripts (%d expected)"), k);
+ error (_("too many subscripts (%d expected)"), k);
arr = value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
- value_copy (arr));
+ value_copy (arr));
get_discrete_bounds (type->index_type (), &lwb, &upb);
arr = value_ptradd (arr, pos_atr (ind[k]) - lwb);
type = TYPE_TARGET_TYPE (type);
this array is LOW, as per Ada rules. */
static struct value *
ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
- int low, int high)
+ int low, int high)
{
struct type *type0 = ada_check_typedef (type);
struct type *base_index_type = TYPE_TARGET_TYPE (type0->index_type ());
else
while (type->code () == TYPE_CODE_ARRAY)
{
- arity += 1;
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ arity += 1;
+ type = ada_check_typedef (TYPE_TARGET_TYPE (type));
}
return arity;
k = ada_array_arity (type);
if (k == 0)
- return NULL;
+ return NULL;
/* Initially p_array_type = elt_type(*)[]...(k times)...[]. */
if (nindices >= 0 && k > nindices)
- k = nindices;
+ k = nindices;
while (k > 0 && p_array_type != NULL)
- {
- p_array_type = ada_check_typedef (TYPE_TARGET_TYPE (p_array_type));
- k -= 1;
- }
+ {
+ p_array_type = ada_check_typedef (TYPE_TARGET_TYPE (p_array_type));
+ k -= 1;
+ }
return p_array_type;
}
else if (type->code () == TYPE_CODE_ARRAY)
{
while (nindices != 0 && type->code () == TYPE_CODE_ARRAY)
- {
- type = TYPE_TARGET_TYPE (type);
- nindices -= 1;
- }
+ {
+ type = TYPE_TARGET_TYPE (type);
+ nindices -= 1;
+ }
return type;
}
int i;
for (i = 1; i < n; i += 1)
- type = TYPE_TARGET_TYPE (type);
+ type = TYPE_TARGET_TYPE (type);
result_type = TYPE_TARGET_TYPE (type->index_type ());
/* FIXME: The stabs type r(0,0);bound;bound in an array type
- has a target type of TYPE_CODE_UNDEF. We compensate here, but
- perhaps stabsread.c would make more sense. */
+ has a target type of TYPE_CODE_UNDEF. We compensate here, but
+ perhaps stabsread.c would make more sense. */
if (result_type && result_type->code () == TYPE_CODE_UNDEF)
- result_type = NULL;
+ result_type = NULL;
}
else
{
return
(LONGEST) (which == 0
- ? ada_discrete_type_low_bound (index_type)
- : ada_discrete_type_high_bound (index_type));
+ ? ada_discrete_type_low_bound (index_type)
+ : ada_discrete_type_high_bound (index_type));
}
/* Given that arr is an array value, returns the lower bound of the
struct type *arr_type0 = ada_check_typedef (arr_type);
struct type *index_type
= create_static_range_type
- (NULL, TYPE_TARGET_TYPE (arr_type0->index_type ()), low,
+ (NULL, TYPE_TARGET_TYPE (arr_type0->index_type ()), low,
high < low ? low - 1 : high);
struct type *elt_type = ada_array_element_type (arr_type0, 1);
}
\f
- /* Name resolution */
+ /* Name resolution */
/* The "decoded" name for the user-definable Ada operator corresponding
to OP. */
for (i = 0; ada_opname_table[i].encoded != NULL; i += 1)
{
if (ada_opname_table[i].op == op)
- return ada_opname_table[i].decoded;
+ return ada_opname_table[i].decoded;
}
error (_("Could not find operator name for opcode"));
}
int k0, k1;
for (k0 = strlen (N0) - 1; k0 > 0 && isdigit (N0[k0]); k0 -= 1)
- ;
+ ;
for (k1 = strlen (N1) - 1; k1 > 0 && isdigit (N1[k1]); k1 -= 1)
- ;
+ ;
if ((N0[k0] == '_' || N0[k0] == '$') && N0[k0 + 1] != '\000'
- && (N1[k1] == '_' || N1[k1] == '$') && N1[k1 + 1] != '\000')
- {
- int n0, n1;
-
- n0 = k0;
- while (N0[n0] == '_' && n0 > 0 && N0[n0 - 1] == '_')
- n0 -= 1;
- n1 = k1;
- while (N1[n1] == '_' && n1 > 0 && N1[n1 - 1] == '_')
- n1 -= 1;
- if (n0 == n1 && strncmp (N0, N1, n0) == 0)
- return (atoi (N0 + k0 + 1) < atoi (N1 + k1 + 1));
- }
+ && (N1[k1] == '_' || N1[k1] == '$') && N1[k1 + 1] != '\000')
+ {
+ int n0, n1;
+
+ n0 = k0;
+ while (N0[n0] == '_' && n0 > 0 && N0[n0 - 1] == '_')
+ n0 -= 1;
+ n1 = k1;
+ while (N1[n1] == '_' && n1 > 0 && N1[n1 - 1] == '_')
+ n1 -= 1;
+ if (n0 == n1 && strncmp (N0, N1, n0) == 0)
+ return (atoi (N0 + k0 + 1) < atoi (N1 + k1 + 1));
+ }
return (strcmp (N0, N1) < 0);
}
}
int j;
for (j = i - 1; j >= 0; j -= 1)
- {
- if (encoded_ordered_before (syms[j].symbol->linkage_name (),
- sym.symbol->linkage_name ()))
- break;
- syms[j + 1] = syms[j];
- }
+ {
+ if (encoded_ordered_before (syms[j].symbol->linkage_name (),
+ sym.symbol->linkage_name ()))
+ break;
+ syms[j + 1] = syms[j];
+ }
syms[j + 1] = sym;
}
}
static int
get_selections (int *choices, int n_choices, int max_results,
- int is_all_choice, const char *annotation_suffix)
+ int is_all_choice, const char *annotation_suffix)
{
const char *args;
const char *prompt;
args = skip_spaces (args);
if (*args == '\0' && n_chosen == 0)
- error_no_arg (_("one or more choice numbers"));
+ error_no_arg (_("one or more choice numbers"));
else if (*args == '\0')
- break;
+ break;
choice = strtol (args, &args2, 10);
if (args == args2 || choice < 0
- || choice > n_choices + first_choice - 1)
- error (_("Argument must be choice number"));
+ || choice > n_choices + first_choice - 1)
+ error (_("Argument must be choice number"));
args = args2;
if (choice == 0)
- error (_("cancelled"));
+ error (_("cancelled"));
if (choice < first_choice)
- {
- n_chosen = n_choices;
- for (j = 0; j < n_choices; j += 1)
- choices[j] = j;
- break;
- }
+ {
+ n_chosen = n_choices;
+ for (j = 0; j < n_choices; j += 1)
+ choices[j] = j;
+ break;
+ }
choice -= first_choice;
for (j = n_chosen - 1; j >= 0 && choice < choices[j]; j -= 1)
- {
- }
+ {
+ }
if (j < 0 || choice != choices[j])
- {
- int k;
+ {
+ int k;
- for (k = n_chosen - 1; k > j; k -= 1)
- choices[k + 1] = choices[k];
- choices[j + 1] = choice;
- n_chosen += 1;
- }
+ for (k = n_chosen - 1; k > j; k -= 1)
+ choices[k + 1] = choices[k];
+ choices[j + 1] = choice;
+ n_chosen += 1;
+ }
}
if (n_chosen > max_results)
for (i = 0; i < nsyms; i += 1)
{
if (syms[i].symbol == NULL)
- continue;
+ continue;
if (SYMBOL_CLASS (syms[i].symbol) == LOC_BLOCK)
- {
- struct symtab_and_line sal =
- find_function_start_sal (syms[i].symbol, 1);
+ {
+ struct symtab_and_line sal =
+ find_function_start_sal (syms[i].symbol, 1);
printf_filtered ("[%d] ", i + first_choice);
ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
styled_string (file_name_style.style (),
symtab_to_filename_for_display (sal.symtab)),
sal.line);
- continue;
- }
+ continue;
+ }
else
- {
- int is_enumeral =
- (SYMBOL_CLASS (syms[i].symbol) == LOC_CONST
- && SYMBOL_TYPE (syms[i].symbol) != NULL
- && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM);
+ {
+ int is_enumeral =
+ (SYMBOL_CLASS (syms[i].symbol) == LOC_CONST
+ && SYMBOL_TYPE (syms[i].symbol) != NULL
+ && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM);
struct symtab *symtab = NULL;
if (SYMBOL_OBJFILE_OWNED (syms[i].symbol))
symtab = symbol_symtab (syms[i].symbol);
- if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL)
+ if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL)
{
printf_filtered ("[%d] ", i + first_choice);
ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
symtab_to_filename_for_display (symtab),
SYMBOL_LINE (syms[i].symbol));
}
- else if (is_enumeral
- && SYMBOL_TYPE (syms[i].symbol)->name () != NULL)
- {
- printf_filtered (("[%d] "), i + first_choice);
- ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
- gdb_stdout, -1, 0, &type_print_raw_options);
- printf_filtered (_("'(%s) (enumeral)\n"),
+ else if (is_enumeral
+ && SYMBOL_TYPE (syms[i].symbol)->name () != NULL)
+ {
+ printf_filtered (("[%d] "), i + first_choice);
+ ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
+ gdb_stdout, -1, 0, &type_print_raw_options);
+ printf_filtered (_("'(%s) (enumeral)\n"),
syms[i].symbol->print_name ());
- }
+ }
else
{
printf_filtered ("[%d] ", i + first_choice);
? _(" (enumeral)\n")
: _(" at ?\n"));
}
- }
+ }
}
n_chosen = get_selections (chosen, nsyms, max_results, max_results > 1,
- "overload-choice");
+ "overload-choice");
for (i = 0; i < n_chosen; i += 1)
syms[i] = syms[chosen[i]];
static struct value *
resolve_subexp (expression_up *expp, int *pos, int deprocedure_p,
- struct type *context_type, int parse_completion,
+ struct type *context_type, int parse_completion,
innermost_block_tracker *tracker)
{
int pc = *pos;
{
case OP_FUNCALL:
if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
- && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
- *pos += 7;
+ && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
+ *pos += 7;
else
- {
- *pos += 3;
- resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
- }
+ {
+ *pos += 3;
+ resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
+ }
nargs = longest_to_int (exp->elts[pc + 1].longconst);
break;
case BINOP_ASSIGN:
{
- struct value *arg1;
-
- *pos += 1;
- arg1 = resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
- if (arg1 == NULL)
- resolve_subexp (expp, pos, 1, NULL, parse_completion, tracker);
- else
- resolve_subexp (expp, pos, 1, value_type (arg1), parse_completion,
+ struct value *arg1;
+
+ *pos += 1;
+ arg1 = resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker);
+ if (arg1 == NULL)
+ resolve_subexp (expp, pos, 1, NULL, parse_completion, tracker);
+ else
+ resolve_subexp (expp, pos, 1, value_type (arg1), parse_completion,
tracker);
- break;
+ break;
}
case UNOP_CAST:
case OP_VAR_VALUE:
if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
- {
- std::vector<struct block_symbol> candidates;
- int n_candidates;
-
- n_candidates =
- ada_lookup_symbol_list (exp->elts[pc + 2].symbol->linkage_name (),
- exp->elts[pc + 1].block, VAR_DOMAIN,
- &candidates);
-
- if (n_candidates > 1)
- {
- /* Types tend to get re-introduced locally, so if there
- are any local symbols that are not types, first filter
- out all types. */
- int j;
- for (j = 0; j < n_candidates; j += 1)
- switch (SYMBOL_CLASS (candidates[j].symbol))
- {
- case LOC_REGISTER:
- case LOC_ARG:
- case LOC_REF_ARG:
- case LOC_REGPARM_ADDR:
- case LOC_LOCAL:
- case LOC_COMPUTED:
- goto FoundNonType;
- default:
- break;
- }
- FoundNonType:
- if (j < n_candidates)
- {
- j = 0;
- while (j < n_candidates)
- {
- if (SYMBOL_CLASS (candidates[j].symbol) == LOC_TYPEDEF)
- {
- candidates[j] = candidates[n_candidates - 1];
- n_candidates -= 1;
- }
- else
- j += 1;
- }
- }
- }
-
- if (n_candidates == 0)
- error (_("No definition found for %s"),
- exp->elts[pc + 2].symbol->print_name ());
- else if (n_candidates == 1)
- i = 0;
- else if (deprocedure_p
- && !is_nonfunction (candidates.data (), n_candidates))
- {
- i = ada_resolve_function
- (candidates.data (), n_candidates, NULL, 0,
- exp->elts[pc + 2].symbol->linkage_name (),
- context_type, parse_completion);
- if (i < 0)
- error (_("Could not find a match for %s"),
- exp->elts[pc + 2].symbol->print_name ());
- }
- else
- {
- printf_filtered (_("Multiple matches for %s\n"),
- exp->elts[pc + 2].symbol->print_name ());
- user_select_syms (candidates.data (), n_candidates, 1);
- i = 0;
- }
-
- exp->elts[pc + 1].block = candidates[i].block;
- exp->elts[pc + 2].symbol = candidates[i].symbol;
+ {
+ std::vector<struct block_symbol> candidates;
+ int n_candidates;
+
+ n_candidates =
+ ada_lookup_symbol_list (exp->elts[pc + 2].symbol->linkage_name (),
+ exp->elts[pc + 1].block, VAR_DOMAIN,
+ &candidates);
+
+ if (n_candidates > 1)
+ {
+ /* Types tend to get re-introduced locally, so if there
+ are any local symbols that are not types, first filter
+ out all types. */
+ int j;
+ for (j = 0; j < n_candidates; j += 1)
+ switch (SYMBOL_CLASS (candidates[j].symbol))
+ {
+ case LOC_REGISTER:
+ case LOC_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM_ADDR:
+ case LOC_LOCAL:
+ case LOC_COMPUTED:
+ goto FoundNonType;
+ default:
+ break;
+ }
+ FoundNonType:
+ if (j < n_candidates)
+ {
+ j = 0;
+ while (j < n_candidates)
+ {
+ if (SYMBOL_CLASS (candidates[j].symbol) == LOC_TYPEDEF)
+ {
+ candidates[j] = candidates[n_candidates - 1];
+ n_candidates -= 1;
+ }
+ else
+ j += 1;
+ }
+ }
+ }
+
+ if (n_candidates == 0)
+ error (_("No definition found for %s"),
+ exp->elts[pc + 2].symbol->print_name ());
+ else if (n_candidates == 1)
+ i = 0;
+ else if (deprocedure_p
+ && !is_nonfunction (candidates.data (), n_candidates))
+ {
+ i = ada_resolve_function
+ (candidates.data (), n_candidates, NULL, 0,
+ exp->elts[pc + 2].symbol->linkage_name (),
+ context_type, parse_completion);
+ if (i < 0)
+ error (_("Could not find a match for %s"),
+ exp->elts[pc + 2].symbol->print_name ());
+ }
+ else
+ {
+ printf_filtered (_("Multiple matches for %s\n"),
+ exp->elts[pc + 2].symbol->print_name ());
+ user_select_syms (candidates.data (), n_candidates, 1);
+ i = 0;
+ }
+
+ exp->elts[pc + 1].block = candidates[i].block;
+ exp->elts[pc + 2].symbol = candidates[i].symbol;
tracker->update (candidates[i]);
- }
+ }
if (deprocedure_p
- && (SYMBOL_TYPE (exp->elts[pc + 2].symbol)->code ()
- == TYPE_CODE_FUNC))
- {
- replace_operator_with_call (expp, pc, 0, 4,
- exp->elts[pc + 2].symbol,
- exp->elts[pc + 1].block);
- exp = expp->get ();
- }
+ && (SYMBOL_TYPE (exp->elts[pc + 2].symbol)->code ()
+ == TYPE_CODE_FUNC))
+ {
+ replace_operator_with_call (expp, pc, 0, 4,
+ exp->elts[pc + 2].symbol,
+ exp->elts[pc + 1].block);
+ exp = expp->get ();
+ }
break;
case OP_FUNCALL:
{
- if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
- && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
- {
+ if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
+ && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
+ {
std::vector<struct block_symbol> candidates;
- int n_candidates;
-
- n_candidates =
- ada_lookup_symbol_list (exp->elts[pc + 5].symbol->linkage_name (),
- exp->elts[pc + 4].block, VAR_DOMAIN,
- &candidates);
-
- if (n_candidates == 1)
- i = 0;
- else
- {
- i = ada_resolve_function
- (candidates.data (), n_candidates,
- argvec, nargs,
- exp->elts[pc + 5].symbol->linkage_name (),
- context_type, parse_completion);
- if (i < 0)
- error (_("Could not find a match for %s"),
- exp->elts[pc + 5].symbol->print_name ());
- }
-
- exp->elts[pc + 4].block = candidates[i].block;
- exp->elts[pc + 5].symbol = candidates[i].symbol;
+ int n_candidates;
+
+ n_candidates =
+ ada_lookup_symbol_list (exp->elts[pc + 5].symbol->linkage_name (),
+ exp->elts[pc + 4].block, VAR_DOMAIN,
+ &candidates);
+
+ if (n_candidates == 1)
+ i = 0;
+ else
+ {
+ i = ada_resolve_function
+ (candidates.data (), n_candidates,
+ argvec, nargs,
+ exp->elts[pc + 5].symbol->linkage_name (),
+ context_type, parse_completion);
+ if (i < 0)
+ error (_("Could not find a match for %s"),
+ exp->elts[pc + 5].symbol->print_name ());
+ }
+
+ exp->elts[pc + 4].block = candidates[i].block;
+ exp->elts[pc + 5].symbol = candidates[i].symbol;
tracker->update (candidates[i]);
- }
+ }
}
break;
case BINOP_ADD:
case UNOP_LOGICAL_NOT:
case UNOP_ABS:
if (possible_user_operator_p (op, argvec))
- {
+ {
std::vector<struct block_symbol> candidates;
- int n_candidates;
+ int n_candidates;
- n_candidates =
- ada_lookup_symbol_list (ada_decoded_op_name (op),
+ n_candidates =
+ ada_lookup_symbol_list (ada_decoded_op_name (op),
NULL, VAR_DOMAIN,
- &candidates);
+ &candidates);
- i = ada_resolve_function (candidates.data (), n_candidates, argvec,
+ i = ada_resolve_function (candidates.data (), n_candidates, argvec,
nargs, ada_decoded_op_name (op), NULL,
parse_completion);
- if (i < 0)
- break;
+ if (i < 0)
+ break;
replace_operator_with_call (expp, pc, nargs, 1,
candidates[i].symbol,
candidates[i].block);
- exp = expp->get ();
- }
+ exp = expp->get ();
+ }
break;
case OP_TYPE:
return ftype->code () == atype->code ();
case TYPE_CODE_PTR:
if (atype->code () == TYPE_CODE_PTR)
- return ada_type_match (TYPE_TARGET_TYPE (ftype),
- TYPE_TARGET_TYPE (atype), 0);
+ return ada_type_match (TYPE_TARGET_TYPE (ftype),
+ TYPE_TARGET_TYPE (atype), 0);
else
- return (may_deref
- && ada_type_match (TYPE_TARGET_TYPE (ftype), atype, 0));
+ return (may_deref
+ && ada_type_match (TYPE_TARGET_TYPE (ftype), atype, 0));
case TYPE_CODE_INT:
case TYPE_CODE_ENUM:
case TYPE_CODE_RANGE:
switch (atype->code ())
- {
- case TYPE_CODE_INT:
- case TYPE_CODE_ENUM:
- case TYPE_CODE_RANGE:
- return 1;
- default:
- return 0;
- }
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_RANGE:
+ return 1;
+ default:
+ return 0;
+ }
case TYPE_CODE_ARRAY:
return (atype->code () == TYPE_CODE_ARRAY
- || ada_is_array_descriptor_type (atype));
+ || ada_is_array_descriptor_type (atype));
case TYPE_CODE_STRUCT:
if (ada_is_array_descriptor_type (ftype))
- return (atype->code () == TYPE_CODE_ARRAY
- || ada_is_array_descriptor_type (atype));
+ return (atype->code () == TYPE_CODE_ARRAY
+ || ada_is_array_descriptor_type (atype));
else
- return (atype->code () == TYPE_CODE_STRUCT
- && !ada_is_array_descriptor_type (atype));
+ return (atype->code () == TYPE_CODE_STRUCT
+ && !ada_is_array_descriptor_type (atype));
case TYPE_CODE_UNION:
case TYPE_CODE_FLT:
for (i = 0; i < n_actuals; i += 1)
{
if (actuals[i] == NULL)
- return 0;
+ return 0;
else
- {
- struct type *ftype = ada_check_typedef (func_type->field (i).type ());
- struct type *atype = ada_check_typedef (value_type (actuals[i]));
+ {
+ struct type *ftype = ada_check_typedef (func_type->field (i).type ());
+ struct type *atype = ada_check_typedef (value_type (actuals[i]));
- if (!ada_type_match (ftype, atype, 1))
- return 0;
- }
+ if (!ada_type_match (ftype, atype, 1))
+ return 0;
+ }
}
return 1;
}
static int
ada_resolve_function (struct block_symbol syms[],
- int nsyms, struct value **args, int nargs,
- const char *name, struct type *context_type,
+ int nsyms, struct value **args, int nargs,
+ const char *name, struct type *context_type,
int parse_completion)
{
int fallback;
for (fallback = 0; m == 0 && fallback < 2; fallback++)
{
for (k = 0; k < nsyms; k += 1)
- {
- struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol));
+ {
+ struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol));
- if (ada_args_match (syms[k].symbol, args, nargs)
- && (fallback || return_match (type, context_type)))
- {
- syms[m] = syms[k];
- m += 1;
- }
- }
+ if (ada_args_match (syms[k].symbol, args, nargs)
+ && (fallback || return_match (type, context_type)))
+ {
+ syms[m] = syms[k];
+ m += 1;
+ }
+ }
}
/* If we got multiple matches, ask the user which one to use. Don't do this
static void
replace_operator_with_call (expression_up *expp, int pc, int nargs,
- int oplen, struct symbol *sym,
- const struct block *block)
+ int oplen, struct symbol *sym,
+ const struct block *block)
{
/* A new expression, with 6 more elements (3 for funcall, 4 for function
symbol, -oplen for operator being replaced). */
struct expression *newexp = (struct expression *)
xzalloc (sizeof (struct expression)
- + EXP_ELEM_TO_BYTES ((*expp)->nelts + 7 - oplen));
+ + EXP_ELEM_TO_BYTES ((*expp)->nelts + 7 - oplen));
struct expression *exp = expp->get ();
newexp->nelts = exp->nelts + 7 - oplen;
newexp->gdbarch = exp->gdbarch;
memcpy (newexp->elts, exp->elts, EXP_ELEM_TO_BYTES (pc));
memcpy (newexp->elts + pc + 7, exp->elts + pc + oplen,
- EXP_ELEM_TO_BYTES (exp->nelts - pc - oplen));
+ EXP_ELEM_TO_BYTES (exp->nelts - pc - oplen));
newexp->elts[pc].opcode = newexp->elts[pc + 2].opcode = OP_FUNCALL;
newexp->elts[pc + 1].longconst = (LONGEST) nargs;
else
{
switch (type->code ())
- {
- case TYPE_CODE_INT:
- case TYPE_CODE_FLT:
- return 1;
- case TYPE_CODE_RANGE:
- return (type == TYPE_TARGET_TYPE (type)
- || numeric_type_p (TYPE_TARGET_TYPE (type)));
- default:
- return 0;
- }
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_FLT:
+ return 1;
+ case TYPE_CODE_RANGE:
+ return (type == TYPE_TARGET_TYPE (type)
+ || numeric_type_p (TYPE_TARGET_TYPE (type)));
+ default:
+ return 0;
+ }
}
}
else
{
switch (type->code ())
- {
- case TYPE_CODE_INT:
- return 1;
- case TYPE_CODE_RANGE:
- return (type == TYPE_TARGET_TYPE (type)
- || integer_type_p (TYPE_TARGET_TYPE (type)));
- default:
- return 0;
- }
+ {
+ case TYPE_CODE_INT:
+ return 1;
+ case TYPE_CODE_RANGE:
+ return (type == TYPE_TARGET_TYPE (type)
+ || integer_type_p (TYPE_TARGET_TYPE (type)));
+ default:
+ return 0;
+ }
}
}
else
{
switch (type->code ())
- {
- case TYPE_CODE_INT:
- case TYPE_CODE_RANGE:
- case TYPE_CODE_ENUM:
- case TYPE_CODE_FLT:
- return 1;
- default:
- return 0;
- }
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_RANGE:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_FLT:
+ return 1;
+ default:
+ return 0;
+ }
}
}
else
{
switch (type->code ())
- {
- case TYPE_CODE_INT:
- case TYPE_CODE_RANGE:
- case TYPE_CODE_ENUM:
- case TYPE_CODE_BOOL:
- return 1;
- default:
- return 0;
- }
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_RANGE:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_BOOL:
+ return 1;
+ default:
+ return 0;
+ }
}
}
}
}
\f
- /* Renaming */
+ /* Renaming */
/* NOTES:
}
\f
- /* Evaluation: Function Calls */
+ /* Evaluation: Function Calls */
/* Return an lvalue containing the value VAL. This is the identity on
lvalues, and otherwise has the side-effect of allocating memory
{
int len = TYPE_LENGTH (ada_check_typedef (value_type (val)));
const CORE_ADDR addr =
- value_as_long (value_allocate_space_in_inferior (len));
+ value_as_long (value_allocate_space_in_inferior (len));
VALUE_LVAL (val) = lval_memory;
set_value_address (val, addr);
goto BadValue;
t1 = ada_check_typedef (t1);
if (t1->code () == TYPE_CODE_PTR)
- {
- arg = coerce_ref (arg);
- t = t1;
- }
+ {
+ arg = coerce_ref (arg);
+ t = t1;
+ }
}
while (t->code () == TYPE_CODE_PTR)
goto BadValue;
t1 = ada_check_typedef (t1);
if (t1->code () == TYPE_CODE_PTR)
- {
- arg = value_ind (arg);
- t = t1;
- }
+ {
+ arg = value_ind (arg);
+ t = t1;
+ }
else
- break;
+ break;
}
if (t1->code () != TYPE_CODE_STRUCT && t1->code () != TYPE_CODE_UNION)
address = value_address (ada_coerce_ref (arg));
/* Check to see if this is a tagged type. We also need to handle
- the case where the type is a reference to a tagged type, but
- we have to be careful to exclude pointers to tagged types.
- The latter should be shown as usual (as a pointer), whereas
- a reference should mostly be transparent to the user. */
+ the case where the type is a reference to a tagged type, but
+ we have to be careful to exclude pointers to tagged types.
+ The latter should be shown as usual (as a pointer), whereas
+ a reference should mostly be transparent to the user. */
if (ada_is_tagged_type (t1, 0)
- || (t1->code () == TYPE_CODE_REF
- && ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0)))
- {
- /* We first try to find the searched field in the current type.
+ || (t1->code () == TYPE_CODE_REF
+ && ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0)))
+ {
+ /* We first try to find the searched field in the current type.
If not found then let's look in the fixed type. */
- if (!find_struct_field (name, t1, 0,
- &field_type, &byte_offset, &bit_offset,
- &bit_size, NULL))
+ if (!find_struct_field (name, t1, 0,
+ &field_type, &byte_offset, &bit_offset,
+ &bit_size, NULL))
check_tag = 1;
else
check_tag = 0;
- }
+ }
else
check_tag = 0;
address, NULL, check_tag);
if (find_struct_field (name, t1, 0,
- &field_type, &byte_offset, &bit_offset,
- &bit_size, NULL))
- {
- if (bit_size != 0)
- {
- if (t->code () == TYPE_CODE_REF)
- arg = ada_coerce_ref (arg);
- else
- arg = ada_value_ind (arg);
- v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
- bit_offset, bit_size,
- field_type);
- }
- else
- v = value_at_lazy (field_type, address + byte_offset);
- }
+ &field_type, &byte_offset, &bit_offset,
+ &bit_size, NULL))
+ {
+ if (bit_size != 0)
+ {
+ if (t->code () == TYPE_CODE_REF)
+ arg = ada_coerce_ref (arg);
+ else
+ arg = ada_value_ind (arg);
+ v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
+ bit_offset, bit_size,
+ field_type);
+ }
+ else
+ v = value_at_lazy (field_type, address + byte_offset);
+ }
}
if (v != NULL || no_err)
struct value *result;
if (formal_target->code () == TYPE_CODE_ARRAY
- && ada_is_array_descriptor_type (actual_target))
+ && ada_is_array_descriptor_type (actual_target))
result = desc_data (actual);
else if (formal_type->code () != TYPE_CODE_PTR)
- {
- if (VALUE_LVAL (actual) != lval_memory)
- {
- struct value *val;
-
- actual_type = ada_check_typedef (value_type (actual));
- val = allocate_value (actual_type);
- memcpy ((char *) value_contents_raw (val),
- (char *) value_contents (actual),
- TYPE_LENGTH (actual_type));
- actual = ensure_lval (val);
- }
- result = value_addr (actual);
- }
+ {
+ if (VALUE_LVAL (actual) != lval_memory)
+ {
+ struct value *val;
+
+ actual_type = ada_check_typedef (value_type (actual));
+ val = allocate_value (actual_type);
+ memcpy ((char *) value_contents_raw (val),
+ (char *) value_contents (actual),
+ TYPE_LENGTH (actual_type));
+ actual = ensure_lval (val);
+ }
+ result = value_addr (actual);
+ }
else
return actual;
return value_cast_pointers (formal_type, result, 0);
return descriptor;
}
\f
- /* Symbol Cache Module */
+ /* Symbol Cache Module */
/* Performance measurements made as of 2010-01-15 indicate that
this cache does bring some noticeable improvements. Depending
for (e = &sym_cache->root[h]; *e != NULL; e = &(*e)->next)
{
if (domain == (*e)->domain && strcmp (name, (*e)->name) == 0)
- return e;
+ return e;
}
return NULL;
}
static int
lookup_cached_symbol (const char *name, domain_enum domain,
- struct symbol **sym, const struct block **block)
+ struct symbol **sym, const struct block **block)
{
struct cache_entry **e = find_entry (name, domain);
static void
cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
- const struct block *block)
+ const struct block *block)
{
struct ada_symbol_cache *sym_cache
= ada_get_symbol_cache (current_program_space);
e->block = block;
}
\f
- /* Symbol Lookup */
+ /* Symbol Lookup */
/* Return the symbol name match type that should be used used when
searching for all symbols matching LOOKUP_NAME.
static struct symbol *
standard_lookup (const char *name, const struct block *block,
- domain_enum domain)
+ domain_enum domain)
{
/* Initialize it just to avoid a GCC false warning. */
struct block_symbol sym = {};
for (i = 0; i < n; i += 1)
if (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_FUNC
- && (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM
- || SYMBOL_CLASS (syms[i].symbol) != LOC_CONST))
+ && (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM
+ || SYMBOL_CLASS (syms[i].symbol) != LOC_CONST))
return 1;
return 0;
return 1;
case LOC_TYPEDEF:
{
- struct type *type0 = SYMBOL_TYPE (sym0);
- struct type *type1 = SYMBOL_TYPE (sym1);
- const char *name0 = sym0->linkage_name ();
- const char *name1 = sym1->linkage_name ();
- int len0 = strlen (name0);
-
- return
- type0->code () == type1->code ()
- && (equiv_types (type0, type1)
- || (len0 < strlen (name1) && strncmp (name0, name1, len0) == 0
- && startswith (name1 + len0, "___XV")));
+ struct type *type0 = SYMBOL_TYPE (sym0);
+ struct type *type1 = SYMBOL_TYPE (sym1);
+ const char *name0 = sym0->linkage_name ();
+ const char *name1 = sym1->linkage_name ();
+ int len0 = strlen (name0);
+
+ return
+ type0->code () == type1->code ()
+ && (equiv_types (type0, type1)
+ || (len0 < strlen (name1) && strncmp (name0, name1, len0) == 0
+ && startswith (name1 + len0, "___XV")));
}
case LOC_CONST:
return SYMBOL_VALUE (sym0) == SYMBOL_VALUE (sym1)
- && equiv_types (SYMBOL_TYPE (sym0), SYMBOL_TYPE (sym1));
+ && equiv_types (SYMBOL_TYPE (sym0), SYMBOL_TYPE (sym1));
case LOC_STATIC:
{
- const char *name0 = sym0->linkage_name ();
- const char *name1 = sym1->linkage_name ();
- return (strcmp (name0, name1) == 0
- && SYMBOL_VALUE_ADDRESS (sym0) == SYMBOL_VALUE_ADDRESS (sym1));
+ const char *name0 = sym0->linkage_name ();
+ const char *name1 = sym1->linkage_name ();
+ return (strcmp (name0, name1) == 0
+ && SYMBOL_VALUE_ADDRESS (sym0) == SYMBOL_VALUE_ADDRESS (sym1));
}
default:
static void
add_defn_to_vec (struct obstack *obstackp,
- struct symbol *sym,
- const struct block *block)
+ struct symbol *sym,
+ const struct block *block)
{
int i;
struct block_symbol *prevDefns = defns_collected (obstackp, 0);
for (i = num_defns_collected (obstackp) - 1; i >= 0; i -= 1)
{
if (lesseq_defined_than (sym, prevDefns[i].symbol))
- return;
+ return;
else if (lesseq_defined_than (prevDefns[i].symbol, sym))
- {
- prevDefns[i].symbol = sym;
- prevDefns[i].block = block;
- return;
- }
+ {
+ prevDefns[i].symbol = sym;
+ prevDefns[i].block = block;
+ return;
+ }
}
{
ada_remove_trailing_digits (TYPE_FIELD_NAME (type1, i), &len_1);
ada_remove_trailing_digits (TYPE_FIELD_NAME (type2, i), &len_2);
if (len_1 != len_2
- || strncmp (TYPE_FIELD_NAME (type1, i),
+ || strncmp (TYPE_FIELD_NAME (type1, i),
TYPE_FIELD_NAME (type2, i),
len_1) != 0)
return 0;
/* Quick check: They should all have the same number of enumerals. */
for (i = 1; i < syms.size (); i++)
if (SYMBOL_TYPE (syms[i].symbol)->num_fields ()
- != SYMBOL_TYPE (syms[0].symbol)->num_fields ())
+ != SYMBOL_TYPE (syms[0].symbol)->num_fields ())
return 0;
/* All the sanity checks passed, so we might have a set of
comparison of the type of each symbol. */
for (i = 1; i < syms.size (); i++)
if (!ada_identical_enum_types_p (SYMBOL_TYPE (syms[i].symbol),
- SYMBOL_TYPE (syms[0].symbol)))
+ SYMBOL_TYPE (syms[0].symbol)))
return 0;
return 1;
int remove_p = 0;
/* If two symbols have the same name and one of them is a stub type,
- the get rid of the stub. */
+ the get rid of the stub. */
if (SYMBOL_TYPE ((*syms)[i].symbol)->is_stub ()
- && (*syms)[i].symbol->linkage_name () != NULL)
- {
- for (j = 0; j < syms->size (); j++)
- {
- if (j != i
- && !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub ()
- && (*syms)[j].symbol->linkage_name () != NULL
- && strcmp ((*syms)[i].symbol->linkage_name (),
- (*syms)[j].symbol->linkage_name ()) == 0)
- remove_p = 1;
- }
- }
+ && (*syms)[i].symbol->linkage_name () != NULL)
+ {
+ for (j = 0; j < syms->size (); j++)
+ {
+ if (j != i
+ && !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub ()
+ && (*syms)[j].symbol->linkage_name () != NULL
+ && strcmp ((*syms)[i].symbol->linkage_name (),
+ (*syms)[j].symbol->linkage_name ()) == 0)
+ remove_p = 1;
+ }
+ }
/* Two symbols with the same name, same class and same address
- should be identical. */
+ should be identical. */
else if ((*syms)[i].symbol->linkage_name () != NULL
- && SYMBOL_CLASS ((*syms)[i].symbol) == LOC_STATIC
- && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol)))
- {
- for (j = 0; j < syms->size (); j += 1)
- {
- if (i != j
- && (*syms)[j].symbol->linkage_name () != NULL
- && strcmp ((*syms)[i].symbol->linkage_name (),
- (*syms)[j].symbol->linkage_name ()) == 0
- && SYMBOL_CLASS ((*syms)[i].symbol)
+ && SYMBOL_CLASS ((*syms)[i].symbol) == LOC_STATIC
+ && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol)))
+ {
+ for (j = 0; j < syms->size (); j += 1)
+ {
+ if (i != j
+ && (*syms)[j].symbol->linkage_name () != NULL
+ && strcmp ((*syms)[i].symbol->linkage_name (),
+ (*syms)[j].symbol->linkage_name ()) == 0
+ && SYMBOL_CLASS ((*syms)[i].symbol)
== SYMBOL_CLASS ((*syms)[j].symbol)
- && SYMBOL_VALUE_ADDRESS ((*syms)[i].symbol)
- == SYMBOL_VALUE_ADDRESS ((*syms)[j].symbol))
- remove_p = 1;
- }
- }
+ && SYMBOL_VALUE_ADDRESS ((*syms)[i].symbol)
+ == SYMBOL_VALUE_ADDRESS ((*syms)[j].symbol))
+ remove_p = 1;
+ }
+ }
if (remove_p)
syms->erase (syms->begin () + i);
below has a couple of limitations (FIXME: brobecker-2003-05-12):
- When the user tries to print a rename in a function while there
- is another rename entity defined in a package: Normally, the
- rename in the function has precedence over the rename in the
- package, so the latter should be removed from the list. This is
- currently not the case.
-
+ is another rename entity defined in a package: Normally, the
+ rename in the function has precedence over the rename in the
+ package, so the latter should be removed from the list. This is
+ currently not the case.
+
- This function will incorrectly remove valid renames if
- the CURRENT_BLOCK corresponds to a function which symbol name
- has been changed by an "Export" pragma. As a consequence,
- the user will be unable to print such rename entities. */
+ the CURRENT_BLOCK corresponds to a function which symbol name
+ has been changed by an "Export" pragma. As a consequence,
+ the user will be unable to print such rename entities. */
static int
remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
while (i < syms->size ())
{
if (ada_parse_renaming ((*syms)[i].symbol, NULL, NULL, NULL)
- == ADA_OBJECT_RENAMING
- && old_renaming_is_invisible ((*syms)[i].symbol,
+ == ADA_OBJECT_RENAMING
+ && old_renaming_is_invisible ((*syms)[i].symbol,
current_function_name))
syms->erase (syms->begin () + i);
else
- i += 1;
+ i += 1;
}
return syms->size ();
/* If we found a non-function match, assume that's the one. */
if (is_nonfunction (defns_collected (obstackp, 0),
- num_defns_collected (obstackp)))
- return;
+ num_defns_collected (obstackp)))
+ return;
block = BLOCK_SUPERBLOCK (block);
}
lookup_name_info name1 (bracket_name, symbol_name_match_type::FULL);
for (objfile *objfile : current_program_space->objfiles ())
- {
+ {
data.objfile = objfile;
objfile->sf->qf->map_matching_symbols (objfile, name1,
domain, global, callback,
struct block_symbol
ada_lookup_symbol (const char *name, const struct block *block0,
- domain_enum domain)
+ domain_enum domain)
{
std::vector<struct block_symbol> candidates;
int n_candidates;
{
str += 3;
while (isdigit (str[0]))
- str += 1;
+ str += 1;
}
/* [.$][0-9]+ */
{
matching = str + 1;
while (isdigit (matching[0]))
- matching += 1;
+ matching += 1;
if (matching[0] == '\0')
- return 1;
+ return 1;
}
/* ___[0-9]+ */
{
matching = str + 3;
while (isdigit (matching[0]))
- matching += 1;
+ matching += 1;
if (matching[0] == '\0')
- return 1;
+ return 1;
}
/* "TKB" suffixes are used for subprograms implementing task bodies. */
{
matching = str + 3;
while (isdigit (matching[0]))
- matching += 1;
+ matching += 1;
if ((matching[0] == 'b' || matching[0] == 's')
- && matching [1] == '\0')
- return 1;
+ && matching [1] == '\0')
+ return 1;
}
/* ??? We should not modify STR directly, as we are doing below. This
{
str += 1;
while (str[0] != '_' && str[0] != '\0')
- {
- if (str[0] != 'n' && str[0] != 'b')
- return 0;
- str += 1;
- }
+ {
+ if (str[0] != 'n' && str[0] != 'b')
+ return 0;
+ str += 1;
+ }
}
if (str[0] == '\000')
if (str[0] == '_')
{
if (str[1] != '_' || str[2] == '\000')
- return 0;
+ return 0;
if (str[2] == '_')
- {
- if (strcmp (str + 3, "JM") == 0)
- return 1;
- /* FIXME: brobecker/2004-09-30: GNAT will soon stop using
- the LJM suffix in favor of the JM one. But we will
- still accept LJM as a valid suffix for a reasonable
- amount of time, just to allow ourselves to debug programs
- compiled using an older version of GNAT. */
- if (strcmp (str + 3, "LJM") == 0)
- return 1;
- if (str[3] != 'X')
- return 0;
- if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B'
- || str[4] == 'U' || str[4] == 'P')
- return 1;
- if (str[4] == 'R' && str[5] != 'T')
- return 1;
- return 0;
- }
+ {
+ if (strcmp (str + 3, "JM") == 0)
+ return 1;
+ /* FIXME: brobecker/2004-09-30: GNAT will soon stop using
+ the LJM suffix in favor of the JM one. But we will
+ still accept LJM as a valid suffix for a reasonable
+ amount of time, just to allow ourselves to debug programs
+ compiled using an older version of GNAT. */
+ if (strcmp (str + 3, "LJM") == 0)
+ return 1;
+ if (str[3] != 'X')
+ return 0;
+ if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B'
+ || str[4] == 'U' || str[4] == 'P')
+ return 1;
+ if (str[4] == 'R' && str[5] != 'T')
+ return 1;
+ return 0;
+ }
if (!isdigit (str[2]))
- return 0;
+ return 0;
for (k = 3; str[k] != '\0'; k += 1)
- if (!isdigit (str[k]) && str[k] != '_')
- return 0;
+ if (!isdigit (str[k]) && str[k] != '_')
+ return 0;
return 1;
}
if (str[0] == '$' && isdigit (str[1]))
{
for (k = 2; str[k] != '\0'; k += 1)
- if (!isdigit (str[k]) && str[k] != '_')
- return 0;
+ if (!isdigit (str[k]) && str[k] != '_')
+ return 0;
return 1;
}
return 0;
if (!found_sym && arg_sym != NULL)
{
add_defn_to_vec (obstackp,
- fixup_symbol_section (arg_sym, objfile),
- block);
+ fixup_symbol_section (arg_sym, objfile),
+ block);
}
if (!lookup_name.ada ().wild_match_p ())
ALL_BLOCK_SYMBOLS (block, iter, sym)
{
- if (symbol_matches_domain (sym->language (),
- SYMBOL_DOMAIN (sym), domain))
- {
- int cmp;
-
- cmp = (int) '_' - (int) sym->linkage_name ()[0];
- if (cmp == 0)
- {
- cmp = !startswith (sym->linkage_name (), "_ada_");
- if (cmp == 0)
- cmp = strncmp (name, sym->linkage_name () + 5,
- name_len);
- }
-
- if (cmp == 0
- && is_name_suffix (sym->linkage_name () + name_len + 5))
- {
+ if (symbol_matches_domain (sym->language (),
+ SYMBOL_DOMAIN (sym), domain))
+ {
+ int cmp;
+
+ cmp = (int) '_' - (int) sym->linkage_name ()[0];
+ if (cmp == 0)
+ {
+ cmp = !startswith (sym->linkage_name (), "_ada_");
+ if (cmp == 0)
+ cmp = strncmp (name, sym->linkage_name () + 5,
+ name_len);
+ }
+
+ if (cmp == 0
+ && is_name_suffix (sym->linkage_name () + name_len + 5))
+ {
if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED)
{
if (SYMBOL_IS_ARGUMENT (sym))
block);
}
}
- }
- }
+ }
+ }
}
/* NOTE: This really shouldn't be needed for _ada_ symbols.
- They aren't parameters, right? */
+ They aren't parameters, right? */
if (!found_sym && arg_sym != NULL)
- {
- add_defn_to_vec (obstackp,
- fixup_symbol_section (arg_sym, objfile),
- block);
- }
+ {
+ add_defn_to_vec (obstackp,
+ fixup_symbol_section (arg_sym, objfile),
+ block);
+ }
}
}
\f
- /* Symbol Completion */
+ /* Symbol Completion */
/* See symtab.h. */
if (match && !m_encoded_p)
{
/* One needed check before declaring a positive match is to verify
- that iff we are doing a verbatim match, the decoded version
- of the symbol name starts with '<'. Otherwise, this symbol name
- is not a suitable completion. */
+ that iff we are doing a verbatim match, the decoded version
+ of the symbol name starts with '<'. Otherwise, this symbol name
+ is not a suitable completion. */
bool has_angle_bracket = (decoded_name[0] == '<');
match = (has_angle_bracket == m_verbatim_p);
if (match && !m_verbatim_p)
{
/* When doing non-verbatim match, another check that needs to
- be done is to verify that the potentially matching symbol name
- does not include capital letters, because the ada-mode would
- not be able to understand these symbol names without the
- angle bracket notation. */
+ be done is to verify that the potentially matching symbol name
+ does not include capital letters, because the ada-mode would
+ not be able to understand these symbol names without the
+ angle bracket notation. */
const char *tmp;
for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++);
if (!match && m_wild_match_p)
{
/* Since we are doing wild matching, this means that TEXT
- may represent an unqualified symbol name. We therefore must
- also compare TEXT against the unqualified name of the symbol. */
+ may represent an unqualified symbol name. We therefore must
+ also compare TEXT against the unqualified name of the symbol. */
sym_name = ada_unqualified_name (decoded_name.c_str ());
if (strncmp (sym_name, text, text_len) == 0)
return true;
}
- /* Field Access */
+ /* Field Access */
/* Return non-zero if TYPE is a pointer to the GNAT dispatch table used
for tagged types. */
const char *name = ada_type_name (TYPE_TARGET_TYPE (type));
return (name != NULL
- && strcmp (name, "ada__tags__dispatch_table") == 0);
+ && strcmp (name, "ada__tags__dispatch_table") == 0);
}
}
static struct value *
value_tag_from_contents_and_address (struct type *type,
const gdb_byte *valaddr,
- CORE_ADDR address)
+ CORE_ADDR address)
{
int tag_byte_offset;
struct type *tag_type;
if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset,
- NULL, NULL, NULL))
+ NULL, NULL, NULL))
{
const gdb_byte *valaddr1 = ((valaddr == NULL)
? NULL
for (i = 0; i < type->num_fields (); i += 1)
if (ada_is_parent_field (type, i))
{
- struct type *parent_type = type->field (i).type ();
+ struct type *parent_type = type->field (i).type ();
- /* If the _parent field is a pointer, then dereference it. */
- if (parent_type->code () == TYPE_CODE_PTR)
- parent_type = TYPE_TARGET_TYPE (parent_type);
- /* If there is a parallel XVS type, get the actual base type. */
- parent_type = ada_get_base_type (parent_type);
+ /* If the _parent field is a pointer, then dereference it. */
+ if (parent_type->code () == TYPE_CODE_PTR)
+ parent_type = TYPE_TARGET_TYPE (parent_type);
+ /* If there is a parallel XVS type, get the actual base type. */
+ parent_type = ada_get_base_type (parent_type);
- return ada_check_typedef (parent_type);
+ return ada_check_typedef (parent_type);
}
return NULL;
const char *name = TYPE_FIELD_NAME (ada_check_typedef (type), field_num);
return (name != NULL
- && (startswith (name, "PARENT")
- || startswith (name, "_parent")));
+ && (startswith (name, "PARENT")
+ || startswith (name, "_parent")));
}
/* True iff field number FIELD_NUM of structure type TYPE is a
}
return (name != NULL
- && (startswith (name, "PARENT")
- || strcmp (name, "REP") == 0
- || startswith (name, "_parent")
- || name[0] == 'S' || name[0] == 'R' || name[0] == 'O'));
+ && (startswith (name, "PARENT")
+ || strcmp (name, "REP") == 0
+ || startswith (name, "_parent")
+ || name[0] == 'S' || name[0] == 'R' || name[0] == 'O'));
}
/* True iff field number FIELD_NUM of structure or union type TYPE
discrim_end -= 1)
{
if (startswith (discrim_end, "___XVN"))
- break;
+ break;
}
if (discrim_end == name)
return "";
discrim_start -= 1)
{
if (discrim_start == name + 1)
- return "";
+ return "";
if ((discrim_start > name + 3
- && startswith (discrim_start - 3, "___"))
- || discrim_start[-1] == '.')
- break;
+ && startswith (discrim_start - 3, "___"))
+ || discrim_start[-1] == '.')
+ break;
}
GROW_VECT (result, result_len, discrim_end - discrim_start + 1);
if (str[k] == 'm')
{
if (R != NULL)
- *R = (-(LONGEST) (RU - 1)) - 1;
+ *R = (-(LONGEST) (RU - 1)) - 1;
k += 1;
}
else if (R != NULL)
while (1)
{
switch (name[p])
- {
- case '\0':
- return 0;
- case 'S':
- {
- LONGEST W;
-
- if (!ada_scan_number (name, p + 1, &W, &p))
- return 0;
- if (val == W)
- return 1;
- break;
- }
- case 'R':
- {
- LONGEST L, U;
-
- if (!ada_scan_number (name, p + 1, &L, &p)
- || name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p))
- return 0;
- if (val >= L && val <= U)
- return 1;
- break;
- }
- case 'O':
- return 1;
- default:
- return 0;
- }
+ {
+ case '\0':
+ return 0;
+ case 'S':
+ {
+ LONGEST W;
+
+ if (!ada_scan_number (name, p + 1, &W, &p))
+ return 0;
+ if (val == W)
+ return 1;
+ break;
+ }
+ case 'R':
+ {
+ LONGEST L, U;
+
+ if (!ada_scan_number (name, p + 1, &L, &p)
+ || name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p))
+ return 0;
+ if (val >= L && val <= U)
+ return 1;
+ break;
+ }
+ case 'O':
+ return 1;
+ default:
+ return 0;
+ }
}
}
struct value *
ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
- struct type *arg_type)
+ struct type *arg_type)
{
struct type *type;
int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
return ada_value_primitive_packed_val (arg1, value_contents (arg1),
- offset + bit_pos / 8,
- bit_pos % 8, bit_size, type);
+ offset + bit_pos / 8,
+ bit_pos % 8, bit_size, type);
}
else
return value_primitive_field (arg1, offset, fieldno, arg_type);
has some components with the same name, like in this scenario:
type Top_T is tagged record
- N : Integer := 1;
- U : Integer := 974;
- A : Integer := 48;
+ N : Integer := 1;
+ U : Integer := 974;
+ A : Integer := 48;
end record;
type Middle_T is new Top.Top_T with record
- N : Character := 'a';
- C : Integer := 3;
+ N : Character := 'a';
+ C : Integer := 3;
end record;
type Bottom_T is new Middle.Middle_T with record
- N : Float := 4.0;
- C : Character := '5';
- X : Integer := 6;
- A : Character := 'J';
+ N : Float := 4.0;
+ C : Character := '5';
+ X : Integer := 6;
+ A : Character := 'J';
end record;
Let's say we now have a variable declared and initialized as follow:
static int
find_struct_field (const char *name, struct type *type, int offset,
- struct type **field_type_p,
- int *byte_offset_p, int *bit_offset_p, int *bit_size_p,
+ struct type **field_type_p,
+ int *byte_offset_p, int *bit_offset_p, int *bit_size_p,
int *index_p)
{
int i;
const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name == NULL)
- continue;
+ continue;
else if (ada_is_parent_field (type, i))
- {
+ {
/* This is a field pointing us to the parent type of a tagged
type. As hinted in this function's documentation, we give
preference to fields in the current record first, so what
in the current record, then we'll get back to it and search
inside it whether the field might exist in the parent. */
- parent_offset = i;
- continue;
- }
+ parent_offset = i;
+ continue;
+ }
else if (name != NULL && field_name_match (t_field_name, name))
- {
- int bit_size = TYPE_FIELD_BITSIZE (type, i);
+ {
+ int bit_size = TYPE_FIELD_BITSIZE (type, i);
if (field_type_p != NULL)
*field_type_p = type->field (i).type ();
*bit_offset_p = bit_pos % 8;
if (bit_size_p != NULL)
*bit_size_p = bit_size;
- return 1;
- }
+ return 1;
+ }
else if (ada_is_wrapper_field (type, i))
- {
+ {
if (find_struct_field (name, type->field (i).type (), fld_offset,
field_type_p, byte_offset_p, bit_offset_p,
bit_size_p, index_p))
- return 1;
- }
+ return 1;
+ }
else if (ada_is_variant_part (type, i))
- {
+ {
/* PNH: Wait. Do we ever execute this section, or is ARG always of
fixed type?? */
- int j;
- struct type *field_type
+ int j;
+ struct type *field_type
= ada_check_typedef (type->field (i).type ());
- for (j = 0; j < field_type->num_fields (); j += 1)
- {
- if (find_struct_field (name, field_type->field (j).type (),
- fld_offset
- + TYPE_FIELD_BITPOS (field_type, j) / 8,
- field_type_p, byte_offset_p,
- bit_offset_p, bit_size_p, index_p))
- return 1;
- }
- }
+ for (j = 0; j < field_type->num_fields (); j += 1)
+ {
+ if (find_struct_field (name, field_type->field (j).type (),
+ fld_offset
+ + TYPE_FIELD_BITPOS (field_type, j) / 8,
+ field_type_p, byte_offset_p,
+ bit_offset_p, bit_size_p, index_p))
+ return 1;
+ }
+ }
else if (index_p != NULL)
*index_p += 1;
}
int fld_offset = offset + bit_pos / 8;
if (find_struct_field (name, type->field (parent_offset).type (),
- fld_offset, field_type_p, byte_offset_p,
- bit_offset_p, bit_size_p, index_p))
- return 1;
+ fld_offset, field_type_p, byte_offset_p,
+ bit_offset_p, bit_size_p, index_p))
+ return 1;
}
return 0;
static struct value *
ada_search_struct_field (const char *name, struct value *arg, int offset,
- struct type *type)
+ struct type *type)
{
int i;
int parent_offset = -1;
const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name == NULL)
- continue;
+ continue;
else if (ada_is_parent_field (type, i))
- {
+ {
/* This is a field pointing us to the parent type of a tagged
type. As hinted in this function's documentation, we give
preference to fields in the current record first, so what
in the current record, then we'll get back to it and search
inside it whether the field might exist in the parent. */
- parent_offset = i;
- continue;
- }
+ parent_offset = i;
+ continue;
+ }
else if (field_name_match (t_field_name, name))
- return ada_value_primitive_field (arg, offset, i, type);
+ return ada_value_primitive_field (arg, offset, i, type);
else if (ada_is_wrapper_field (type, i))
- {
- struct value *v = /* Do not let indent join lines here. */
- ada_search_struct_field (name, arg,
- offset + TYPE_FIELD_BITPOS (type, i) / 8,
- type->field (i).type ());
+ {
+ struct value *v = /* Do not let indent join lines here. */
+ ada_search_struct_field (name, arg,
+ offset + TYPE_FIELD_BITPOS (type, i) / 8,
+ type->field (i).type ());
- if (v != NULL)
- return v;
- }
+ if (v != NULL)
+ return v;
+ }
else if (ada_is_variant_part (type, i))
- {
+ {
/* PNH: Do we ever get here? See find_struct_field. */
- int j;
- struct type *field_type = ada_check_typedef (type->field (i).type ());
- int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
+ int j;
+ struct type *field_type = ada_check_typedef (type->field (i).type ());
+ int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
- for (j = 0; j < field_type->num_fields (); j += 1)
- {
- struct value *v = ada_search_struct_field /* Force line
+ for (j = 0; j < field_type->num_fields (); j += 1)
+ {
+ struct value *v = ada_search_struct_field /* Force line
break. */
- (name, arg,
- var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8,
- field_type->field (j).type ());
+ (name, arg,
+ var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8,
+ field_type->field (j).type ());
- if (v != NULL)
- return v;
- }
- }
+ if (v != NULL)
+ return v;
+ }
+ }
}
/* Field not found so far. If this is a tagged type which
type->field (parent_offset).type ());
if (v != NULL)
- return v;
+ return v;
}
return NULL;
for (i = 0; i < type->num_fields (); i += 1)
{
if (TYPE_FIELD_NAME (type, i) == NULL)
- continue;
+ continue;
else if (ada_is_wrapper_field (type, i))
- {
- struct value *v = /* Do not let indent join lines here. */
- ada_index_struct_field_1 (index_p, arg,
+ {
+ struct value *v = /* Do not let indent join lines here. */
+ ada_index_struct_field_1 (index_p, arg,
offset + TYPE_FIELD_BITPOS (type, i) / 8,
type->field (i).type ());
- if (v != NULL)
- return v;
- }
+ if (v != NULL)
+ return v;
+ }
else if (ada_is_variant_part (type, i))
- {
+ {
/* PNH: Do we ever get here? See ada_search_struct_field,
find_struct_field. */
error (_("Cannot assign this kind of variant record"));
- }
+ }
else if (*index_p == 0)
- return ada_value_primitive_field (arg, offset, i, type);
+ return ada_value_primitive_field (arg, offset, i, type);
else
*index_p -= 1;
}
static struct type *
ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
- int noerr)
+ int noerr)
{
int i;
int parent_offset = -1;
if (refok && type != NULL)
while (1)
{
- type = ada_check_typedef (type);
- if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF)
- break;
- type = TYPE_TARGET_TYPE (type);
+ type = ada_check_typedef (type);
+ if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF)
+ break;
+ type = TYPE_TARGET_TYPE (type);
}
if (type == NULL
&& type->code () != TYPE_CODE_UNION))
{
if (noerr)
- return NULL;
+ return NULL;
error (_("Type %s is not a structure or union type"),
type != NULL ? type_as_string (type).c_str () : _("(null)"));
struct type *t;
if (t_field_name == NULL)
- continue;
+ continue;
else if (ada_is_parent_field (type, i))
- {
+ {
/* This is a field pointing us to the parent type of a tagged
type. As hinted in this function's documentation, we give
preference to fields in the current record first, so what
in the current record, then we'll get back to it and search
inside it whether the field might exist in the parent. */
- parent_offset = i;
- continue;
- }
+ parent_offset = i;
+ continue;
+ }
else if (field_name_match (t_field_name, name))
return type->field (i).type ();
else if (ada_is_wrapper_field (type, i))
- {
- t = ada_lookup_struct_elt_type (type->field (i).type (), name,
- 0, 1);
- if (t != NULL)
+ {
+ t = ada_lookup_struct_elt_type (type->field (i).type (), name,
+ 0, 1);
+ if (t != NULL)
return t;
- }
+ }
else if (ada_is_variant_part (type, i))
- {
- int j;
- struct type *field_type = ada_check_typedef (type->field (i).type ());
+ {
+ int j;
+ struct type *field_type = ada_check_typedef (type->field (i).type ());
- for (j = field_type->num_fields () - 1; j >= 0; j -= 1)
- {
+ for (j = field_type->num_fields () - 1; j >= 0; j -= 1)
+ {
/* FIXME pnh 2008/01/26: We check for a field that is
- NOT wrapped in a struct, since the compiler sometimes
+ NOT wrapped in a struct, since the compiler sometimes
generates these for unchecked variant types. Revisit
- if the compiler changes this practice. */
+ if the compiler changes this practice. */
const char *v_field_name = TYPE_FIELD_NAME (field_type, j);
if (v_field_name != NULL
t = ada_lookup_struct_elt_type (field_type->field (j).type (),
name, 0, 1);
- if (t != NULL)
+ if (t != NULL)
return t;
- }
- }
+ }
+ }
}
if (parent_offset != -1)
{
- struct type *t;
+ struct type *t;
- t = ada_lookup_struct_elt_type (type->field (parent_offset).type (),
- name, 0, 1);
- if (t != NULL)
+ t = ada_lookup_struct_elt_type (type->field (parent_offset).type (),
+ name, 0, 1);
+ if (t != NULL)
return t;
}
for (i = 0; i < var_type->num_fields (); i += 1)
{
if (ada_is_others_clause (var_type, i))
- others_clause = i;
+ others_clause = i;
else if (ada_in_variant (discrim_val, var_type, i))
- return i;
+ return i;
}
return others_clause;
\f
- /* Dynamic-Sized Records */
+ /* Dynamic-Sized Records */
/* Strategy: The type ostensibly attached to a value with dynamic size
(i.e., a size that is not statically recorded in the debugging
else if (ada_is_constrained_packed_array_type (type0))
return 1;
else if (ada_is_array_descriptor_type (type0)
- && !ada_is_array_descriptor_type (type1))
+ && !ada_is_array_descriptor_type (type1))
return 1;
else
{
const char *result_name = ada_type_name (result);
if (result_name == NULL)
- {
- warning (_("unexpected null name on descriptive type"));
- return NULL;
- }
+ {
+ warning (_("unexpected null name on descriptive type"));
+ return NULL;
+ }
/* If the names match, stop. */
if (strcmp (result_name, name) == 0)
int len = strlen (ada_type_name (type));
if (len > 6 && strcmp (ada_type_name (type) + len - 6, "___XVE") == 0)
- return type;
+ return type;
else
- return ada_find_parallel_type (type, "___XVE");
+ return ada_find_parallel_type (type, "___XVE");
}
}
for (f = 0; f < type->num_fields (); f += 1)
{
if (ada_is_variant_part (type, f))
- return f;
+ return f;
}
return -1;
}
struct type *
ada_template_to_fixed_record_type_1 (struct type *type,
const gdb_byte *valaddr,
- CORE_ADDR address, struct value *dval0,
- int keep_dynamic_fields)
+ CORE_ADDR address, struct value *dval0,
+ int keep_dynamic_fields)
{
struct value *mark = value_mark ();
struct value *dval;
{
nfields = 0;
while (nfields < type->num_fields ()
- && !ada_is_variant_part (type, nfields)
- && !is_dynamic_field (type, nfields))
- nfields++;
+ && !ada_is_variant_part (type, nfields)
+ && !is_dynamic_field (type, nfields))
+ nfields++;
}
rtype = alloc_type_copy (type);
TYPE_FIELD_BITSIZE (rtype, f) = 0;
if (ada_is_variant_part (type, f))
- {
- variant_field = f;
- fld_bit_len = 0;
- }
+ {
+ variant_field = f;
+ fld_bit_len = 0;
+ }
else if (is_dynamic_field (type, f))
- {
+ {
const gdb_byte *field_valaddr = valaddr;
CORE_ADDR field_address = address;
struct type *field_type =
TYPE_TARGET_TYPE (type->field (f).type ());
- if (dval0 == NULL)
+ if (dval0 == NULL)
{
/* rtype's length is computed based on the run-time
value of discriminants. If the discriminants are not
address);
rtype = value_type (dval);
}
- else
- dval = dval0;
+ else
+ dval = dval0;
/* If the type referenced by this field is an aligner type, we need
to unwrap that aligner type, because its size might not be set.
ada_ensure_varsize_limit (field_type);
rtype->field (f).set_type (field_type);
- TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
+ TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
/* The multiplication can potentially overflow. But because
the field length has been size-checked just above, and
assuming that the maximum size is a reasonable value,
an overflow should not happen in practice. So rather than
adding overflow recovery code to this already complex code,
we just assume that it's not going to happen. */
- fld_bit_len =
- TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT;
- }
+ fld_bit_len =
+ TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT;
+ }
else
- {
+ {
/* Note: If this field's type is a typedef, it is important
to preserve the typedef layer.
structure, the typedef is the only clue which allows us
to distinguish between the two options. Stripping it
would prevent us from printing this field appropriately. */
- rtype->field (f).set_type (type->field (f).type ());
- TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
- if (TYPE_FIELD_BITSIZE (type, f) > 0)
- fld_bit_len =
- TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
- else
+ rtype->field (f).set_type (type->field (f).type ());
+ TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
+ if (TYPE_FIELD_BITSIZE (type, f) > 0)
+ fld_bit_len =
+ TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
+ else
{
struct type *field_type = type->field (f).type ();
if (field_type->code () == TYPE_CODE_TYPEDEF)
field_type = ada_typedef_target_type (field_type);
- fld_bit_len =
- TYPE_LENGTH (ada_check_typedef (field_type)) * TARGET_CHAR_BIT;
+ fld_bit_len =
+ TYPE_LENGTH (ada_check_typedef (field_type)) * TARGET_CHAR_BIT;
}
- }
+ }
if (off + fld_bit_len > bit_len)
- bit_len = off + fld_bit_len;
+ bit_len = off + fld_bit_len;
off += fld_bit_len;
TYPE_LENGTH (rtype) =
- align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT;
+ align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT;
}
/* We handle the variant part, if any, at the end because of certain
rtype = value_type (dval);
}
else
- dval = dval0;
+ dval = dval0;
branch_type =
- to_fixed_variant_branch_type
- (type->field (variant_field).type (),
- cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
- cond_offset_target (address, off / TARGET_CHAR_BIT), dval);
+ to_fixed_variant_branch_type
+ (type->field (variant_field).type (),
+ cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
+ cond_offset_target (address, off / TARGET_CHAR_BIT), dval);
if (branch_type == NULL)
- {
- for (f = variant_field + 1; f < rtype->num_fields (); f += 1)
- rtype->field (f - 1) = rtype->field (f);
+ {
+ for (f = variant_field + 1; f < rtype->num_fields (); f += 1)
+ rtype->field (f - 1) = rtype->field (f);
rtype->set_num_fields (rtype->num_fields () - 1);
- }
+ }
else
- {
- rtype->field (variant_field).set_type (branch_type);
- TYPE_FIELD_NAME (rtype, variant_field) = "S";
- fld_bit_len =
- TYPE_LENGTH (rtype->field (variant_field).type ()) *
- TARGET_CHAR_BIT;
- if (off + fld_bit_len > bit_len)
- bit_len = off + fld_bit_len;
- TYPE_LENGTH (rtype) =
- align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT;
- }
+ {
+ rtype->field (variant_field).set_type (branch_type);
+ TYPE_FIELD_NAME (rtype, variant_field) = "S";
+ fld_bit_len =
+ TYPE_LENGTH (rtype->field (variant_field).type ()) *
+ TARGET_CHAR_BIT;
+ if (off + fld_bit_len > bit_len)
+ bit_len = off + fld_bit_len;
+ TYPE_LENGTH (rtype) =
+ align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT;
+ }
}
/* According to exp_dbug.ads, the size of TYPE for variable-size records
static struct type *
template_to_fixed_record_type (struct type *type, const gdb_byte *valaddr,
- CORE_ADDR address, struct value *dval0)
+ CORE_ADDR address, struct value *dval0)
{
return ada_template_to_fixed_record_type_1 (type, valaddr,
- address, dval0, 1);
+ address, dval0, 1);
}
/* An ordinary record type in which ___XVL-convention fields and
if (is_dynamic_field (type0, f))
{
field_type = ada_check_typedef (field_type);
- new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type));
+ new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type));
}
else
- new_type = static_unwrap_type (field_type);
+ new_type = static_unwrap_type (field_type);
if (new_type != field_type)
{
static struct type *
to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
- CORE_ADDR address, struct value *dval0)
+ CORE_ADDR address, struct value *dval0)
{
struct value *mark = value_mark ();
struct value *dval;
branch_type = to_fixed_variant_branch_type
(type->field (variant_field).type (),
cond_offset_host (valaddr,
- TYPE_FIELD_BITPOS (type, variant_field)
- / TARGET_CHAR_BIT),
+ TYPE_FIELD_BITPOS (type, variant_field)
+ / TARGET_CHAR_BIT),
cond_offset_target (address,
- TYPE_FIELD_BITPOS (type, variant_field)
- / TARGET_CHAR_BIT), dval);
+ TYPE_FIELD_BITPOS (type, variant_field)
+ / TARGET_CHAR_BIT), dval);
if (branch_type == NULL)
{
int f;
for (f = variant_field + 1; f < nfields; f += 1)
- rtype->field (f - 1) = rtype->field (f);
+ rtype->field (f - 1) = rtype->field (f);
rtype->set_num_fields (rtype->num_fields () - 1);
}
else
static struct type *
to_fixed_record_type (struct type *type0, const gdb_byte *valaddr,
- CORE_ADDR address, struct value *dval)
+ CORE_ADDR address, struct value *dval)
{
struct type *templ_type;
else if (variant_field_index (type0) >= 0)
{
if (dval == NULL && valaddr == NULL && address == 0)
- return type0;
+ return type0;
return to_record_with_fixed_variant_part (type0, valaddr, address,
- dval);
+ dval);
}
else
{
static struct type *
to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
- CORE_ADDR address, struct value *dval)
+ CORE_ADDR address, struct value *dval)
{
int which;
struct type *templ_type;
static struct type *
to_fixed_array_type (struct type *type0, struct value *dval,
- int ignore_too_big)
+ int ignore_too_big)
{
struct type *index_type_desc;
struct type *result;
struct type *elt_type0 = ada_check_typedef (TYPE_TARGET_TYPE (type0));
/* NOTE: elt_type---the fixed version of elt_type0---should never
- depend on the contents of the array in properly constructed
- debugging data. */
+ depend on the contents of the array in properly constructed
+ debugging data. */
/* Create a fixed version of the array element type.
- We're not providing the address of an element here,
- and thus the actual object value cannot be inspected to do
- the conversion. This should not be a problem, since arrays of
- unconstrained objects are not allowed. In particular, all
- the elements of an array of a tagged type should all be of
- the same type specified in the debugging info. No need to
- consult the object tag. */
+ We're not providing the address of an element here,
+ and thus the actual object value cannot be inspected to do
+ the conversion. This should not be a problem, since arrays of
+ unconstrained objects are not allowed. In particular, all
+ the elements of an array of a tagged type should all be of
+ the same type specified in the debugging info. No need to
+ consult the object tag. */
struct type *elt_type = ada_to_fixed_type (elt_type0, 0, 0, dval, 1);
/* Make sure we always create a new array type when dealing with
packed array types, since we're going to fix-up the array
type length and element bitsize a little further down. */
if (elt_type0 == elt_type && !constrained_packed_array_p)
- result = type0;
+ result = type0;
else
- result = create_array_type (alloc_type_copy (type0),
- elt_type, type0->index_type ());
+ result = create_array_type (alloc_type_copy (type0),
+ elt_type, type0->index_type ());
}
else
{
elt_type0 = type0;
for (i = index_type_desc->num_fields (); i > 0; i -= 1)
- elt_type0 = TYPE_TARGET_TYPE (elt_type0);
+ elt_type0 = TYPE_TARGET_TYPE (elt_type0);
/* NOTE: result---the fixed version of elt_type0---should never
- depend on the contents of the array in properly constructed
- debugging data. */
+ depend on the contents of the array in properly constructed
+ debugging data. */
/* Create a fixed version of the array element type.
- We're not providing the address of an element here,
- and thus the actual object value cannot be inspected to do
- the conversion. This should not be a problem, since arrays of
- unconstrained objects are not allowed. In particular, all
- the elements of an array of a tagged type should all be of
- the same type specified in the debugging info. No need to
- consult the object tag. */
+ We're not providing the address of an element here,
+ and thus the actual object value cannot be inspected to do
+ the conversion. This should not be a problem, since arrays of
+ unconstrained objects are not allowed. In particular, all
+ the elements of an array of a tagged type should all be of
+ the same type specified in the debugging info. No need to
+ consult the object tag. */
result =
- ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval, 1);
+ ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval, 1);
elt_type0 = type0;
for (i = index_type_desc->num_fields () - 1; i >= 0; i -= 1)
- {
- struct type *range_type =
- to_fixed_range_type (index_type_desc->field (i).type (), dval);
+ {
+ struct type *range_type =
+ to_fixed_range_type (index_type_desc->field (i).type (), dval);
- result = create_array_type (alloc_type_copy (elt_type0),
- result, range_type);
+ result = create_array_type (alloc_type_copy (elt_type0),
+ result, range_type);
elt_type0 = TYPE_TARGET_TYPE (elt_type0);
- }
+ }
if (!ignore_too_big && TYPE_LENGTH (result) > varsize_limit)
- error (_("array type with dynamic size is larger than varsize-limit"));
+ error (_("array type with dynamic size is larger than varsize-limit"));
}
/* We want to preserve the type name. This can be useful when
TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0);
TYPE_LENGTH (result) = len * elt_bitsize / HOST_CHAR_BIT;
if (TYPE_LENGTH (result) * HOST_CHAR_BIT < len * elt_bitsize)
- TYPE_LENGTH (result)++;
+ TYPE_LENGTH (result)++;
}
result->set_is_fixed_instance (true);
static struct type *
ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
- CORE_ADDR address, struct value *dval, int check_tag)
+ CORE_ADDR address, struct value *dval, int check_tag)
{
type = ada_check_typedef (type);
return type;
case TYPE_CODE_STRUCT:
{
- struct type *static_type = to_static_fixed_type (type);
- struct type *fixed_record_type =
- to_fixed_record_type (type, valaddr, address, NULL);
-
- /* If STATIC_TYPE is a tagged type and we know the object's address,
- then we can determine its tag, and compute the object's actual
- type from there. Note that we have to use the fixed record
- type (the parent part of the record may have dynamic fields
- and the way the location of _tag is expressed may depend on
- them). */
-
- if (check_tag && address != 0 && ada_is_tagged_type (static_type, 0))
- {
+ struct type *static_type = to_static_fixed_type (type);
+ struct type *fixed_record_type =
+ to_fixed_record_type (type, valaddr, address, NULL);
+
+ /* If STATIC_TYPE is a tagged type and we know the object's address,
+ then we can determine its tag, and compute the object's actual
+ type from there. Note that we have to use the fixed record
+ type (the parent part of the record may have dynamic fields
+ and the way the location of _tag is expressed may depend on
+ them). */
+
+ if (check_tag && address != 0 && ada_is_tagged_type (static_type, 0))
+ {
struct value *tag =
value_tag_from_contents_and_address
(fixed_record_type,
value_from_contents_and_address (fixed_record_type,
valaddr,
address);
- fixed_record_type = value_type (obj);
- if (real_type != NULL)
- return to_fixed_record_type
+ fixed_record_type = value_type (obj);
+ if (real_type != NULL)
+ return to_fixed_record_type
(real_type, NULL,
value_address (ada_tag_value_at_base_address (obj)), NULL);
- }
-
- /* Check to see if there is a parallel ___XVZ variable.
- If there is, then it provides the actual size of our type. */
- else if (ada_type_name (fixed_record_type) != NULL)
- {
- const char *name = ada_type_name (fixed_record_type);
- char *xvz_name
+ }
+
+ /* Check to see if there is a parallel ___XVZ variable.
+ If there is, then it provides the actual size of our type. */
+ else if (ada_type_name (fixed_record_type) != NULL)
+ {
+ const char *name = ada_type_name (fixed_record_type);
+ char *xvz_name
= (char *) alloca (strlen (name) + 7 /* "___XVZ\0" */);
bool xvz_found = false;
- LONGEST size;
+ LONGEST size;
- xsnprintf (xvz_name, strlen (name) + 7, "%s___XVZ", name);
+ xsnprintf (xvz_name, strlen (name) + 7, "%s___XVZ", name);
try
{
xvz_found = get_int_var_value (xvz_name, size);
xvz_name, except.what ());
}
- if (xvz_found && TYPE_LENGTH (fixed_record_type) != size)
- {
- fixed_record_type = copy_type (fixed_record_type);
- TYPE_LENGTH (fixed_record_type) = size;
-
- /* The FIXED_RECORD_TYPE may have be a stub. We have
- observed this when the debugging info is STABS, and
- apparently it is something that is hard to fix.
-
- In practice, we don't need the actual type definition
- at all, because the presence of the XVZ variable allows us
- to assume that there must be a XVS type as well, which we
- should be able to use later, when we need the actual type
- definition.
-
- In the meantime, pretend that the "fixed" type we are
- returning is NOT a stub, because this can cause trouble
- when using this type to create new types targeting it.
- Indeed, the associated creation routines often check
- whether the target type is a stub and will try to replace
- it, thus using a type with the wrong size. This, in turn,
- might cause the new type to have the wrong size too.
- Consider the case of an array, for instance, where the size
- of the array is computed from the number of elements in
- our array multiplied by the size of its element. */
+ if (xvz_found && TYPE_LENGTH (fixed_record_type) != size)
+ {
+ fixed_record_type = copy_type (fixed_record_type);
+ TYPE_LENGTH (fixed_record_type) = size;
+
+ /* The FIXED_RECORD_TYPE may have be a stub. We have
+ observed this when the debugging info is STABS, and
+ apparently it is something that is hard to fix.
+
+ In practice, we don't need the actual type definition
+ at all, because the presence of the XVZ variable allows us
+ to assume that there must be a XVS type as well, which we
+ should be able to use later, when we need the actual type
+ definition.
+
+ In the meantime, pretend that the "fixed" type we are
+ returning is NOT a stub, because this can cause trouble
+ when using this type to create new types targeting it.
+ Indeed, the associated creation routines often check
+ whether the target type is a stub and will try to replace
+ it, thus using a type with the wrong size. This, in turn,
+ might cause the new type to have the wrong size too.
+ Consider the case of an array, for instance, where the size
+ of the array is computed from the number of elements in
+ our array multiplied by the size of its element. */
fixed_record_type->set_is_stub (false);
- }
- }
- return fixed_record_type;
+ }
+ }
+ return fixed_record_type;
}
case TYPE_CODE_ARRAY:
return to_fixed_array_type (type, dval, 1);
case TYPE_CODE_UNION:
if (dval == NULL)
- return type;
+ return type;
else
- return to_fixed_variant_branch_type (type, valaddr, address, dval);
+ return to_fixed_variant_branch_type (type, valaddr, address, dval);
}
}
struct type *
ada_to_fixed_type (struct type *type, const gdb_byte *valaddr,
- CORE_ADDR address, struct value *dval, int check_tag)
+ CORE_ADDR address, struct value *dval, int check_tag)
{
struct type *fixed_type =
case TYPE_CODE_STRUCT:
type = dynamic_template_type (type0);
if (type != NULL)
- return template_to_static_fixed_type (type);
+ return template_to_static_fixed_type (type);
else
- return template_to_static_fixed_type (type0);
+ return template_to_static_fixed_type (type0);
case TYPE_CODE_UNION:
type = ada_find_parallel_type (type0, "___XVU");
if (type != NULL)
- return template_to_static_fixed_type (type);
+ return template_to_static_fixed_type (type);
else
- return template_to_static_fixed_type (type0);
+ return template_to_static_fixed_type (type0);
}
}
struct type *raw_real_type = ada_get_base_type (type);
if (raw_real_type == type)
- return type;
+ return type;
else
- return to_static_fixed_type (raw_real_type);
+ return to_static_fixed_type (raw_real_type);
}
}
struct type *type1 = ada_find_any_type (name);
if (type1 == NULL)
- return type;
+ return type;
/* TYPE1 might itself be a TYPE_CODE_TYPEDEF (this can happen with
stubs pointing to arrays, as we don't create symbols for array
static struct value *
ada_to_fixed_value_create (struct type *type0, CORE_ADDR address,
- struct value *val0)
+ struct value *val0)
{
struct type *type = ada_to_fixed_type (type0, 0, address, NULL, 1);
if (type->code () == TYPE_CODE_ENUM)
{
if (val < 0 || val >= type->num_fields ())
- error (_("argument to 'VAL out of range"));
+ error (_("argument to 'VAL out of range"));
val = TYPE_FIELD_ENUMVAL (type, val);
}
return value_from_longest (type, val);
}
\f
- /* Evaluation */
+ /* Evaluation */
/* True if TYPE appears to be an Ada character type.
[At the moment, this is true only for Character and Wide_Character;
with a known character type name. */
name = ada_type_name (type);
return (name != NULL
- && (type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_RANGE)
- && (strcmp (name, "character") == 0
- || strcmp (name, "wide_character") == 0
- || strcmp (name, "wide_wide_character") == 0
- || strcmp (name, "unsigned char") == 0));
+ && (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_RANGE)
+ && (strcmp (name, "character") == 0
+ || strcmp (name, "wide_character") == 0
+ || strcmp (name, "wide_wide_character") == 0
+ || strcmp (name, "unsigned char") == 0));
}
/* True if TYPE appears to be an Ada string type. */
if (type != NULL
&& type->code () != TYPE_CODE_PTR
&& (ada_is_simple_array_type (type)
- || ada_is_array_descriptor_type (type))
+ || ada_is_array_descriptor_type (type))
&& ada_array_arity (type) == 1)
{
struct type *elttype = ada_array_element_type (type, 1);
return 0;
return (type->code () == TYPE_CODE_STRUCT
- && type->num_fields () == 1
- && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
+ && type->num_fields () == 1
+ && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
}
/* If there is an ___XVS-convention type parallel to SUBTYPE, return
{
if (ada_is_aligner_type (type))
return ada_aligned_value_addr (type->field (0).type (),
- valaddr +
- TYPE_FIELD_BITPOS (type,
- 0) / TARGET_CHAR_BIT);
+ valaddr +
+ TYPE_FIELD_BITPOS (type,
+ 0) / TARGET_CHAR_BIT);
else
return valaddr;
}
else
{
while ((tmp = strstr (name, "__")) != NULL)
- {
- if (isdigit (tmp[2]))
- break;
- else
- name = tmp + 2;
- }
+ {
+ if (isdigit (tmp[2]))
+ break;
+ else
+ name = tmp + 2;
+ }
}
if (name[0] == 'Q')
int v;
if (name[1] == 'U' || name[1] == 'W')
- {
- if (sscanf (name + 2, "%x", &v) != 1)
- return name;
- }
+ {
+ if (sscanf (name + 2, "%x", &v) != 1)
+ return name;
+ }
else if (((name[1] >= '0' && name[1] <= '9')
|| (name[1] >= 'a' && name[1] <= 'z'))
&& name[2] == '\0')
return result;
}
else
- return name;
+ return name;
GROW_VECT (result, result_len, 16);
if (isascii (v) && isprint (v))
- xsnprintf (result, result_len, "'%c'", v);
+ xsnprintf (result, result_len, "'%c'", v);
else if (name[1] == 'U')
- xsnprintf (result, result_len, "[\"%02x\"]", v);
+ xsnprintf (result, result_len, "[\"%02x\"]", v);
else
- xsnprintf (result, result_len, "[\"%04x\"]", v);
+ xsnprintf (result, result_len, "[\"%04x\"]", v);
return result;
}
if (tmp == NULL)
tmp = strstr (name, "$");
if (tmp != NULL)
- {
- GROW_VECT (result, result_len, tmp - name + 1);
- strncpy (result, name, tmp - name);
- result[tmp - name] = '\0';
- return result;
- }
+ {
+ GROW_VECT (result, result_len, tmp - name + 1);
+ strncpy (result, name, tmp - name);
+ result[tmp - name] = '\0';
+ return result;
+ }
return name;
}
else
{
struct type *raw_real_type =
- ada_check_typedef (ada_get_base_type (type));
+ ada_check_typedef (ada_get_base_type (type));
/* If there is no parallel XVS or XVE type, then the value is
already unwrapped. Return it without further modification. */
return val;
return
- coerce_unspec_val_to_type
- (val, ada_to_fixed_type (raw_real_type, 0,
- value_address (val),
- NULL, 1));
+ coerce_unspec_val_to_type
+ (val, ada_to_fixed_type (raw_real_type, 0,
+ value_address (val),
+ NULL, 1));
}
}
}
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
- != TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
- error (_("Incompatible types in assignment"));
+ != TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
+ error (_("Incompatible types in assignment"));
deprecated_set_value_type (val, type);
}
return val;
case BINOP_DIV:
v = v1 / v2;
if (!TRUNCATION_TOWARDS_ZERO && v1 * (v1 % v2) < 0)
- v += v > 0 ? -1 : 1;
+ v += v > 0 ? -1 : 1;
break;
case BINOP_REM:
v = v1 % v2;
if (v * v1 < 0)
- v -= v2;
+ v -= v2;
break;
default:
/* Should not reach this point. */
val = allocate_value (type1);
store_unsigned_integer (value_contents_raw (val),
- TYPE_LENGTH (value_type (val)),
+ TYPE_LENGTH (value_type (val)),
type_byte_order (type1), v);
return val;
}
struct type *arg1_type, *arg2_type;
/* Automatically dereference any array reference before
- we attempt to perform the comparison. */
+ we attempt to perform the comparison. */
arg1 = ada_coerce_ref (arg1);
arg2 = ada_coerce_ref (arg2);
arg2_type = ada_check_typedef (value_type (arg2));
if (arg1_type->code () != TYPE_CODE_ARRAY
- || arg2_type->code () != TYPE_CODE_ARRAY)
- error (_("Attempt to compare array with non-array"));
+ || arg2_type->code () != TYPE_CODE_ARRAY)
+ error (_("Attempt to compare array with non-array"));
/* FIXME: The following works only for types whose
- representations use all bits (no padding or undefined bits)
- and do not have user-defined equality. */
+ representations use all bits (no padding or undefined bits)
+ and do not have user-defined equality. */
return (TYPE_LENGTH (arg1_type) == TYPE_LENGTH (arg2_type)
&& memcmp (value_contents (arg1), value_contents (arg2),
TYPE_LENGTH (arg1_type)) == 0);
known. Consider for instance a variant record:
type Rec (Empty : Boolean := True) is record
- case Empty is
- when True => null;
- when False => Value : Integer;
- end case;
+ case Empty is
+ when True => null;
+ when False => Value : Integer;
+ end case;
end record;
Yes : Rec := (Empty => False, Value => 1);
No : Rec := (empty => True);
type would look like this:
type Rec is record
- Empty : Boolean;
- Value : Integer;
+ Empty : Boolean;
+ Value : Integer;
end record;
On the other hand, if we printed the value of "No", its fixed type
would become:
type Rec is record
- Empty : Boolean;
+ Empty : Boolean;
end record;
Things become a little more complicated when trying to fix an entity
The simplest case is when we have an array of a constrained element
type. For instance, consider the following type declarations:
- type Bounded_String (Max_Size : Integer) is
- Length : Integer;
- Buffer : String (1 .. Max_Size);
- end record;
- type Bounded_String_Array is array (1 ..2) of Bounded_String (80);
+ type Bounded_String (Max_Size : Integer) is
+ Length : Integer;
+ Buffer : String (1 .. Max_Size);
+ end record;
+ type Bounded_String_Array is array (1 ..2) of Bounded_String (80);
In this case, the compiler describes the array as an array of
variable-size elements (identified by its XVS suffix) for which
But there are cases when this size is not statically known.
For instance, assuming that "Five" is an integer variable:
- type Dynamic is array (1 .. Five) of Integer;
- type Wrapper (Has_Length : Boolean := False) is record
- Data : Dynamic;
- case Has_Length is
- when True => Length : Integer;
- when False => null;
- end case;
- end record;
- type Wrapper_Array is array (1 .. 2) of Wrapper;
+ type Dynamic is array (1 .. Five) of Integer;
+ type Wrapper (Has_Length : Boolean := False) is record
+ Data : Dynamic;
+ case Has_Length is
+ when True => Length : Integer;
+ when False => null;
+ end case;
+ end record;
+ type Wrapper_Array is array (1 .. 2) of Wrapper;
- Hello : Wrapper_Array := (others => (Has_Length => True,
- Data => (others => 17),
- Length => 1));
+ Hello : Wrapper_Array := (others => (Has_Length => True,
+ Data => (others => 17),
+ Length => 1));
The debugging info would describe variable Hello as being an
Consider for instance the example:
- type Bounded_String (Max_Size : Natural) is record
- Str : String (1 .. Max_Size);
- Length : Natural;
- end record;
- My_String : Bounded_String (Max_Size => 10);
+ type Bounded_String (Max_Size : Natural) is record
+ Str : String (1 .. Max_Size);
+ Length : Natural;
+ end record;
+ My_String : Bounded_String (Max_Size => 10);
In that case, the position of field "Length" depends on the size
of field Str, which itself depends on the value of the Max_Size
(assuming type Rec above):
type Container (Big : Boolean) is record
- First : Rec;
- After : Integer;
- case Big is
- when True => Another : Integer;
- when False => null;
- end case;
+ First : Rec;
+ After : Integer;
+ case Big is
+ when True => Another : Integer;
+ when False => null;
+ end case;
end record;
My_Container : Container := (Big => False,
- First => (Empty => True),
- After => 42);
+ First => (Empty => True),
+ After => 42);
In that example, the compiler creates a PAD type for component First,
whose size is constant, and then positions the component After just
we might end up with the wrong size for our component. This can be
observed with the following type declarations:
- type Octal is new Integer range 0 .. 7;
- type Octal_Array is array (Positive range <>) of Octal;
- pragma Pack (Octal_Array);
+ type Octal is new Integer range 0 .. 7;
+ type Octal_Array is array (Positive range <>) of Octal;
+ pragma Pack (Octal_Array);
- type Octal_Buffer (Size : Positive) is record
- Buffer : Octal_Array (1 .. Size);
- Length : Integer;
- end record;
+ type Octal_Buffer (Size : Positive) is record
+ Buffer : Octal_Array (1 .. Size);
+ Length : Integer;
+ end record;
In that case, Buffer is a PAD type whose size is unset and needs
to be computed by fixing the unwrapped type.
value *val;
if (exp->elts[pc].opcode == OP_VAR_MSYM_VALUE)
- {
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (to_type, not_lval);
-
- val = evaluate_var_msym_value (noside,
- exp->elts[pc + 1].objfile,
- exp->elts[pc + 2].msymbol);
- }
+ {
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (to_type, not_lval);
+
+ val = evaluate_var_msym_value (noside,
+ exp->elts[pc + 1].objfile,
+ exp->elts[pc + 2].msymbol);
+ }
else
- val = evaluate_var_value (noside,
- exp->elts[pc + 1].block,
- exp->elts[pc + 2].symbol);
+ val = evaluate_var_value (noside,
+ exp->elts[pc + 1].block,
+ exp->elts[pc + 2].symbol);
if (noside == EVAL_SKIP)
- return eval_skip_value (exp);
+ return eval_skip_value (exp);
val = ada_value_cast (to_type, val);
/* Follow the Ada language semantics that do not allow taking
an address of the result of a cast (view conversion in Ada). */
if (VALUE_LVAL (val) == lval_memory)
- {
- if (value_lazy (val))
- value_fetch_lazy (val);
- VALUE_LVAL (val) = not_lval;
- }
+ {
+ if (value_lazy (val))
+ value_fetch_lazy (val);
+ VALUE_LVAL (val) = not_lval;
+ }
return val;
}
static struct value *
ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
- int *pos, enum noside noside)
+ int *pos, enum noside noside)
{
enum exp_opcode op;
int tem;
arg1 = unwrap_value (arg1);
/* If evaluating an OP_FLOAT and an EXPECT_TYPE was provided,
- then we need to perform the conversion manually, because
- evaluate_subexp_standard doesn't do it. This conversion is
- necessary in Ada because the different kinds of float/fixed
- types in Ada have different representations.
+ then we need to perform the conversion manually, because
+ evaluate_subexp_standard doesn't do it. This conversion is
+ necessary in Ada because the different kinds of float/fixed
+ types in Ada have different representations.
- Similarly, we need to perform the conversion from OP_LONG
- ourselves. */
+ Similarly, we need to perform the conversion from OP_LONG
+ ourselves. */
if ((op == OP_FLOAT || op == OP_LONG) && expect_type != NULL)
- arg1 = ada_value_cast (expect_type, arg1);
+ arg1 = ada_value_cast (expect_type, arg1);
return arg1;
case OP_STRING:
{
- struct value *result;
-
- *pos -= 1;
- result = evaluate_subexp_standard (expect_type, exp, pos, noside);
- /* The result type will have code OP_STRING, bashed there from
- OP_ARRAY. Bash it back. */
- if (value_type (result)->code () == TYPE_CODE_STRING)
- value_type (result)->set_code (TYPE_CODE_ARRAY);
- return result;
+ struct value *result;
+
+ *pos -= 1;
+ result = evaluate_subexp_standard (expect_type, exp, pos, noside);
+ /* The result type will have code OP_STRING, bashed there from
+ OP_ARRAY. Bash it back. */
+ if (value_type (result)->code () == TYPE_CODE_STRING)
+ value_type (result)->set_code (TYPE_CODE_ARRAY);
+ return result;
}
case UNOP_CAST:
return ada_value_assign (arg1, arg1);
}
/* Force the evaluation of the rhs ARG2 to the type of the lhs ARG1,
- except if the lhs of our assignment is a convenience variable.
- In the case of assigning to a convenience variable, the lhs
- should be exactly the result of the evaluation of the rhs. */
+ except if the lhs of our assignment is a convenience variable.
+ In the case of assigning to a convenience variable, the lhs
+ should be exactly the result of the evaluation of the rhs. */
type = value_type (arg1);
if (VALUE_LVAL (arg1) == lval_internalvar)
- type = NULL;
+ type = NULL;
arg2 = evaluate_subexp (type, exp, pos, noside);
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
- return arg1;
+ return arg1;
if (VALUE_LVAL (arg1) == lval_internalvar)
{
/* Nothing. */
}
else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1)))
- arg2 = cast_to_gnat_encoded_fixed_point_type (value_type (arg1), arg2);
+ arg2 = cast_to_gnat_encoded_fixed_point_type (value_type (arg1), arg2);
else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
- error
- (_("Fixed-point values must be assigned to fixed-point variables"));
+ error
+ (_("Fixed-point values must be assigned to fixed-point variables"));
else
- arg2 = coerce_for_assign (value_type (arg1), arg2);
+ arg2 = coerce_for_assign (value_type (arg1), arg2);
return ada_value_assign (arg1, arg2);
case BINOP_ADD:
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
if (value_type (arg1)->code () == TYPE_CODE_PTR)
- return (value_from_longest
- (value_type (arg1),
- value_as_long (arg1) + value_as_long (arg2)));
+ return (value_from_longest
+ (value_type (arg1),
+ value_as_long (arg1) + value_as_long (arg2)));
if (value_type (arg2)->code () == TYPE_CODE_PTR)
- return (value_from_longest
- (value_type (arg2),
- value_as_long (arg1) + value_as_long (arg2)));
+ return (value_from_longest
+ (value_type (arg2),
+ value_as_long (arg1) + value_as_long (arg2)));
if ((ada_is_gnat_encoded_fixed_point_type (value_type (arg1))
- || ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
- && value_type (arg1) != value_type (arg2))
- error (_("Operands of fixed-point addition must have the same type"));
+ || ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
+ && value_type (arg1) != value_type (arg2))
+ error (_("Operands of fixed-point addition must have the same type"));
/* Do the addition, and cast the result to the type of the first
- argument. We cannot cast the result to a reference type, so if
- ARG1 is a reference type, find its underlying type. */
+ argument. We cannot cast the result to a reference type, so if
+ ARG1 is a reference type, find its underlying type. */
type = value_type (arg1);
while (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = TYPE_TARGET_TYPE (type);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
return value_cast (type, value_binop (arg1, arg2, BINOP_ADD));
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
if (value_type (arg1)->code () == TYPE_CODE_PTR)
- return (value_from_longest
- (value_type (arg1),
- value_as_long (arg1) - value_as_long (arg2)));
+ return (value_from_longest
+ (value_type (arg1),
+ value_as_long (arg1) - value_as_long (arg2)));
if (value_type (arg2)->code () == TYPE_CODE_PTR)
- return (value_from_longest
- (value_type (arg2),
- value_as_long (arg1) - value_as_long (arg2)));
+ return (value_from_longest
+ (value_type (arg2),
+ value_as_long (arg1) - value_as_long (arg2)));
if ((ada_is_gnat_encoded_fixed_point_type (value_type (arg1))
- || ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
- && value_type (arg1) != value_type (arg2))
- error (_("Operands of fixed-point subtraction "
+ || ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
+ && value_type (arg1) != value_type (arg2))
+ error (_("Operands of fixed-point subtraction "
"must have the same type"));
/* Do the substraction, and cast the result to the type of the first
- argument. We cannot cast the result to a reference type, so if
- ARG1 is a reference type, find its underlying type. */
+ argument. We cannot cast the result to a reference type, so if
+ ARG1 is a reference type, find its underlying type. */
type = value_type (arg1);
while (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = TYPE_TARGET_TYPE (type);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
return value_cast (type, value_binop (arg1, arg2, BINOP_SUB));
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
arg2 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
- return value_zero (value_type (arg1), not_lval);
- }
+ {
+ binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
+ return value_zero (value_type (arg1), not_lval);
+ }
else
- {
- type = builtin_type (exp->gdbarch)->builtin_double;
- if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1)))
- arg1 = cast_from_gnat_encoded_fixed_point_type (type, arg1);
- if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
- arg2 = cast_from_gnat_encoded_fixed_point_type (type, arg2);
- binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
- return ada_value_binop (arg1, arg2, op);
- }
+ {
+ type = builtin_type (exp->gdbarch)->builtin_double;
+ if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1)))
+ arg1 = cast_from_gnat_encoded_fixed_point_type (type, arg1);
+ if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2)))
+ arg2 = cast_from_gnat_encoded_fixed_point_type (type, arg2);
+ binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
+ return ada_value_binop (arg1, arg2, op);
+ }
case BINOP_EQUAL:
case BINOP_NOTEQUAL:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- tem = 0;
+ tem = 0;
else
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
tem = ada_value_equal (arg1, arg2);
}
if (op == BINOP_NOTEQUAL)
- tem = !tem;
+ tem = !tem;
type = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) tem);
case UNOP_NEG:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1)))
- return value_cast (value_type (arg1), value_neg (arg1));
+ return value_cast (value_type (arg1), value_neg (arg1));
else
{
unop_promote (exp->language_defn, exp->gdbarch, &arg1);
case BINOP_LOGICAL_OR:
case UNOP_LOGICAL_NOT:
{
- struct value *val;
+ struct value *val;
- *pos -= 1;
- val = evaluate_subexp_standard (expect_type, exp, pos, noside);
+ *pos -= 1;
+ val = evaluate_subexp_standard (expect_type, exp, pos, noside);
type = language_bool_type (exp->language_defn, exp->gdbarch);
- return value_cast (type, val);
+ return value_cast (type, val);
}
case BINOP_BITWISE_AND:
case BINOP_BITWISE_IOR:
case BINOP_BITWISE_XOR:
{
- struct value *val;
+ struct value *val;
arg1 = evaluate_subexp (nullptr, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
*pos = pc;
- val = evaluate_subexp_standard (expect_type, exp, pos, noside);
+ val = evaluate_subexp_standard (expect_type, exp, pos, noside);
- return value_cast (value_type (arg1), val);
+ return value_cast (value_type (arg1), val);
}
case OP_VAR_VALUE:
*pos -= 1;
if (noside == EVAL_SKIP)
- {
- *pos += 4;
- goto nosideret;
- }
+ {
+ *pos += 4;
+ goto nosideret;
+ }
if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
- /* Only encountered when an unresolved symbol occurs in a
- context other than a function call, in which case, it is
- invalid. */
- error (_("Unexpected unresolved symbol, %s, during evaluation"),
- exp->elts[pc + 2].symbol->print_name ());
+ /* Only encountered when an unresolved symbol occurs in a
+ context other than a function call, in which case, it is
+ invalid. */
+ error (_("Unexpected unresolved symbol, %s, during evaluation"),
+ exp->elts[pc + 2].symbol->print_name ());
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol));
- /* Check to see if this is a tagged type. We also need to handle
- the case where the type is a reference to a tagged type, but
- we have to be careful to exclude pointers to tagged types.
- The latter should be shown as usual (as a pointer), whereas
- a reference should mostly be transparent to the user. */
- if (ada_is_tagged_type (type, 0)
- || (type->code () == TYPE_CODE_REF
- && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0)))
+ {
+ type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol));
+ /* Check to see if this is a tagged type. We also need to handle
+ the case where the type is a reference to a tagged type, but
+ we have to be careful to exclude pointers to tagged types.
+ The latter should be shown as usual (as a pointer), whereas
+ a reference should mostly be transparent to the user. */
+ if (ada_is_tagged_type (type, 0)
+ || (type->code () == TYPE_CODE_REF
+ && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0)))
{
/* Tagged types are a little special in the fact that the real
type is dynamic and can only be determined by inspecting the
*pos += 4;
return value_zero (to_static_fixed_type (type), not_lval);
}
- }
+ }
arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
return ada_to_fixed_value (arg1);
(*pos) += 2;
/* Allocate arg vector, including space for the function to be
- called in argvec[0] and a terminating NULL. */
+ called in argvec[0] and a terminating NULL. */
nargs = longest_to_int (exp->elts[pc + 1].longconst);
argvec = XALLOCAVEC (struct value *, nargs + 2);
if (exp->elts[*pos].opcode == OP_VAR_VALUE
- && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
- error (_("Unexpected unresolved symbol, %s, during evaluation"),
- exp->elts[pc + 5].symbol->print_name ());
+ && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
+ error (_("Unexpected unresolved symbol, %s, during evaluation"),
+ exp->elts[pc + 5].symbol->print_name ());
else
- {
- for (tem = 0; tem <= nargs; tem += 1)
+ {
+ for (tem = 0; tem <= nargs; tem += 1)
argvec[tem] = evaluate_subexp (nullptr, exp, pos, noside);
argvec[tem] = 0;
- if (noside == EVAL_SKIP)
- goto nosideret;
- }
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+ }
if (ada_is_constrained_packed_array_type
(desc_base_type (value_type (argvec[0]))))
- argvec[0] = ada_coerce_to_simple_array (argvec[0]);
+ argvec[0] = ada_coerce_to_simple_array (argvec[0]);
else if (value_type (argvec[0])->code () == TYPE_CODE_ARRAY
- && TYPE_FIELD_BITSIZE (value_type (argvec[0]), 0) != 0)
- /* This is a packed array that has already been fixed, and
+ && TYPE_FIELD_BITSIZE (value_type (argvec[0]), 0) != 0)
+ /* This is a packed array that has already been fixed, and
therefore already coerced to a simple array. Nothing further
to do. */
- ;
+ ;
else if (value_type (argvec[0])->code () == TYPE_CODE_REF)
{
/* Make sure we dereference references so that all the code below
type = ada_typedef_target_type (type);
if (type->code () == TYPE_CODE_PTR)
- {
- switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ())
- {
- case TYPE_CODE_FUNC:
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
- break;
- case TYPE_CODE_ARRAY:
- break;
- case TYPE_CODE_STRUCT:
- if (noside != EVAL_AVOID_SIDE_EFFECTS)
- argvec[0] = ada_value_ind (argvec[0]);
- type = ada_check_typedef (TYPE_TARGET_TYPE (type));
- break;
- default:
- error (_("cannot subscript or call something of type `%s'"),
- ada_type_name (value_type (argvec[0])));
- break;
- }
- }
+ {
+ switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ())
+ {
+ case TYPE_CODE_FUNC:
+ type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ break;
+ case TYPE_CODE_ARRAY:
+ break;
+ case TYPE_CODE_STRUCT:
+ if (noside != EVAL_AVOID_SIDE_EFFECTS)
+ argvec[0] = ada_value_ind (argvec[0]);
+ type = ada_check_typedef (TYPE_TARGET_TYPE (type));
+ break;
+ default:
+ error (_("cannot subscript or call something of type `%s'"),
+ ada_type_name (value_type (argvec[0])));
+ break;
+ }
+ }
switch (type->code ())
- {
- case TYPE_CODE_FUNC:
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ case TYPE_CODE_FUNC:
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
if (TYPE_TARGET_TYPE (type) == NULL)
error_call_unknown_return_type (NULL);
return call_internal_function (exp->gdbarch, exp->language_defn,
argvec[0], nargs, argvec + 1);
- case TYPE_CODE_STRUCT:
- {
- int arity;
-
- arity = ada_array_arity (type);
- type = ada_array_element_type (type, nargs);
- if (type == NULL)
- error (_("cannot subscript or call a record"));
- if (arity != nargs)
- error (_("wrong number of subscripts; expecting %d"), arity);
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (ada_aligned_type (type), lval_memory);
- return
- unwrap_value (ada_value_subscript
- (argvec[0], nargs, argvec + 1));
- }
- case TYPE_CODE_ARRAY:
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- type = ada_array_element_type (type, nargs);
- if (type == NULL)
- error (_("element type of array unknown"));
- else
- return value_zero (ada_aligned_type (type), lval_memory);
- }
- return
- unwrap_value (ada_value_subscript
- (ada_coerce_to_simple_array (argvec[0]),
- nargs, argvec + 1));
- case TYPE_CODE_PTR: /* Pointer to array */
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
+ case TYPE_CODE_STRUCT:
+ {
+ int arity;
+
+ arity = ada_array_arity (type);
+ type = ada_array_element_type (type, nargs);
+ if (type == NULL)
+ error (_("cannot subscript or call a record"));
+ if (arity != nargs)
+ error (_("wrong number of subscripts; expecting %d"), arity);
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return value_zero (ada_aligned_type (type), lval_memory);
+ return
+ unwrap_value (ada_value_subscript
+ (argvec[0], nargs, argvec + 1));
+ }
+ case TYPE_CODE_ARRAY:
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
+ type = ada_array_element_type (type, nargs);
+ if (type == NULL)
+ error (_("element type of array unknown"));
+ else
+ return value_zero (ada_aligned_type (type), lval_memory);
+ }
+ return
+ unwrap_value (ada_value_subscript
+ (ada_coerce_to_simple_array (argvec[0]),
+ nargs, argvec + 1));
+ case TYPE_CODE_PTR: /* Pointer to array */
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ {
type = to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1);
- type = ada_array_element_type (type, nargs);
- if (type == NULL)
- error (_("element type of array unknown"));
- else
- return value_zero (ada_aligned_type (type), lval_memory);
- }
- return
- unwrap_value (ada_value_ptr_subscript (argvec[0],
+ type = ada_array_element_type (type, nargs);
+ if (type == NULL)
+ error (_("element type of array unknown"));
+ else
+ return value_zero (ada_aligned_type (type), lval_memory);
+ }
+ return
+ unwrap_value (ada_value_ptr_subscript (argvec[0],
nargs, argvec + 1));
- default:
- error (_("Attempt to index or call something other than an "
+ default:
+ error (_("Attempt to index or call something other than an "
"array or function"));
- }
+ }
case TERNOP_SLICE:
{
struct value *high_bound_val
= evaluate_subexp (nullptr, exp, pos, noside);
LONGEST low_bound;
- LONGEST high_bound;
-
- low_bound_val = coerce_ref (low_bound_val);
- high_bound_val = coerce_ref (high_bound_val);
- low_bound = value_as_long (low_bound_val);
- high_bound = value_as_long (high_bound_val);
-
- if (noside == EVAL_SKIP)
- goto nosideret;
-
- /* If this is a reference to an aligner type, then remove all
- the aligners. */
- if (value_type (array)->code () == TYPE_CODE_REF
- && ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array))))
- TYPE_TARGET_TYPE (value_type (array)) =
- ada_aligned_type (TYPE_TARGET_TYPE (value_type (array)));
-
- if (ada_is_constrained_packed_array_type (value_type (array)))
- error (_("cannot slice a packed array"));
-
- /* If this is a reference to an array or an array lvalue,
- convert to a pointer. */
- if (value_type (array)->code () == TYPE_CODE_REF
- || (value_type (array)->code () == TYPE_CODE_ARRAY
- && VALUE_LVAL (array) == lval_memory))
- array = value_addr (array);
-
- if (noside == EVAL_AVOID_SIDE_EFFECTS
- && ada_is_array_descriptor_type (ada_check_typedef
- (value_type (array))))
- return empty_array (ada_type_of_array (array, 0), low_bound,
+ LONGEST high_bound;
+
+ low_bound_val = coerce_ref (low_bound_val);
+ high_bound_val = coerce_ref (high_bound_val);
+ low_bound = value_as_long (low_bound_val);
+ high_bound = value_as_long (high_bound_val);
+
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
+ /* If this is a reference to an aligner type, then remove all
+ the aligners. */
+ if (value_type (array)->code () == TYPE_CODE_REF
+ && ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array))))
+ TYPE_TARGET_TYPE (value_type (array)) =
+ ada_aligned_type (TYPE_TARGET_TYPE (value_type (array)));
+
+ if (ada_is_constrained_packed_array_type (value_type (array)))
+ error (_("cannot slice a packed array"));
+
+ /* If this is a reference to an array or an array lvalue,
+ convert to a pointer. */
+ if (value_type (array)->code () == TYPE_CODE_REF
+ || (value_type (array)->code () == TYPE_CODE_ARRAY
+ && VALUE_LVAL (array) == lval_memory))
+ array = value_addr (array);
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS
+ && ada_is_array_descriptor_type (ada_check_typedef
+ (value_type (array))))
+ return empty_array (ada_type_of_array (array, 0), low_bound,
high_bound);
- array = ada_coerce_to_simple_array_ptr (array);
-
- /* If we have more than one level of pointer indirection,
- dereference the value until we get only one level. */
- while (value_type (array)->code () == TYPE_CODE_PTR
- && (TYPE_TARGET_TYPE (value_type (array))->code ()
- == TYPE_CODE_PTR))
- array = value_ind (array);
-
- /* Make sure we really do have an array type before going further,
- to avoid a SEGV when trying to get the index type or the target
- type later down the road if the debug info generated by
- the compiler is incorrect or incomplete. */
- if (!ada_is_simple_array_type (value_type (array)))
- error (_("cannot take slice of non-array"));
-
- if (ada_check_typedef (value_type (array))->code ()
- == TYPE_CODE_PTR)
- {
- struct type *type0 = ada_check_typedef (value_type (array));
-
- if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
- return empty_array (TYPE_TARGET_TYPE (type0), low_bound, high_bound);
- else
- {
- struct type *arr_type0 =
- to_fixed_array_type (TYPE_TARGET_TYPE (type0), NULL, 1);
-
- return ada_value_slice_from_ptr (array, arr_type0,
- longest_to_int (low_bound),
- longest_to_int (high_bound));
- }
- }
- else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return array;
- else if (high_bound < low_bound)
- return empty_array (value_type (array), low_bound, high_bound);
- else
- return ada_value_slice (array, longest_to_int (low_bound),
+ array = ada_coerce_to_simple_array_ptr (array);
+
+ /* If we have more than one level of pointer indirection,
+ dereference the value until we get only one level. */
+ while (value_type (array)->code () == TYPE_CODE_PTR
+ && (TYPE_TARGET_TYPE (value_type (array))->code ()
+ == TYPE_CODE_PTR))
+ array = value_ind (array);
+
+ /* Make sure we really do have an array type before going further,
+ to avoid a SEGV when trying to get the index type or the target
+ type later down the road if the debug info generated by
+ the compiler is incorrect or incomplete. */
+ if (!ada_is_simple_array_type (value_type (array)))
+ error (_("cannot take slice of non-array"));
+
+ if (ada_check_typedef (value_type (array))->code ()
+ == TYPE_CODE_PTR)
+ {
+ struct type *type0 = ada_check_typedef (value_type (array));
+
+ if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
+ return empty_array (TYPE_TARGET_TYPE (type0), low_bound, high_bound);
+ else
+ {
+ struct type *arr_type0 =
+ to_fixed_array_type (TYPE_TARGET_TYPE (type0), NULL, 1);
+
+ return ada_value_slice_from_ptr (array, arr_type0,
+ longest_to_int (low_bound),
+ longest_to_int (high_bound));
+ }
+ }
+ else if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ return array;
+ else if (high_bound < low_bound)
+ return empty_array (value_type (array), low_bound, high_bound);
+ else
+ return ada_value_slice (array, longest_to_int (low_bound),
longest_to_int (high_bound));
}
type = check_typedef (exp->elts[pc + 1].type);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
switch (type->code ())
- {
- default:
- lim_warning (_("Membership test incompletely implemented; "
+ {
+ default:
+ lim_warning (_("Membership test incompletely implemented; "
"always returns true"));
type = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) 1);
- case TYPE_CODE_RANGE:
+ case TYPE_CODE_RANGE:
arg2 = value_from_longest (type,
type->bounds ()->low.const_val ());
arg3 = value_from_longest (type,
type = language_bool_type (exp->language_defn, exp->gdbarch);
return
value_from_longest (type,
- (value_less (arg1, arg3)
- || value_equal (arg1, arg3))
- && (value_less (arg2, arg1)
- || value_equal (arg2, arg1)));
- }
+ (value_less (arg1, arg3)
+ || value_equal (arg1, arg3))
+ && (value_less (arg2, arg1)
+ || value_equal (arg2, arg1)));
+ }
case BINOP_IN_BOUNDS:
(*pos) += 2;
arg2 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
type = language_bool_type (exp->language_defn, exp->gdbarch);
return
- value_from_longest (type,
- (value_less (arg1, arg3)
- || value_equal (arg1, arg3))
- && (value_less (arg2, arg1)
- || value_equal (arg2, arg1)));
+ value_from_longest (type,
+ (value_less (arg1, arg3)
+ || value_equal (arg1, arg3))
+ && (value_less (arg2, arg1)
+ || value_equal (arg2, arg1)));
case TERNOP_IN_RANGE:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
arg3 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
type = language_bool_type (exp->language_defn, exp->gdbarch);
return
- value_from_longest (type,
- (value_less (arg1, arg3)
- || value_equal (arg1, arg3))
- && (value_less (arg2, arg1)
- || value_equal (arg2, arg1)));
+ value_from_longest (type,
+ (value_less (arg1, arg3)
+ || value_equal (arg1, arg3))
+ && (value_less (arg2, arg1)
+ || value_equal (arg2, arg1)));
case OP_ATR_FIRST:
case OP_ATR_LAST:
case OP_ATR_LENGTH:
{
- struct type *type_arg;
+ struct type *type_arg;
- if (exp->elts[*pos].opcode == OP_TYPE)
- {
+ if (exp->elts[*pos].opcode == OP_TYPE)
+ {
evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
arg1 = NULL;
- type_arg = check_typedef (exp->elts[pc + 2].type);
- }
- else
- {
+ type_arg = check_typedef (exp->elts[pc + 2].type);
+ }
+ else
+ {
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
type_arg = NULL;
- }
+ }
- if (exp->elts[*pos].opcode != OP_LONG)
- error (_("Invalid operand to '%s"), ada_attribute_name (op));
- tem = longest_to_int (exp->elts[*pos + 2].longconst);
- *pos += 4;
+ if (exp->elts[*pos].opcode != OP_LONG)
+ error (_("Invalid operand to '%s"), ada_attribute_name (op));
+ tem = longest_to_int (exp->elts[*pos + 2].longconst);
+ *pos += 4;
- if (noside == EVAL_SKIP)
- goto nosideret;
+ if (noside == EVAL_SKIP)
+ goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
if (type_arg == NULL)
type_arg = value_type (arg1);
- if (ada_is_constrained_packed_array_type (type_arg))
+ if (ada_is_constrained_packed_array_type (type_arg))
type_arg = decode_constrained_packed_array_type (type_arg);
if (!discrete_type_p (type_arg))
return value_zero (type_arg, not_lval);
}
- else if (type_arg == NULL)
- {
- arg1 = ada_coerce_ref (arg1);
+ else if (type_arg == NULL)
+ {
+ arg1 = ada_coerce_ref (arg1);
- if (ada_is_constrained_packed_array_type (value_type (arg1)))
- arg1 = ada_coerce_to_simple_array (arg1);
+ if (ada_is_constrained_packed_array_type (value_type (arg1)))
+ arg1 = ada_coerce_to_simple_array (arg1);
- if (op == OP_ATR_LENGTH)
+ if (op == OP_ATR_LENGTH)
type = builtin_type (exp->gdbarch)->builtin_int;
else
{
type = builtin_type (exp->gdbarch)->builtin_int;
}
- switch (op)
- {
- default: /* Should never happen. */
- error (_("unexpected attribute encountered"));
- case OP_ATR_FIRST:
- return value_from_longest
+ switch (op)
+ {
+ default: /* Should never happen. */
+ error (_("unexpected attribute encountered"));
+ case OP_ATR_FIRST:
+ return value_from_longest
(type, ada_array_bound (arg1, tem, 0));
- case OP_ATR_LAST:
- return value_from_longest
+ case OP_ATR_LAST:
+ return value_from_longest
(type, ada_array_bound (arg1, tem, 1));
- case OP_ATR_LENGTH:
- return value_from_longest
+ case OP_ATR_LENGTH:
+ return value_from_longest
(type, ada_array_length (arg1, tem));
- }
- }
- else if (discrete_type_p (type_arg))
- {
- struct type *range_type;
- const char *name = ada_type_name (type_arg);
-
- range_type = NULL;
- if (name != NULL && type_arg->code () != TYPE_CODE_ENUM)
- range_type = to_fixed_range_type (type_arg, NULL);
- if (range_type == NULL)
- range_type = type_arg;
- switch (op)
- {
- default:
- error (_("unexpected attribute encountered"));
- case OP_ATR_FIRST:
+ }
+ }
+ else if (discrete_type_p (type_arg))
+ {
+ struct type *range_type;
+ const char *name = ada_type_name (type_arg);
+
+ range_type = NULL;
+ if (name != NULL && type_arg->code () != TYPE_CODE_ENUM)
+ range_type = to_fixed_range_type (type_arg, NULL);
+ if (range_type == NULL)
+ range_type = type_arg;
+ switch (op)
+ {
+ default:
+ error (_("unexpected attribute encountered"));
+ case OP_ATR_FIRST:
return value_from_longest
(range_type, ada_discrete_type_low_bound (range_type));
- case OP_ATR_LAST:
- return value_from_longest
+ case OP_ATR_LAST:
+ return value_from_longest
(range_type, ada_discrete_type_high_bound (range_type));
- case OP_ATR_LENGTH:
- error (_("the 'length attribute applies only to array types"));
- }
- }
- else if (type_arg->code () == TYPE_CODE_FLT)
- error (_("unimplemented type attribute"));
- else
- {
- LONGEST low, high;
-
- if (ada_is_constrained_packed_array_type (type_arg))
- type_arg = decode_constrained_packed_array_type (type_arg);
+ case OP_ATR_LENGTH:
+ error (_("the 'length attribute applies only to array types"));
+ }
+ }
+ else if (type_arg->code () == TYPE_CODE_FLT)
+ error (_("unimplemented type attribute"));
+ else
+ {
+ LONGEST low, high;
+
+ if (ada_is_constrained_packed_array_type (type_arg))
+ type_arg = decode_constrained_packed_array_type (type_arg);
if (op == OP_ATR_LENGTH)
type = builtin_type (exp->gdbarch)->builtin_int;
type = builtin_type (exp->gdbarch)->builtin_int;
}
- switch (op)
- {
- default:
- error (_("unexpected attribute encountered"));
- case OP_ATR_FIRST:
- low = ada_array_bound_from_type (type_arg, tem, 0);
- return value_from_longest (type, low);
- case OP_ATR_LAST:
- high = ada_array_bound_from_type (type_arg, tem, 1);
- return value_from_longest (type, high);
- case OP_ATR_LENGTH:
- low = ada_array_bound_from_type (type_arg, tem, 0);
- high = ada_array_bound_from_type (type_arg, tem, 1);
- return value_from_longest (type, high - low + 1);
- }
- }
+ switch (op)
+ {
+ default:
+ error (_("unexpected attribute encountered"));
+ case OP_ATR_FIRST:
+ low = ada_array_bound_from_type (type_arg, tem, 0);
+ return value_from_longest (type, low);
+ case OP_ATR_LAST:
+ high = ada_array_bound_from_type (type_arg, tem, 1);
+ return value_from_longest (type, high);
+ case OP_ATR_LENGTH:
+ low = ada_array_bound_from_type (type_arg, tem, 0);
+ high = ada_array_bound_from_type (type_arg, tem, 1);
+ return value_from_longest (type, high - low + 1);
+ }
+ }
}
case OP_ATR_TAG:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (ada_tag_type (arg1), not_lval);
+ return value_zero (ada_tag_type (arg1), not_lval);
return ada_value_tag (arg1);
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
arg2 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (value_type (arg1), not_lval);
+ return value_zero (value_type (arg1), not_lval);
else
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
case OP_ATR_MODULUS:
{
- struct type *type_arg = check_typedef (exp->elts[pc + 2].type);
+ struct type *type_arg = check_typedef (exp->elts[pc + 2].type);
evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
- if (!ada_is_modular_type (type_arg))
- error (_("'modulus must be applied to modular type"));
+ if (!ada_is_modular_type (type_arg))
+ error (_("'modulus must be applied to modular type"));
- return value_from_longest (TYPE_TARGET_TYPE (type_arg),
- ada_modulus (type_arg));
+ return value_from_longest (TYPE_TARGET_TYPE (type_arg),
+ ada_modulus (type_arg));
}
evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
type = builtin_type (exp->gdbarch)->builtin_int;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (type, not_lval);
type = value_type (arg1);
/* If the argument is a reference, then dereference its type, since
- the user is really asking for the size of the actual object,
- not the size of the pointer. */
+ the user is really asking for the size of the actual object,
+ not the size of the pointer. */
if (type->code () == TYPE_CODE_REF)
- type = TYPE_TARGET_TYPE (type);
+ type = TYPE_TARGET_TYPE (type);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
+ return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
else
- return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
- TARGET_CHAR_BIT * TYPE_LENGTH (type));
+ return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
+ TARGET_CHAR_BIT * TYPE_LENGTH (type));
case OP_ATR_VAL:
evaluate_subexp (nullptr, exp, pos, EVAL_SKIP);
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
type = exp->elts[pc + 2].type;
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (type, not_lval);
+ return value_zero (type, not_lval);
else
- return value_val_atr (type, arg1);
+ return value_val_atr (type, arg1);
case BINOP_EXP:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
arg2 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return value_zero (value_type (arg1), not_lval);
+ return value_zero (value_type (arg1), not_lval);
else
{
/* For integer exponentiation operations,
case UNOP_PLUS:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
else
- return arg1;
+ return arg1;
case UNOP_ABS:
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
unop_promote (exp->language_defn, exp->gdbarch, &arg1);
if (value_less (arg1, value_zero (value_type (arg1), not_lval)))
- return value_neg (arg1);
+ return value_neg (arg1);
else
- return arg1;
+ return arg1;
case UNOP_IND:
preeval_pos = *pos;
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
type = ada_check_typedef (value_type (arg1));
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- if (ada_is_array_descriptor_type (type))
- /* GDB allows dereferencing GNAT array descriptors. */
- {
- struct type *arrType = ada_type_of_array (arg1, 0);
-
- if (arrType == NULL)
- error (_("Attempt to dereference null array pointer."));
- return value_at_lazy (arrType, 0);
- }
- else if (type->code () == TYPE_CODE_PTR
- || type->code () == TYPE_CODE_REF
- /* In C you can dereference an array to get the 1st elt. */
- || type->code () == TYPE_CODE_ARRAY)
- {
- /* As mentioned in the OP_VAR_VALUE case, tagged types can
- only be determined by inspecting the object's tag.
- This means that we need to evaluate completely the
- expression in order to get its type. */
+ {
+ if (ada_is_array_descriptor_type (type))
+ /* GDB allows dereferencing GNAT array descriptors. */
+ {
+ struct type *arrType = ada_type_of_array (arg1, 0);
+
+ if (arrType == NULL)
+ error (_("Attempt to dereference null array pointer."));
+ return value_at_lazy (arrType, 0);
+ }
+ else if (type->code () == TYPE_CODE_PTR
+ || type->code () == TYPE_CODE_REF
+ /* In C you can dereference an array to get the 1st elt. */
+ || type->code () == TYPE_CODE_ARRAY)
+ {
+ /* As mentioned in the OP_VAR_VALUE case, tagged types can
+ only be determined by inspecting the object's tag.
+ This means that we need to evaluate completely the
+ expression in order to get its type. */
if ((type->code () == TYPE_CODE_REF
|| type->code () == TYPE_CODE_PTR)
(ada_check_typedef (TYPE_TARGET_TYPE (type))));
}
ada_ensure_varsize_limit (type);
- return value_zero (type, lval_memory);
- }
- else if (type->code () == TYPE_CODE_INT)
+ return value_zero (type, lval_memory);
+ }
+ else if (type->code () == TYPE_CODE_INT)
{
/* GDB allows dereferencing an int. */
if (expect_type == NULL)
return value_zero (expect_type, lval_memory);
}
}
- else
- error (_("Attempt to take contents of a non-pointer value."));
- }
+ else
+ error (_("Attempt to take contents of a non-pointer value."));
+ }
arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
type = ada_check_typedef (value_type (arg1));
if (type->code () == TYPE_CODE_INT)
- /* GDB allows dereferencing an int. If we were given
- the expect_type, then use that as the target type.
- Otherwise, assume that the target type is an int. */
- {
- if (expect_type != NULL)
+ /* GDB allows dereferencing an int. If we were given
+ the expect_type, then use that as the target type.
+ Otherwise, assume that the target type is an int. */
+ {
+ if (expect_type != NULL)
return ada_value_ind (value_cast (lookup_pointer_type (expect_type),
arg1));
else
return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
(CORE_ADDR) value_as_address (arg1));
- }
+ }
if (ada_is_array_descriptor_type (type))
- /* GDB allows dereferencing GNAT array descriptors. */
- return ada_coerce_to_simple_array (arg1);
+ /* GDB allows dereferencing GNAT array descriptors. */
+ return ada_coerce_to_simple_array (arg1);
else
- return ada_value_ind (arg1);
+ return ada_value_ind (arg1);
case STRUCTOP_STRUCT:
tem = longest_to_int (exp->elts[pc + 1].longconst);
preeval_pos = *pos;
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- struct type *type1 = value_type (arg1);
+ {
+ struct type *type1 = value_type (arg1);
- if (ada_is_tagged_type (type1, 1))
- {
- type = ada_lookup_struct_elt_type (type1,
- &exp->elts[pc + 2].string,
- 1, 1);
+ if (ada_is_tagged_type (type1, 1))
+ {
+ type = ada_lookup_struct_elt_type (type1,
+ &exp->elts[pc + 2].string,
+ 1, 1);
/* If the field is not found, check if it exists in the
extension of this object's type. This means that we
need to evaluate completely the expression. */
- if (type == NULL)
+ if (type == NULL)
{
arg1
= evaluate_subexp (nullptr, exp, &preeval_pos, EVAL_NORMAL);
arg1 = unwrap_value (arg1);
type = value_type (ada_to_fixed_value (arg1));
}
- }
- else
- type =
- ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1,
- 0);
-
- return value_zero (ada_aligned_type (type), lval_memory);
- }
+ }
+ else
+ type =
+ ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1,
+ 0);
+
+ return value_zero (ada_aligned_type (type), lval_memory);
+ }
else
{
arg1 = ada_value_struct_elt (arg1, &exp->elts[pc + 2].string, 0);
case OP_TYPE:
/* The value is not supposed to be used. This is here to make it
- easier to accommodate expressions that contain types. */
+ easier to accommodate expressions that contain types. */
(*pos) += 2;
if (noside == EVAL_SKIP)
- goto nosideret;
+ goto nosideret;
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
- return allocate_value (exp->elts[pc + 1].type);
+ return allocate_value (exp->elts[pc + 1].type);
else
- error (_("Attempt to use a type name as an expression"));
+ error (_("Attempt to use a type name as an expression"));
case OP_AGGREGATE:
case OP_CHOICES:
}
\f
- /* Fixed point */
+ /* Fixed point */
/* If TYPE encodes an Ada fixed-point type, return the suffix of the
type name that encodes the 'small and 'delta information.
const char *tail = strstr (name, "___XF_");
if (tail == NULL)
- return NULL;
+ return NULL;
else
- return tail + 5;
+ return tail + 5;
}
else if (code == TYPE_CODE_RANGE && TYPE_TARGET_TYPE (type) != type)
return gnat_encoded_fixed_point_type_info (TYPE_TARGET_TYPE (type));
\f
- /* Range types */
+ /* Range types */
/* Scan STR beginning at position K for a discriminant name, and
return the value of that discriminant field of DVAL in *PX. If
static int
scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px,
- int *pnew_k)
+ int *pnew_k)
{
static char *bound_buffer = NULL;
static size_t bound_buffer_len = 0;
if (nsyms != 1)
{
if (err_msg == NULL)
- return 0;
+ return 0;
else
- error (("%s"), err_msg);
+ error (("%s"), err_msg);
}
return value_of_variable (syms[0].symbol, syms[0].block);
n = 1;
if (*subtype_info == 'L')
- {
- if (!ada_scan_number (bounds_str, n, &L, &n)
- && !scan_discrim_bound (bounds_str, n, dval, &L, &n))
- return raw_type;
- if (bounds_str[n] == '_')
- n += 2;
- else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */
- n += 1;
- subtype_info += 1;
- }
+ {
+ if (!ada_scan_number (bounds_str, n, &L, &n)
+ && !scan_discrim_bound (bounds_str, n, dval, &L, &n))
+ return raw_type;
+ if (bounds_str[n] == '_')
+ n += 2;
+ else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */
+ n += 1;
+ subtype_info += 1;
+ }
else
- {
- strcpy (name_buf + prefix_len, "___L");
- if (!get_int_var_value (name_buf, L))
- {
- lim_warning (_("Unknown lower bound, using 1."));
- L = 1;
- }
- }
+ {
+ strcpy (name_buf + prefix_len, "___L");
+ if (!get_int_var_value (name_buf, L))
+ {
+ lim_warning (_("Unknown lower bound, using 1."));
+ L = 1;
+ }
+ }
if (*subtype_info == 'U')
- {
- if (!ada_scan_number (bounds_str, n, &U, &n)
- && !scan_discrim_bound (bounds_str, n, dval, &U, &n))
- return raw_type;
- }
+ {
+ if (!ada_scan_number (bounds_str, n, &U, &n)
+ && !scan_discrim_bound (bounds_str, n, dval, &U, &n))
+ return raw_type;
+ }
else
- {
- strcpy (name_buf + prefix_len, "___U");
- if (!get_int_var_value (name_buf, U))
- {
- lim_warning (_("Unknown upper bound, using %ld."), (long) L);
- U = L;
- }
- }
+ {
+ strcpy (name_buf + prefix_len, "___U");
+ if (!get_int_var_value (name_buf, U))
+ {
+ lim_warning (_("Unknown upper bound, using %ld."), (long) L);
+ U = L;
+ }
+ }
type = create_static_range_type (alloc_type_copy (raw_type),
base_type, L, U);
/* create_static_range_type alters the resulting type's length
- to match the size of the base_type, which is not what we want.
- Set it back to the original range type's length. */
+ to match the size of the base_type, which is not what we want.
+ Set it back to the original range type's length. */
TYPE_LENGTH (type) = TYPE_LENGTH (raw_type);
type->set_name (name);
return type;
}
\f
- /* Modular types */
+ /* Modular types */
/* True iff TYPE is an Ada modular type. */
struct type *subranged_type = get_base_type (type);
return (subranged_type != NULL && type->code () == TYPE_CODE_RANGE
- && subranged_type->code () == TYPE_CODE_INT
- && subranged_type->is_unsigned ());
+ && subranged_type->code () == TYPE_CODE_INT
+ && subranged_type->is_unsigned ());
}
/* Assuming ada_is_modular_type (TYPE), the modulus of TYPE. */
{
re_comp (known_runtime_file_name_patterns[i]);
if (re_exec (lbasename (sal.symtab->filename)))
- return 1;
+ return 1;
if (SYMTAB_OBJFILE (sal.symtab) != NULL
- && re_exec (objfile_name (SYMTAB_OBJFILE (sal.symtab))))
- return 1;
+ && re_exec (objfile_name (SYMTAB_OBJFILE (sal.symtab))))
+ return 1;
}
/* Check whether the function is a GNAT-generated entity. */
for (; fi != NULL; fi = get_prev_frame (fi))
{
if (!is_known_support_routine (fi))
- {
- select_frame (fi);
- break;
- }
+ {
+ select_frame (fi);
+ break;
+ }
}
}
= find_frame_funname (fi, &func_lang, NULL);
if (func_name != NULL)
{
- if (strcmp (func_name.get (),
+ if (strcmp (func_name.get (),
data->exception_info->catch_exception_sym) == 0)
break; /* We found the frame we were looking for... */
}
static CORE_ADDR
ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex,
- struct breakpoint *b)
+ struct breakpoint *b)
{
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
switch (ex)
{
case ada_catch_exception:
- return (parse_and_eval_address ("e.full_name"));
- break;
+ return (parse_and_eval_address ("e.full_name"));
+ break;
case ada_catch_exception_unhandled:
- return data->exception_info->unhandled_exception_name_addr ();
- break;
+ return data->exception_info->unhandled_exception_name_addr ();
+ break;
case ada_catch_handlers:
- return 0; /* The runtimes does not provide access to the exception
+ return 0; /* The runtimes does not provide access to the exception
name. */
- break;
+ break;
case ada_catch_assert:
- return 0; /* Exception name is not relevant in this case. */
- break;
+ return 0; /* Exception name is not relevant in this case. */
+ break;
default:
- internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
- break;
+ internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+ break;
}
return 0; /* Should never be reached. */
static CORE_ADDR
ada_exception_name_addr (enum ada_exception_catchpoint_kind ex,
- struct breakpoint *b)
+ struct breakpoint *b)
{
CORE_ADDR result = 0;
static void
create_excep_cond_exprs (struct ada_catchpoint *c,
- enum ada_exception_catchpoint_kind ex)
+ enum ada_exception_catchpoint_kind ex)
{
struct bp_location *bl;
switch (c->m_kind)
{
case ada_catch_exception:
- if (!c->excep_string.empty ())
- {
+ if (!c->excep_string.empty ())
+ {
std::string msg = string_printf (_("`%s' Ada exception"),
c->excep_string.c_str ());
- uiout->field_string ("what", msg);
- }
- else
- uiout->field_string ("what", "all Ada exceptions");
-
- break;
+ uiout->field_string ("what", msg);
+ }
+ else
+ uiout->field_string ("what", "all Ada exceptions");
+
+ break;
case ada_catch_exception_unhandled:
- uiout->field_string ("what", "unhandled Ada exceptions");
- break;
+ uiout->field_string ("what", "unhandled Ada exceptions");
+ break;
case ada_catch_handlers:
- if (!c->excep_string.empty ())
- {
+ if (!c->excep_string.empty ())
+ {
uiout->field_fmt ("what",
_("`%s' Ada exception handlers"),
c->excep_string.c_str ());
- }
- else
+ }
+ else
uiout->field_string ("what", "all Ada exceptions handlers");
- break;
+ break;
case ada_catch_assert:
- uiout->field_string ("what", "failed Ada assertions");
- break;
+ uiout->field_string ("what", "failed Ada assertions");
+ break;
default:
- internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
- break;
+ internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+ break;
}
}
struct ui_out *uiout = current_uiout;
uiout->text (b->disposition == disp_del ? _("Temporary catchpoint ")
- : _("Catchpoint "));
+ : _("Catchpoint "));
uiout->field_signed ("bkptno", b->number);
uiout->text (": ");
switch (c->m_kind)
{
case ada_catch_exception:
- if (!c->excep_string.empty ())
+ if (!c->excep_string.empty ())
{
std::string info = string_printf (_("`%s' Ada exception"),
c->excep_string.c_str ());
uiout->text (info.c_str ());
}
- else
- uiout->text (_("all Ada exceptions"));
- break;
+ else
+ uiout->text (_("all Ada exceptions"));
+ break;
case ada_catch_exception_unhandled:
- uiout->text (_("unhandled Ada exceptions"));
- break;
+ uiout->text (_("unhandled Ada exceptions"));
+ break;
case ada_catch_handlers:
- if (!c->excep_string.empty ())
+ if (!c->excep_string.empty ())
{
std::string info
= string_printf (_("`%s' Ada exception handlers"),
c->excep_string.c_str ());
uiout->text (info.c_str ());
}
- else
- uiout->text (_("all Ada exceptions handlers"));
- break;
+ else
+ uiout->text (_("all Ada exceptions handlers"));
+ break;
case ada_catch_assert:
- uiout->text (_("failed Ada assertions"));
- break;
+ uiout->text (_("failed Ada assertions"));
+ break;
default:
- internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
- break;
+ internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
+ break;
}
}
static void
catch_ada_exception_command_split (const char *args,
bool is_catch_handlers_cmd,
- enum ada_exception_catchpoint_kind *ex,
+ enum ada_exception_catchpoint_kind *ex,
std::string *excep_string,
std::string *cond_string)
{
args = skip_spaces (args);
if (args[0] == '\0')
- error (_("Condition missing after `if' keyword"));
+ error (_("Condition missing after `if' keyword"));
*cond_string = args;
args += strlen (args);
switch (ex)
{
case ada_catch_exception:
- return (data->exception_info->catch_exception_sym);
- break;
+ return (data->exception_info->catch_exception_sym);
+ break;
case ada_catch_exception_unhandled:
- return (data->exception_info->catch_exception_unhandled_sym);
- break;
+ return (data->exception_info->catch_exception_unhandled_sym);
+ break;
case ada_catch_assert:
- return (data->exception_info->catch_assert_sym);
- break;
+ return (data->exception_info->catch_assert_sym);
+ break;
case ada_catch_handlers:
- return (data->exception_info->catch_handlers_sym);
- break;
+ return (data->exception_info->catch_handlers_sym);
+ break;
default:
- internal_error (__FILE__, __LINE__,
- _("unexpected catchpoint kind (%d)"), ex);
+ internal_error (__FILE__, __LINE__,
+ _("unexpected catchpoint kind (%d)"), ex);
}
}
switch (ex)
{
case ada_catch_exception:
- return (&catch_exception_breakpoint_ops);
- break;
+ return (&catch_exception_breakpoint_ops);
+ break;
case ada_catch_exception_unhandled:
- return (&catch_exception_unhandled_breakpoint_ops);
- break;
+ return (&catch_exception_unhandled_breakpoint_ops);
+ break;
case ada_catch_assert:
- return (&catch_assert_breakpoint_ops);
- break;
+ return (&catch_assert_breakpoint_ops);
+ break;
case ada_catch_handlers:
- return (&catch_handlers_breakpoint_ops);
- break;
+ return (&catch_handlers_breakpoint_ops);
+ break;
default:
- internal_error (__FILE__, __LINE__,
- _("unexpected catchpoint kind (%d)"), ex);
+ internal_error (__FILE__, __LINE__,
+ _("unexpected catchpoint kind (%d)"), ex);
}
}
static std::string
ada_exception_catchpoint_cond_string (const char *excep_string,
- enum ada_exception_catchpoint_kind ex)
+ enum ada_exception_catchpoint_kind ex)
{
int i;
bool is_standard_exc = false;
if (ex == ada_catch_handlers)
{
/* For exception handlers catchpoints, the condition string does
- not use the same parameter as for the other exceptions. */
+ not use the same parameter as for the other exceptions. */
result = ("long_integer (GNAT_GCC_exception_Access"
"(gcc_exception).all.occurrence.id)");
}
args += 2;
args = skip_spaces (args);
if (args[0] == '\0')
- error (_("condition missing after `if' keyword"));
+ error (_("condition missing after `if' keyword"));
cond_string.assign (args);
}
const char *type_name = SYMBOL_TYPE (sym)->name ();
return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
- && SYMBOL_CLASS (sym) != LOC_BLOCK
- && SYMBOL_CLASS (sym) != LOC_CONST
- && SYMBOL_CLASS (sym) != LOC_UNRESOLVED
- && type_name != NULL && strcmp (type_name, "exception") == 0);
+ && SYMBOL_CLASS (sym) != LOC_BLOCK
+ && SYMBOL_CLASS (sym) != LOC_CONST
+ && SYMBOL_CLASS (sym) != LOC_UNRESOLVED
+ && type_name != NULL && strcmp (type_name, "exception") == 0);
}
/* Given a global symbol SYM, return non-zero iff SYM is a non-standard
printf_filtered ("%s: %s\n", info.name, paddress (gdbarch, info.addr));
}
- /* Operators */
+ /* Operators */
/* Information about operators given special treatment in functions
below. */
/* Format: OP_DEFN (<operator>, <operator length>, <# args>, <binop>). */
static void
ada_forward_operator_length (struct expression *exp, int pc,
- int *oplenp, int *argsp)
+ int *oplenp, int *argsp)
{
switch (exp->elts[pc].opcode)
{
static void
ada_print_subexp (struct expression *exp, int *pos,
- struct ui_file *stream, enum precedence prec)
+ struct ui_file *stream, enum precedence prec)
{
int oplen, nargs, i;
int pc = *pos;
print_subexp (exp, pos, stream, PREC_SUFFIX);
fputs_filtered ("'range", stream);
if (exp->elts[pc + 1].longconst > 1)
- fprintf_filtered (stream, "(%ld)",
- (long) exp->elts[pc + 1].longconst);
+ fprintf_filtered (stream, "(%ld)",
+ (long) exp->elts[pc + 1].longconst);
return;
case TERNOP_IN_RANGE:
if (prec >= PREC_EQUAL)
- fputs_filtered ("(", stream);
+ fputs_filtered ("(", stream);
/* XXX: sprint_subexp */
print_subexp (exp, pos, stream, PREC_SUFFIX);
fputs_filtered (" in ", stream);
fputs_filtered (" .. ", stream);
print_subexp (exp, pos, stream, PREC_EQUAL);
if (prec >= PREC_EQUAL)
- fputs_filtered (")", stream);
+ fputs_filtered (")", stream);
return;
case OP_ATR_FIRST:
case OP_ATR_TAG:
case OP_ATR_VAL:
if (exp->elts[*pos].opcode == OP_TYPE)
- {
- if (exp->elts[*pos + 1].type->code () != TYPE_CODE_VOID)
- LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0,
+ {
+ if (exp->elts[*pos + 1].type->code () != TYPE_CODE_VOID)
+ LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0,
&type_print_raw_options);
- *pos += 3;
- }
+ *pos += 3;
+ }
else
- print_subexp (exp, pos, stream, PREC_SUFFIX);
+ print_subexp (exp, pos, stream, PREC_SUFFIX);
fprintf_filtered (stream, "'%s", ada_attribute_name (op));
if (nargs > 1)
- {
- int tem;
-
- for (tem = 1; tem < nargs; tem += 1)
- {
- fputs_filtered ((tem == 1) ? " (" : ", ", stream);
- print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
- }
- fputs_filtered (")", stream);
- }
+ {
+ int tem;
+
+ for (tem = 1; tem < nargs; tem += 1)
+ {
+ fputs_filtered ((tem == 1) ? " (" : ", ", stream);
+ print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
+ }
+ fputs_filtered (")", stream);
+ }
return;
case UNOP_QUAL:
&show_ada_list, "show ada ", 0, &showlist);
add_setshow_boolean_cmd ("trust-PAD-over-XVS", class_obscure,
- &trust_pad_over_xvs, _("\
+ &trust_pad_over_xvs, _("\
Enable or disable an optimization trusting PAD types over XVS types."), _("\
Show whether an optimization trusting PAD types over XVS types is activated."),
- _("\
+ _("\
This is related to the encoding used by the GNAT compiler. The debugger\n\
should normally trust the contents of PAD types, but certain older versions\n\
of GNAT have a bug that sometimes causes the information in the PAD type\n\
work around this bug. It is always safe to turn this option \"off\", but\n\
this incurs a slight performance penalty, so it is recommended to NOT change\n\
this option to \"off\" unless necessary."),
- NULL, NULL, &set_ada_list, &show_ada_list);
+ NULL, NULL, &set_ada_list, &show_ada_list);
add_setshow_boolean_cmd ("print-signatures", class_vars,
&print_signatures, _("\
CONDITION is a boolean expression that is evaluated to see whether the\n\
exception should cause a stop."),
catch_ada_handlers_command,
- catch_ada_completer,
+ catch_ada_completer,
CATCH_PERMANENT,
CATCH_TEMPORARY);
add_catch_command ("assert", _("\
CONDITION is a boolean expression that is evaluated to see whether the\n\
exception should cause a stop."),
catch_assert_command,
- NULL,
+ NULL,
CATCH_PERMANENT,
CATCH_TEMPORARY);
ADA_NOT_RENAMING,
/* For symbols declared
- Foo : TYPE renamed OBJECT; */
+ Foo : TYPE renamed OBJECT; */
ADA_OBJECT_RENAMING,
/* For symbols declared
- Foo : exception renames EXCEPTION; */
+ Foo : exception renames EXCEPTION; */
ADA_EXCEPTION_RENAMING,
/* For packages declared
- package Foo renames PACKAGE; */
+ package Foo renames PACKAGE; */
ADA_PACKAGE_RENAMING,
/* For subprograms declared
- SUBPROGRAM_SPEC renames SUBPROGRAM;
+ SUBPROGRAM_SPEC renames SUBPROGRAM;
(Currently not used). */
ADA_SUBPROGRAM_RENAMING
};
extern void ada_ensure_varsize_limit (const struct type *type);
extern int ada_get_field_index (const struct type *type,
- const char *field_name,
- int maybe_missing);
+ const char *field_name,
+ int maybe_missing);
extern int ada_parse (struct parser_state *); /* Defined in ada-exp.y */
- /* Defined in ada-typeprint.c */
+ /* Defined in ada-typeprint.c */
extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
- int, const struct type_print_options *);
+ int, const struct type_print_options *);
extern void ada_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream);
extern void ada_value_print (struct value *, struct ui_file *,
const struct value_print_options *);
- /* Defined in ada-lang.c */
+ /* Defined in ada-lang.c */
extern void ada_emit_char (int, struct type *, struct ui_file *, int, int);
const struct value_print_options *);
struct value *ada_convert_actual (struct value *actual,
- struct type *formal_type0);
+ struct type *formal_type0);
extern bool ada_is_access_to_unconstrained_array (struct type *type);
extern struct value *ada_value_subscript (struct value *, int,
- struct value **);
+ struct value **);
extern void ada_fixup_array_indexes_type (struct type *index_desc_type);
extern std::string ada_decode (const char*);
extern int ada_lookup_symbol_list (const char *, const struct block *,
- domain_enum,
+ domain_enum,
std::vector<struct block_symbol> *);
extern struct block_symbol ada_lookup_symbol (const char *,
extern struct value *ada_value_primitive_packed_val (struct value *,
const gdb_byte *,
- long, int, int,
- struct type *);
+ long, int, int,
+ struct type *);
extern struct type *ada_coerce_to_simple_array_type (struct type *);
extern struct type *ada_to_fixed_type (struct type *, const gdb_byte *,
CORE_ADDR, struct value *,
- int check_tag);
+ int check_tag);
extern struct value *ada_to_fixed_value (struct value *val);
extern const char *ada_type_name (struct type *);
extern struct type *ada_find_parallel_type (struct type *,
- const char *suffix);
+ const char *suffix);
extern bool get_int_var_value (const char *, LONGEST &value);
the list of Ada tasks. The value of this field influences
the interpretation of the known_tasks_addr field below:
- ADA_TASKS_UNKNOWN: The value of known_tasks_addr hasn't
- been determined yet;
+ been determined yet;
- ADA_TASKS_NOT_FOUND: The program probably does not use tasking
- and the known_tasks_addr is irrelevant;
+ and the known_tasks_addr is irrelevant;
- ADA_TASKS_ARRAY: The known_tasks is an array;
- ADA_TASKS_LIST: The known_tasks is a list. */
enum ada_known_tasks_kind known_tasks_kind = ADA_TASKS_UNKNOWN;
for (int i = 0; i < data->task_list.size (); i++)
{
if (data->task_list[i].task_id == task_id)
- return i + 1;
+ return i + 1;
}
/* Task not found. Return 0. */
for (ada_task_info &task : data->task_list)
{
if (!ada_task_is_alive (&task))
- continue;
+ continue;
iterator (&task);
}
}
bounds_type = type->field (bounds_fieldno).type ();
if (bounds_type->code () == TYPE_CODE_PTR)
- bounds_type = TYPE_TARGET_TYPE (bounds_type);
+ bounds_type = TYPE_TARGET_TYPE (bounds_type);
if (bounds_type->code () != TYPE_CODE_STRUCT)
- error (_("Unknown task name format. Aborting"));
+ error (_("Unknown task name format. Aborting"));
upper_bound_fieldno = ada_get_field_index (bounds_type, "UB0", 0);
initialize_fieldnos = 0;
if (atcb_sym == NULL || atcb_sym->type == NULL)
{
/* In Ravenscar run-time libs, the ATCB does not have a dynamic
- size, so the symbol name differs. */
+ size, so the symbol name differs. */
atcb_sym = lookup_symbol_in_language (atcb_name_fixed, NULL,
STRUCT_DOMAIN, language_c,
NULL).symbol;
if (atcb_sym == NULL || atcb_sym->type == NULL)
- return _("Cannot find Ada_Task_Control_Block type");
+ return _("Cannot find Ada_Task_Control_Block type");
type = atcb_sym->type;
}
else
{
/* Get a static representation of the type record
- Ada_Task_Control_Block. */
+ Ada_Task_Control_Block. */
type = atcb_sym->type;
type = ada_template_to_fixed_record_type_1 (type, NULL, 0, NULL, 0);
}
fieldnos.image = ada_get_field_index (common_type, "task_image", 1);
fieldnos.image_len = ada_get_field_index (common_type, "task_image_len", 1);
fieldnos.activation_link = ada_get_field_index (common_type,
- "activation_link", 1);
+ "activation_link", 1);
fieldnos.call = ada_get_field_index (common_type, "call", 1);
fieldnos.ll = ada_get_field_index (common_type, "ll", 0);
fieldnos.base_cpu = ada_get_field_index (common_type, "base_cpu", 0);
if (pspace_data->atcb_fieldno.image_len == -1)
{
if (pspace_data->atcb_fieldno.image >= 0)
- read_fat_string_value (task_info->name,
- value_field (common_value,
+ read_fat_string_value (task_info->name,
+ value_field (common_value,
pspace_data->atcb_fieldno.image),
- sizeof (task_info->name) - 1);
+ sizeof (task_info->name) - 1);
else
{
struct bound_minimal_symbol msym;
pspace_data->atcb_fieldno.image_len));
value_as_string (task_info->name,
- value_field (common_value,
+ value_field (common_value,
pspace_data->atcb_fieldno.image),
len);
}
&& pspace_data->atcb_fieldno.entry_calls > 0)
{
/* Let My_ATCB be the Ada task control block of a task calling the
- entry of another task; then the Task_Id of the called task is
- in My_ATCB.Entry_Calls (My_ATCB.ATC_Nesting_Level).Called_Task. */
+ entry of another task; then the Task_Id of the called task is
+ in My_ATCB.Entry_Calls (My_ATCB.ATC_Nesting_Level).Called_Task. */
atc_nesting_level_value =
- value_field (tcb_value, pspace_data->atcb_fieldno.atc_nesting_level);
+ value_field (tcb_value, pspace_data->atcb_fieldno.atc_nesting_level);
entry_calls_value =
- ada_coerce_to_simple_array_ptr
+ ada_coerce_to_simple_array_ptr
(value_field (tcb_value, pspace_data->atcb_fieldno.entry_calls));
entry_calls_value_element =
- value_subscript (entry_calls_value,
+ value_subscript (entry_calls_value,
value_as_long (atc_nesting_level_value));
called_task_fieldno =
- ada_get_field_index (value_type (entry_calls_value_element),
- "called_task", 0);
+ ada_get_field_index (value_type (entry_calls_value_element),
+ "called_task", 0);
task_info->called_task =
- value_as_address (value_field (entry_calls_value_element,
- called_task_fieldno));
+ value_as_address (value_field (entry_calls_value_element,
+ called_task_fieldno));
}
/* If the ATCB contains some information about RV callers, then
if (pspace_data->atcb_fieldno.call >= 0)
{
/* Get the ID of the caller task from Common_ATCB.Call.all.Self.
- If Common_ATCB.Call is null, then there is no caller. */
+ If Common_ATCB.Call is null, then there is no caller. */
const CORE_ADDR call =
- value_as_address (value_field (common_value,
+ value_as_address (value_field (common_value,
pspace_data->atcb_fieldno.call));
struct value *call_val;
if (call != 0)
- {
- call_val =
- value_from_contents_and_address (pspace_data->atcb_call_type,
+ {
+ call_val =
+ value_from_contents_and_address (pspace_data->atcb_call_type,
NULL, call);
- task_info->caller_task =
- value_as_address
+ task_info->caller_task =
+ value_as_address
(value_field (call_val, pspace_data->atcb_fieldno.call_self));
- }
+ }
}
task_info->base_cpu
for (i = 0; i < data->known_tasks_length; i++)
{
CORE_ADDR task_id =
- extract_typed_address (known_tasks + i * target_ptr_byte,
+ extract_typed_address (known_tasks + i * target_ptr_byte,
data->known_tasks_element);
if (task_id != 0)
- add_ada_task (task_id, current_inferior ());
+ add_ada_task (task_id, current_inferior ());
}
return true;
common_value = value_field (tcb_value, pspace_data->atcb_fieldno.common);
task_id = value_as_address
(value_field (common_value,
- pspace_data->atcb_fieldno.activation_link));
+ pspace_data->atcb_fieldno.activation_link));
}
return true;
to one task only, and this is not the task, skip
to the next one. */
if (taskno_arg && taskno != taskno_arg)
- continue;
+ continue;
ui_out_emit_tuple tuple_emitter (uiout, NULL);
/* Print a star if this task is the current task (or the task
- currently selected). */
+ currently selected). */
if (task_info->ptid == inferior_ptid)
uiout->field_string ("current", "*");
else
/* Print the associated Thread ID. */
if (uiout->is_mi_like_p ())
- {
+ {
thread_info *thread = (ada_task_is_alive (task_info)
? find_thread_ptid (inf, task_info->ptid)
: nullptr);
/* Print the ID of the parent task. */
parent_id = get_task_number_from_id (task_info->parent, inf);
if (parent_id)
- uiout->field_signed ("parent-id", parent_id);
+ uiout->field_signed ("parent-id", parent_id);
else
- uiout->field_skip ("parent-id");
+ uiout->field_skip ("parent-id");
/* Print the base priority of the task. */
uiout->field_signed ("priority", task_info->priority);
/* Finally, print the task name, without quotes around it, as mi like
is not expecting quotes, and in non mi-like no need for quotes
- as there is a specific column for the name. */
+ as there is a specific column for the name. */
uiout->field_fmt ("name",
(task_info->name[0] != '\0'
? ui_file_style ()
if (taskno <= 0 || taskno > data->task_list.size ())
error (_("Task ID %d not known. Use the \"info tasks\" command to\n"
- "see the IDs of currently known tasks"), taskno);
+ "see the IDs of currently known tasks"), taskno);
task_info = &data->task_list[taskno - 1];
/* Print the Ada task ID. */
printf_filtered (_("Parent: %d"), parent_taskno);
if (parent->name[0] != '\0')
- printf_filtered (" (%s)", parent->name);
+ printf_filtered (" (%s)", parent->name);
printf_filtered ("\n");
}
else
if (task_info->caller_task)
{
- target_taskno = get_task_number_from_id (task_info->caller_task, inf);
- printf_filtered (_("State: Accepting rendezvous with %d"),
- target_taskno);
+ target_taskno = get_task_number_from_id (task_info->caller_task, inf);
+ printf_filtered (_("State: Accepting rendezvous with %d"),
+ target_taskno);
}
else if (task_info->called_task)
{
- target_taskno = get_task_number_from_id (task_info->called_task, inf);
- printf_filtered (_("State: Waiting on task %d's entry"),
- target_taskno);
+ target_taskno = get_task_number_from_id (task_info->called_task, inf);
+ printf_filtered (_("State: Waiting on task %d's entry"),
+ target_taskno);
}
else
printf_filtered (_("State: %s"), _(long_task_states[task_info->state]));
if (target_taskno)
{
- ada_task_info *target_task_info = &data->task_list[target_taskno - 1];
+ ada_task_info *target_task_info = &data->task_list[target_taskno - 1];
- if (target_task_info->name[0] != '\0')
- printf_filtered (" (%s)", target_task_info->name);
+ if (target_task_info->name[0] != '\0')
+ printf_filtered (" (%s)", target_task_info->name);
}
printf_filtered ("\n");
if (taskno <= 0 || taskno > data->task_list.size ())
error (_("Task ID %d not known. Use the \"info tasks\" command to\n"
- "see the IDs of currently known tasks"), taskno);
+ "see the IDs of currently known tasks"), taskno);
task_info = &data->task_list[taskno - 1];
if (!ada_task_is_alive (task_info))
thread_info *tp = find_thread_ptid (inf, task_info->ptid);
if (tp == NULL)
error (_("Unable to compute thread ID for task %s.\n"
- "Cannot switch to this task."),
- task_to_str (taskno, task_info).c_str ());
+ "Cannot switch to this task."),
+ task_to_str (taskno, task_info).c_str ());
switch_to_thread (tp);
ada_find_printable_frame (get_selected_frame (NULL));
printf_filtered (_("[Switching to task %s]\n"),
task_to_str (taskno, task_info).c_str ());
print_stack_frame (get_selected_frame (NULL),
- frame_relative_level (get_selected_frame (NULL)),
+ frame_relative_level (get_selected_frame (NULL)),
SRC_AND_LOC, 1);
}
/* All objfiles are being cleared, so we should clear all
our caches for all program spaces. */
for (struct program_space *pspace : program_spaces)
- ada_tasks_invalidate_pspace_data (pspace);
+ ada_tasks_invalidate_pspace_data (pspace);
}
else
{
/* Some new commands provided by this module. */
add_info ("tasks", info_tasks_command,
- _("Provide information about all known Ada tasks."));
+ _("Provide information about all known Ada tasks."));
add_cmd ("task", class_run, task_command,
- _("Use this command to switch between Ada tasks.\n\
+ _("Use this command to switch between Ada tasks.\n\
Without argument, this command simply prints the current task ID."),
- &cmdlist);
+ &cmdlist);
}
if (ada_scan_number (bounds, *n, &B, n))
{
/* STABS decodes all range types which bounds are 0 .. -1 as
- unsigned integers (ie. the type code is TYPE_CODE_INT, not
- TYPE_CODE_RANGE). Unfortunately, ada_print_scalar() relies
- on the unsigned flag to determine whether the bound should
- be printed as a signed or an unsigned value. This causes
- the upper bound of the 0 .. -1 range types to be printed as
- a very large unsigned number instead of -1.
- To workaround this stabs deficiency, we replace the TYPE by NULL
- to indicate default output when we detect that the bound is negative,
- and the type is a TYPE_CODE_INT. The bound is negative when
- 'm' is the last character of the number scanned in BOUNDS. */
+ unsigned integers (ie. the type code is TYPE_CODE_INT, not
+ TYPE_CODE_RANGE). Unfortunately, ada_print_scalar() relies
+ on the unsigned flag to determine whether the bound should
+ be printed as a signed or an unsigned value. This causes
+ the upper bound of the 0 .. -1 range types to be printed as
+ a very large unsigned number instead of -1.
+ To workaround this stabs deficiency, we replace the TYPE by NULL
+ to indicate default output when we detect that the bound is negative,
+ and the type is a TYPE_CODE_INT. The bound is negative when
+ 'm' is the last character of the number scanned in BOUNDS. */
if (bounds[*n - 1] == 'm' && type->code () == TYPE_CODE_INT)
type = NULL;
ada_print_scalar (type, B, stream);
void
ada_print_typedef (struct type *type, struct symbol *new_symbol,
- struct ui_file *stream)
+ struct ui_file *stream)
{
type = ada_check_typedef (type);
ada_print_type (type, "", stream, 0, 0, &type_print_raw_options);
while (index_type->code () == TYPE_CODE_RANGE)
{
/* We need to know what the base type is, in order to do the
- appropriate check below. Otherwise, if this is a subrange
- of an enumerated type, where the underlying value of the
- first element is typically 0, we might test the low bound
- against the wrong value. */
+ appropriate check below. Otherwise, if this is a subrange
+ of an enumerated type, where the underlying value of the
+ first element is typically 0, we might test the low bound
+ against the wrong value. */
index_type = TYPE_TARGET_TYPE (index_type);
}
len = 1;
else if (low > high)
{
- /* The array length should normally be HIGH_POS - LOW_POS + 1.
- But in Ada we allow LOW_POS to be greater than HIGH_POS for
- empty arrays. In that situation, the array length is just zero,
- not negative! */
+ /* The array length should normally be HIGH_POS - LOW_POS + 1.
+ But in Ada we allow LOW_POS to be greater than HIGH_POS for
+ empty arrays. In that situation, the array length is just zero,
+ not negative! */
len = 0;
}
else
return string[i];
else
return (int) extract_unsigned_integer (string + type_len * i,
- type_len, byte_order);
+ type_len, byte_order);
}
/* Print a floating-point value of type TYPE, pointed to in GDB by
for (i = 0; i < length && things_printed < options->print_max; i += 1)
{
/* Position of the character we are examining
- to see whether it is repeated. */
+ to see whether it is repeated. */
unsigned int rep1;
/* Number of repetitions we have detected so far. */
unsigned int reps;
if (type->code () == TYPE_CODE_PTR)
{
/* Hack: don't print (char *) for char strings. Their
- type is indicated by the quoted string anyway. */
+ type is indicated by the quoted string anyway. */
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char)
|| TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_INT
|| TYPE_TARGET_TYPE (type)->is_unsigned ())
access type (this is encoded by the compiler as a typedef to
a fat pointer - hence the check against TYPE_CODE_TYPEDEF). */
if (type->code () == TYPE_CODE_TYPEDEF)
- {
+ {
fprintf_filtered (stream, "(");
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") ");
the (value, type) couple. */
if ((*type)->code () == TYPE_CODE_PTR
&& (TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_STRUCT
- || TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_UNION)
+ || TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_UNION)
&& *value != nullptr
&& value_as_address (*value) != 0
&& !ada_is_array_descriptor_type (TYPE_TARGET_TYPE (*type))
struct addrmap_funcs
{
void (*set_empty) (struct addrmap *self,
- CORE_ADDR start, CORE_ADDR end_inclusive,
- void *obj);
+ CORE_ADDR start, CORE_ADDR end_inclusive,
+ void *obj);
void *(*find) (struct addrmap *self, CORE_ADDR addr);
struct addrmap *(*create_fixed) (struct addrmap *self,
- struct obstack *obstack);
+ struct obstack *obstack);
void (*relocate) (struct addrmap *self, CORE_ADDR offset);
int (*foreach) (struct addrmap *self, addrmap_foreach_fn fn, void *data);
};
void
addrmap_set_empty (struct addrmap *map,
- CORE_ADDR start, CORE_ADDR end_inclusive,
- void *obj)
+ CORE_ADDR start, CORE_ADDR end_inclusive,
+ void *obj)
{
map->funcs->set_empty (map, start, end_inclusive, obj);
}
static void
addrmap_fixed_set_empty (struct addrmap *self,
- CORE_ADDR start, CORE_ADDR end_inclusive,
- void *obj)
+ CORE_ADDR start, CORE_ADDR end_inclusive,
+ void *obj)
{
internal_error (__FILE__, __LINE__,
- "addrmap_fixed_set_empty: "
- "fixed addrmaps can't be changed\n");
+ "addrmap_fixed_set_empty: "
+ "fixed addrmaps can't be changed\n");
}
while (bottom < top)
{
/* This needs to round towards top, or else when top = bottom +
- 1 (i.e., two entries are under consideration), then mid ==
- bottom, and then we may not narrow the range when (mid->addr
- < addr). */
+ 1 (i.e., two entries are under consideration), then mid ==
+ bottom, and then we may not narrow the range when (mid->addr
+ < addr). */
struct addrmap_transition *mid = top - (top - bottom) / 2;
if (mid->addr == addr)
- {
- bottom = mid;
- break;
- }
+ {
+ bottom = mid;
+ break;
+ }
else if (mid->addr < addr)
- /* We don't eliminate mid itself here, since each transition
- covers all subsequent addresses until the next. This is why
- we must round up in computing the midpoint. */
- bottom = mid;
+ /* We don't eliminate mid itself here, since each transition
+ covers all subsequent addresses until the next. This is why
+ we must round up in computing the midpoint. */
+ bottom = mid;
else
- top = mid - 1;
+ top = mid - 1;
}
return bottom->value;
addrmap_fixed_create_fixed (struct addrmap *self, struct obstack *obstack)
{
internal_error (__FILE__, __LINE__,
- _("addrmap_create_fixed is not implemented yet "
- "for fixed addrmaps"));
+ _("addrmap_create_fixed is not implemented yet "
+ "for fixed addrmaps"));
}
CORE_ADDR key, void *value)
{
splay_tree_insert (map->tree,
- allocate_key (map, key),
- (splay_tree_value) value);
+ allocate_key (map, key),
+ (splay_tree_value) value);
}
{
n = addrmap_splay_tree_predecessor (self, addr);
addrmap_splay_tree_insert (self, addr,
- n ? addrmap_node_value (n) : NULL);
+ n ? addrmap_node_value (n) : NULL);
}
}
static void
addrmap_mutable_set_empty (struct addrmap *self,
- CORE_ADDR start, CORE_ADDR end_inclusive,
- void *obj)
+ CORE_ADDR start, CORE_ADDR end_inclusive,
+ void *obj)
{
struct addrmap_mutable *map = (struct addrmap_mutable *) self;
splay_tree_node n, next;
n = addrmap_splay_tree_successor (map, addrmap_node_key (n)))
{
if (! addrmap_node_value (n))
- addrmap_node_set_value (n, obj);
+ addrmap_node_set_value (n, obj);
}
/* Walk the area again, removing transitions from any value to
prior_value = n ? addrmap_node_value (n) : NULL;
for (n = addrmap_splay_tree_lookup (map, start), gdb_assert (n);
n && (end_inclusive == CORE_ADDR_MAX
- || addrmap_node_key (n) <= end_inclusive + 1);
+ || addrmap_node_key (n) <= end_inclusive + 1);
n = next)
{
next = addrmap_splay_tree_successor (map, addrmap_node_key (n));
if (addrmap_node_value (n) == prior_value)
- addrmap_splay_tree_remove (map, addrmap_node_key (n));
+ addrmap_splay_tree_remove (map, addrmap_node_key (n));
else
- prior_value = addrmap_node_value (n);
+ prior_value = addrmap_node_value (n);
}
}
{
/* Not needed yet. */
internal_error (__FILE__, __LINE__,
- _("addrmap_find is not implemented yet "
- "for mutable addrmaps"));
+ _("addrmap_find is not implemented yet "
+ "for mutable addrmaps"));
}
{
/* Not needed yet. */
internal_error (__FILE__, __LINE__,
- _("addrmap_relocate is not implemented yet "
- "for mutable addrmaps"));
+ _("addrmap_relocate is not implemented yet "
+ "for mutable addrmaps"));
}
map->free_nodes = NULL;
map->tree = splay_tree_new_with_allocator (splay_compare_CORE_ADDR_ptr,
- NULL, /* no delete key */
- NULL, /* no delete value */
- splay_obstack_alloc,
- splay_obstack_free,
- map);
+ NULL, /* no delete key */
+ NULL, /* no delete value */
+ splay_obstack_alloc,
+ splay_obstack_free,
+ map);
return (struct addrmap *) map;
}
implemented efficiently, but doesn't reveal too much of the
representation. */
void addrmap_set_empty (struct addrmap *map,
- CORE_ADDR start, CORE_ADDR end_inclusive,
- void *obj);
+ CORE_ADDR start, CORE_ADDR end_inclusive,
+ void *obj);
/* Return the object associated with ADDR in MAP. */
void *addrmap_find (struct addrmap *map, CORE_ADDR addr);
/* Create a fixed address map which is a copy of the mutable address
map ORIGINAL. Allocate entries in OBSTACK. */
struct addrmap *addrmap_create_fixed (struct addrmap *original,
- struct obstack *obstack);
+ struct obstack *obstack);
/* Relocate all the addresses in MAP by OFFSET. (This can be applied
to either mutable or immutable maps.) */
if (can_use && !agent_loaded_p ())
{
/* Since the setting was off, we may not have observed the objfiles and
- therefore not looked up the required symbols. Do so now. */
+ therefore not looked up the required symbols. Do so now. */
for (objfile *objfile : current_program_space->objfiles ())
if (agent_look_up_symbols (objfile) == 0)
break;
if (debug_aix_thread)
fprintf_unfiltered (gdb_stdlog, "pdc_read_regs tid=%d flags=%s\n",
- (int) tid, hex_string (flags));
+ (int) tid, hex_string (flags));
/* General-purpose registers. */
if (flags & PTHDB_FLAG_GPRS)
if (debug_aix_thread)
fprintf_unfiltered (gdb_stdlog, "pdc_write_regs tid=%d flags=%s\n",
- (int) tid, hex_string (flags));
+ (int) tid, hex_string (flags));
/* General-purpose registers. */
if (flags & PTHDB_FLAG_GPRS)
{
if (debug_aix_thread)
fprintf_unfiltered (gdb_stdlog,
- "pdc_alloc (user = %ld, len = %ld, bufp = 0x%lx)\n",
+ "pdc_alloc (user = %ld, len = %ld, bufp = 0x%lx)\n",
user, len, (long) bufp);
*bufp = xmalloc (len);
if (debug_aix_thread)
if (debug_aix_thread)
fprintf_unfiltered (gdb_stdlog,
"pdc_free (user = %ld, buf = 0x%lx)\n", user,
- (long) buf);
+ (long) buf);
xfree (buf);
return PDC_SUCCESS;
}
while (1)
{
if (getthrds (inferior_ptid.pid (), &thrinf,
- sizeof (thrinf), &ktid, 1) != 1)
+ sizeof (thrinf), &ktid, 1) != 1)
break;
if (thrinf.ti_cursig == SIGTRAP)
status = pthdb_pthread_context (pd_session, pdtid, &ctx);
if (status != PTHDB_SUCCESS)
error (_("aix-thread: fetch_registers: pthdb_pthread_context returned %s"),
- pd_status2str (status));
+ pd_status2str (status));
/* General-purpose registers. */
/* General-purpose registers. */
if (regno == -1
|| (tdep->ppc_gp0_regnum <= regno
- && regno < tdep->ppc_gp0_regnum + ppc_num_gprs))
+ && regno < tdep->ppc_gp0_regnum + ppc_num_gprs))
{
if (arch64)
{
if (ppc_floating_point_unit_p (gdbarch)
&& (regno == -1
- || (regno >= tdep->ppc_fp0_regnum
- && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
+ || (regno >= tdep->ppc_fp0_regnum
+ && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
{
if (!ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
memset (fprs, 0, sizeof (fprs));
status = pthdb_pthread_context (pd_session, pdtid, &ctx);
if (status != PTHDB_SUCCESS)
error (_("aix-thread: store_registers: pthdb_pthread_context returned %s"),
- pd_status2str (status));
+ pd_status2str (status));
/* Collect general-purpose register values from the regcache. */
if (status != PTHDB_SUCCESS)
error (_("aix-thread: store_registers: "
"pthdb_pthread_setcontext returned %s"),
- pd_status2str (status));
+ pd_status2str (status));
}
/* Store register REGNO if != -1 or all registers otherwise into
if (debug_aix_thread)
fprintf_unfiltered (gdb_stdlog,
"store_regs_kernel_thread tid=%lx regno=%d\n",
- (long) tid, regno);
+ (long) tid, regno);
/* General-purpose registers. */
if (regno == -1
|| (tdep->ppc_gp0_regnum <= regno
- && regno < tdep->ppc_gp0_regnum + ppc_num_fprs))
+ && regno < tdep->ppc_gp0_regnum + ppc_num_fprs))
{
if (arch64)
{
if (ppc_floating_point_unit_p (gdbarch)
&& (regno == -1
- || (regno >= tdep->ppc_fp0_regnum
- && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
+ || (regno >= tdep->ppc_fp0_regnum
+ && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
{
/* Pre-fetch: some regs may not be in the cache. */
ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL);
{
struct reg gregs;
if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
+ perror_with_name (_("Couldn't get registers"));
alphabsd_fill_reg (regcache, (char *) &gregs, regno);
if (ptrace (PT_SETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
- perror_with_name (_("Couldn't write registers"));
+ (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
+ perror_with_name (_("Couldn't write registers"));
if (regno != -1)
return;
This is somewhat complicated in that:
(1) the expansion of the "mov" assembler macro has changed over
- time, from "bis src,src,dst" to "bis zero,src,dst",
+ time, from "bis src,src,dst" to "bis zero,src,dst",
(2) the kernel has changed from using "addq" to "lda" to load the
- syscall number,
+ syscall number,
(3) there is a "normal" sigreturn and an "rt" sigreturn which
- has a different stack layout. */
+ has a different stack layout. */
static long
alpha_linux_sigtramp_offset_1 (struct gdbarch *gdbarch, CORE_ADDR pc)
struct rt_sigframe {
struct siginfo info;
struct ucontext uc;
- };
+ };
offsetof (struct rt_sigframe, uc.uc_mcontext); */
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
set_gdbarch_iterate_over_regset_sections
(gdbarch, alpha_linux_iterate_over_regset_sections);
_initialize_alpha_linux_tdep ()
{
gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_LINUX,
- alpha_linux_init_abi);
+ alpha_linux_init_abi);
}
/* *INDENT-OFF* */
/* Layout of a stack frame on the alpha:
- | |
+ | |
pdr members: | 7th ... nth arg, |
- | `pushed' by caller. |
- | |
+ | `pushed' by caller. |
+ | |
----------------|-------------------------------|<-- old_sp == vfp
^ ^ ^ ^ | |
| | | | | |
| | called procedure. |
v | |
-------------|-------------------------------|<-- sp
- | |
+ | |
*/
/* *INDENT-ON* */
proc_desc = (struct mdebug_extra_func_info *) SYMBOL_VALUE_BYTES (sym);
/* Correct incorrect setjmp procedure descriptor from the library
- to make backtrace through setjmp work. */
+ to make backtrace through setjmp work. */
if (proc_desc->pdr.pcreg == 0
&& strcmp (sh_name, "setjmp") == 0)
{
if (proc_desc)
{
/* If function is frameless, then we need to do it the hard way. I
- strongly suspect that frameless always means prologueless... */
+ strongly suspect that frameless always means prologueless... */
if (alpha_mdebug_frameless (proc_desc))
return 0;
}
static int
alpha_mdebug_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
+ struct frame_info *this_frame,
+ void **this_cache)
{
CORE_ADDR pc = get_frame_address_in_block (this_frame);
struct mdebug_extra_func_info *proc_desc;
static void
alphanbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+ struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
traditional a.out-style core dump format before NetBSD 1.6, but
we don't support those. */
gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_NETBSD,
- alphanbsd_init_abi);
+ alphanbsd_init_abi);
}
_initialize_alphaobsd_tdep ()
{
gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_OPENBSD,
- alphaobsd_init_abi);
+ alphaobsd_init_abi);
}
alpha_cannot_store_register (struct gdbarch *gdbarch, int regno)
{
return (regno == ALPHA_ZERO_REGNUM
- || strlen (alpha_register_name (gdbarch, regno)) == 0);
+ || strlen (alpha_register_name (gdbarch, regno)) == 0);
}
static struct type *
addr = alpha_sigtramp_register_address (get_frame_arch (this_frame),
info->sigcontext_addr, regnum);
if (addr != 0)
- return frame_unwind_got_memory (this_frame, regnum, addr);
+ return frame_unwind_got_memory (this_frame, regnum, addr);
}
/* This extra register may actually be in the sigcontext, but our
static int
alpha_sigtramp_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_prologue_cache)
+ struct frame_info *this_frame,
+ void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
/* The following pattern is recognized as a probing loop:
- lda REG_INDEX,NB_OF_ITERATIONS
- lda REG_PROBE,<immediate>(sp)
+ lda REG_INDEX,NB_OF_ITERATIONS
+ lda REG_PROBE,<immediate>(sp)
LOOP_START:
- stq zero,<immediate>(REG_PROBE)
- subq REG_INDEX,0x1,REG_INDEX
- lda REG_PROBE,<immediate>(REG_PROBE)
- bne REG_INDEX, LOOP_START
+ stq zero,<immediate>(REG_PROBE)
+ subq REG_INDEX,0x1,REG_INDEX
+ lda REG_PROBE,<immediate>(REG_PROBE)
+ bne REG_INDEX, LOOP_START
- lda sp,<immediate>(REG_PROBE)
+ lda sp,<immediate>(REG_PROBE)
If anything different is found, the function returns without
changing PC and FRAME_SIZE. Otherwise, PC will point immediately
{
reg = (word & 0x03e00000) >> 21;
- /* Ignore this instruction if we have already encountered
- an instruction saving the same register earlier in the
- function code. The current instruction does not tell
- us where the original value upon function entry is saved.
- All it says is that the function we are scanning reused
- that register for some computation of its own, and is now
- saving its result. */
- if (trad_frame_addr_p(info->saved_regs, reg))
- continue;
+ /* Ignore this instruction if we have already encountered
+ an instruction saving the same register earlier in the
+ function code. The current instruction does not tell
+ us where the original value upon function entry is saved.
+ All it says is that the function we are scanning reused
+ that register for some computation of its own, and is now
+ saving its result. */
+ if (trad_frame_addr_p(info->saved_regs, reg))
+ continue;
if (reg == 31)
continue;
|| op == 0x34) /* BSR */
{
branch_taken:
- offset = (insn & 0x001fffff);
+ offset = (insn & 0x001fffff);
if (offset & 0x00100000)
offset |= 0xffe00000;
offset *= ALPHA_INSN_SIZE;
/* Need to determine if branch is taken; read RA. */
regno = (insn >> 21) & 0x1f;
switch (op)
- {
- case 0x31: /* FBEQ */
- case 0x36: /* FBGE */
- case 0x37: /* FBGT */
- case 0x33: /* FBLE */
- case 0x32: /* FBLT */
- case 0x35: /* FBNE */
- regno += gdbarch_fp0_regnum (gdbarch);
+ {
+ case 0x31: /* FBEQ */
+ case 0x36: /* FBGE */
+ case 0x37: /* FBGT */
+ case 0x33: /* FBLE */
+ case 0x32: /* FBLT */
+ case 0x35: /* FBNE */
+ regno += gdbarch_fp0_regnum (gdbarch);
}
rav = regcache_raw_get_signed (regcache, regno);
goto branch_taken;
break;
- /* Floating point branches. */
-
- case 0x31: /* FBEQ */
- if (fp_register_zero_p (rav))
- goto branch_taken;
- break;
- case 0x36: /* FBGE */
- if (fp_register_sign_bit (rav) == 0 || fp_register_zero_p (rav))
- goto branch_taken;
- break;
- case 0x37: /* FBGT */
- if (fp_register_sign_bit (rav) == 0 && ! fp_register_zero_p (rav))
- goto branch_taken;
- break;
- case 0x33: /* FBLE */
- if (fp_register_sign_bit (rav) == 1 || fp_register_zero_p (rav))
- goto branch_taken;
- break;
- case 0x32: /* FBLT */
- if (fp_register_sign_bit (rav) == 1 && ! fp_register_zero_p (rav))
- goto branch_taken;
- break;
- case 0x35: /* FBNE */
- if (! fp_register_zero_p (rav))
- goto branch_taken;
- break;
+ /* Floating point branches. */
+
+ case 0x31: /* FBEQ */
+ if (fp_register_zero_p (rav))
+ goto branch_taken;
+ break;
+ case 0x36: /* FBGE */
+ if (fp_register_sign_bit (rav) == 0 || fp_register_zero_p (rav))
+ goto branch_taken;
+ break;
+ case 0x37: /* FBGT */
+ if (fp_register_sign_bit (rav) == 0 && ! fp_register_zero_p (rav))
+ goto branch_taken;
+ break;
+ case 0x33: /* FBLE */
+ if (fp_register_sign_bit (rav) == 1 || fp_register_zero_p (rav))
+ goto branch_taken;
+ break;
+ case 0x32: /* FBLT */
+ if (fp_register_sign_bit (rav) == 1 && ! fp_register_zero_p (rav))
+ goto branch_taken;
+ break;
+ case 0x35: /* FBNE */
+ if (! fp_register_zero_p (rav))
+ goto branch_taken;
+ break;
}
}
struct reg regs;
if (gdb_ptrace (PT_GETREGS, ptid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_("Couldn't get registers"));
amd64_collect_native_gregset (regcache, ®s, regnum);
if (gdb_ptrace (PT_SETREGS, ptid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
return;
_initialize_amd64_darwin_tdep ()
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_DARWIN, x86_darwin_init_abi_64);
+ GDB_OSABI_DARWIN, x86_darwin_init_abi_64);
}
static void
amd64_linux_collect_native_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
+ void *gregs, int regnum)
{
amd64_collect_native_gregset (regcache, gregs, regnum);
ps_err_e
ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ lwpid_t lwpid, int idx, void **base)
{
if (gdbarch_bfd_arch_info (ph->thread->inf->gdbarch)->bits_per_word == 32)
{
|| regnum == AMD64_FSBASE_REGNUM
|| regnum == AMD64_GSBASE_REGNUM)
return (group == system_reggroup
- || group == save_reggroup
- || group == restore_reggroup);
+ || group == save_reggroup
+ || group == restore_reggroup);
return i386_register_reggroup_p (gdbarch, regnum, group);
}
case amd64_sys_rt_sigreturn:
case amd64_x32_sys_rt_sigreturn:
if (amd64_all_but_ip_registers_record (regcache))
- return -1;
+ return -1;
return 0;
break;
if (syscall_gdb == gdb_sys_no_syscall)
{
printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
+ "support syscall number %s\n"),
pulongest (syscall_native));
return -1;
}
else
{
ret = record_linux_system_call (syscall_gdb, regcache,
- linux_record_tdep_p);
+ linux_record_tdep_p);
if (ret)
- return ret;
+ return ret;
}
record_regs:
static int
amd64_linux_record_signal (struct gdbarch *gdbarch,
- struct regcache *regcache,
- enum gdb_signal signal)
+ struct regcache *regcache,
+ enum gdb_signal signal)
{
ULONGEST rsp;
sp -= sizeof (struct rt_sigframe); */
rsp -= AMD64_LINUX_frame_size;
if (record_full_arch_list_add_mem (rsp, AMD64_LINUX_redzone
- + AMD64_LINUX_xstate
- + AMD64_LINUX_frame_size))
+ + AMD64_LINUX_xstate
+ + AMD64_LINUX_frame_size))
return -1;
if (record_full_arch_list_add_end ())
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_AMD64);
set_gdbarch_get_syscall_number (gdbarch,
- amd64_linux_get_syscall_number);
+ amd64_linux_get_syscall_number);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
/* Displaced stepping. */
set_gdbarch_displaced_step_copy_insn (gdbarch,
- amd64_displaced_step_copy_insn);
+ amd64_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, amd64_displaced_step_fixup);
set_gdbarch_displaced_step_location (gdbarch,
- linux_displaced_step_location);
+ linux_displaced_step_location);
set_gdbarch_process_record (gdbarch, i386_process_record);
set_gdbarch_process_record_signal (gdbarch, amd64_linux_record_signal);
num_regs = amd64_native_gregset32_num_regs;
/* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
- %eip get zero-extended to 64 bits. */
+ %eip get zero-extended to 64 bits. */
for (i = 0; i <= I386_EIP_REGNUM; i++)
{
if (regnum == -1 || regnum == i)
/* The %rsp register points at `struct sigcontext' upon entry of a
signal trampoline. The relevant part of the trampoline is
- call *%rax
- movq %rsp, %rdi
- pushq %rdi
- movq $SYS_sigreturn,%rax
- int $0x80
+ call *%rax
+ movq %rsp, %rdi
+ pushq %rdi
+ movq $SYS_sigreturn,%rax
+ int $0x80
(see /usr/src/sys/arch/amd64/amd64/locore.S). The `pushq'
instruction clobbers %rsp, but its value is saved in `%rdi'. */
sp = read_memory_unsigned_integer (sp_addr, 8, byte_order);
/* Adjust the stack pointer such that it looks as if we just
- returned from _thread_machdep_switch. */
+ returned from _thread_machdep_switch. */
offset = amd64obsd_uthread_reg_offset[AMD64_RIP_REGNUM] + 8;
store_unsigned_integer (buf, 8, byte_order, sp + offset);
regcache->raw_supply (AMD64_RSP_REGNUM, buf);
&& (regnum == -1 || regnum == i))
{
/* Fetch stack pointer from thread structure (if we didn't
- do so already). */
+ do so already). */
if (sp == 0)
sp = read_memory_unsigned_integer (sp_addr, 8, byte_order);
int offset;
/* Calculate the stack pointer (frame pointer) that will be
- stored into the thread structure. */
+ stored into the thread structure. */
offset = amd64obsd_uthread_reg_offset[AMD64_RIP_REGNUM] + 8;
regcache->raw_collect (AMD64_RSP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 8, byte_order) - offset;
write_memory_unsigned_integer (sp_addr, 8, byte_order, sp);
/* The stack pointer was (potentially) modified. Make sure we
- build a proper stack frame. */
+ build a proper stack frame. */
regnum = -1;
}
&& (regnum == -1 || regnum == i))
{
/* Fetch stack pointer from thread structure (if we didn't
- calculate it already). */
+ calculate it already). */
if (sp == 0)
sp = read_memory_unsigned_integer (sp_addr, 8, byte_order);
amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
{
/* 1. If the size of an object is larger than two eightbytes, or it has
- unaligned fields, it has class memory. */
+ unaligned fields, it has class memory. */
if (TYPE_LENGTH (type) > 16 || amd64_has_unaligned_fields (type))
{
theclass[0] = theclass[1] = AMD64_MEMORY;
theclass[0] = theclass[1] = AMD64_NO_CLASS;
/* 3. Each field of an object is classified recursively so that
- always two fields are considered. The resulting class is
- calculated according to the classes of the fields in the
- eightbyte: */
+ always two fields are considered. The resulting class is
+ calculated according to the classes of the fields in the
+ eightbyte: */
if (type->code () == TYPE_CODE_ARRAY)
{
if (theclass[0] == AMD64_MEMORY)
{
/* As indicated by the comment above, the ABI guarantees that we
- can always find the return value just after the function has
- returned. */
+ can always find the return value just after the function has
+ returned. */
if (readbuf)
{
}
/* 8. If the class is COMPLEX_X87, the real part of the value is
- returned in %st0 and the imaginary part in %st1. */
+ returned in %st0 and the imaginary part in %st1. */
if (theclass[0] == AMD64_COMPLEX_X87)
{
if (readbuf)
case AMD64_SSE:
/* 4. If the class is SSE, the next available SSE register
- of the sequence %xmm0, %xmm1 is used. */
+ of the sequence %xmm0, %xmm1 is used. */
regnum = sse_regnum[sse_reg++];
break;
case AMD64_X87:
/* 6. If the class is X87, the value is returned on the X87
- stack in %st0 as 80-bit x87 number. */
+ stack in %st0 as 80-bit x87 number. */
regnum = AMD64_ST0_REGNUM;
if (writebuf)
i387_return_value (gdbarch, regcache);
case AMD64_X87UP:
/* 7. If the class is X87UP, the value is returned together
- with the previous X87 value in %st0. */
+ with the previous X87 value in %st0. */
gdb_assert (i > 0 && theclass[0] == AMD64_X87);
regnum = AMD64_ST0_REGNUM;
offset = 8;
amd64_classify (type, theclass);
/* Calculate the number of integer and SSE registers needed for
- this argument. */
+ this argument. */
for (j = 0; j < 2; j++)
{
if (theclass[j] == AMD64_INTEGER)
}
/* Check whether enough registers are available, and if the
- argument should be passed in registers at all. */
+ argument should be passed in registers at all. */
if (integer_reg + needed_integer_regs > ARRAY_SIZE (integer_regnum)
|| sse_reg + needed_sse_regs > ARRAY_SIZE (sse_regnum)
|| (needed_integer_regs == 0 && needed_sse_regs == 0))
if (op == 0x55) /* pushq %rbp */
{
/* Take into account that we've executed the `pushq %rbp' that
- starts this instruction sequence. */
+ starts this instruction sequence. */
cache->saved_regs[AMD64_RBP_REGNUM] = 0;
cache->sp_offset += 8;
/* If that's all, return now. */
if (current_pc <= pc + 1)
- return current_pc;
+ return current_pc;
read_code (pc + 1, buf, 3);
{
/* 0x0f 0x29 0b??000101 movaps %xmmreg?,-0x??(%rbp) */
if (buf[offset] != 0x0f || buf[offset + 1] != 0x29
- || (buf[offset + 2] & 0x3f) != (xmmreg << 3 | 0x5))
+ || (buf[offset + 2] & 0x3f) != (xmmreg << 3 | 0x5))
return pc;
/* 0b01?????? */
struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
/* LLVM backend (Clang/Flang) always emits a line note before the
- prologue and another one after. We trust clang to emit usable
- line notes. */
+ prologue and another one after. We trust clang to emit usable
+ line notes. */
if (post_prologue_pc
&& (cust != NULL
&& COMPUNIT_PRODUCER (cust) != NULL
&& producer_is_llvm (COMPUNIT_PRODUCER (cust))))
- return std::max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
amd64_init_frame_cache (&cache);
{
return ((type->code () == TYPE_CODE_FLT
|| type->code () == TYPE_CODE_DECFLOAT)
- && (TYPE_LENGTH (type) == 4 || TYPE_LENGTH (type) == 8));
+ && (TYPE_LENGTH (type) == 4 || TYPE_LENGTH (type) == 8));
}
/* Return non-zero iff an argument of the given TYPE should be passed
else if (amd64_windows_passed_by_xmm_register (type))
{
amd64_windows_store_arg_in_reg
- (regcache, args[i], AMD64_XMM0_REGNUM + reg_idx);
+ (regcache, args[i], AMD64_XMM0_REGNUM + reg_idx);
/* In case of varargs, these parameters must also be
passed via the integer registers. */
amd64_windows_store_arg_in_reg
if (return_method == return_method_struct)
{
/* The "hidden" argument is passed throught the first argument
- register. */
+ register. */
const int arg_regnum = amd64_windows_dummy_call_integer_regs[0];
store_unsigned_integer (buf, 8, byte_order, struct_addr);
case TYPE_CODE_FLT:
/* floats, and doubles are returned via XMM0. */
if (len == 4 || len == 8)
- regnum = AMD64_XMM0_REGNUM;
- break;
+ regnum = AMD64_XMM0_REGNUM;
+ break;
case TYPE_CODE_ARRAY:
/* __m128, __m128i and __m128d are returned via XMM0. */
if (type->is_vector () && len == 16)
}
/* fall through */
default:
- /* All other values that are 1, 2, 4 or 8 bytes long are returned
- via RAX. */
- if (len == 1 || len == 2 || len == 4 || len == 8)
- regnum = AMD64_RAX_REGNUM;
+ /* All other values that are 1, 2, 4 or 8 bytes long are returned
+ via RAX. */
+ if (len == 1 || len == 2 || len == 4 || len == 8)
+ regnum = AMD64_RAX_REGNUM;
else if (len == 16 && type->code () == TYPE_CODE_INT)
regnum = AMD64_XMM0_REGNUM;
- break;
+ break;
}
if (regnum < 0)
{
/* RAX contains the address where the return value has been stored. */
if (readbuf)
- {
+ {
ULONGEST addr;
regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &addr);
_initialize_amd64_windows_tdep ()
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_WINDOWS,
- amd64_windows_init_abi);
+ amd64_windows_init_abi);
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_CYGWIN,
- amd64_cygwin_init_abi);
+ amd64_cygwin_init_abi);
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
amd64_windows_osabi_sniffer);
if (annotation_level > 1)
{
printf_filtered(("\n\032\032thread-exited,"
- "id=\"%d\",group-id=\"i%d\"\n"),
- t->global_num, t->inf->num);
+ "id=\"%d\",group-id=\"i%d\"\n"),
+ t->global_num, t->inf->num);
}
}
The stack grows downward, so SP points below FP in memory; SP always
points to the last used word on the stack, not the first one.
- | | |
- | arg word N | | caller's
- | : | | frame
- | arg word 10 | |
- | arg word 9 | |
- old SP ---> +-----------------------+ --+
- | | |
- | callee-saved | |
- | registers | |
- | including fp, blink | |
- | | | callee's
- new FP ---> +-----------------------+ | frame
- | | |
- | local | |
- | variables | |
- | | |
- | register | |
- | spill area | |
- | | |
- | outgoing args | |
- | | |
- new SP ---> +-----------------------+ --+
- | |
- | unused |
- | |
- |
- |
- V
- downwards
+ | | |
+ | arg word N | | caller's
+ | : | | frame
+ | arg word 10 | |
+ | arg word 9 | |
+ old SP ---> +-----------------------+ --+
+ | | |
+ | callee-saved | |
+ | registers | |
+ | including fp, blink | |
+ | | | callee's
+ new FP ---> +-----------------------+ | frame
+ | | |
+ | local | |
+ | variables | |
+ | | |
+ | register | |
+ | spill area | |
+ | | |
+ | outgoing args | |
+ | | |
+ new SP ---> +-----------------------+ --+
+ | |
+ | unused |
+ | |
+ |
+ |
+ V
+ downwards
The list of arguments to be passed to a function is considered to be a
sequence of _N_ words (as though all the parameters were stored in order in
return &arc_v2_core_reg_feature;
default:
gdb_assert_not_reached
- ("Unknown machine type to determine the core feature set.");
+ ("Unknown machine type to determine the core feature set.");
}
}
/* Update accumulator register names (ACCH/ACCL) for r58 and r59 in the
register sets. The endianness determines the assignment:
- ,------.------.
- | acch | accl |
+ ,------.------.
+ | acch | accl |
,----|------+------|
| LE | r59 | r58 |
| BE | r58 | r59 |
if (!valid_p)
{
if (arc_debug)
- debug_printf ("arc: Target description is not valid\n");
+ debug_printf ("arc: Target description is not valid\n");
return false;
}
*frame_regnum = gdbarch_deprecated_fp_regnum (gdbarch);
else if (gdbarch_sp_regnum (gdbarch) >= 0
&& gdbarch_sp_regnum (gdbarch)
- < gdbarch_num_regs (gdbarch))
+ < gdbarch_num_regs (gdbarch))
*frame_regnum = gdbarch_sp_regnum (gdbarch);
else
/* Should this be an internal error? I guess so, it is reflecting
/* See arch-utils.h. */
void
default_read_core_file_mappings (struct gdbarch *gdbarch,
- struct bfd *cbfd,
+ struct bfd *cbfd,
gdb::function_view<void (ULONGEST count)>
pre_loop_cb,
gdb::function_view<void (int num,
- ULONGEST start,
+ ULONGEST start,
ULONGEST end,
ULONGEST file_ofs,
const char *filename,
loc += 2;
if (!((insn1 & 0xfff0) == 0xe850
- || ((insn1 & 0xfff0) == 0xe8d0 && (insn2 & 0x00c0) == 0x0040)))
+ || ((insn1 & 0xfff0) == 0xe8d0 && (insn2 & 0x00c0) == 0x0040)))
return {};
/* Assume that no atomic sequence is longer than "atomic_sequence_length"
loc += 4;
/* Assume that there is at most one conditional branch in the atomic
- sequence. If a conditional branch is found, put a breakpoint in
- its destination address. */
+ sequence. If a conditional branch is found, put a breakpoint in
+ its destination address. */
if (bits (insn, 24, 27) == 0xa)
{
- if (last_breakpoint > 0)
- return {}; /* More than one conditional branch found, fallback
+ if (last_breakpoint > 0)
+ return {}; /* More than one conditional branch found, fallback
to the standard single-step code. */
breaks[1] = BranchDest (loc - 4, insn);
last_breakpoint++;
- }
+ }
/* We do not support atomic sequences that use any *other* instructions
- but conditional branches to change the PC. Fall back to standard
+ but conditional branches to change the PC. Fall back to standard
code to avoid losing control of execution. */
else if (arm_instruction_changes_pc (insn))
return {};
CORE_ADDR sp;
/* Fetch the saved PC from the stack. It's stored above
- all of the other registers. */
+ all of the other registers. */
unsigned long offset
= count_one_bits (bits (inst1, 0, 7)) * ARM_INT_REGISTER_SIZE;
sp = regcache_raw_get_unsigned (regcache, ARM_SP_REGNUM);
case 0xd:
case 0xe:
/* Coprocessor register transfer. */
- if (bits (this_instr, 12, 15) == 15)
+ if (bits (this_instr, 12, 15) == 15)
error (_("Invalid update to pc in instruction"));
break;
}
case 0xd:
case 0xe:
/* Coprocessor register transfer. */
- if (bits (this_instr, 12, 15) == 15)
+ if (bits (this_instr, 12, 15) == 15)
error (_("Invalid update to pc in instruction"));
return 0;
default:
ps_err_e
ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ lwpid_t lwpid, int idx, void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
info.bp_count = (gdb_byte)(val & 0xff);
if (info.wp_count > MAX_WPTS)
- {
- warning (_("arm-linux-gdb supports %d hardware watchpoints but target \
- supports %d"), MAX_WPTS, info.wp_count);
- info.wp_count = MAX_WPTS;
- }
+ {
+ warning (_("arm-linux-gdb supports %d hardware watchpoints but target \
+ supports %d"), MAX_WPTS, info.wp_count);
+ info.wp_count = MAX_WPTS;
+ }
if (info.bp_count > MAX_BPTS)
- {
- warning (_("arm-linux-gdb supports %d hardware breakpoints but target \
- supports %d"), MAX_BPTS, info.bp_count);
- info.bp_count = MAX_BPTS;
- }
+ {
+ warning (_("arm-linux-gdb supports %d hardware breakpoints but target \
+ supports %d"), MAX_BPTS, info.bp_count);
+ info.bp_count = MAX_BPTS;
+ }
available = (info.arch != 0);
}
}
The Linux vector is indexed as follows:
-((i << 1) + 2): Control register for watchpoint i.
-((i << 1) + 1): Address register for watchpoint i.
- 0: Information register.
+ 0: Information register.
((i << 1) + 1): Address register for breakpoint i.
((i << 1) + 2): Control register for breakpoint i.
=1) BPT for thread TID. */
static void
arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt,
- int watchpoint)
+ int watchpoint)
{
int pid;
ptid_t pid_ptid;
for (i = 0; i < count; ++i)
if (!arm_hwbp_control_is_enabled (bpts[i].control))
{
- bpts[i] = *bpt;
- iterate_over_lwps (pid_ptid,
+ bpts[i] = *bpt;
+ iterate_over_lwps (pid_ptid,
[=] (struct lwp_info *info)
{
return update_registers_callback (info, watchpoint,
i);
});
- break;
+ break;
}
gdb_assert (i != count);
(WATCHPOINT = 1) BPT for thread TID. */
static void
arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
- int watchpoint)
+ int watchpoint)
{
int pid;
gdb_byte count, i;
for (i = 0; i < count; ++i)
if (arm_linux_hw_breakpoint_equal (bpt, bpts + i))
{
- bpts[i].control = arm_hwbp_control_disable (bpts[i].control);
+ bpts[i].control = arm_hwbp_control_disable (bpts[i].control);
iterate_over_lwps (pid_ptid,
[=] (struct lwp_info *info)
{
return update_registers_callback (info, watchpoint,
i);
});
- break;
+ break;
}
gdb_assert (i != count);
for (i = 0; i < arm_linux_get_hw_breakpoint_count (); i++)
if (arm_lwp_info->bpts_changed[i])
{
- errno = 0;
- if (arm_hwbp_control_is_enabled (bpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 1), &bpts[i].address) < 0)
- perror_with_name (_("Unexpected error setting breakpoint"));
-
- if (bpts[i].control != 0)
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 2), &bpts[i].control) < 0)
- perror_with_name (_("Unexpected error setting breakpoint"));
-
- arm_lwp_info->bpts_changed[i] = 0;
+ errno = 0;
+ if (arm_hwbp_control_is_enabled (bpts[i].control))
+ if (ptrace (PTRACE_SETHBPREGS, pid,
+ (PTRACE_TYPE_ARG3) ((i << 1) + 1), &bpts[i].address) < 0)
+ perror_with_name (_("Unexpected error setting breakpoint"));
+
+ if (bpts[i].control != 0)
+ if (ptrace (PTRACE_SETHBPREGS, pid,
+ (PTRACE_TYPE_ARG3) ((i << 1) + 2), &bpts[i].control) < 0)
+ perror_with_name (_("Unexpected error setting breakpoint"));
+
+ arm_lwp_info->bpts_changed[i] = 0;
}
for (i = 0; i < arm_linux_get_hw_watchpoint_count (); i++)
if (arm_lwp_info->wpts_changed[i])
{
- errno = 0;
- if (arm_hwbp_control_is_enabled (wpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) -((i << 1) + 1), &wpts[i].address) < 0)
- perror_with_name (_("Unexpected error setting watchpoint"));
-
- if (wpts[i].control != 0)
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) -((i << 1) + 2), &wpts[i].control) < 0)
- perror_with_name (_("Unexpected error setting watchpoint"));
-
- arm_lwp_info->wpts_changed[i] = 0;
+ errno = 0;
+ if (arm_hwbp_control_is_enabled (wpts[i].control))
+ if (ptrace (PTRACE_SETHBPREGS, pid,
+ (PTRACE_TYPE_ARG3) -((i << 1) + 1), &wpts[i].address) < 0)
+ perror_with_name (_("Unexpected error setting watchpoint"));
+
+ if (wpts[i].control != 0)
+ if (ptrace (PTRACE_SETHBPREGS, pid,
+ (PTRACE_TYPE_ARG3) -((i << 1) + 2), &wpts[i].control) < 0)
+ perror_with_name (_("Unexpected error setting watchpoint"));
+
+ arm_lwp_info->wpts_changed[i] = 0;
}
}
static const struct target_desc *
arm_linux_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target,
+ bfd *abfd)
{
CORE_ADDR arm_hwcap = linux_get_hwcap (target);
if (arm_hwcap & HWCAP_VFP)
{
/* NEON implies VFPv3-D32 or no-VFP unit. Say that we only support
- Neon with VFPv3-D32. */
+ Neon with VFPv3-D32. */
if (arm_hwcap & HWCAP_NEON)
return aarch32_read_description ();
else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3)
if (svc_operand)
{
- /* OABI */
+ /* OABI */
svc_number = svc_operand - 0x900000;
}
else
{
- /* EABI */
+ /* EABI */
regcache_cooked_read_unsigned (regs, 7, &svc_number);
}
}
location, else nothing.
Insn: unmodified svc.
Cleanup: if pc lands in scratch space, pc <- insn_addr + insn_size
- else leave pc alone. */
+ else leave pc alone. */
dsc->cleanup = &arm_linux_cleanup_svc;
dsc->wrote_to_pc = 1;
/* Preparation: tmp[0] <- r14
- r14 <- <scratch space>+4
+ r14 <- <scratch space>+4
*(<scratch space>+8) <- from
Insn: ldr pc, [r14, #4]
Cleanup: r14 <- tmp[0], pc <- tmp[0]. */
for (i = 0; i < ARM_PC_REGNUM; i++)
{
if (record_full_arch_list_add_reg (regcache, ARM_A1_REGNUM + i))
- return -1;
+ return -1;
}
if (record_full_arch_list_add_reg (regcache, ARM_PS_REGNUM))
if (syscall_gdb == gdb_sys_no_syscall)
{
printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- plongest (svc_number));
+ "support syscall number %s\n"),
+ plongest (svc_number));
return -1;
}
}
ret = record_linux_system_call (syscall_gdb, regcache,
- &arm_linux_record_tdep);
+ &arm_linux_record_tdep);
if (ret != 0)
return ret;
default:
internal_error
(__FILE__, __LINE__,
- _("arm_linux_init_abi: Floating point model not supported"));
+ _("arm_linux_init_abi: Floating point model not supported"));
break;
}
tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
tramp_frame_prepend_unwinder (gdbarch,
&arm_linux_sigreturn_tramp_frame);
_initialize_arm_netbsd_tdep ()
{
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD,
- arm_netbsd_elf_init_abi);
+ arm_netbsd_elf_init_abi);
}
{
/* Register the sniffer for the PikeOS targets. */
gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_elf_flavour,
- arm_pikeos_osabi_sniffer);
+ arm_pikeos_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_PIKEOS,
- arm_pikeos_init_abi);
+ arm_pikeos_init_abi);
}
&prologue_end))
{
/* One way to find the end of the prologue (which works well
- for unoptimized code) is to do the following:
+ for unoptimized code) is to do the following:
struct symtab_and_line sal = find_pc_line (prologue_start, 0);
/* AAPCS does not use a frame register, so we can abort here. */
if (gdbarch_tdep (gdbarch)->arm_abi == ARM_ABI_AAPCS)
- return;
+ return;
frame_loc = get_frame_register_unsigned (this_frame, ARM_FP_REGNUM);
if (!safe_read_memory_unsigned_integer (frame_loc, 4, byte_order,
&return_value))
- return;
+ return;
else
- {
- prologue_start = gdbarch_addr_bits_remove
+ {
+ prologue_start = gdbarch_addr_bits_remove
(gdbarch, return_value) - 8;
- prologue_end = prologue_start + 64; /* See above. */
- }
+ prologue_end = prologue_start + 64; /* See above. */
+ }
}
if (prev_pc < prologue_end)
for (i = 0; i < 12; i++)
if (mask & (1 << i))
{
- cache->saved_regs[4 + i].addr = vsp;
+ cache->saved_regs[4 + i].addr = vsp;
vsp += 4;
}
if (exc_return && process_stack_used)
{
/* Thread (process) stack used.
- Potentially this could be other register defined by target, but PSP
- can be considered a standard name for the "Process Stack Pointer".
- To be fully aware of system registers like MSP and PSP, these could
- be added to a separate XML arm-m-system-profile that is valid for
- ARMv6-M and ARMv7-M architectures. Also to be able to debug eg a
- corefile off-line, then these registers must be defined by GDB,
- and also be included in the corefile regsets. */
+ Potentially this could be other register defined by target, but PSP
+ can be considered a standard name for the "Process Stack Pointer".
+ To be fully aware of system registers like MSP and PSP, these could
+ be added to a separate XML arm-m-system-profile that is valid for
+ ARMv6-M and ARMv7-M architectures. Also to be able to debug eg a
+ corefile off-line, then these registers must be defined by GDB,
+ and also be included in the corefile regsets. */
int psp_regnum = user_reg_map_name_to_regnum (gdbarch, "psp", -1);
if (psp_regnum == -1)
- {
- /* Thread (process) stack could not be fetched,
- give warning and exit. */
+ {
+ /* Thread (process) stack could not be fetched,
+ give warning and exit. */
- warning (_("no PSP thread stack unwinding supported."));
+ warning (_("no PSP thread stack unwinding supported."));
- /* Terminate any further stack unwinding by refer to self. */
- cache->prev_sp = sp;
- return cache;
- }
+ /* Terminate any further stack unwinding by refer to self. */
+ cache->prev_sp = sp;
+ return cache;
+ }
else
- {
- /* Thread (process) stack used, use PSP as SP. */
- unwound_sp = get_frame_register_unsigned (this_frame, psp_regnum);
- }
+ {
+ /* Thread (process) stack used, use PSP as SP. */
+ unwound_sp = get_frame_register_unsigned (this_frame, psp_regnum);
+ }
}
else
{
int fpu_regs_stack_offset;
/* This code does not take into account the lazy stacking, see "Lazy
- context save of FP state", in B1.5.7, also ARM AN298, supported
- by Cortex-M4F architecture.
- To fully handle this the FPCCR register (Floating-point Context
- Control Register) needs to be read out and the bits ASPEN and LSPEN
- could be checked to setup correct lazy stacked FP registers.
- This register is located at address 0xE000EF34. */
+ context save of FP state", in B1.5.7, also ARM AN298, supported
+ by Cortex-M4F architecture.
+ To fully handle this the FPCCR register (Floating-point Context
+ Control Register) needs to be read out and the bits ASPEN and LSPEN
+ could be checked to setup correct lazy stacked FP registers.
+ This register is located at address 0xE000EF34. */
/* Extended stack frame type used. */
fpu_regs_stack_offset = unwound_sp + 0x20;
for (i = 0; i < 16; i++)
- {
- cache->saved_regs[ARM_D0_REGNUM + i].addr = fpu_regs_stack_offset;
- fpu_regs_stack_offset += 4;
- }
+ {
+ cache->saved_regs[ARM_D0_REGNUM + i].addr = fpu_regs_stack_offset;
+ fpu_regs_stack_offset += 4;
+ }
cache->saved_regs[ARM_FPSCR_REGNUM].addr = unwound_sp + 0x60;
/* Offset 0x64 is reserved. */
Insn1: push {pc} Write address of STR instruction + offset on stack
Insn2: pop {r4} Read it back from stack, r4 = addr(Insn1) + offset
Insn3: sub r4, r4, pc r4 = addr(Insn1) + offset - pc
- = addr(Insn1) + offset - addr(Insn3) - 8
- = offset - 16
+ = addr(Insn1) + offset - addr(Insn3) - 8
+ = offset - 16
Insn4: add r4, r4, #8 r4 = offset - 8
Insn5: add r0, r0, r4 r0 = from + 8 + offset - 8
- = from + offset
+ = from + offset
Insn6: str r0, [r2, #imm] (or str r0, [r2, r3])
Otherwise we don't know what value to write for PC, since the offset is
static int
thumb_32bit_copy_undef (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
- arm_displaced_step_closure *dsc)
+ arm_displaced_step_closure *dsc)
{
displaced_debug_printf ("copying undefined insn %.4x %.4x",
case 0x65:
return arm_copy_preload_reg (gdbarch, insn, regs, dsc); /* pli reg. */
case 0x71: case 0x75:
- /* pld/pldw reg. */
+ /* pld/pldw reg. */
return arm_copy_preload_reg (gdbarch, insn, regs, dsc);
case 0x63: case 0x67: case 0x73: case 0x77:
return arm_copy_unpred (gdbarch, insn, dsc);
case 0xb:
if (bits (insn, 16, 19) == 0xf)
- /* ldc/ldc2 lit. */
+ /* ldc/ldc2 lit. */
return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
else
return arm_copy_undef (gdbarch, insn, dsc);
case 0x2:
if (op == 0x1)
- /* Not really supported. */
+ /* Not really supported. */
return arm_copy_unmodified (gdbarch, insn, "bxj", dsc);
else
return arm_copy_undef (gdbarch, insn, dsc);
if (op == 0x1)
return arm_copy_unmodified (gdbarch, insn, "bkpt", dsc);
else if (op == 0x3)
- /* Not really supported. */
+ /* Not really supported. */
return arm_copy_unmodified (gdbarch, insn, "smc", dsc);
/* Fall through. */
else
{
/* For a structure or union the behaviour is as if the value had
- been stored to word-aligned memory and then loaded into
- registers with 32-bit load instruction(s). */
+ been stored to word-aligned memory and then loaded into
+ registers with 32-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int regno = ARM_A1_REGNUM;
bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE];
else
{
/* For a structure or union the behaviour is as if the value had
- been stored to word-aligned memory and then loaded into
- registers with 32-bit load instruction(s). */
+ been stored to word-aligned memory and then loaded into
+ registers with 32-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int regno = ARM_A1_REGNUM;
bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE];
|| startswith (name, "__ARM_call_via_"))
{
/* Use the name suffix to determine which register contains the
- target PC. */
+ target PC. */
static const char *table[15] =
{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "sl", "fp", "ip", "sp", "lr"
#define INSN_S_L_BIT_NUM 20
#define REG_ALLOC(REGS, LENGTH, RECORD_BUF) \
- do \
- { \
- unsigned int reg_len = LENGTH; \
- if (reg_len) \
- { \
- REGS = XNEWVEC (uint32_t, reg_len); \
- memcpy(®S[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
- } \
- } \
- while (0)
+ do \
+ { \
+ unsigned int reg_len = LENGTH; \
+ if (reg_len) \
+ { \
+ REGS = XNEWVEC (uint32_t, reg_len); \
+ memcpy(®S[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
+ } \
+ } \
+ while (0)
#define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \
- do \
- { \
- 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); \
- } \
- } \
- while (0)
+ do \
+ { \
+ 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); \
+ } \
+ } \
+ while (0)
/* Checks whether insn is already recorded or yet to be decoded. (boolean expression). */
#define INSN_RECORDED(ARM_RECORD) \
- (0 != (ARM_RECORD)->reg_rec_count || 0 != (ARM_RECORD)->mem_rec_count)
+ (0 != (ARM_RECORD)->reg_rec_count || 0 != (ARM_RECORD)->mem_rec_count)
/* ARM memory record structure. */
struct arm_mem_r
while (ones)
{
if (!(ones & sbo))
- {
- return 0;
- }
+ {
+ return 0;
+ }
ones = ones >> 1;
}
return 1;
static int
arm_record_strx (insn_decode_record *arm_insn_r, uint32_t *record_buf,
- uint32_t *record_buf_mem, arm_record_strx_t str_type)
+ uint32_t *record_buf_mem, arm_record_strx_t str_type)
{
struct regcache *reg_cache = arm_insn_r->regcache;
immed_high = bits (arm_insn_r->arm_insn, 8, 11);
reg_src1 = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_src1,
- &u_regval[0]);
+ &u_regval[0]);
if (ARM_PC_REGNUM == reg_src1)
- {
- /* If R15 was used as Rn, hence current PC+8. */
- u_regval[0] = u_regval[0] + 8;
- }
+ {
+ /* If R15 was used as Rn, hence current PC+8. */
+ u_regval[0] = u_regval[0] + 8;
+ }
offset_8 = (immed_high << 4) | immed_low;
/* Calculate target store address. */
if (14 == arm_insn_r->opcode)
- {
- tgt_mem_addr = u_regval[0] + offset_8;
- }
+ {
+ tgt_mem_addr = u_regval[0] + offset_8;
+ }
else
- {
- tgt_mem_addr = u_regval[0] - offset_8;
- }
+ {
+ tgt_mem_addr = u_regval[0] - offset_8;
+ }
if (ARM_RECORD_STRH == str_type)
- {
- record_buf_mem[0] = 2;
- record_buf_mem[1] = tgt_mem_addr;
- arm_insn_r->mem_rec_count = 1;
- }
+ {
+ record_buf_mem[0] = 2;
+ record_buf_mem[1] = tgt_mem_addr;
+ arm_insn_r->mem_rec_count = 1;
+ }
else if (ARM_RECORD_STRD == str_type)
- {
- record_buf_mem[0] = 4;
- record_buf_mem[1] = tgt_mem_addr;
- record_buf_mem[2] = 4;
- record_buf_mem[3] = tgt_mem_addr + 4;
- arm_insn_r->mem_rec_count = 2;
- }
+ {
+ record_buf_mem[0] = 4;
+ record_buf_mem[1] = tgt_mem_addr;
+ record_buf_mem[2] = 4;
+ record_buf_mem[3] = tgt_mem_addr + 4;
+ arm_insn_r->mem_rec_count = 2;
+ }
}
else if (12 == arm_insn_r->opcode || 8 == arm_insn_r->opcode)
{
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
if (15 == reg_src2)
- {
- /* If R15 was used as Rn, hence current PC+8. */
- u_regval[0] = u_regval[0] + 8;
- }
+ {
+ /* If R15 was used as Rn, hence current PC+8. */
+ u_regval[0] = u_regval[0] + 8;
+ }
/* Calculate target store address, Rn +/- Rm, register offset. */
if (12 == arm_insn_r->opcode)
- {
- tgt_mem_addr = u_regval[0] + u_regval[1];
- }
+ {
+ tgt_mem_addr = u_regval[0] + u_regval[1];
+ }
else
- {
- tgt_mem_addr = u_regval[1] - u_regval[0];
- }
+ {
+ tgt_mem_addr = u_regval[1] - u_regval[0];
+ }
if (ARM_RECORD_STRH == str_type)
- {
- record_buf_mem[0] = 2;
- record_buf_mem[1] = tgt_mem_addr;
- arm_insn_r->mem_rec_count = 1;
- }
+ {
+ record_buf_mem[0] = 2;
+ record_buf_mem[1] = tgt_mem_addr;
+ arm_insn_r->mem_rec_count = 1;
+ }
else if (ARM_RECORD_STRD == str_type)
- {
- record_buf_mem[0] = 4;
- record_buf_mem[1] = tgt_mem_addr;
- record_buf_mem[2] = 4;
- record_buf_mem[3] = tgt_mem_addr + 4;
- arm_insn_r->mem_rec_count = 2;
- }
+ {
+ record_buf_mem[0] = 4;
+ record_buf_mem[1] = tgt_mem_addr;
+ record_buf_mem[2] = 4;
+ record_buf_mem[3] = tgt_mem_addr + 4;
+ arm_insn_r->mem_rec_count = 2;
+ }
}
else if (11 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
- || 2 == arm_insn_r->opcode || 6 == arm_insn_r->opcode)
+ || 2 == arm_insn_r->opcode || 6 == arm_insn_r->opcode)
{
/* 3) Store, immediate pre-indexed. */
/* 5) Store, immediate post-indexed. */
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
/* Calculate target store address, Rn +/- Rm, register offset. */
if (15 == arm_insn_r->opcode || 6 == arm_insn_r->opcode)
- {
- tgt_mem_addr = u_regval[0] + offset_8;
- }
+ {
+ tgt_mem_addr = u_regval[0] + offset_8;
+ }
else
- {
- tgt_mem_addr = u_regval[0] - offset_8;
- }
+ {
+ tgt_mem_addr = u_regval[0] - offset_8;
+ }
if (ARM_RECORD_STRH == str_type)
- {
- record_buf_mem[0] = 2;
- record_buf_mem[1] = tgt_mem_addr;
- arm_insn_r->mem_rec_count = 1;
- }
+ {
+ record_buf_mem[0] = 2;
+ record_buf_mem[1] = tgt_mem_addr;
+ arm_insn_r->mem_rec_count = 1;
+ }
else if (ARM_RECORD_STRD == str_type)
- {
- record_buf_mem[0] = 4;
- record_buf_mem[1] = tgt_mem_addr;
- record_buf_mem[2] = 4;
- record_buf_mem[3] = tgt_mem_addr + 4;
- arm_insn_r->mem_rec_count = 2;
- }
+ {
+ record_buf_mem[0] = 4;
+ record_buf_mem[1] = tgt_mem_addr;
+ record_buf_mem[2] = 4;
+ record_buf_mem[3] = tgt_mem_addr + 4;
+ arm_insn_r->mem_rec_count = 2;
+ }
/* Record Rn also as it changes. */
*(record_buf) = bits (arm_insn_r->arm_insn, 16, 19);
arm_insn_r->reg_rec_count = 1;
}
else if (9 == arm_insn_r->opcode || 13 == arm_insn_r->opcode
- || 0 == arm_insn_r->opcode || 4 == arm_insn_r->opcode)
+ || 0 == arm_insn_r->opcode || 4 == arm_insn_r->opcode)
{
/* 4) Store, register pre-indexed. */
/* 6) Store, register post -indexed. */
regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
/* Calculate target store address, Rn +/- Rm, register offset. */
if (13 == arm_insn_r->opcode || 4 == arm_insn_r->opcode)
- {
- tgt_mem_addr = u_regval[0] + u_regval[1];
- }
+ {
+ tgt_mem_addr = u_regval[0] + u_regval[1];
+ }
else
- {
- tgt_mem_addr = u_regval[1] - u_regval[0];
- }
+ {
+ tgt_mem_addr = u_regval[1] - u_regval[0];
+ }
if (ARM_RECORD_STRH == str_type)
- {
- record_buf_mem[0] = 2;
- record_buf_mem[1] = tgt_mem_addr;
- arm_insn_r->mem_rec_count = 1;
- }
+ {
+ record_buf_mem[0] = 2;
+ record_buf_mem[1] = tgt_mem_addr;
+ arm_insn_r->mem_rec_count = 1;
+ }
else if (ARM_RECORD_STRD == str_type)
- {
- record_buf_mem[0] = 4;
- record_buf_mem[1] = tgt_mem_addr;
- record_buf_mem[2] = 4;
- record_buf_mem[3] = tgt_mem_addr + 4;
- arm_insn_r->mem_rec_count = 2;
- }
+ {
+ record_buf_mem[0] = 4;
+ record_buf_mem[1] = tgt_mem_addr;
+ record_buf_mem[2] = 4;
+ record_buf_mem[3] = tgt_mem_addr + 4;
+ arm_insn_r->mem_rec_count = 2;
+ }
/* Record Rn also as it changes. */
*(record_buf) = bits (arm_insn_r->arm_insn, 16, 19);
arm_insn_r->reg_rec_count = 1;
if (arm_insn_r->cond)
{
/* PLD has no affect on architectural state, it just affects
- the caches. */
+ the caches. */
if (5 == ((opcode1 & 0xE0) >> 5))
- {
- /* BLX(1) */
- record_buf[0] = ARM_PS_REGNUM;
- record_buf[1] = ARM_LR_REGNUM;
- arm_insn_r->reg_rec_count = 2;
- }
+ {
+ /* BLX(1) */
+ record_buf[0] = ARM_PS_REGNUM;
+ record_buf[1] = ARM_LR_REGNUM;
+ arm_insn_r->reg_rec_count = 2;
+ }
/* STC2, LDC2, MCR2, MRC2, CDP2: <TBD>, co-processor insn. */
}
{
ret = -1;
/* Undefined instruction on ARM V5; need to handle if later
- versions define it. */
+ versions define it. */
}
opcode1 = bits (arm_insn_r->arm_insn, 24, 27);
/* 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;
}
}
&& 1 != arm_insn_r->cond && !INSN_RECORDED(arm_insn_r))
{
if (!bit (arm_insn_r->arm_insn,25))
- {
- if (!bits (arm_insn_r->arm_insn, 4, 7))
- {
- if ((0 == insn_op1) || (2 == insn_op1))
- {
- /* MRS. */
- record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
- arm_insn_r->reg_rec_count = 1;
- }
- else if (1 == insn_op1)
- {
- /* CSPR is going to be changed. */
- record_buf[0] = ARM_PS_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- }
- else if (3 == insn_op1)
- {
- /* SPSR is going to be changed. */
- /* We need to get SPSR value, which is yet to be done. */
- return -1;
- }
- }
- else if (1 == bits (arm_insn_r->arm_insn, 4, 7))
- {
- if (1 == insn_op1)
- {
- /* BX. */
- record_buf[0] = ARM_PS_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- }
- else if (3 == insn_op1)
- {
- /* CLZ. */
- record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
- arm_insn_r->reg_rec_count = 1;
- }
- }
- else if (3 == bits (arm_insn_r->arm_insn, 4, 7))
- {
- /* BLX. */
- record_buf[0] = ARM_PS_REGNUM;
- record_buf[1] = ARM_LR_REGNUM;
- arm_insn_r->reg_rec_count = 2;
- }
- else if (5 == bits (arm_insn_r->arm_insn, 4, 7))
- {
- /* QADD, QSUB, QDADD, QDSUB */
- record_buf[0] = ARM_PS_REGNUM;
- record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15);
- arm_insn_r->reg_rec_count = 2;
- }
- else if (7 == bits (arm_insn_r->arm_insn, 4, 7))
- {
- /* BKPT. */
- record_buf[0] = ARM_PS_REGNUM;
- record_buf[1] = ARM_LR_REGNUM;
- arm_insn_r->reg_rec_count = 2;
-
- /* Save SPSR also;how? */
- return -1;
- }
- else if(8 == bits (arm_insn_r->arm_insn, 4, 7)
- || 10 == bits (arm_insn_r->arm_insn, 4, 7)
- || 12 == bits (arm_insn_r->arm_insn, 4, 7)
- || 14 == bits (arm_insn_r->arm_insn, 4, 7)
- )
- {
- if (0 == insn_op1 || 1 == insn_op1)
- {
- /* SMLA<x><y>, SMLAW<y>, SMULW<y>. */
- /* We dont do optimization for SMULW<y> where we
- need only Rd. */
- 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 (2 == insn_op1)
- {
- /* SMLAL<x><y>. */
- record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
- record_buf[1] = bits (arm_insn_r->arm_insn, 16, 19);
- arm_insn_r->reg_rec_count = 2;
- }
- else if (3 == insn_op1)
- {
- /* SMUL<x><y>. */
- record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
- arm_insn_r->reg_rec_count = 1;
- }
- }
- }
+ {
+ if (!bits (arm_insn_r->arm_insn, 4, 7))
+ {
+ if ((0 == insn_op1) || (2 == insn_op1))
+ {
+ /* MRS. */
+ record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ arm_insn_r->reg_rec_count = 1;
+ }
+ else if (1 == insn_op1)
+ {
+ /* CSPR is going to be changed. */
+ record_buf[0] = ARM_PS_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ }
+ else if (3 == insn_op1)
+ {
+ /* SPSR is going to be changed. */
+ /* We need to get SPSR value, which is yet to be done. */
+ return -1;
+ }
+ }
+ else if (1 == bits (arm_insn_r->arm_insn, 4, 7))
+ {
+ if (1 == insn_op1)
+ {
+ /* BX. */
+ record_buf[0] = ARM_PS_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ }
+ else if (3 == insn_op1)
+ {
+ /* CLZ. */
+ record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ arm_insn_r->reg_rec_count = 1;
+ }
+ }
+ else if (3 == bits (arm_insn_r->arm_insn, 4, 7))
+ {
+ /* BLX. */
+ record_buf[0] = ARM_PS_REGNUM;
+ record_buf[1] = ARM_LR_REGNUM;
+ arm_insn_r->reg_rec_count = 2;
+ }
+ else if (5 == bits (arm_insn_r->arm_insn, 4, 7))
+ {
+ /* QADD, QSUB, QDADD, QDSUB */
+ record_buf[0] = ARM_PS_REGNUM;
+ record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15);
+ arm_insn_r->reg_rec_count = 2;
+ }
+ else if (7 == bits (arm_insn_r->arm_insn, 4, 7))
+ {
+ /* BKPT. */
+ record_buf[0] = ARM_PS_REGNUM;
+ record_buf[1] = ARM_LR_REGNUM;
+ arm_insn_r->reg_rec_count = 2;
+
+ /* Save SPSR also;how? */
+ return -1;
+ }
+ else if(8 == bits (arm_insn_r->arm_insn, 4, 7)
+ || 10 == bits (arm_insn_r->arm_insn, 4, 7)
+ || 12 == bits (arm_insn_r->arm_insn, 4, 7)
+ || 14 == bits (arm_insn_r->arm_insn, 4, 7)
+ )
+ {
+ if (0 == insn_op1 || 1 == insn_op1)
+ {
+ /* SMLA<x><y>, SMLAW<y>, SMULW<y>. */
+ /* We dont do optimization for SMULW<y> where we
+ need only Rd. */
+ 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 (2 == insn_op1)
+ {
+ /* SMLAL<x><y>. */
+ record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ record_buf[1] = bits (arm_insn_r->arm_insn, 16, 19);
+ arm_insn_r->reg_rec_count = 2;
+ }
+ else if (3 == insn_op1)
+ {
+ /* SMUL<x><y>. */
+ record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ arm_insn_r->reg_rec_count = 1;
+ }
+ }
+ }
else
- {
- /* MSR : immediate form. */
- if (1 == insn_op1)
- {
- /* CSPR is going to be changed. */
- record_buf[0] = ARM_PS_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- }
- else if (3 == insn_op1)
- {
- /* SPSR is going to be changed. */
- /* we need to get SPSR value, which is yet to be done */
- return -1;
- }
- }
+ {
+ /* MSR : immediate form. */
+ if (1 == insn_op1)
+ {
+ /* CSPR is going to be changed. */
+ record_buf[0] = ARM_PS_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ }
+ else if (3 == insn_op1)
+ {
+ /* SPSR is going to be changed. */
+ /* we need to get SPSR value, which is yet to be done */
+ return -1;
+ }
+ }
}
opcode1 = bits (arm_insn_r->arm_insn, 25, 27);
{
/* SWP/SWPB. */
if (0 == insn_op1)
- {
- /* These insn, changes register and memory as well. */
- /* SWP or SWPB insn. */
- /* Get memory address given by Rn. */
- reg_src1 = bits (arm_insn_r->arm_insn, 16, 19);
- regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval);
- /* SWP insn ?, swaps word. */
- if (8 == arm_insn_r->opcode)
- {
- record_buf_mem[0] = 4;
- }
- else
- {
- /* SWPB insn, swaps only byte. */
- record_buf_mem[0] = 1;
- }
- record_buf_mem[1] = u_regval;
- arm_insn_r->mem_rec_count = 1;
- record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
- arm_insn_r->reg_rec_count = 1;
- }
+ {
+ /* These insn, changes register and memory as well. */
+ /* SWP or SWPB insn. */
+ /* Get memory address given by Rn. */
+ reg_src1 = bits (arm_insn_r->arm_insn, 16, 19);
+ regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval);
+ /* SWP insn ?, swaps word. */
+ if (8 == arm_insn_r->opcode)
+ {
+ record_buf_mem[0] = 4;
+ }
+ else
+ {
+ /* SWPB insn, swaps only byte. */
+ record_buf_mem[0] = 1;
+ }
+ record_buf_mem[1] = u_regval;
+ arm_insn_r->mem_rec_count = 1;
+ record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ arm_insn_r->reg_rec_count = 1;
+ }
else if (1 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
- {
- /* STRH. */
- arm_record_strx(arm_insn_r, &record_buf[0], &record_buf_mem[0],
- ARM_RECORD_STRH);
- }
+ {
+ /* STRH. */
+ arm_record_strx(arm_insn_r, &record_buf[0], &record_buf_mem[0],
+ ARM_RECORD_STRH);
+ }
else if (2 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
- {
- /* LDRD. */
- record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
- record_buf[1] = record_buf[0] + 1;
- arm_insn_r->reg_rec_count = 2;
- }
+ {
+ /* LDRD. */
+ record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ record_buf[1] = record_buf[0] + 1;
+ arm_insn_r->reg_rec_count = 2;
+ }
else if (3 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
- {
- /* STRD. */
- arm_record_strx(arm_insn_r, &record_buf[0], &record_buf_mem[0],
- ARM_RECORD_STRD);
- }
+ {
+ /* STRD. */
+ arm_record_strx(arm_insn_r, &record_buf[0], &record_buf_mem[0],
+ ARM_RECORD_STRD);
+ }
else if (bit (arm_insn_r->arm_insn, 20) && insn_op1 <= 3)
- {
- /* LDRH, LDRSB, LDRSH. */
- record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
- arm_insn_r->reg_rec_count = 1;
- }
+ {
+ /* LDRH, LDRSB, LDRSH. */
+ record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ arm_insn_r->reg_rec_count = 1;
+ }
}
{
/* Handle MSR insn. */
if (9 == arm_insn_r->opcode)
- {
- /* CSPR is going to be changed. */
- record_buf[0] = ARM_PS_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- }
+ {
+ /* CSPR is going to be changed. */
+ record_buf[0] = ARM_PS_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ }
else
- {
- /* SPSR is going to be changed. */
- }
+ {
+ /* SPSR is going to be changed. */
+ }
}
else if (arm_insn_r->opcode <= 15)
{
/* Normal data processing insns. */
/* Out of 11 shifter operands mode, all the insn modifies destination
- register, which is specified by 13-16 decode. */
+ register, which is specified by 13-16 decode. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 2;
{
reg_dest = bits (arm_insn_r->arm_insn, 12, 15);
/* LDR insn has a capability to do branching, if
- MOV LR, PC is preceded by LDR insn having Rn as R15
- in that case, it emulates branch and link insn, and hence we
- need to save CSPR and PC as well. */
+ MOV LR, PC is preceded by LDR insn having Rn as R15
+ in that case, it emulates branch and link insn, and hence we
+ need to save CSPR and PC as well. */
if (15 != reg_dest)
- {
- record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
- arm_insn_r->reg_rec_count = 1;
- }
+ {
+ record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ arm_insn_r->reg_rec_count = 1;
+ }
else
- {
- record_buf[0] = reg_dest;
- record_buf[1] = ARM_PS_REGNUM;
- arm_insn_r->reg_rec_count = 2;
- }
+ {
+ record_buf[0] = reg_dest;
+ record_buf[1] = ARM_PS_REGNUM;
+ arm_insn_r->reg_rec_count = 2;
+ }
}
else
{
if (! bits (arm_insn_r->arm_insn, 4, 11))
- {
- /* Store insn, register offset and register pre-indexed,
- register post-indexed. */
- /* Get Rm. */
- reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
- /* Get Rn. */
- reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
- regcache_raw_read_unsigned (reg_cache, reg_src1
- , &u_regval[0]);
- regcache_raw_read_unsigned (reg_cache, reg_src2
- , &u_regval[1]);
- if (15 == reg_src2)
- {
- /* If R15 was used as Rn, hence current PC+8. */
- /* Pre-indexed mode doesnt reach here ; illegal insn. */
- u_regval[0] = u_regval[0] + 8;
- }
- /* Calculate target store address, Rn +/- Rm, register offset. */
- /* U == 1. */
- if (bit (arm_insn_r->arm_insn, 23))
- {
- tgt_mem_addr = u_regval[0] + u_regval[1];
- }
- else
- {
- tgt_mem_addr = u_regval[1] - u_regval[0];
- }
-
- switch (arm_insn_r->opcode)
- {
- /* STR. */
- case 8:
- case 12:
- /* STR. */
- case 9:
- case 13:
- /* STRT. */
- case 1:
- case 5:
- /* STR. */
- case 0:
- case 4:
- record_buf_mem[0] = 4;
- break;
-
- /* STRB. */
- case 10:
- case 14:
- /* STRB. */
- case 11:
- case 15:
- /* STRBT. */
- case 3:
- case 7:
- /* STRB. */
- case 2:
- case 6:
- record_buf_mem[0] = 1;
- break;
-
- default:
- gdb_assert_not_reached ("no decoding pattern found");
- break;
- }
- record_buf_mem[1] = tgt_mem_addr;
- arm_insn_r->mem_rec_count = 1;
-
- if (9 == arm_insn_r->opcode || 11 == arm_insn_r->opcode
- || 13 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
- || 0 == arm_insn_r->opcode || 2 == arm_insn_r->opcode
- || 4 == arm_insn_r->opcode || 6 == arm_insn_r->opcode
- || 1 == arm_insn_r->opcode || 3 == arm_insn_r->opcode
- || 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode
- )
- {
- /* Rn is going to be changed in pre-indexed mode and
- post-indexed mode as well. */
- record_buf[0] = reg_src2;
- arm_insn_r->reg_rec_count = 1;
- }
- }
+ {
+ /* Store insn, register offset and register pre-indexed,
+ register post-indexed. */
+ /* Get Rm. */
+ reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
+ /* Get Rn. */
+ reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
+ regcache_raw_read_unsigned (reg_cache, reg_src1
+ , &u_regval[0]);
+ regcache_raw_read_unsigned (reg_cache, reg_src2
+ , &u_regval[1]);
+ if (15 == reg_src2)
+ {
+ /* If R15 was used as Rn, hence current PC+8. */
+ /* Pre-indexed mode doesnt reach here ; illegal insn. */
+ u_regval[0] = u_regval[0] + 8;
+ }
+ /* Calculate target store address, Rn +/- Rm, register offset. */
+ /* U == 1. */
+ if (bit (arm_insn_r->arm_insn, 23))
+ {
+ tgt_mem_addr = u_regval[0] + u_regval[1];
+ }
+ else
+ {
+ tgt_mem_addr = u_regval[1] - u_regval[0];
+ }
+
+ switch (arm_insn_r->opcode)
+ {
+ /* STR. */
+ case 8:
+ case 12:
+ /* STR. */
+ case 9:
+ case 13:
+ /* STRT. */
+ case 1:
+ case 5:
+ /* STR. */
+ case 0:
+ case 4:
+ record_buf_mem[0] = 4;
+ break;
+
+ /* STRB. */
+ case 10:
+ case 14:
+ /* STRB. */
+ case 11:
+ case 15:
+ /* STRBT. */
+ case 3:
+ case 7:
+ /* STRB. */
+ case 2:
+ case 6:
+ record_buf_mem[0] = 1;
+ break;
+
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
+ break;
+ }
+ record_buf_mem[1] = tgt_mem_addr;
+ arm_insn_r->mem_rec_count = 1;
+
+ if (9 == arm_insn_r->opcode || 11 == arm_insn_r->opcode
+ || 13 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
+ || 0 == arm_insn_r->opcode || 2 == arm_insn_r->opcode
+ || 4 == arm_insn_r->opcode || 6 == arm_insn_r->opcode
+ || 1 == arm_insn_r->opcode || 3 == arm_insn_r->opcode
+ || 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode
+ )
+ {
+ /* Rn is going to be changed in pre-indexed mode and
+ post-indexed mode as well. */
+ record_buf[0] = reg_src2;
+ arm_insn_r->reg_rec_count = 1;
+ }
+ }
else
- {
- /* Store insn, scaled register offset; scaled pre-indexed. */
- offset_12 = bits (arm_insn_r->arm_insn, 5, 6);
- /* Get Rm. */
- reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
- /* Get Rn. */
- reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
- /* Get shift_imm. */
- shift_imm = bits (arm_insn_r->arm_insn, 7, 11);
- regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
- regcache_raw_read_signed (reg_cache, reg_src1, &s_word);
- regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
- /* Offset_12 used as shift. */
- switch (offset_12)
- {
- case 0:
- /* Offset_12 used as index. */
- offset_12 = u_regval[0] << shift_imm;
- break;
-
- case 1:
- offset_12 = (!shift_imm)?0:u_regval[0] >> shift_imm;
- break;
-
- case 2:
- if (!shift_imm)
- {
- if (bit (u_regval[0], 31))
- {
- offset_12 = 0xFFFFFFFF;
- }
- else
- {
- offset_12 = 0;
- }
- }
- else
- {
- /* This is arithmetic shift. */
- offset_12 = s_word >> shift_imm;
- }
- break;
-
- case 3:
- if (!shift_imm)
- {
- regcache_raw_read_unsigned (reg_cache, ARM_PS_REGNUM,
- &u_regval[1]);
- /* Get C flag value and shift it by 31. */
- offset_12 = (((bit (u_regval[1], 29)) << 31) \
- | (u_regval[0]) >> 1);
- }
- else
- {
- offset_12 = (u_regval[0] >> shift_imm) \
- | (u_regval[0] <<
- (sizeof(uint32_t) - shift_imm));
- }
- break;
-
- default:
- gdb_assert_not_reached ("no decoding pattern found");
- break;
- }
-
- regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
- /* bit U set. */
- if (bit (arm_insn_r->arm_insn, 23))
- {
- tgt_mem_addr = u_regval[1] + offset_12;
- }
- else
- {
- tgt_mem_addr = u_regval[1] - offset_12;
- }
-
- switch (arm_insn_r->opcode)
- {
- /* STR. */
- case 8:
- case 12:
- /* STR. */
- case 9:
- case 13:
- /* STRT. */
- case 1:
- case 5:
- /* STR. */
- case 0:
- case 4:
- record_buf_mem[0] = 4;
- break;
-
- /* STRB. */
- case 10:
- case 14:
- /* STRB. */
- case 11:
- case 15:
- /* STRBT. */
- case 3:
- case 7:
- /* STRB. */
- case 2:
- case 6:
- record_buf_mem[0] = 1;
- break;
-
- default:
- gdb_assert_not_reached ("no decoding pattern found");
- break;
- }
- record_buf_mem[1] = tgt_mem_addr;
- arm_insn_r->mem_rec_count = 1;
-
- if (9 == arm_insn_r->opcode || 11 == arm_insn_r->opcode
- || 13 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
- || 0 == arm_insn_r->opcode || 2 == arm_insn_r->opcode
- || 4 == arm_insn_r->opcode || 6 == arm_insn_r->opcode
- || 1 == arm_insn_r->opcode || 3 == arm_insn_r->opcode
- || 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode
- )
- {
- /* Rn is going to be changed in register scaled pre-indexed
- mode,and scaled post indexed mode. */
- record_buf[0] = reg_src2;
- arm_insn_r->reg_rec_count = 1;
- }
- }
+ {
+ /* Store insn, scaled register offset; scaled pre-indexed. */
+ offset_12 = bits (arm_insn_r->arm_insn, 5, 6);
+ /* Get Rm. */
+ reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
+ /* Get Rn. */
+ reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
+ /* Get shift_imm. */
+ shift_imm = bits (arm_insn_r->arm_insn, 7, 11);
+ regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
+ regcache_raw_read_signed (reg_cache, reg_src1, &s_word);
+ regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
+ /* Offset_12 used as shift. */
+ switch (offset_12)
+ {
+ case 0:
+ /* Offset_12 used as index. */
+ offset_12 = u_regval[0] << shift_imm;
+ break;
+
+ case 1:
+ offset_12 = (!shift_imm)?0:u_regval[0] >> shift_imm;
+ break;
+
+ case 2:
+ if (!shift_imm)
+ {
+ if (bit (u_regval[0], 31))
+ {
+ offset_12 = 0xFFFFFFFF;
+ }
+ else
+ {
+ offset_12 = 0;
+ }
+ }
+ else
+ {
+ /* This is arithmetic shift. */
+ offset_12 = s_word >> shift_imm;
+ }
+ break;
+
+ case 3:
+ if (!shift_imm)
+ {
+ regcache_raw_read_unsigned (reg_cache, ARM_PS_REGNUM,
+ &u_regval[1]);
+ /* Get C flag value and shift it by 31. */
+ offset_12 = (((bit (u_regval[1], 29)) << 31) \
+ | (u_regval[0]) >> 1);
+ }
+ else
+ {
+ offset_12 = (u_regval[0] >> shift_imm) \
+ | (u_regval[0] <<
+ (sizeof(uint32_t) - shift_imm));
+ }
+ break;
+
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
+ break;
+ }
+
+ regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
+ /* bit U set. */
+ if (bit (arm_insn_r->arm_insn, 23))
+ {
+ tgt_mem_addr = u_regval[1] + offset_12;
+ }
+ else
+ {
+ tgt_mem_addr = u_regval[1] - offset_12;
+ }
+
+ switch (arm_insn_r->opcode)
+ {
+ /* STR. */
+ case 8:
+ case 12:
+ /* STR. */
+ case 9:
+ case 13:
+ /* STRT. */
+ case 1:
+ case 5:
+ /* STR. */
+ case 0:
+ case 4:
+ record_buf_mem[0] = 4;
+ break;
+
+ /* STRB. */
+ case 10:
+ case 14:
+ /* STRB. */
+ case 11:
+ case 15:
+ /* STRBT. */
+ case 3:
+ case 7:
+ /* STRB. */
+ case 2:
+ case 6:
+ record_buf_mem[0] = 1;
+ break;
+
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
+ break;
+ }
+ record_buf_mem[1] = tgt_mem_addr;
+ arm_insn_r->mem_rec_count = 1;
+
+ if (9 == arm_insn_r->opcode || 11 == arm_insn_r->opcode
+ || 13 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
+ || 0 == arm_insn_r->opcode || 2 == arm_insn_r->opcode
+ || 4 == arm_insn_r->opcode || 6 == arm_insn_r->opcode
+ || 1 == arm_insn_r->opcode || 3 == arm_insn_r->opcode
+ || 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode
+ )
+ {
+ /* Rn is going to be changed in register scaled pre-indexed
+ mode,and scaled post indexed mode. */
+ record_buf[0] = reg_src2;
+ arm_insn_r->reg_rec_count = 1;
+ }
+ }
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
{
/* Handle VMOV instruction. */
if (bits_a == 0x00)
- {
+ {
record_buf[0] = reg_t;
- arm_insn_r->reg_rec_count = 1;
- }
+ arm_insn_r->reg_rec_count = 1;
+ }
/* Handle VMRS instruction. */
else if (bits_a == 0x07)
- {
- if (reg_t == 15)
- reg_t = ARM_PS_REGNUM;
+ {
+ if (reg_t == 15)
+ reg_t = ARM_PS_REGNUM;
- record_buf[0] = reg_t;
- arm_insn_r->reg_rec_count = 1;
- }
+ record_buf[0] = reg_t;
+ arm_insn_r->reg_rec_count = 1;
+ }
}
else if (!bit_l && !bit_c)
{
/* Handle VMOV instruction. */
if (bits_a == 0x00)
- {
+ {
record_buf[0] = ARM_D0_REGNUM + reg_v;
- arm_insn_r->reg_rec_count = 1;
- }
+ arm_insn_r->reg_rec_count = 1;
+ }
/* Handle VMSR instruction. */
else if (bits_a == 0x07)
- {
- record_buf[0] = ARM_FPSCR_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- }
+ {
+ record_buf[0] = ARM_FPSCR_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ }
}
else if (!bit_l && bit_c)
{
/* Handle VMOV instruction. */
if (!(bits_a & 0x04))
- {
- record_buf[0] = (reg_v | (bit (arm_insn_r->arm_insn, 7) << 4))
- + ARM_D0_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- }
+ {
+ record_buf[0] = (reg_v | (bit (arm_insn_r->arm_insn, 7) << 4))
+ + ARM_D0_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ }
/* Handle VDUP instruction. */
else
- {
- if (bit (arm_insn_r->arm_insn, 21))
- {
- reg_v = reg_v | (bit (arm_insn_r->arm_insn, 7) << 4);
- record_buf[0] = reg_v + ARM_D0_REGNUM;
- record_buf[1] = reg_v + ARM_D0_REGNUM + 1;
- arm_insn_r->reg_rec_count = 2;
- }
- else
- {
- reg_v = reg_v | (bit (arm_insn_r->arm_insn, 7) << 4);
- record_buf[0] = reg_v + ARM_D0_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- }
- }
- }
-
- REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
- return 0;
-}
-
+ {
+ if (bit (arm_insn_r->arm_insn, 21))
+ {
+ reg_v = reg_v | (bit (arm_insn_r->arm_insn, 7) << 4);
+ record_buf[0] = reg_v + ARM_D0_REGNUM;
+ record_buf[1] = reg_v + ARM_D0_REGNUM + 1;
+ arm_insn_r->reg_rec_count = 2;
+ }
+ else
+ {
+ reg_v = reg_v | (bit (arm_insn_r->arm_insn, 7) << 4);
+ record_buf[0] = reg_v + ARM_D0_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ }
+ }
+ }
+
+ REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
+ return 0;
+}
+
/* Record handler for extension register load/store instructions. */
static int
if (opc1 == 0x00)
{
if (bit (arm_insn_r->arm_insn, 10))
- {
- if (bit (arm_insn_r->arm_insn, 6))
- curr_insn_type = INSN_T0;
- else
- curr_insn_type = INSN_T1;
- }
+ {
+ if (bit (arm_insn_r->arm_insn, 6))
+ curr_insn_type = INSN_T0;
+ else
+ curr_insn_type = INSN_T1;
+ }
else
- {
- if (dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
+ {
+ if (dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
}
/* Handle VNMLA, VNMLS, VNMUL. */
else if (opc1 == 0x01)
{
if (dp_op_sz)
- curr_insn_type = INSN_T1;
+ curr_insn_type = INSN_T1;
else
- curr_insn_type = INSN_T2;
+ curr_insn_type = INSN_T2;
}
/* Handle VMUL. */
else if (opc1 == 0x02 && !(opc3 & 0x01))
{
if (bit (arm_insn_r->arm_insn, 10))
- {
- if (bit (arm_insn_r->arm_insn, 6))
- curr_insn_type = INSN_T0;
- else
- curr_insn_type = INSN_T1;
- }
+ {
+ if (bit (arm_insn_r->arm_insn, 6))
+ curr_insn_type = INSN_T0;
+ else
+ curr_insn_type = INSN_T1;
+ }
else
- {
- if (dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
+ {
+ if (dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
}
/* Handle VADD, VSUB. */
else if (opc1 == 0x03)
{
if (!bit (arm_insn_r->arm_insn, 9))
- {
- if (bit (arm_insn_r->arm_insn, 6))
- curr_insn_type = INSN_T0;
- else
- curr_insn_type = INSN_T1;
- }
+ {
+ if (bit (arm_insn_r->arm_insn, 6))
+ curr_insn_type = INSN_T0;
+ else
+ curr_insn_type = INSN_T1;
+ }
else
- {
- if (dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
+ {
+ if (dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
}
/* Handle VDIV. */
else if (opc1 == 0x08)
{
if (dp_op_sz)
- curr_insn_type = INSN_T1;
+ curr_insn_type = INSN_T1;
else
- curr_insn_type = INSN_T2;
+ curr_insn_type = INSN_T2;
}
/* Handle all other vfp data processing instructions. */
else if (opc1 == 0x0b)
{
/* Handle VMOV. */
if (!(opc3 & 0x01) || (opc2 == 0x00 && opc3 == 0x01))
- {
- if (bit (arm_insn_r->arm_insn, 4))
- {
- if (bit (arm_insn_r->arm_insn, 6))
- curr_insn_type = INSN_T0;
- else
- curr_insn_type = INSN_T1;
- }
- else
- {
- if (dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
- }
+ {
+ if (bit (arm_insn_r->arm_insn, 4))
+ {
+ if (bit (arm_insn_r->arm_insn, 6))
+ curr_insn_type = INSN_T0;
+ else
+ curr_insn_type = INSN_T1;
+ }
+ else
+ {
+ if (dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
+ }
/* Handle VNEG and VABS. */
else if ((opc2 == 0x01 && opc3 == 0x01)
- || (opc2 == 0x00 && opc3 == 0x03))
- {
- if (!bit (arm_insn_r->arm_insn, 11))
- {
- if (bit (arm_insn_r->arm_insn, 6))
- curr_insn_type = INSN_T0;
- else
- curr_insn_type = INSN_T1;
- }
- else
- {
- if (dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
- }
+ || (opc2 == 0x00 && opc3 == 0x03))
+ {
+ if (!bit (arm_insn_r->arm_insn, 11))
+ {
+ if (bit (arm_insn_r->arm_insn, 6))
+ curr_insn_type = INSN_T0;
+ else
+ curr_insn_type = INSN_T1;
+ }
+ else
+ {
+ if (dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
+ }
/* Handle VSQRT. */
else if (opc2 == 0x01 && opc3 == 0x03)
- {
- if (dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
+ {
+ if (dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
/* Handle VCVT. */
else if (opc2 == 0x07 && opc3 == 0x03)
- {
- if (!dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
+ {
+ if (!dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
else if (opc3 & 0x01)
- {
- /* Handle VCVT. */
- if ((opc2 == 0x08) || (opc2 & 0x0e) == 0x0c)
- {
- if (!bit (arm_insn_r->arm_insn, 18))
- curr_insn_type = INSN_T2;
- else
- {
- if (dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
- }
- /* Handle VCVT. */
- else if ((opc2 & 0x0e) == 0x0a || (opc2 & 0x0e) == 0x0e)
- {
- if (dp_op_sz)
- curr_insn_type = INSN_T1;
- else
- curr_insn_type = INSN_T2;
- }
- /* Handle VCVTB, VCVTT. */
- else if ((opc2 & 0x0e) == 0x02)
- curr_insn_type = INSN_T2;
- /* Handle VCMP, VCMPE. */
- else if ((opc2 & 0x0e) == 0x04)
- curr_insn_type = INSN_T3;
- }
+ {
+ /* Handle VCVT. */
+ if ((opc2 == 0x08) || (opc2 & 0x0e) == 0x0c)
+ {
+ if (!bit (arm_insn_r->arm_insn, 18))
+ curr_insn_type = INSN_T2;
+ else
+ {
+ if (dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
+ }
+ /* Handle VCVT. */
+ else if ((opc2 & 0x0e) == 0x0a || (opc2 & 0x0e) == 0x0e)
+ {
+ if (dp_op_sz)
+ curr_insn_type = INSN_T1;
+ else
+ curr_insn_type = INSN_T2;
+ }
+ /* Handle VCVTB, VCVTT. */
+ else if ((opc2 & 0x0e) == 0x02)
+ curr_insn_type = INSN_T2;
+ /* Handle VCMP, VCMPE. */
+ else if ((opc2 & 0x0e) == 0x04)
+ curr_insn_type = INSN_T3;
+ }
}
switch (curr_insn_type)
{
case INSN_T0:
- reg_vd = reg_vd | (bit_d << 4);
- record_buf[0] = reg_vd + ARM_D0_REGNUM;
- record_buf[1] = reg_vd + ARM_D0_REGNUM + 1;
- arm_insn_r->reg_rec_count = 2;
- break;
+ reg_vd = reg_vd | (bit_d << 4);
+ record_buf[0] = reg_vd + ARM_D0_REGNUM;
+ record_buf[1] = reg_vd + ARM_D0_REGNUM + 1;
+ arm_insn_r->reg_rec_count = 2;
+ break;
case INSN_T1:
- reg_vd = reg_vd | (bit_d << 4);
- record_buf[0] = reg_vd + ARM_D0_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- break;
+ reg_vd = reg_vd | (bit_d << 4);
+ record_buf[0] = reg_vd + ARM_D0_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ break;
case INSN_T2:
- reg_vd = (reg_vd << 1) | bit_d;
- record_buf[0] = reg_vd + ARM_D0_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- break;
+ reg_vd = (reg_vd << 1) | bit_d;
+ record_buf[0] = reg_vd + ARM_D0_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ break;
case INSN_T3:
- record_buf[0] = ARM_FPSCR_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- break;
+ record_buf[0] = ARM_FPSCR_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ break;
default:
- gdb_assert_not_reached ("no decoding pattern found");
- break;
+ gdb_assert_not_reached ("no decoding pattern found");
+ break;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
{
/* Handle extension register ld/st instructions. */
if (!(op1 & 0x20))
- return arm_record_exreg_ld_st_insn (arm_insn_r);
+ return arm_record_exreg_ld_st_insn (arm_insn_r);
/* 64-bit transfers between arm core and extension registers. */
if ((op1 & 0x3e) == 0x04)
- return arm_record_exreg_ld_st_insn (arm_insn_r);
+ return arm_record_exreg_ld_st_insn (arm_insn_r);
}
else
{
/* Handle coprocessor ld/st instructions. */
if (!(op1 & 0x3a))
- {
- /* Store. */
- if (!op1_ebit)
- return arm_record_unsupported_insn (arm_insn_r);
- else
- /* Load. */
- return arm_record_unsupported_insn (arm_insn_r);
- }
+ {
+ /* Store. */
+ if (!op1_ebit)
+ return arm_record_unsupported_insn (arm_insn_r);
+ else
+ /* Load. */
+ return arm_record_unsupported_insn (arm_insn_r);
+ }
/* Move to coprocessor from two arm core registers. */
if (op1 == 0x4)
- return arm_record_unsupported_insn (arm_insn_r);
+ return arm_record_unsupported_insn (arm_insn_r);
/* Move to two arm core registers from coprocessor. */
if (op1 == 0x5)
- {
- uint32_t reg_t[2];
+ {
+ uint32_t reg_t[2];
- reg_t[0] = bits (arm_insn_r->arm_insn, 12, 15);
- reg_t[1] = bits (arm_insn_r->arm_insn, 16, 19);
- arm_insn_r->reg_rec_count = 2;
+ reg_t[0] = bits (arm_insn_r->arm_insn, 12, 15);
+ reg_t[1] = bits (arm_insn_r->arm_insn, 16, 19);
+ arm_insn_r->reg_rec_count = 2;
- REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, reg_t);
- return 0;
+ REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, reg_t);
+ return 0;
}
}
return arm_record_unsupported_insn (arm_insn_r);
if (bits_24_25 == 0x3)
{
if (tdep->arm_syscall_record != NULL)
- {
- ULONGEST svc_operand, svc_number;
+ {
+ ULONGEST svc_operand, svc_number;
- svc_operand = (0x00ffffff & arm_insn_r->arm_insn);
+ svc_operand = (0x00ffffff & arm_insn_r->arm_insn);
- if (svc_operand) /* OABI. */
- svc_number = svc_operand - 0x900000;
- else /* EABI. */
- regcache_raw_read_unsigned (reg_cache, 7, &svc_number);
+ if (svc_operand) /* OABI. */
+ svc_number = svc_operand - 0x900000;
+ else /* EABI. */
+ regcache_raw_read_unsigned (reg_cache, 7, &svc_number);
- return tdep->arm_syscall_record (reg_cache, svc_number);
- }
+ return tdep->arm_syscall_record (reg_cache, svc_number);
+ }
else
- {
- printf_unfiltered (_("no syscall record support\n"));
- return -1;
- }
+ {
+ printf_unfiltered (_("no syscall record support\n"));
+ return -1;
+ }
}
else if (bits_24_25 == 0x02)
{
uint32_t opB = bits (thumb_insn_r->arm_insn, 9, 11);
if (in_inclusive_range (opB, 4U, 7U))
- {
- /* LDR(2), LDRB(2) , LDRH(2), LDRSB, LDRSH. */
- reg_src1 = bits (thumb_insn_r->arm_insn,0, 2);
- record_buf[0] = reg_src1;
- thumb_insn_r->reg_rec_count = 1;
- }
+ {
+ /* LDR(2), LDRB(2) , LDRH(2), LDRSB, LDRSH. */
+ reg_src1 = bits (thumb_insn_r->arm_insn,0, 2);
+ record_buf[0] = reg_src1;
+ thumb_insn_r->reg_rec_count = 1;
+ }
else if (in_inclusive_range (opB, 0U, 2U))
- {
- /* STR(2), STRB(2), STRH(2) . */
- reg_src1 = bits (thumb_insn_r->arm_insn, 3, 5);
- reg_src2 = bits (thumb_insn_r->arm_insn, 6, 8);
- regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
- regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
- if (0 == opB)
- record_buf_mem[0] = 4; /* STR (2). */
- else if (2 == opB)
- record_buf_mem[0] = 1; /* STRB (2). */
- else if (1 == opB)
- record_buf_mem[0] = 2; /* STRH (2). */
- record_buf_mem[1] = u_regval[0] + u_regval[1];
- thumb_insn_r->mem_rec_count = 1;
- }
+ {
+ /* STR(2), STRB(2), STRH(2) . */
+ reg_src1 = bits (thumb_insn_r->arm_insn, 3, 5);
+ reg_src2 = bits (thumb_insn_r->arm_insn, 6, 8);
+ regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
+ regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
+ if (0 == opB)
+ record_buf_mem[0] = 4; /* STR (2). */
+ else if (2 == opB)
+ record_buf_mem[0] = 1; /* STRB (2). */
+ else if (1 == opB)
+ record_buf_mem[0] = 2; /* STRH (2). */
+ record_buf_mem[1] = u_regval[0] + u_regval[1];
+ thumb_insn_r->mem_rec_count = 1;
+ }
}
else if (bit (thumb_insn_r->arm_insn, 11))
{
opcode2 = bits (thumb_insn_r->arm_insn, 8, 9);
opcode3 = bits (thumb_insn_r->arm_insn, 0, 2);
if ((3 == opcode2) && (!opcode3))
- {
- /* Branch with exchange. */
- record_buf[0] = ARM_PS_REGNUM;
- thumb_insn_r->reg_rec_count = 1;
- }
+ {
+ /* Branch with exchange. */
+ record_buf[0] = ARM_PS_REGNUM;
+ thumb_insn_r->reg_rec_count = 1;
+ }
else
- {
+ {
/* Format 8; special data processing insns. */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = (bit (thumb_insn_r->arm_insn, 7) << 3
| bits (thumb_insn_r->arm_insn, 0, 2));
- thumb_insn_r->reg_rec_count = 2;
- }
+ thumb_insn_r->reg_rec_count = 2;
+ }
}
else
{
/* Format 5; data processing insns. */
reg_src1 = bits (thumb_insn_r->arm_insn, 0, 2);
if (bit (thumb_insn_r->arm_insn, 7))
- {
- reg_src1 = reg_src1 + 8;
- }
+ {
+ reg_src1 = reg_src1 + 8;
+ }
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = reg_src1;
thumb_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return 0;
}
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return 0;
}
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return 0;
}
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return 0;
}
/* Get Rn. */
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
while (register_bits)
- {
- if (register_bits & 0x00000001)
- record_buf[index++] = register_count;
- register_bits = register_bits >> 1;
- register_count++;
- }
+ {
+ if (register_bits & 0x00000001)
+ record_buf[index++] = register_count;
+ register_bits = register_bits >> 1;
+ register_count++;
+ }
record_buf[index++] = reg_src1;
thumb_insn_r->reg_rec_count = index;
}
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval);
while (register_bits)
- {
- if (register_bits & 0x00000001)
- register_count++;
- register_bits = register_bits >> 1;
- }
+ {
+ if (register_bits & 0x00000001)
+ register_count++;
+ register_bits = register_bits >> 1;
+ }
start_address = u_regval;
thumb_insn_r->mem_rec_count = register_count;
while (register_count)
- {
- record_buf_mem[(register_count * 2) - 1] = start_address;
- record_buf_mem[(register_count * 2) - 2] = 4;
- start_address = start_address + 4;
- register_count--;
- }
+ {
+ record_buf_mem[(register_count * 2) - 1] = start_address;
+ record_buf_mem[(register_count * 2) - 2] = 4;
+ start_address = start_address + 4;
+ register_count--;
+ }
}
else if (0x1F == opcode1)
{
- /* Handle arm syscall insn. */
- if (tdep->arm_syscall_record != NULL)
- {
- regcache_raw_read_unsigned (reg_cache, 7, &u_regval);
- ret = tdep->arm_syscall_record (reg_cache, u_regval);
- }
- else
- {
- printf_unfiltered (_("no syscall record support\n"));
- return -1;
- }
+ /* Handle arm syscall insn. */
+ if (tdep->arm_syscall_record != NULL)
+ {
+ regcache_raw_read_unsigned (reg_cache, 7, &u_regval);
+ ret = tdep->arm_syscall_record (reg_cache, u_regval);
+ }
+ else
+ {
+ printf_unfiltered (_("no syscall record support\n"));
+ return -1;
+ }
}
/* B (1), conditional branch is automatically taken care in process_record,
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return ret;
}
if (0 == op || 3 == op)
{
if (bit (thumb2_insn_r->arm_insn, INSN_S_L_BIT_NUM))
- {
- /* Handle RFE instruction. */
- record_buf[0] = ARM_PS_REGNUM;
- thumb2_insn_r->reg_rec_count = 1;
- }
+ {
+ /* Handle RFE instruction. */
+ record_buf[0] = ARM_PS_REGNUM;
+ thumb2_insn_r->reg_rec_count = 1;
+ }
else
- {
- /* Handle SRS instruction after reading banked SP. */
- return arm_record_unsupported_insn (thumb2_insn_r);
- }
+ {
+ /* Handle SRS instruction after reading banked SP. */
+ return arm_record_unsupported_insn (thumb2_insn_r);
+ }
}
else if (1 == op || 2 == op)
{
if (bit (thumb2_insn_r->arm_insn, INSN_S_L_BIT_NUM))
- {
- /* Handle LDM/LDMIA/LDMFD and LDMDB/LDMEA instructions. */
- register_bits = bits (thumb2_insn_r->arm_insn, 0, 15);
- while (register_bits)
- {
- if (register_bits & 0x00000001)
- record_buf[index++] = register_count;
-
- register_count++;
- register_bits = register_bits >> 1;
- }
- record_buf[index++] = reg_rn;
- record_buf[index++] = ARM_PS_REGNUM;
- thumb2_insn_r->reg_rec_count = index;
- }
+ {
+ /* Handle LDM/LDMIA/LDMFD and LDMDB/LDMEA instructions. */
+ register_bits = bits (thumb2_insn_r->arm_insn, 0, 15);
+ while (register_bits)
+ {
+ if (register_bits & 0x00000001)
+ record_buf[index++] = register_count;
+
+ register_count++;
+ register_bits = register_bits >> 1;
+ }
+ record_buf[index++] = reg_rn;
+ record_buf[index++] = ARM_PS_REGNUM;
+ thumb2_insn_r->reg_rec_count = index;
+ }
else
- {
- /* Handle STM/STMIA/STMEA and STMDB/STMFD. */
- register_bits = bits (thumb2_insn_r->arm_insn, 0, 15);
- regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval);
- while (register_bits)
- {
- if (register_bits & 0x00000001)
- register_count++;
-
- register_bits = register_bits >> 1;
- }
-
- if (1 == op)
- {
- /* Start address calculation for LDMDB/LDMEA. */
- start_address = u_regval;
- }
- else if (2 == op)
- {
- /* Start address calculation for LDMDB/LDMEA. */
- start_address = u_regval - register_count * 4;
- }
-
- thumb2_insn_r->mem_rec_count = register_count;
- while (register_count)
- {
- record_buf_mem[register_count * 2 - 1] = start_address;
- record_buf_mem[register_count * 2 - 2] = 4;
- start_address = start_address + 4;
- register_count--;
- }
- record_buf[0] = reg_rn;
- record_buf[1] = ARM_PS_REGNUM;
- thumb2_insn_r->reg_rec_count = 2;
- }
+ {
+ /* Handle STM/STMIA/STMEA and STMDB/STMFD. */
+ register_bits = bits (thumb2_insn_r->arm_insn, 0, 15);
+ regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval);
+ while (register_bits)
+ {
+ if (register_bits & 0x00000001)
+ register_count++;
+
+ register_bits = register_bits >> 1;
+ }
+
+ if (1 == op)
+ {
+ /* Start address calculation for LDMDB/LDMEA. */
+ start_address = u_regval;
+ }
+ else if (2 == op)
+ {
+ /* Start address calculation for LDMDB/LDMEA. */
+ start_address = u_regval - register_count * 4;
+ }
+
+ thumb2_insn_r->mem_rec_count = register_count;
+ while (register_count)
+ {
+ record_buf_mem[register_count * 2 - 1] = start_address;
+ record_buf_mem[register_count * 2 - 2] = 4;
+ start_address = start_address + 4;
+ register_count--;
+ }
+ record_buf[0] = reg_rn;
+ record_buf[1] = ARM_PS_REGNUM;
+ thumb2_insn_r->reg_rec_count = 2;
+ }
}
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
if (bit (thumb2_insn_r->arm_insn, INSN_S_L_BIT_NUM))
{
if(!(1 == op1 && 1 == op2 && (0 == op3 || 1 == op3)))
- {
- reg_dest1 = bits (thumb2_insn_r->arm_insn, 12, 15);
- record_buf[0] = reg_dest1;
- record_buf[1] = ARM_PS_REGNUM;
- thumb2_insn_r->reg_rec_count = 2;
- }
+ {
+ reg_dest1 = bits (thumb2_insn_r->arm_insn, 12, 15);
+ record_buf[0] = reg_dest1;
+ record_buf[1] = ARM_PS_REGNUM;
+ thumb2_insn_r->reg_rec_count = 2;
+ }
if (3 == op2 || (op1 & 2) || (1 == op1 && 1 == op2 && 7 == op3))
- {
- reg_dest2 = bits (thumb2_insn_r->arm_insn, 8, 11);
- record_buf[2] = reg_dest2;
- thumb2_insn_r->reg_rec_count = 3;
- }
+ {
+ reg_dest2 = bits (thumb2_insn_r->arm_insn, 8, 11);
+ record_buf[2] = reg_dest2;
+ thumb2_insn_r->reg_rec_count = 3;
+ }
}
else
{
regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval[0]);
if (0 == op1 && 0 == op2)
- {
- /* Handle STREX. */
- offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
- address = u_regval[0] + (offset_imm * 4);
- record_buf_mem[0] = 4;
- record_buf_mem[1] = address;
- thumb2_insn_r->mem_rec_count = 1;
- reg_rd = bits (thumb2_insn_r->arm_insn, 0, 3);
- record_buf[0] = reg_rd;
- thumb2_insn_r->reg_rec_count = 1;
- }
+ {
+ /* Handle STREX. */
+ offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
+ address = u_regval[0] + (offset_imm * 4);
+ record_buf_mem[0] = 4;
+ record_buf_mem[1] = address;
+ thumb2_insn_r->mem_rec_count = 1;
+ reg_rd = bits (thumb2_insn_r->arm_insn, 0, 3);
+ record_buf[0] = reg_rd;
+ thumb2_insn_r->reg_rec_count = 1;
+ }
else if (1 == op1 && 0 == op2)
- {
- reg_rd = bits (thumb2_insn_r->arm_insn, 0, 3);
- record_buf[0] = reg_rd;
- thumb2_insn_r->reg_rec_count = 1;
- address = u_regval[0];
- record_buf_mem[1] = address;
-
- if (4 == op3)
- {
- /* Handle STREXB. */
- record_buf_mem[0] = 1;
- thumb2_insn_r->mem_rec_count = 1;
- }
- else if (5 == op3)
- {
- /* Handle STREXH. */
- record_buf_mem[0] = 2 ;
- thumb2_insn_r->mem_rec_count = 1;
- }
- else if (7 == op3)
- {
- /* Handle STREXD. */
- address = u_regval[0];
- record_buf_mem[0] = 4;
- record_buf_mem[2] = 4;
- record_buf_mem[3] = address + 4;
- thumb2_insn_r->mem_rec_count = 2;
- }
- }
+ {
+ reg_rd = bits (thumb2_insn_r->arm_insn, 0, 3);
+ record_buf[0] = reg_rd;
+ thumb2_insn_r->reg_rec_count = 1;
+ address = u_regval[0];
+ record_buf_mem[1] = address;
+
+ if (4 == op3)
+ {
+ /* Handle STREXB. */
+ record_buf_mem[0] = 1;
+ thumb2_insn_r->mem_rec_count = 1;
+ }
+ else if (5 == op3)
+ {
+ /* Handle STREXH. */
+ record_buf_mem[0] = 2 ;
+ thumb2_insn_r->mem_rec_count = 1;
+ }
+ else if (7 == op3)
+ {
+ /* Handle STREXD. */
+ address = u_regval[0];
+ record_buf_mem[0] = 4;
+ record_buf_mem[2] = 4;
+ record_buf_mem[3] = address + 4;
+ thumb2_insn_r->mem_rec_count = 2;
+ }
+ }
else
- {
- offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
-
- if (bit (thumb2_insn_r->arm_insn, 24))
- {
- if (bit (thumb2_insn_r->arm_insn, 23))
- offset_addr = u_regval[0] + (offset_imm * 4);
- else
- offset_addr = u_regval[0] - (offset_imm * 4);
-
- address = offset_addr;
- }
- else
- address = u_regval[0];
-
- record_buf_mem[0] = 4;
- record_buf_mem[1] = address;
- record_buf_mem[2] = 4;
- record_buf_mem[3] = address + 4;
- thumb2_insn_r->mem_rec_count = 2;
- record_buf[0] = reg_rn;
- thumb2_insn_r->reg_rec_count = 1;
- }
+ {
+ offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
+
+ if (bit (thumb2_insn_r->arm_insn, 24))
+ {
+ if (bit (thumb2_insn_r->arm_insn, 23))
+ offset_addr = u_regval[0] + (offset_imm * 4);
+ else
+ offset_addr = u_regval[0] - (offset_imm * 4);
+
+ address = offset_addr;
+ }
+ else
+ address = u_regval[0];
+
+ record_buf_mem[0] = 4;
+ record_buf_mem[1] = address;
+ record_buf_mem[2] = 4;
+ record_buf_mem[3] = address + 4;
+ thumb2_insn_r->mem_rec_count = 2;
+ record_buf[0] = reg_rn;
+ thumb2_insn_r->reg_rec_count = 1;
+ }
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return ARM_RECORD_SUCCESS;
}
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
thumb2_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
if (!(op1 & 0x2) && 0x38 == op)
{
if (!(op2 & 0x3))
- {
- /* CPSR is going to be changed. */
- record_buf[0] = ARM_PS_REGNUM;
- thumb2_insn_r->reg_rec_count = 1;
- }
+ {
+ /* CPSR is going to be changed. */
+ record_buf[0] = ARM_PS_REGNUM;
+ thumb2_insn_r->reg_rec_count = 1;
+ }
else
- {
- arm_record_unsupported_insn(thumb2_insn_r);
- return -1;
- }
+ {
+ arm_record_unsupported_insn(thumb2_insn_r);
+ return -1;
+ }
}
else if (4 == (op1 & 0x5) || 5 == (op1 & 0x5))
{
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
{
/* T3 encoding. */
if ((0 == op1 || 1 == op1 || 2 == op1) && !(op2 & 0x20))
- {
- /* Handle STRB (register). */
- reg_rm = bits (thumb2_insn_r->arm_insn, 0, 3);
- regcache_raw_read_unsigned (reg_cache, reg_rm, &u_regval[1]);
- shift_imm = bits (thumb2_insn_r->arm_insn, 4, 5);
- offset_addr = u_regval[1] << shift_imm;
- address = u_regval[0] + offset_addr;
- }
+ {
+ /* Handle STRB (register). */
+ reg_rm = bits (thumb2_insn_r->arm_insn, 0, 3);
+ regcache_raw_read_unsigned (reg_cache, reg_rm, &u_regval[1]);
+ shift_imm = bits (thumb2_insn_r->arm_insn, 4, 5);
+ offset_addr = u_regval[1] << shift_imm;
+ address = u_regval[0] + offset_addr;
+ }
else
- {
- offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
- if (bit (thumb2_insn_r->arm_insn, 10))
- {
- if (bit (thumb2_insn_r->arm_insn, 9))
- offset_addr = u_regval[0] + offset_imm;
- else
- offset_addr = u_regval[0] - offset_imm;
-
- address = offset_addr;
- }
- else
- address = u_regval[0];
- }
+ {
+ offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
+ if (bit (thumb2_insn_r->arm_insn, 10))
+ {
+ if (bit (thumb2_insn_r->arm_insn, 9))
+ offset_addr = u_regval[0] + offset_imm;
+ else
+ offset_addr = u_regval[0] - offset_imm;
+
+ address = offset_addr;
+ }
+ else
+ address = u_regval[0];
+ }
}
switch (op1)
/* Store byte instructions. */
case 4:
case 0:
- record_buf_mem[0] = 1;
- break;
+ record_buf_mem[0] = 1;
+ break;
/* Store half word instructions. */
case 1:
case 5:
- record_buf_mem[0] = 2;
- break;
+ record_buf_mem[0] = 2;
+ break;
/* Store word instructions. */
case 2:
case 6:
- record_buf_mem[0] = 4;
- break;
+ record_buf_mem[0] = 4;
+ break;
default:
- gdb_assert_not_reached ("no decoding pattern found");
- break;
+ gdb_assert_not_reached ("no decoding pattern found");
+ break;
}
record_buf_mem[1] = address;
thumb2_insn_r->reg_rec_count = 1;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return ARM_RECORD_SUCCESS;
}
thumb2_insn_r->reg_rec_count = 3;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
thumb2_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
return ARM_RECORD_FAILURE;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
address = u_regval;
if (!a_bit)
- {
- /* Handle VST1. */
- if (b_bits == 0x02 || b_bits == 0x0a || (b_bits & 0x0e) == 0x06)
- {
- if (b_bits == 0x07)
- bf_regs = 1;
- else if (b_bits == 0x0a)
- bf_regs = 2;
- else if (b_bits == 0x06)
- bf_regs = 3;
- else if (b_bits == 0x02)
- bf_regs = 4;
- else
- bf_regs = 0;
-
- for (index_r = 0; index_r < bf_regs; index_r++)
- {
- for (index_e = 0; index_e < f_elem; index_e++)
- {
- record_buf_mem[index_m++] = f_ebytes;
- record_buf_mem[index_m++] = address;
- address = address + f_ebytes;
- thumb2_insn_r->mem_rec_count += 1;
- }
- }
- }
- /* Handle VST2. */
- else if (b_bits == 0x03 || (b_bits & 0x0e) == 0x08)
- {
- if (b_bits == 0x09 || b_bits == 0x08)
- bf_regs = 1;
- else if (b_bits == 0x03)
- bf_regs = 2;
- else
- bf_regs = 0;
-
- for (index_r = 0; index_r < bf_regs; index_r++)
- for (index_e = 0; index_e < f_elem; index_e++)
- {
- for (loop_t = 0; loop_t < 2; loop_t++)
- {
- record_buf_mem[index_m++] = f_ebytes;
- record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
- thumb2_insn_r->mem_rec_count += 1;
- }
- address = address + (2 * f_ebytes);
- }
- }
- /* Handle VST3. */
- else if ((b_bits & 0x0e) == 0x04)
- {
- for (index_e = 0; index_e < f_elem; index_e++)
- {
- for (loop_t = 0; loop_t < 3; loop_t++)
- {
- record_buf_mem[index_m++] = f_ebytes;
- record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
- thumb2_insn_r->mem_rec_count += 1;
- }
- address = address + (3 * f_ebytes);
- }
- }
- /* Handle VST4. */
- else if (!(b_bits & 0x0e))
- {
- for (index_e = 0; index_e < f_elem; index_e++)
- {
- for (loop_t = 0; loop_t < 4; loop_t++)
- {
- record_buf_mem[index_m++] = f_ebytes;
- record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
- thumb2_insn_r->mem_rec_count += 1;
- }
- address = address + (4 * f_ebytes);
- }
- }
- }
+ {
+ /* Handle VST1. */
+ if (b_bits == 0x02 || b_bits == 0x0a || (b_bits & 0x0e) == 0x06)
+ {
+ if (b_bits == 0x07)
+ bf_regs = 1;
+ else if (b_bits == 0x0a)
+ bf_regs = 2;
+ else if (b_bits == 0x06)
+ bf_regs = 3;
+ else if (b_bits == 0x02)
+ bf_regs = 4;
+ else
+ bf_regs = 0;
+
+ for (index_r = 0; index_r < bf_regs; index_r++)
+ {
+ for (index_e = 0; index_e < f_elem; index_e++)
+ {
+ record_buf_mem[index_m++] = f_ebytes;
+ record_buf_mem[index_m++] = address;
+ address = address + f_ebytes;
+ thumb2_insn_r->mem_rec_count += 1;
+ }
+ }
+ }
+ /* Handle VST2. */
+ else if (b_bits == 0x03 || (b_bits & 0x0e) == 0x08)
+ {
+ if (b_bits == 0x09 || b_bits == 0x08)
+ bf_regs = 1;
+ else if (b_bits == 0x03)
+ bf_regs = 2;
+ else
+ bf_regs = 0;
+
+ for (index_r = 0; index_r < bf_regs; index_r++)
+ for (index_e = 0; index_e < f_elem; index_e++)
+ {
+ for (loop_t = 0; loop_t < 2; loop_t++)
+ {
+ record_buf_mem[index_m++] = f_ebytes;
+ record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
+ thumb2_insn_r->mem_rec_count += 1;
+ }
+ address = address + (2 * f_ebytes);
+ }
+ }
+ /* Handle VST3. */
+ else if ((b_bits & 0x0e) == 0x04)
+ {
+ for (index_e = 0; index_e < f_elem; index_e++)
+ {
+ for (loop_t = 0; loop_t < 3; loop_t++)
+ {
+ record_buf_mem[index_m++] = f_ebytes;
+ record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
+ thumb2_insn_r->mem_rec_count += 1;
+ }
+ address = address + (3 * f_ebytes);
+ }
+ }
+ /* Handle VST4. */
+ else if (!(b_bits & 0x0e))
+ {
+ for (index_e = 0; index_e < f_elem; index_e++)
+ {
+ for (loop_t = 0; loop_t < 4; loop_t++)
+ {
+ record_buf_mem[index_m++] = f_ebytes;
+ record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
+ thumb2_insn_r->mem_rec_count += 1;
+ }
+ address = address + (4 * f_ebytes);
+ }
+ }
+ }
else
- {
- uint8_t bft_size = bits (thumb2_insn_r->arm_insn, 10, 11);
-
- if (bft_size == 0x00)
- f_ebytes = 1;
- else if (bft_size == 0x01)
- f_ebytes = 2;
- else if (bft_size == 0x02)
- f_ebytes = 4;
- else
- f_ebytes = 0;
-
- /* Handle VST1. */
- if (!(b_bits & 0x0b) || b_bits == 0x08)
- thumb2_insn_r->mem_rec_count = 1;
- /* Handle VST2. */
- else if ((b_bits & 0x0b) == 0x01 || b_bits == 0x09)
- thumb2_insn_r->mem_rec_count = 2;
- /* Handle VST3. */
- else if ((b_bits & 0x0b) == 0x02 || b_bits == 0x0a)
- thumb2_insn_r->mem_rec_count = 3;
- /* Handle VST4. */
- else if ((b_bits & 0x0b) == 0x03 || b_bits == 0x0b)
- thumb2_insn_r->mem_rec_count = 4;
-
- for (index_m = 0; index_m < thumb2_insn_r->mem_rec_count; index_m++)
- {
- record_buf_mem[index_m] = f_ebytes;
- record_buf_mem[index_m] = address + (index_m * f_ebytes);
- }
- }
+ {
+ uint8_t bft_size = bits (thumb2_insn_r->arm_insn, 10, 11);
+
+ if (bft_size == 0x00)
+ f_ebytes = 1;
+ else if (bft_size == 0x01)
+ f_ebytes = 2;
+ else if (bft_size == 0x02)
+ f_ebytes = 4;
+ else
+ f_ebytes = 0;
+
+ /* Handle VST1. */
+ if (!(b_bits & 0x0b) || b_bits == 0x08)
+ thumb2_insn_r->mem_rec_count = 1;
+ /* Handle VST2. */
+ else if ((b_bits & 0x0b) == 0x01 || b_bits == 0x09)
+ thumb2_insn_r->mem_rec_count = 2;
+ /* Handle VST3. */
+ else if ((b_bits & 0x0b) == 0x02 || b_bits == 0x0a)
+ thumb2_insn_r->mem_rec_count = 3;
+ /* Handle VST4. */
+ else if ((b_bits & 0x0b) == 0x03 || b_bits == 0x0b)
+ thumb2_insn_r->mem_rec_count = 4;
+
+ for (index_m = 0; index_m < thumb2_insn_r->mem_rec_count; index_m++)
+ {
+ record_buf_mem[index_m] = f_ebytes;
+ record_buf_mem[index_m] = address + (index_m * f_ebytes);
+ }
+ }
}
else
{
if (!a_bit)
- {
- /* Handle VLD1. */
- if (b_bits == 0x02 || b_bits == 0x0a || (b_bits & 0x0e) == 0x06)
- thumb2_insn_r->reg_rec_count = 1;
- /* Handle VLD2. */
- else if (b_bits == 0x03 || (b_bits & 0x0e) == 0x08)
- thumb2_insn_r->reg_rec_count = 2;
- /* Handle VLD3. */
- else if ((b_bits & 0x0e) == 0x04)
- thumb2_insn_r->reg_rec_count = 3;
- /* Handle VLD4. */
- else if (!(b_bits & 0x0e))
- thumb2_insn_r->reg_rec_count = 4;
- }
+ {
+ /* Handle VLD1. */
+ if (b_bits == 0x02 || b_bits == 0x0a || (b_bits & 0x0e) == 0x06)
+ thumb2_insn_r->reg_rec_count = 1;
+ /* Handle VLD2. */
+ else if (b_bits == 0x03 || (b_bits & 0x0e) == 0x08)
+ thumb2_insn_r->reg_rec_count = 2;
+ /* Handle VLD3. */
+ else if ((b_bits & 0x0e) == 0x04)
+ thumb2_insn_r->reg_rec_count = 3;
+ /* Handle VLD4. */
+ else if (!(b_bits & 0x0e))
+ thumb2_insn_r->reg_rec_count = 4;
+ }
else
- {
- /* Handle VLD1. */
- if (!(b_bits & 0x0b) || b_bits == 0x08 || b_bits == 0x0c)
- thumb2_insn_r->reg_rec_count = 1;
- /* Handle VLD2. */
- else if ((b_bits & 0x0b) == 0x01 || b_bits == 0x09 || b_bits == 0x0d)
- thumb2_insn_r->reg_rec_count = 2;
- /* Handle VLD3. */
- else if ((b_bits & 0x0b) == 0x02 || b_bits == 0x0a || b_bits == 0x0e)
- thumb2_insn_r->reg_rec_count = 3;
- /* Handle VLD4. */
- else if ((b_bits & 0x0b) == 0x03 || b_bits == 0x0b || b_bits == 0x0f)
- thumb2_insn_r->reg_rec_count = 4;
-
- for (index_r = 0; index_r < thumb2_insn_r->reg_rec_count; index_r++)
- record_buf[index_r] = reg_vd + ARM_D0_REGNUM + index_r;
- }
+ {
+ /* Handle VLD1. */
+ if (!(b_bits & 0x0b) || b_bits == 0x08 || b_bits == 0x0c)
+ thumb2_insn_r->reg_rec_count = 1;
+ /* Handle VLD2. */
+ else if ((b_bits & 0x0b) == 0x01 || b_bits == 0x09 || b_bits == 0x0d)
+ thumb2_insn_r->reg_rec_count = 2;
+ /* Handle VLD3. */
+ else if ((b_bits & 0x0b) == 0x02 || b_bits == 0x0a || b_bits == 0x0e)
+ thumb2_insn_r->reg_rec_count = 3;
+ /* Handle VLD4. */
+ else if ((b_bits & 0x0b) == 0x03 || b_bits == 0x0b || b_bits == 0x0f)
+ thumb2_insn_r->reg_rec_count = 4;
+
+ for (index_r = 0; index_r < thumb2_insn_r->reg_rec_count; index_r++)
+ record_buf[index_r] = reg_vd + ARM_D0_REGNUM + index_r;
+ }
}
if (bits (thumb2_insn_r->arm_insn, 0, 3) != 15)
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return 0;
}
if (op1 == 0x01)
{
if (!(op2 & 0x64 ))
- {
- /* Load/store multiple instruction. */
- return thumb2_record_ld_st_multiple (thumb2_insn_r);
- }
+ {
+ /* Load/store multiple instruction. */
+ return thumb2_record_ld_st_multiple (thumb2_insn_r);
+ }
else if ((op2 & 0x64) == 0x4)
- {
- /* Load/store (dual/exclusive) and table branch instruction. */
- return thumb2_record_ld_st_dual_ex_tbb (thumb2_insn_r);
- }
+ {
+ /* Load/store (dual/exclusive) and table branch instruction. */
+ return thumb2_record_ld_st_dual_ex_tbb (thumb2_insn_r);
+ }
else if ((op2 & 0x60) == 0x20)
- {
- /* Data-processing (shifted register). */
- return thumb2_record_data_proc_sreg_mimm (thumb2_insn_r);
- }
+ {
+ /* Data-processing (shifted register). */
+ return thumb2_record_data_proc_sreg_mimm (thumb2_insn_r);
+ }
else if (op2 & 0x40)
- {
- /* Co-processor instructions. */
- return thumb2_record_coproc_insn (thumb2_insn_r);
- }
+ {
+ /* Co-processor instructions. */
+ return thumb2_record_coproc_insn (thumb2_insn_r);
+ }
}
else if (op1 == 0x02)
{
if (op)
- {
- /* Branches and miscellaneous control instructions. */
- return thumb2_record_branch_misc_cntrl (thumb2_insn_r);
- }
+ {
+ /* Branches and miscellaneous control instructions. */
+ return thumb2_record_branch_misc_cntrl (thumb2_insn_r);
+ }
else if (op2 & 0x20)
- {
- /* Data-processing (plain binary immediate) instruction. */
- return thumb2_record_ps_dest_generic (thumb2_insn_r);
- }
+ {
+ /* Data-processing (plain binary immediate) instruction. */
+ return thumb2_record_ps_dest_generic (thumb2_insn_r);
+ }
else
- {
- /* Data-processing (modified immediate). */
- return thumb2_record_data_proc_sreg_mimm (thumb2_insn_r);
- }
+ {
+ /* Data-processing (modified immediate). */
+ return thumb2_record_data_proc_sreg_mimm (thumb2_insn_r);
+ }
}
else if (op1 == 0x03)
{
if (!(op2 & 0x71 ))
- {
- /* Store single data item. */
- return thumb2_record_str_single_data (thumb2_insn_r);
- }
+ {
+ /* Store single data item. */
+ return thumb2_record_str_single_data (thumb2_insn_r);
+ }
else if (!((op2 & 0x71) ^ 0x10))
- {
- /* Advanced SIMD or structure load/store instructions. */
- return thumb2_record_asimd_struct_ld_st (thumb2_insn_r);
- }
+ {
+ /* Advanced SIMD or structure load/store instructions. */
+ return thumb2_record_asimd_struct_ld_st (thumb2_insn_r);
+ }
else if (!((op2 & 0x67) ^ 0x01))
- {
- /* Load byte, memory hints instruction. */
- return thumb2_record_ld_mem_hints (thumb2_insn_r);
- }
+ {
+ /* Load byte, memory hints instruction. */
+ return thumb2_record_ld_mem_hints (thumb2_insn_r);
+ }
else if (!((op2 & 0x67) ^ 0x03))
- {
- /* Load halfword, memory hints instruction. */
- return thumb2_record_ld_mem_hints (thumb2_insn_r);
- }
+ {
+ /* Load halfword, memory hints instruction. */
+ return thumb2_record_ld_mem_hints (thumb2_insn_r);
+ }
else if (!((op2 & 0x67) ^ 0x05))
- {
- /* Load word instruction. */
- return thumb2_record_ld_word (thumb2_insn_r);
- }
+ {
+ /* Load word instruction. */
+ return thumb2_record_ld_word (thumb2_insn_r);
+ }
else if (!((op2 & 0x70) ^ 0x20))
- {
- /* Data-processing (register) instruction. */
- return thumb2_record_ps_dest_generic (thumb2_insn_r);
- }
+ {
+ /* Data-processing (register) instruction. */
+ return thumb2_record_ps_dest_generic (thumb2_insn_r);
+ }
else if (!((op2 & 0x78) ^ 0x30))
- {
- /* Multiply, multiply accumulate, abs diff instruction. */
- return thumb2_record_ps_dest_generic (thumb2_insn_r);
- }
+ {
+ /* Multiply, multiply accumulate, abs diff instruction. */
+ return thumb2_record_ps_dest_generic (thumb2_insn_r);
+ }
else if (!((op2 & 0x78) ^ 0x38))
- {
- /* Long multiply, long multiply accumulate, and divide. */
- return thumb2_record_lmul_lmla_div (thumb2_insn_r);
- }
+ {
+ /* Long multiply, long multiply accumulate, and divide. */
+ return thumb2_record_lmul_lmla_div (thumb2_insn_r);
+ }
else if (op2 & 0x40)
- {
- /* Co-processor instructions. */
- return thumb2_record_coproc_insn (thumb2_insn_r);
- }
+ {
+ /* Co-processor instructions. */
+ return thumb2_record_coproc_insn (thumb2_insn_r);
+ }
}
return -1;
if (!reader.read (insn_record->this_addr, buf, insn_size))
return 1;
insn_record->arm_insn = (uint32_t) extract_unsigned_integer (&buf[0],
- insn_size,
+ insn_size,
gdbarch_byte_order_for_code (insn_record->gdbarch));
return 0;
}
struct
{
/* If non-NULL, override generic SVC handling (e.g. for a particular
- OS). */
+ OS). */
int (*copy_svc_os) (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_closure *dsc);
} svc;
extern int arm_pc_is_thumb (struct gdbarch *, CORE_ADDR);
extern int arm_process_record (struct gdbarch *gdbarch,
- struct regcache *regcache, CORE_ADDR addr);
+ struct regcache *regcache, CORE_ADDR addr);
/* Functions exported from arm-bsd-tdep.h. */
/* Return the appropriate register set for the core section identified
_initialize_arm_wince_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_coff_flavour,
- arm_wince_osabi_sniffer);
+ arm_wince_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_WINCE,
- arm_wince_init_abi);
+ arm_wince_init_abi);
}
for (;;)
{
/* Trim trailing slashes ("/"). PATTERN also has slashes trimmed the
- same way so they will match. */
+ same way so they will match. */
while (filename_len && IS_DIR_SEPARATOR (filename[filename_len - 1]))
filename_len--;
filename[filename_len] = '\0';
len -= block;
/* Check terminal AT_NULL. This function is being called
- indefinitely being extended its READBUF until it returns EOF
- (0). */
+ indefinitely being extended its READBUF until it returns EOF
+ (0). */
while (block >= auxv_pair_size)
{
avr_write_pc (struct regcache *regcache, CORE_ADDR val)
{
regcache_cooked_write_unsigned (regcache, AVR_PC_REGNUM,
- avr_convert_iaddr_to_raw (val));
+ avr_convert_iaddr_to_raw (val));
}
static enum register_status
avr_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+ int regnum, gdb_byte *buf)
{
ULONGEST val;
enum register_status status;
static void
avr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
- int regnum, const gdb_byte *buf)
+ int regnum, const gdb_byte *buf)
{
ULONGEST val;
This information is stored in the avr_unwind_cache structure.
Some devices lack the sbiw instruction, so on those replace this:
- sbiw r28, XX
+ sbiw r28, XX
with this:
- subi r28,lo8(XX)
- sbci r29,hi8(XX)
+ subi r28,lo8(XX)
+ sbci r29,hi8(XX)
A typical AVR function prologue with a frame pointer might look like this:
- push rXX ; saved regs
- ...
- push r28
- push r29
- in r28,__SP_L__
- in r29,__SP_H__
- sbiw r28,<LOCALS_SIZE>
- in __tmp_reg__,__SREG__
- cli
- out __SP_H__,r29
- out __SREG__,__tmp_reg__
- out __SP_L__,r28
+ push rXX ; saved regs
+ ...
+ push r28
+ push r29
+ in r28,__SP_L__
+ in r29,__SP_H__
+ sbiw r28,<LOCALS_SIZE>
+ in __tmp_reg__,__SREG__
+ cli
+ out __SP_H__,r29
+ out __SREG__,__tmp_reg__
+ out __SP_L__,r28
A typical AVR function prologue without a frame pointer might look like
this:
- push rXX ; saved regs
- ...
+ push rXX ; saved regs
+ ...
A main function prologue looks like this:
- ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>)
- ldi r29,hi8(<RAM_ADDR> - <LOCALS_SIZE>)
- out __SP_H__,r29
- out __SP_L__,r28
+ ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>)
+ ldi r29,hi8(<RAM_ADDR> - <LOCALS_SIZE>)
+ out __SP_H__,r29
+ out __SP_L__,r28
A signal handler prologue looks like this:
- push __zero_reg__
- push __tmp_reg__
- in __tmp_reg__, __SREG__
- push __tmp_reg__
- clr __zero_reg__
- push rXX ; save registers r18:r27, r30:r31
- ...
- push r28 ; save frame pointer
- push r29
- in r28, __SP_L__
- in r29, __SP_H__
- sbiw r28, <LOCALS_SIZE>
- out __SP_H__, r29
- out __SP_L__, r28
-
+ push __zero_reg__
+ push __tmp_reg__
+ in __tmp_reg__, __SREG__
+ push __tmp_reg__
+ clr __zero_reg__
+ push rXX ; save registers r18:r27, r30:r31
+ ...
+ push r28 ; save frame pointer
+ push r29
+ in r28, __SP_L__
+ in r29, __SP_H__
+ sbiw r28, <LOCALS_SIZE>
+ out __SP_H__, r29
+ out __SP_L__, r28
+
A interrupt handler prologue looks like this:
- sei
- push __zero_reg__
- push __tmp_reg__
- in __tmp_reg__, __SREG__
- push __tmp_reg__
- clr __zero_reg__
- push rXX ; save registers r18:r27, r30:r31
- ...
- push r28 ; save frame pointer
- push r29
- in r28, __SP_L__
- in r29, __SP_H__
- sbiw r28, <LOCALS_SIZE>
- cli
- out __SP_H__, r29
- sei
- out __SP_L__, r28
+ sei
+ push __zero_reg__
+ push __tmp_reg__
+ in __tmp_reg__, __SREG__
+ push __tmp_reg__
+ clr __zero_reg__
+ push rXX ; save registers r18:r27, r30:r31
+ ...
+ push r28 ; save frame pointer
+ push r29
+ in r28, __SP_L__
+ in r29, __SP_H__
+ sbiw r28, <LOCALS_SIZE>
+ cli
+ out __SP_H__, r29
+ sei
+ out __SP_L__, r28
A `-mcall-prologues' prologue looks like this (Note that the megas use a
jmp instead of a rjmp, thus the prologue is one word larger since jmp is a
32 bit insn and rjmp is a 16 bit insn):
- ldi r26,lo8(<LOCALS_SIZE>)
- ldi r27,hi8(<LOCALS_SIZE>)
- ldi r30,pm_lo8(.L_foo_body)
- ldi r31,pm_hi8(.L_foo_body)
- rjmp __prologue_saves__+RRR
- .L_foo_body: */
+ ldi r26,lo8(<LOCALS_SIZE>)
+ ldi r27,hi8(<LOCALS_SIZE>)
+ ldi r30,pm_lo8(.L_foo_body)
+ ldi r31,pm_hi8(.L_foo_body)
+ rjmp __prologue_saves__+RRR
+ .L_foo_body: */
/* Not really part of a prologue, but still need to scan for it, is when a
function prologue moves values passed via registers as arguments to new
registers. In this case, all local variables live in registers, so there
may be some register saves. This is what it looks like:
- movw rMM, rNN
- ...
+ movw rMM, rNN
+ ...
There could be multiple movw's. If the target doesn't have a movw insn, it
will use two mov insns. This could be done after any of the above prologue
if (vpc + 4 + sizeof (img) < len
&& memcmp (prologue + vpc + 4, img, sizeof (img)) == 0)
{
- info->prologue_type = AVR_PROLOGUE_MAIN;
- info->base = locals;
- return pc_beg + 4;
+ info->prologue_type = AVR_PROLOGUE_MAIN;
+ info->base = locals;
+ return pc_beg + 4;
}
}
}
insn = extract_unsigned_integer (&prologue[vpc + 8], 2, byte_order);
/* rjmp __prologue_saves__+RRR */
if ((insn & 0xf000) == 0xc000)
- {
- /* Extract PC relative offset from RJMP */
- i = (insn & 0xfff) | (insn & 0x800 ? (-1 ^ 0xfff) : 0);
- /* Convert offset to byte addressable mode */
- i *= 2;
- /* Destination address */
- i += pc_beg + 10;
-
- if (body_addr != (pc_beg + 10)/2)
- break;
-
- pc_offset += 2;
- }
+ {
+ /* Extract PC relative offset from RJMP */
+ i = (insn & 0xfff) | (insn & 0x800 ? (-1 ^ 0xfff) : 0);
+ /* Convert offset to byte addressable mode */
+ i *= 2;
+ /* Destination address */
+ i += pc_beg + 10;
+
+ if (body_addr != (pc_beg + 10)/2)
+ break;
+
+ pc_offset += 2;
+ }
else if ((insn & 0xfe0e) == 0x940c)
- {
- /* Extract absolute PC address from JMP */
- i = (((insn & 0x1) | ((insn & 0x1f0) >> 3) << 16)
+ {
+ /* Extract absolute PC address from JMP */
+ i = (((insn & 0x1) | ((insn & 0x1f0) >> 3) << 16)
| (extract_unsigned_integer (&prologue[vpc + 10], 2, byte_order)
& 0xffff));
- /* Convert address to byte addressable mode */
- i *= 2;
+ /* Convert address to byte addressable mode */
+ i *= 2;
- if (body_addr != (pc_beg + 12)/2)
- break;
+ if (body_addr != (pc_beg + 12)/2)
+ break;
- pc_offset += 4;
- }
+ pc_offset += 4;
+ }
else
- break;
+ break;
/* Resolve offset (in words) from __prologue_saves__ symbol.
- Which is a pushes count in `-mcall-prologues' mode */
+ Which is a pushes count in `-mcall-prologues' mode */
num_pushes = AVR_MAX_PUSHES - (i - BMSYMBOL_VALUE_ADDRESS (msymbol)) / 2;
if (num_pushes > AVR_MAX_PUSHES)
- {
- fprintf_unfiltered (gdb_stderr, _("Num pushes too large: %d\n"),
- num_pushes);
- num_pushes = 0;
- }
+ {
+ fprintf_unfiltered (gdb_stderr, _("Num pushes too large: %d\n"),
+ num_pushes);
+ num_pushes = 0;
+ }
if (num_pushes)
{
if (len >= sizeof (img)
&& memcmp (prologue, img, sizeof (img)) == 0)
{
- info->prologue_type = AVR_PROLOGUE_INTR;
+ info->prologue_type = AVR_PROLOGUE_INTR;
vpc += sizeof (img);
- info->saved_regs[AVR_SREG_REGNUM].addr = 3;
- info->saved_regs[0].addr = 2;
- info->saved_regs[1].addr = 1;
- info->size += 3;
+ info->saved_regs[AVR_SREG_REGNUM].addr = 3;
+ info->saved_regs[0].addr = 2;
+ info->saved_regs[1].addr = 1;
+ info->size += 3;
}
else if (len >= sizeof (img) - 2
&& memcmp (img + 2, prologue, sizeof (img) - 2) == 0)
{
- info->prologue_type = AVR_PROLOGUE_SIG;
- vpc += sizeof (img) - 2;
- info->saved_regs[AVR_SREG_REGNUM].addr = 3;
- info->saved_regs[0].addr = 2;
- info->saved_regs[1].addr = 1;
- info->size += 2;
+ info->prologue_type = AVR_PROLOGUE_SIG;
+ vpc += sizeof (img) - 2;
+ info->saved_regs[AVR_SREG_REGNUM].addr = 3;
+ info->saved_regs[0].addr = 2;
+ info->saved_regs[1].addr = 1;
+ info->size += 2;
}
}
{
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
if (insn == 0xd000) /* rcall .+0 */
- {
- info->size += gdbarch_tdep (gdbarch)->call_length;
- vpc += 2;
- }
+ {
+ info->size += gdbarch_tdep (gdbarch)->call_length;
+ vpc += 2;
+ }
else if (insn == 0x920f || insn == 0x921f) /* push r0 or push r1 */
- {
- info->size += 1;
- vpc += 2;
- }
+ {
+ info->size += 1;
+ vpc += 2;
+ }
else
- break;
+ break;
}
/* Second stage of the prologue scanning.
/* Third stage of the prologue scanning. (Really two stages).
Scan for:
sbiw r28,XX or subi r28,lo8(XX)
- sbci r29,hi8(XX)
+ sbci r29,hi8(XX)
in __tmp_reg__,__SREG__
cli
out __SP_H__,r29
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
if ((insn & 0xff30) == 0x9720) /* sbiw r28,XXX */
- {
- locals_size = (insn & 0xf) | ((insn & 0xc0) >> 2);
- vpc += 2;
- }
+ {
+ locals_size = (insn & 0xf) | ((insn & 0xc0) >> 2);
+ vpc += 2;
+ }
else if ((insn & 0xf0f0) == 0x50c0) /* subi r28,lo8(XX) */
{
locals_size = (insn & 0xf) | ((insn & 0xf00) >> 4);
locals_size += ((insn & 0xf) | ((insn & 0xf00) >> 4)) << 8;
}
else
- return pc_beg + vpc;
+ return pc_beg + vpc;
/* Scan the last part of the prologue. May not be present for interrupt
- or signal handler functions, which is why we set the prologue type
- when we saw the beginning of the prologue previously. */
+ or signal handler functions, which is why we set the prologue type
+ when we saw the beginning of the prologue previously. */
if (vpc + sizeof (img_sig) < len
&& memcmp (prologue + vpc, img_sig, sizeof (img_sig)) == 0)
- {
- vpc += sizeof (img_sig);
- }
+ {
+ vpc += sizeof (img_sig);
+ }
else if (vpc + sizeof (img_int) < len
&& memcmp (prologue + vpc, img_int, sizeof (img_int)) == 0)
- {
- vpc += sizeof (img_int);
- }
+ {
+ vpc += sizeof (img_int);
+ }
if (vpc + sizeof (img) < len
&& memcmp (prologue + vpc, img, sizeof (img)) == 0)
- {
- info->prologue_type = AVR_PROLOGUE_NORMAL;
- vpc += sizeof (img);
- }
+ {
+ info->prologue_type = AVR_PROLOGUE_NORMAL;
+ vpc += sizeof (img);
+ }
info->size += locals_size;
{
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
if ((insn & 0xff00) == 0x0100) /* movw rXX, rYY */
- continue;
+ continue;
else if ((insn & 0xfc00) == 0x2c00) /* mov rXX, rYY */
- continue;
+ continue;
else
- break;
+ break;
}
return pc_beg + vpc;
static struct avr_unwind_cache *
avr_frame_unwind_cache (struct frame_info *this_frame,
- void **this_prologue_cache)
+ void **this_prologue_cache)
{
CORE_ADDR start_pc, current_pc;
ULONGEST prev_sp;
ULONGEST high_base; /* High byte of FP */
/* The SP was moved to the FP. This indicates that a new frame
- was created. Get THIS frame's FP value by unwinding it from
- the next frame. */
+ was created. Get THIS frame's FP value by unwinding it from
+ the next frame. */
this_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM);
high_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM + 1);
this_base += (high_base << 8);
/* The FP points at the last saved register. Adjust the FP back
- to before the first saved register giving the SP. */
+ to before the first saved register giving the SP. */
prev_sp = this_base + info->size;
}
else
{
/* Assume that the FP is this frame's SP but with that pushed
- stack space added back. */
+ stack space added back. */
this_base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM);
prev_sp = this_base + info->size;
}
value. */
tdep = gdbarch_tdep (gdbarch);
trad_frame_set_value (info->saved_regs, AVR_SP_REGNUM,
- info->prev_sp - 1 + tdep->call_length);
+ info->prev_sp - 1 + tdep->call_length);
return info;
}
static void
avr_frame_this_id (struct frame_info *this_frame,
- void **this_prologue_cache,
- struct frame_id *this_id)
+ void **this_prologue_cache,
+ struct frame_id *this_id)
{
struct avr_unwind_cache *info
= avr_frame_unwind_cache (this_frame, this_prologue_cache);
if (regnum == AVR_PC_REGNUM || regnum == AVR_PSEUDO_PC_REGNUM)
{
if (trad_frame_addr_p (info->saved_regs, AVR_PC_REGNUM))
- {
+ {
/* Reading the return PC from the PC register is slightly
abnormal. register_size(AVR_PC_REGNUM) says it is 4 bytes,
but in reality, only two bytes (3 in upcoming mega256) are
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
read_memory (info->saved_regs[AVR_PC_REGNUM].addr,
- buf, tdep->call_length);
+ buf, tdep->call_length);
/* Extract the PC read from memory as a big-endian. */
pc = 0;
for (i = 0; i < tdep->call_length; i++)
pc = (pc << 8) | buf[i];
- if (regnum == AVR_PC_REGNUM)
- pc <<= 1;
+ if (regnum == AVR_PC_REGNUM)
+ pc <<= 1;
return frame_unwind_got_constant (this_frame, regnum, pc);
- }
+ }
return frame_unwind_got_optimized (this_frame, regnum);
}
static CORE_ADDR
avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
if (return_method == return_method_struct)
{
regcache_cooked_write_unsigned
- (regcache, regnum--, (struct_addr >> 8) & 0xff);
+ (regcache, regnum--, (struct_addr >> 8) & 0xff);
regcache_cooked_write_unsigned
- (regcache, regnum--, struct_addr & 0xff);
+ (regcache, regnum--, struct_addr & 0xff);
/* SP being post decremented, we need to reserve one byte so that the
- return address won't overwrite the result (or vice-versa). */
+ return address won't overwrite the result (or vice-versa). */
if (sp == struct_addr)
- sp--;
+ sp--;
}
for (i = 0; i < nargs; i++)
int len = TYPE_LENGTH (type);
/* Calculate the potential last register needed.
- E.g. For length 2, registers regnum and regnum-1 (say 25 and 24)
- shall be used. So, last needed register will be regnum-1(24). */
+ E.g. For length 2, registers regnum and regnum-1 (say 25 and 24)
+ shall be used. So, last needed register will be regnum-1(24). */
last_regnum = regnum - (len + (len & 1)) + 1;
/* If there are registers available, use them. Once we start putting
- stuff on the stack, all subsequent args go on stack. */
+ stuff on the stack, all subsequent args go on stack. */
if ((si == NULL) && (last_regnum >= AVR_LAST_ARG_REGNUM))
- {
- /* Skip a register for odd length args. */
- if (len & 1)
- regnum--;
-
- /* Write MSB of argument into register and subsequent bytes in
- decreasing register numbers. */
- for (j = 0; j < len; j++)
- regcache_cooked_write_unsigned
- (regcache, regnum--, contents[len - j - 1]);
- }
+ {
+ /* Skip a register for odd length args. */
+ if (len & 1)
+ regnum--;
+
+ /* Write MSB of argument into register and subsequent bytes in
+ decreasing register numbers. */
+ for (j = 0; j < len; j++)
+ regcache_cooked_write_unsigned
+ (regcache, regnum--, contents[len - j - 1]);
+ }
/* No registers available, push the args onto the stack. */
else
- {
- /* From here on, we don't care about regnum. */
- si = push_stack_item (si, contents, len);
- }
+ {
+ /* From here on, we don't care about regnum. */
+ si = push_stack_item (si, contents, len);
+ }
}
/* Push args onto the stack. */
/* how many registers this round? */
int j = step;
if ((i+j) >= nreg)
- j = nreg - i; /* last block is less than 8 registers */
+ j = nreg - i; /* last block is less than 8 registers */
snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j);
buf = target_read_alloc (current_top_target (), TARGET_OBJECT_AVR, query);
if (!buf)
- {
- fprintf_unfiltered (gdb_stderr,
+ {
+ fprintf_unfiltered (gdb_stderr,
_("ERR: error reading avr.io_reg:%x,%x\n"),
i, j);
- return;
- }
+ return;
+ }
const char *p = (const char *) buf->data ();
for (int k = i; k < (i + j); k++)
{
case axs_lvalue_memory:
{
- /* Initialize the TYPE_LENGTH if it is a typedef. */
- check_typedef (value.type);
+ /* Initialize the TYPE_LENGTH if it is a typedef. */
+ check_typedef (value.type);
ax_const_l (ax, TYPE_LENGTH (value.type));
ax_simple (ax, aop_trace);
}
else
{
/* There's no point in trying to use a trace_quick bytecode
- here, since "trace_quick SIZE pop" is three bytes, whereas
- "const8 SIZE trace" is also three bytes, does the same
- thing, and the simplest code which generates that will also
- work correctly for objects with large sizes. */
+ here, since "trace_quick SIZE pop" is three bytes, whereas
+ "const8 SIZE trace" is also three bytes, does the same
+ thing, and the simplest code which generates that will also
+ work correctly for objects with large sizes. */
ax_const_l (ax, TYPE_LENGTH (value->type));
ax_simple (ax, aop_trace);
}
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
/* It's a scalar value, so we know how to dereference it. How
- many bytes long is it? */
+ many bytes long is it? */
switch (TYPE_LENGTH (type))
{
case 8 / TARGET_CHAR_BIT:
case LOC_REGISTER:
/* Don't generate any code at all; in the process of treating
- this as an lvalue or rvalue, the caller will generate the
- right code. */
+ this as an lvalue or rvalue, the caller will generate the
+ right code. */
value->kind = axs_lvalue_register;
value->u.reg
= SYMBOL_REGISTER_OPS (var)->register_number (var, ax->gdbarch);
break;
/* A lot like LOC_REF_ARG, but the pointer lives directly in a
- register, not on the stack. Simpler than LOC_REGISTER
- because it's just like any other case where the thing
+ register, not on the stack. Simpler than LOC_REGISTER
+ because it's just like any other case where the thing
has a real address. */
case LOC_REGPARM_ADDR:
ax_reg (ax,
case axs_lvalue_register:
/* There's nothing on the stack, but value->u.reg is the
- register number containing the value.
+ register number containing the value.
- When we add floating-point support, this is going to have to
- change. What about SPARC register pairs, for example? */
+ When we add floating-point support, this is going to have to
+ change. What about SPARC register pairs, for example? */
ax_reg (ax, value->u.reg);
gen_extend (ax, value->type);
break;
break;
/* Arrays get converted to a pointer to their first element, and
- are no longer an lvalue. */
+ are no longer an lvalue. */
case TYPE_CODE_ARRAY:
{
struct type *elements = TYPE_TARGET_TYPE (value->type);
break;
/* Don't try to convert structures and unions to rvalues. Let the
- consumer signal an error. */
+ consumer signal an error. */
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
return;
&& value2->type->code () == TYPE_CODE_INT)
{
/* The ANSI integral promotions seem to work this way: Order the
- integer types by size, and then by signedness: an n-bit
- unsigned type is considered "wider" than an n-bit signed
- type. Promote to the "wider" of the two types, and always
- promote at least to int. */
+ integer types by size, and then by signedness: an n-bit
+ unsigned type is considered "wider" than an n-bit signed
+ type. Promote to the "wider" of the two types, and always
+ promote at least to int. */
struct type *target = max_type (builtin_type (ax->gdbarch)->builtin_int,
max_type (value1->type, value2->type));
gen_conversion (ax, value2->type, target);
/* Deal with value1, not on the top of the stack. Don't
- generate the `swap' instructions if we're not actually going
- to do anything. */
+ generate the `swap' instructions if we're not actually going
+ to do anything. */
if (is_nontrivial_conversion (value1->type, target))
{
ax_simple (ax, aop_swap);
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
/* It's implementation-defined, and I'll bet this is what GCC
- does. */
+ does. */
break;
case TYPE_CODE_ARRAY:
case TYPE_CODE_ENUM:
case TYPE_CODE_BOOL:
/* We don't have to worry about the size of the value, because
- all our integral values are fully sign-extended, and when
- casting pointers we can do anything we like. Is there any
- way for us to know what GCC actually does with a cast like
- this? */
+ all our integral values are fully sign-extended, and when
+ casting pointers we can do anything we like. Is there any
+ way for us to know what GCC actually does with a cast like
+ this? */
break;
case TYPE_CODE_INT:
case TYPE_CODE_VOID:
/* We could pop the value, and rely on everyone else to check
- the type and notice that this value doesn't occupy a stack
- slot. But for now, leave the value on the stack, and
- preserve the "value == stack element" assumption. */
+ the type and notice that this value doesn't occupy a stack
+ slot. But for now, leave the value on the stack, and
+ preserve the "value == stack element" assumption. */
break;
default:
int op_size = 8 << op;
/* The stack at this point, from bottom to top, contains zero or
- more fragments, then the address. */
+ more fragments, then the address. */
/* Does this fetch fit within the bitfield? */
if (offset + op_size <= bound_end)
all we need to do is frob the type of the lvalue. */
{
/* FIXME-type-allocation: need a way to free this type when we are
- done with it. */
+ done with it. */
struct type *array
= lookup_array_range_type (value1.type, 0, length - 1);
break;
/* Note that we need to be a little subtle about generating code
- for comma. In C, we can do some optimizations here because
- we know the left operand is only being evaluated for effect.
- However, if the tracing kludge is in effect, then we always
- need to evaluate the left hand side fully, so that all the
- variables it mentions get traced. */
+ for comma. In C, we can do some optimizations here because
+ we know the left operand is only being evaluated for effect.
+ However, if the tracing kludge is in effect, then we always
+ need to evaluate the left hand side fully, so that all the
+ variables it mentions get traced. */
case BINOP_COMMA:
(*pc)++;
gen_expr (exp, pc, ax, &value1);
/* Don't just dispose of the left operand. We might be tracing,
- in which case we want to emit code to trace it if it's an
- lvalue. */
+ in which case we want to emit code to trace it if it's an
+ lvalue. */
gen_traced_pop (ax, &value1);
gen_expr (exp, pc, ax, value);
/* It's the consumer's responsibility to trace the right operand. */
case UNOP_SIZEOF:
(*pc)++;
/* Notice that gen_sizeof handles its own operand, unlike most
- of the other unary operator functions. This is because we
- have to throw away the code we generate. */
+ of the other unary operator functions. This is because we
+ have to throw away the code we generate. */
gen_sizeof (exp, pc, ax, value,
builtin_type (ax->gdbarch)->builtin_int);
break;
if (!eval)
{
if (*exp == '/')
- exp = decode_agent_options (exp, &trace_string);
+ exp = decode_agent_options (exp, &trace_string);
}
agent_expr_up agent;
NULL, NULL);
exp = skip_spaces (exp);
if (exp[0] == ',')
- {
+ {
exp++;
exp = skip_spaces (exp);
}
LONGEST lim = ((LONGEST) 1) << (size - 1);
if (-lim <= l && l <= lim - 1)
- break;
+ break;
}
/* Emit the right opcode... */
/* Make sure the register number is in range. */
if (reg < 0 || reg > 0xffff)
- error (_("GDB bug: ax-general.c (ax_reg): "
+ error (_("GDB bug: ax-general.c (ax_reg): "
"register number out of range"));
grow_expr (x, 3);
x->buf[x->len] = aop_reg;
/* Grow the bit mask if necessary. */
if (byte >= ax->reg_mask_len)
- {
- /* It's not appropriate to double here. This isn't a
+ {
+ /* It's not appropriate to double here. This isn't a
string buffer. */
- int new_len = byte + 1;
- unsigned char *new_reg_mask
+ int new_len = byte + 1;
+ unsigned char *new_reg_mask
= XRESIZEVEC (unsigned char, ax->reg_mask, new_len);
- memset (new_reg_mask + ax->reg_mask_len, 0,
- (new_len - ax->reg_mask_len) * sizeof (ax->reg_mask[0]));
- ax->reg_mask_len = new_len;
- ax->reg_mask = new_reg_mask;
- }
+ memset (new_reg_mask + ax->reg_mask_len, 0,
+ (new_len - ax->reg_mask_len) * sizeof (ax->reg_mask[0]));
+ ax->reg_mask_len = new_len;
+ ax->reg_mask = new_reg_mask;
+ }
ax->reg_mask[byte] |= 1 << (reg % 8);
}
}
/* If this instruction is a forward jump target, does the
- current stack height match the stack height at the jump
- source? */
+ current stack height match the stack height at the jump
+ source? */
if (targets[i] && (heights[i] != height))
{
ax->flaw = agent_flaw_height_mismatch;
ax->max_data_size = op->data_size;
/* For jump instructions, check that the target is a valid
- offset. If it is, record the fact that that location is a
- jump target, and record the height we expect there. */
+ offset. If it is, record the fact that that location is a
+ jump target, and record the height we expect there. */
if (aop_goto == op - aop_map
|| aop_if_goto == op - aop_map)
{
}
/* Do we have any information about what the stack height
- should be at the target? */
+ should be at the target? */
if (targets[target] || boundary[target])
{
if (heights[target] != height)
}
}
- /* Record the target, along with the stack height we expect. */
- targets[target] = 1;
- heights[target] = height;
+ /* Record the target, along with the stack height we expect. */
+ targets[target] = 1;
+ heights[target] = height;
}
/* For unconditional jumps with a successor, check that the
- successor is a target, and pick up its stack height. */
+ successor is a target, and pick up its stack height. */
if (aop_goto == op - aop_map
&& i + 3 < ax->len)
{
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, "syscalls/bfin-linux.xml");
set_gdbarch_get_syscall_number (gdbarch,
- bfin_linux_get_syscall_number);
+ bfin_linux_get_syscall_number);
}
void _initialize_bfin_linux_tdep ();
_initialize_bfin_linux_tdep ()
{
gdbarch_register_osabi (bfd_arch_bfin, 0, GDB_OSABI_LINUX,
- bfin_linux_init_abi);
+ bfin_linux_init_abi);
}
if (a == b)
return true;
/* If A is a function block, then A cannot be contained in B,
- except if A was inlined. */
+ except if A was inlined. */
if (!allow_nested && BLOCK_FUNCTION (a) != NULL && !block_inlined_p (a))
- return false;
+ return false;
a = BLOCK_SUPERBLOCK (a);
}
while (a != NULL);
struct blockranges *
make_blockranges (struct objfile *objfile,
- const std::vector<blockrange> &rangevec)
+ const std::vector<blockrange> &rangevec)
{
struct blockranges *blr;
size_t n = rangevec.size();
blr = (struct blockranges *)
obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct blockranges)
+ sizeof (struct blockranges)
+ (n - 1) * sizeof (struct blockrange));
blr->nranges = n;
struct symbol *with_opaque = NULL;
struct symbol *sym
= block_find_symbol (block, name, domain,
- block_find_non_opaque_type_preferred, &with_opaque);
+ block_find_non_opaque_type_preferred, &with_opaque);
At this point if SYM is non-NULL then a non-opaque type has been found.
Otherwise, if WITH_OPAQUE is non-NULL then an opaque type has been found.
/* Given a vector of pairs, allocate and build an obstack allocated
blockranges struct for a block. */
struct blockranges *make_blockranges (struct objfile *objfile,
- const std::vector<blockrange> &rangevec);
+ const std::vector<blockrange> &rangevec);
#endif /* BLOCK_H */
{
int i;
for (i = 0; i < BLOCK_NRANGES (b); i++)
- {
+ {
if (BLOCK_RANGE_START (b, i) <= mapped_pc
&& mapped_pc < BLOCK_RANGE_END (b, i))
{
CORE_ADDR entry_pc = BLOCK_ENTRY_PC (block);
for (int i = 0; i < BLOCK_NRANGES (block); i++)
- {
+ {
if (BLOCK_RANGE_START (block, i) <= entry_pc
&& entry_pc < BLOCK_RANGE_END (block, i))
{
if (address != nullptr)
- *address = BLOCK_RANGE_START (block, i);
+ *address = BLOCK_RANGE_START (block, i);
if (endaddr != nullptr)
- *endaddr = BLOCK_RANGE_END (block, i);
+ *endaddr = BLOCK_RANGE_END (block, i);
return status;
}
}
/* It's an internal error if we exit the above loop without finding
- the range. */
+ the range. */
internal_error (__FILE__, __LINE__,
- _("Entry block not found in find_function_entry_range_from_pc"));
+ _("Entry block not found in find_function_entry_range_from_pc"));
}
return status;
static void
show_bpf_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("Debugging of BPF is %s.\n"), value);
}
bool first = true;
for (gdb_signal iter : c->signals_to_be_caught)
- {
+ {
const char *name = signal_to_name_or_int (iter);
if (!first)
first = false;
text += name;
- }
+ }
uiout->field_string ("what", text.c_str ());
}
else
if (!c->signals_to_be_caught.empty ())
{
if (c->signals_to_be_caught.size () > 1)
- printf_filtered (_("Catchpoint %d (signals"), b->number);
+ printf_filtered (_("Catchpoint %d (signals"), b->number);
else
- printf_filtered (_("Catchpoint %d (signal"), b->number);
+ printf_filtered (_("Catchpoint %d (signal"), b->number);
for (gdb_signal iter : c->signals_to_be_caught)
- {
+ {
const char *name = signal_to_name_or_int (iter);
printf_filtered (" %s", name);
- }
+ }
printf_filtered (")");
}
else if (c->catch_all)
if (iter >= inf_data->syscalls_counts.size ())
/* Shouldn't happen. */
continue;
- --inf_data->syscalls_counts[iter];
- }
+ --inf_data->syscalls_counts[iter];
+ }
}
return target_set_syscall_catchpoint (inferior_ptid.pid (),
char *text = xstrprintf ("%s", "");
for (int iter : c->syscalls_to_be_caught)
- {
- char *previous_text = text;
- struct syscall s;
- get_syscall_by_number (gdbarch, iter, &s);
+ {
+ char *previous_text = text;
+ struct syscall s;
+ get_syscall_by_number (gdbarch, iter, &s);
- if (s.name != NULL)
- text = xstrprintf ("%s%s, ", text, s.name);
- else
- text = xstrprintf ("%s%d, ", text, iter);
+ if (s.name != NULL)
+ text = xstrprintf ("%s%s, ", text, s.name);
+ else
+ text = xstrprintf ("%s%d, ", text, iter);
- /* We have to xfree previous_text because xstrprintf dynamically
+ /* We have to xfree previous_text because xstrprintf dynamically
allocates new space for text on every call. */
xfree (previous_text);
- }
+ }
/* Remove the last comma. */
text[strlen (text) - 2] = '\0';
uiout->field_string ("what", text);
if (!c->syscalls_to_be_caught.empty ())
{
if (c->syscalls_to_be_caught.size () > 1)
- printf_filtered (_("Catchpoint %d (syscalls"), b->number);
+ printf_filtered (_("Catchpoint %d (syscalls"), b->number);
else
- printf_filtered (_("Catchpoint %d (syscall"), b->number);
+ printf_filtered (_("Catchpoint %d (syscall"), b->number);
for (int iter : c->syscalls_to_be_caught)
- {
- struct syscall s;
- get_syscall_by_number (gdbarch, iter, &s);
-
- if (s.name != NULL)
- printf_filtered (" '%s' [%d]", s.name, s.number);
- else
- printf_filtered (" %d", s.number);
- }
+ {
+ struct syscall s;
+ get_syscall_by_number (gdbarch, iter, &s);
+
+ if (s.name != NULL)
+ printf_filtered (" '%s' [%d]", s.name, s.number);
+ else
+ printf_filtered (" %d", s.number);
+ }
printf_filtered (")");
}
else
printf_filtered (_("Catchpoint %d (any syscall)"),
- b->number);
+ b->number);
}
/* Implement the "print_recreate" breakpoint_ops method for syscall
static void
create_syscall_event_catchpoint (int tempflag, std::vector<int> &&filter,
- const struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
struct gdbarch *gdbarch = get_current_arch ();
static void
catch_syscall_completer (struct cmd_list_element *cmd,
completion_tracker &tracker,
- const char *text, const char *word)
+ const char *text, const char *word)
{
struct gdbarch *gdbarch = get_current_arch ();
gdb::unique_xmalloc_ptr<const char *> group_list;
add_catch_command ("catch", _("\
Catch an exception, when caught."),
catch_catch_command,
- NULL,
+ NULL,
CATCH_PERMANENT,
CATCH_TEMPORARY);
add_catch_command ("throw", _("\
Catch an exception, when thrown."),
catch_throw_command,
- NULL,
+ NULL,
CATCH_PERMANENT,
CATCH_TEMPORARY);
add_catch_command ("rethrow", _("\
Catch an exception, when rethrown."),
catch_rethrow_command,
- NULL,
+ NULL,
CATCH_PERMANENT,
CATCH_TEMPORARY);
static CORE_ADDR adjust_breakpoint_address (struct gdbarch *gdbarch,
CORE_ADDR bpaddr,
- enum bptype bptype);
+ enum bptype bptype);
static void describe_other_breakpoints (struct gdbarch *,
struct program_space *, CORE_ADDR,
}
/* If we reach here, the condition is valid at some locations. */
- int loc_num = 1;
- for (bp_location *loc = b->loc; loc != nullptr;
- loc = loc->next, loc_num++)
- set_breakpoint_location_condition (exp, loc, b->number, loc_num);
+ int loc_num = 1;
+ for (bp_location *loc = b->loc; loc != nullptr;
+ loc = loc->next, loc_num++)
+ set_breakpoint_location_condition (exp, loc, b->number, loc_num);
}
/* We know that the new condition parsed successfully. The
struct command_line *while_stepping = 0;
/* Reset the while-stepping step count. The previous commands
- might have included a while-stepping action, while the new
- ones might not. */
+ might have included a while-stepping action, while the new
+ ones might not. */
t->step_count = 0;
/* We need to verify that each top-level element of commands is
return;
/* Save the current frame's ID so we can restore it after
- evaluating the watchpoint expression on its own frame. */
+ evaluating the watchpoint expression on its own frame. */
/* FIXME drow/2003-09-09: It would be nice if evaluate_expression
- took a frame parameter, so that we didn't have to change the
- selected frame. */
+ took a frame parameter, so that we didn't have to change the
+ selected frame. */
frame_saved = 1;
saved_frame_id = get_frame_id (get_selected_frame (NULL));
{
/* Yes. This overlay section is mapped into memory. */
try
- {
+ {
int val;
- val = bl->owner->ops->insert_location (bl);
+ val = bl->owner->ops->insert_location (bl);
if (val)
bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
- }
+ }
catch (gdb_exception &e)
- {
+ {
bp_excpt = std::move (e);
- }
+ }
}
else
{
{
*hw_breakpoint_error = 1;
*hw_bp_error_explained_already = bp_excpt.message != NULL;
- fprintf_unfiltered (tmp_error_stream,
- "Cannot insert hardware breakpoint %d%s",
- bl->owner->number,
+ fprintf_unfiltered (tmp_error_stream,
+ "Cannot insert hardware breakpoint %d%s",
+ bl->owner->number,
bp_excpt.message ? ":" : ".\n");
- if (bp_excpt.message != NULL)
- fprintf_unfiltered (tmp_error_stream, "%s.\n",
+ if (bp_excpt.message != NULL)
+ fprintf_unfiltered (tmp_error_stream, "%s.\n",
bp_excpt.what ());
}
else
if (error_flag)
{
/* If a hardware breakpoint or watchpoint was inserted, add a
- message about possibly exhausted resources. */
+ message about possibly exhausted resources. */
if (hw_breakpoint_error && !hw_bp_error_explained_already)
{
tmp_error_stream.printf ("Could not insert hardware breakpoints:\n\
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->overlay_msym);
b = create_internal_breakpoint (objfile->arch (), addr,
- bp_overlay_event,
+ bp_overlay_event,
&internal_breakpoint_ops);
initialize_explicit_location (&explicit_loc);
explicit_loc.function_name = ASTRDUP (func_name);
b->location = new_explicit_location (&explicit_loc);
if (overlay_debugging == ovly_auto)
- {
- b->enable_state = bp_enabled;
- overlay_events_enabled = 1;
- }
+ {
+ b->enable_state = bp_enabled;
+ overlay_events_enabled = 1;
+ }
else
{
- b->enable_state = bp_disabled;
- overlay_events_enabled = 0;
+ b->enable_state = bp_disabled;
+ overlay_events_enabled = 0;
}
}
}
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;
+ /* 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;
}
/* bp_finish is a special case. The only way we ought to be able
bl->owner->number);
}
else if (bl->owner->type == bp_catchpoint
- && breakpoint_enabled (bl->owner)
- && !bl->duplicate)
+ && breakpoint_enabled (bl->owner)
+ && !bl->duplicate)
{
gdb_assert (bl->owner->ops != NULL
&& bl->owner->ops->remove_location != NULL);
/* Take ownership of the BSP's command tree, if it has one.
- The command tree could legitimately contain commands like
- 'step' and 'next', which call clear_proceed_status, which
- frees stop_bpstat's command tree. To make sure this doesn't
- free the tree we're executing out from under us, we need to
- take ownership of the tree ourselves. Since a given bpstat's
- commands are only executed once, we don't need to copy it; we
- can clear the pointer in the bpstat, and make sure we free
- the tree when we're done. */
+ The command tree could legitimately contain commands like
+ 'step' and 'next', which call clear_proceed_status, which
+ frees stop_bpstat's command tree. To make sure this doesn't
+ free the tree we're executing out from under us, we need to
+ take ownership of the tree ourselves. Since a given bpstat's
+ commands are only executed once, we don't need to copy it; we
+ can clear the pointer in the bpstat, and make sure we free
+ the tree when we're done. */
counted_command_line ccmd = bs->commands;
bs->commands = NULL;
if (ccmd != NULL)
case print_it_done:
/* We still want to print the frame, but we already printed the
- relevant messages. */
+ relevant messages. */
return PRINT_SRC_AND_LOC;
break;
if (within_current_scope)
{
/* We use value_{,free_to_}mark because it could be a *long*
- time before we return to the command level and call
- free_all_values. We can't call free_all_values because we
- might be in the middle of evaluating a function call. */
+ time before we return to the command level and call
+ free_all_values. We can't call free_all_values because we
+ might be in the middle of evaluating a function call. */
int pc = 0;
struct value *mark;
else
{
/* This seems like the only logical thing to do because
- if we temporarily ignored the watchpoint, then when
- we reenter the block in which it is valid it contains
- garbage (in the case of a function, it may have two
- garbage values, one before and one after the prologue).
- So we can't even detect the first assignment to it and
- watch after that (since the garbage may or may not equal
- the first value assigned). */
+ if we temporarily ignored the watchpoint, then when
+ we reenter the block in which it is valid it contains
+ garbage (in the case of a function, it may have two
+ garbage values, one before and one after the prologue).
+ So we can't even detect the first assignment to it and
+ watch after that (since the garbage may or may not equal
+ the first value assigned). */
/* We print all the stop information in
breakpoint_ops->print_it, but in this case, by the time we
call breakpoint_ops->print_it this bp will be deleted
here. */
SWITCH_THRU_ALL_UIS ()
- {
+ {
struct ui_out *uiout = current_uiout;
if (uiout->is_mi_like_p ())
inf_nums.push_back (inf->num);
}
- /* For backward compatibility, don't display inferiors in CLI unless
+ /* For backward compatibility, don't display inferiors in CLI unless
there are several. Always display for MI. */
if (allflag
|| (!gdbarch_has_global_breakpoints (target_gdbarch ())
annotate_field (6);
uiout->text ("\tstop only in stack frame at ");
/* FIXME: cagney/2002-12-01: Shouldn't be poking around inside
- the frame ID. */
+ the frame ID. */
uiout->field_core_addr ("frame",
b->gdbarch, b->frame_id.stack_addr);
uiout->text ("\n");
ALL_BREAKPOINTS (b)
others += (user_breakpoint_p (b)
- && breakpoint_has_pc (b, pspace, pc, section));
+ && breakpoint_has_pc (b, pspace, pc, section));
if (others > 0)
{
if (others == 1)
static void
breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
- int bnum, int have_bnum)
+ int bnum, int have_bnum)
{
/* The longest string possibly returned by hex_string_custom
is 50 chars. These must be at least that big for safety. */
strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));
if (have_bnum)
warning (_("Breakpoint %d address previously adjusted from %s to %s."),
- bnum, astr1, astr2);
+ bnum, astr1, astr2);
else
warning (_("Breakpoint address adjusted from %s to %s."), astr1, astr2);
}
|| bptype == bp_catchpoint)
{
/* Watchpoints and the various bp_catch_* eventpoints should not
- have their addresses modified. */
+ have their addresses modified. */
return bpaddr;
}
else if (bptype == bp_single_step)
adjusted_bpaddr = address_significant (gdbarch, adjusted_bpaddr);
/* An adjusted breakpoint address can significantly alter
- a user's expectations. Print a warning if an adjustment
+ a user's expectations. Print a warning if an adjustment
is required. */
if (adjusted_bpaddr != bpaddr)
breakpoint_adjustment_warning (bpaddr, adjusted_bpaddr, 0, 0);
mess more complicated breakpoints with multiple locations. */
b->type = bp_gnu_ifunc_resolver;
/* Remember the resolver's address for use by the return
- breakpoint. */
+ breakpoint. */
loc->related_address = loc->address;
}
}
static void
create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
bool temp, const char *cond_string,
- const struct breakpoint_ops *ops)
+ const struct breakpoint_ops *ops)
{
std::unique_ptr<fork_catchpoint> c (new fork_catchpoint ());
exception_print (gdb_stderr, e);
- /* If pending breakpoint support is auto query and the user
+ /* If pending breakpoint support is auto query and the user
selects no, then simply return the error code. */
if (pending_break_support == AUTO_BOOLEAN_AUTO
&& !nquery (_("Make %s pending on future shared library load? "),
gdb::unique_xmalloc_ptr<char> extra_string_copy;
if (parse_extra)
- {
+ {
char *rest;
char *cond;
&cond, &thread, &task, &rest);
cond_string_copy.reset (cond);
extra_string_copy.reset (rest);
- }
+ }
else
- {
+ {
if (type_wanted != bp_dprintf
&& extra_string != NULL && *extra_string != '\0')
error (_("Garbage '%s' at end of location"), extra_string);
/* Create a private copy of any extra string. */
if (extra_string)
extra_string_copy.reset (xstrdup (extra_string));
- }
+ }
ops->create_breakpoints_sal (gdbarch, &canonical,
std::move (cond_string_copy),
b->condition_not_parsed = 1;
b->enable_state = enabled ? bp_enabled : bp_disabled;
if ((type_wanted != bp_breakpoint
- && type_wanted != bp_hardware_breakpoint) || thread != -1)
+ && type_wanted != bp_hardware_breakpoint) || thread != -1)
b->pspace = current_program_space;
install_breakpoint (internal, std::move (b), 0);
sal->pc = pc;
/* If this SAL corresponds to a breakpoint inserted using a line
- number, then skip the function prologue if necessary. */
+ number, then skip the function prologue if necessary. */
if (sal->explicit_line)
skip_prologue_sal (sal);
}
else
{
/* It really is worthwhile to have the section, so we'll
- just have to look harder. This case can be executed
- if we have line numbers but no functions (as can
- happen in assembly source). */
+ just have to look harder. This case can be executed
+ if we have line numbers but no functions (as can
+ happen in assembly source). */
scoped_restore_current_pspace_and_thread restore_pspace_thread;
switch_to_program_space_and_thread (sal->pspace);
int hasColon = 0;
/* Look for a ':'. If this is a line number specification, then
- say it is bad, otherwise, it should be an address or
- function/method name. */
+ say it is bad, otherwise, it should be an address or
+ function/method name. */
while (*argptr && !hasColon)
{
hasColon = (*argptr == ':');
int hasColon = 0;
/* Look for a ':'. If there is a '::' then get out, otherwise
- it is probably a line number. */
+ it is probably a line number. */
while (*argptr && !hasColon)
{
hasColon = (*argptr == ':');
struct watchpoint *w = (struct watchpoint *) bl->owner;
return target_remove_mask_watchpoint (bl->address, w->hw_wp_mask,
- bl->watchpoint_type);
+ bl->watchpoint_type);
}
/* Implement the "resources_needed" breakpoint_ops method for
}
/* accessflag: hw_write: watch write,
- hw_read: watch read,
+ hw_read: watch read,
hw_access: watch access (read or write) */
static void
watch_command_1 (const char *arg, int accessflag, int from_tty,
else
{
/* Ahh, memory we actually used! Check if we can cover
- it with hardware watchpoints. */
+ it with hardware watchpoints. */
struct type *vtype = check_typedef (value_type (v));
/* We only watch structs and arrays if user asked for it
case catch_fork_temporary:
case catch_fork_permanent:
create_fork_vfork_event_catchpoint (gdbarch, temp, cond_string,
- &catch_fork_breakpoint_ops);
+ &catch_fork_breakpoint_ops);
break;
case catch_vfork_temporary:
case catch_vfork_permanent:
create_fork_vfork_event_catchpoint (gdbarch, temp, cond_string,
- &catch_vfork_breakpoint_ops);
+ &catch_vfork_breakpoint_ops);
break;
default:
error (_("unsupported or unknown fork kind; cannot catch it"));
describe_other_breakpoints (loc_gdbarch,
sal.pspace, sal.pc, sal.section, -1);
/* FIXME: brobecker/2006-12-28: Actually, re-implement a special
- version for exception catchpoints, because two catchpoints
- used for different exception names will use the same address.
- In this case, a "breakpoint ... also set at..." warning is
- unproductive. Besides, the warning phrasing is also a bit
- inappropriate, we should use the word catchpoint, and tell
- the user what type of catchpoint it is. The above is good
- enough for now, though. */
+ version for exception catchpoints, because two catchpoints
+ used for different exception names will use the same address.
+ In this case, a "breakpoint ... also set at..." warning is
+ unproductive. Besides, the warning phrasing is also a bit
+ inappropriate, we should use the word catchpoint, and tell
+ the user what type of catchpoint it is. The above is good
+ enough for now, though. */
}
init_raw_breakpoint (b, gdbarch, sal, bp_catchpoint, ops);
const char *sal_fullname;
/* If exact pc given, clear bpts at that pc.
- If line given (pc == 0), clear all bpts on specified line.
- If defaulting, clear all bpts on default line
- or at default pc.
+ If line given (pc == 0), clear all bpts on specified line.
+ If defaulting, clear all bpts on default line
+ or at default pc.
- defaulting sal.pc != 0 tests to do
+ defaulting sal.pc != 0 tests to do
- 0 1 pc
- 1 1 pc _and_ line
- 0 0 line
- 1 0 <can't happen> */
+ 0 1 pc
+ 1 1 pc _and_ line
+ 0 0 line
+ 1 0 <can't happen> */
sal_fullname = (sal.symtab == NULL
? NULL : symtab_to_fullname (sal.symtab));
break;
/* This breakpoint is special, it's set up when the inferior
- starts and we really don't want to touch it. */
+ starts and we really don't want to touch it. */
case bp_shlib_event:
/* Like bp_shlib_event, this breakpoint type is special. Once
int breaks_to_delete = 0;
/* Delete all breakpoints if no argument. Do not delete
- internal breakpoints, these have to be deleted with an
- explicit breakpoint number argument. */
+ internal breakpoints, these have to be deleted with an
+ explicit breakpoint number argument. */
ALL_BREAKPOINTS (b)
if (user_breakpoint_p (b))
{
int breaks_to_delete = 0;
/* Delete all breakpoints if no argument.
- Do not delete internal or call-dummy breakpoints, these
- have to be deleted with an explicit breakpoint number
+ Do not delete internal or call-dummy breakpoints, these
+ have to be deleted with an explicit breakpoint number
argument. */
ALL_TRACEPOINTS (b)
if (is_tracepoint (b) && user_breakpoint_p (b))
add_catch_command ("fork", _("Catch calls to fork."),
catch_fork_command_1,
- NULL,
+ NULL,
(void *) (uintptr_t) catch_fork_permanent,
(void *) (uintptr_t) catch_fork_temporary);
add_catch_command ("vfork", _("Catch calls to vfork."),
catch_fork_command_1,
- NULL,
+ NULL,
(void *) (uintptr_t) catch_vfork_permanent,
(void *) (uintptr_t) catch_vfork_temporary);
add_catch_command ("exec", _("Catch calls to exec."),
catch_exec_command_1,
- NULL,
+ NULL,
CATCH_PERMANENT,
CATCH_TEMPORARY);
add_catch_command ("load", _("Catch loads of shared libraries.\n\
LINENUM, for that line in the current file,\n\
FILE:LINENUM, for that line in that file,\n\
+OFFSET, for that number of lines after the current line\n\
- or the start of the range\n\
+ or the start of the range\n\
FUNCTION, for the first line in that function,\n\
FILE:FUNCTION, to distinguish among like-named static functions.\n\
*ADDRESS, for the instruction at that address.\n\
extern void mark_breakpoints_out (void);
extern struct breakpoint *create_jit_event_breakpoint (struct gdbarch *,
- CORE_ADDR);
+ CORE_ADDR);
extern struct breakpoint *create_solib_event_breakpoint (struct gdbarch *,
CORE_ADDR);
else
{
/* Updating the thread that is currently running; pass the
- request to the layer beneath. */
+ request to the layer beneath. */
beneath ()->store_registers (regcache, regnum);
}
}
gdb_byte buf[4];
/* FIXME: For executables linked statically with the threads
- library, we end up here before the program has actually been
- executed. In that case ADDR will be garbage since it has
- been read from the wrong virtual memory image. */
+ library, we end up here before the program has actually been
+ executed. In that case ADDR will be garbage since it has
+ been read from the wrong virtual memory image. */
if (target_read_memory (addr, buf, 4) == 0)
{
ULONGEST magic = extract_unsigned_integer (buf, 4, byte_order);
do \
{ \
if (record_debug != 0) \
- fprintf_unfiltered (gdb_stdlog, \
+ fprintf_unfiltered (gdb_stdlog, \
"[btrace] " msg "\n", ##args); \
} \
while (0)
warning (_("File \"%s\" has no build-id, file skipped"),
bfd_get_filename (abfd));
else if (found->size != check_len
- || memcmp (found->data, check, found->size) != 0)
+ || memcmp (found->data, check, found->size) != 0)
warning (_("File \"%s\" has a different build-id, file skipped"),
bfd_get_filename (abfd));
else
/* Compute where the file named after the build-id would be.
If debugdir is "/usr/lib/debug" and the build-id is abcdef, this will
- give "/usr/lib/debug/.build-id/ab/cdef.debug". */
+ give "/usr/lib/debug/.build-id/ab/cdef.debug". */
std::string link = debugdir.get ();
link += "/.build-id/";
return debug_bfd;
/* Try to look under the sysroot as well. If the sysroot is
- "/the/sysroot", it will give
- "/the/sysroot/usr/lib/debug/.build-id/ab/cdef.debug".
+ "/the/sysroot", it will give
+ "/the/sysroot/usr/lib/debug/.build-id/ab/cdef.debug".
- Don't do it if the sysroot is the target system ("target:"). It
- could work in theory, but the lrealpath in build_id_to_debug_bfd_1
- only works with local paths. */
+ Don't do it if the sysroot is the target system ("target:"). It
+ could work in theory, but the lrealpath in build_id_to_debug_bfd_1
+ only works with local paths. */
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
{
link = gdb_sysroot + link;
CORE_ADDR end);
extern void record_block_range (struct block *,
- CORE_ADDR start, CORE_ADDR end_inclusive);
+ CORE_ADDR start, CORE_ADDR end_inclusive);
extern void start_subfile (const char *name);
set_last_source_file (name);
/* Default the source language to whatever can be deduced from
- the filename. If nothing can be deduced (such as for a C/C++
- include file with a ".h" extension), then inherit whatever
- language the previous subfile had. This kludgery is
- necessary because there is no standard way in some object
- formats to record the source language. Also, when symtabs
- are allocated we try to deduce a language then as well, but
- it is too late for us to use that information while reading
- symbols, since symtabs aren't allocated until after all the
- symbols have been processed for a given source file. */
+ the filename. If nothing can be deduced (such as for a C/C++
+ include file with a ".h" extension), then inherit whatever
+ language the previous subfile had. This kludgery is
+ necessary because there is no standard way in some object
+ formats to record the source language. Also, when symtabs
+ are allocated we try to deduce a language then as well, but
+ it is too late for us to use that information while reading
+ symbols, since symtabs aren't allocated until after all the
+ symbols have been processed for a given source file. */
subfile->language = deduce_language_from_filename (subfile->name);
if (subfile->language == language_unknown
/* C++. */
exp : TRUEKEYWORD
- { write_exp_elt_opcode (pstate, OP_LONG);
- write_exp_elt_type (pstate,
+ { write_exp_elt_opcode (pstate, OP_LONG);
+ write_exp_elt_type (pstate,
parse_type (pstate)->builtin_bool);
- write_exp_elt_longcst (pstate, (LONGEST) 1);
- write_exp_elt_opcode (pstate, OP_LONG); }
+ write_exp_elt_longcst (pstate, (LONGEST) 1);
+ write_exp_elt_opcode (pstate, OP_LONG); }
;
exp : FALSEKEYWORD
- { write_exp_elt_opcode (pstate, OP_LONG);
- write_exp_elt_type (pstate,
+ { write_exp_elt_opcode (pstate, OP_LONG);
+ write_exp_elt_type (pstate,
parse_type (pstate)->builtin_bool);
- write_exp_elt_longcst (pstate, (LONGEST) 0);
- write_exp_elt_opcode (pstate, OP_LONG); }
+ write_exp_elt_longcst (pstate, (LONGEST) 0);
+ write_exp_elt_opcode (pstate, OP_LONG); }
;
/* end of C++. */
else if ($1.is_a_field_of_this)
{
/* C++: it hangs off of `this'. Must
- not inadvertently convert from a method call
+ not inadvertently convert from a method call
to data ref. */
pstate->block_tracker->update (sym);
write_exp_elt_opcode (pstate, OP_THIS);
$2.length);
$$ = NULL;
}
- /* It appears that this rule for templates is never
- reduced; template recognition happens by lookahead
- in the token processing code in yylex. */
+ /* It appears that this rule for templates is never
+ reduced; template recognition happens by lookahead
+ in the token processing code in yylex. */
| TEMPLATE name '<' type '>'
{ $$ = lookup_template_type
(copy_name($2).c_str (), $4,
if (!parse_float (p, len,
putithere->typed_val_float.type,
putithere->typed_val_float.val))
- return ERROR;
+ return ERROR;
if (imaginary_p)
putithere->typed_val_float.type
= macro_expand_next (&pstate->lexptr, *expression_macro_scope);
if (expanded != nullptr)
- scan_macro_expansion (expanded.get ());
+ scan_macro_expansion (expanded.get ());
}
pstate->prev_lexptr = pstate->lexptr;
{
case 0:
/* If we were just scanning the result of a macro expansion,
- then we need to resume scanning the original text.
+ then we need to resume scanning the original text.
If we're parsing for field name completion, and the previous
token allows such completion, return a COMPLETE token.
- Otherwise, we were already scanning the original text, and
- we're really done. */
+ Otherwise, we were already scanning the original text, and
+ we're really done. */
if (scanning_macro_expansion ())
- {
- finished_macro_expansion ();
- goto retry;
- }
+ {
+ finished_macro_expansion ();
+ goto retry;
+ }
else if (saw_name_at_eof)
{
saw_name_at_eof = 0;
else if (par_state->parse_completion && saw_structop)
return COMPLETE;
else
- return 0;
+ return 0;
case ' ':
case '\t':
case ',':
if (pstate->comma_terminates
- && paren_depth == 0
- && ! scanning_macro_expansion ())
+ && paren_depth == 0
+ && ! scanning_macro_expansion ())
return 0;
pstate->lexptr++;
return c;
}
toktype = parse_number (par_state, tokstart, p - tokstart,
got_dot | got_e | got_p, &yylval);
- if (toktype == ERROR)
+ if (toktype == ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
pstate->expression_context_block,
VAR_DOMAIN,
(par_state->language ()->la_language
- == language_cplus ? &is_a_field_of_this
+ == language_cplus ? &is_a_field_of_this
: NULL)).symbol
!= NULL)
{
fputs_styled (varstring, variable_name_style.style (), stream);
/* For demangled function names, we have the arglist as part of
- the name, so don't print an additional pair of ()'s. */
+ the name, so don't print an additional pair of ()'s. */
if (local_name == NULL)
{
demangled_args = strchr (varstring, '(') != NULL;
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
/* These types need no prefix. They are listed here so that
- gcc -Wall will reveal any types that haven't been handled. */
+ gcc -Wall will reveal any types that haven't been handled. */
break;
default:
error (_("type not handled in c_type_print_varspec_prefix()"));
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
/* These types do not need a suffix. They are listed so that
- gcc -Wall will report types that may not have been
- considered. */
+ gcc -Wall will report types that may not have been
+ considered. */
break;
default:
error (_("type not handled in c_type_print_varspec_suffix()"));
if (TYPE_DECLARED_CLASS (type))
fprintf_filtered (stream, "class ");
/* Print the tag name if it exists.
- The aCC compiler emits a spurious
- "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
- tag for unnamed struct/union/enum's, which we don't
- want to print. */
+ The aCC compiler emits a spurious
+ "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
+ tag for unnamed struct/union/enum's, which we don't
+ want to print. */
if (type->name () != NULL
&& !startswith (type->name (), "{unnamed"))
{
default:
/* Handle types not explicitly handled by the other cases, such
- as fundamental types. For these, just print whatever the
- type name is, as recorded in the type itself. If there is no
- type name, then complain. */
+ as fundamental types. For these, just print whatever the
+ type name is, as recorded in the type itself. If there is no
+ type name, then complain. */
if (type->name () != NULL)
{
c_type_print_modifier (type, stream, 0, 1, language);
struct type *original_type = value_type (val);
/* Hack: remove (char *) for char strings. Their
- type is indicated by the quoted string anyway.
- (Don't use c_textual_element_type here; quoted strings
- are always exactly (char *), (wchar_t *), or the like. */
+ type is indicated by the quoted string anyway.
+ (Don't use c_textual_element_type here; quoted strings
+ are always exactly (char *), (wchar_t *), or the like. */
if (original_type->code () == TYPE_CODE_PTR
&& original_type->name () == NULL
&& TYPE_TARGET_TYPE (original_type)->name () != NULL
enclosing_type = value_actual_type (*value, 1, &real_type_found);
if (real_type_found)
- {
- *type = enclosing_type;
- *value = value_cast (enclosing_type, *value);
- }
+ {
+ *type = enclosing_type;
+ *value = value_cast (enclosing_type, *value);
+ }
}
}
have one child, except for function ptrs, which have no children,
and except for void*, as we don't know what to show.
- We can show char* so we allow it to be dereferenced. If you decide
- to test for it, please mind that a little magic is necessary to
- properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and
- TYPE_NAME == "char". */
+ We can show char* so we allow it to be dereferenced. If you decide
+ to test for it, please mind that a little magic is necessary to
+ properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and
+ TYPE_NAME == "char". */
if (target->code () == TYPE_CODE_FUNC
|| target->code () == TYPE_CODE_VOID)
children = 0;
/* It is necessary to access a real type (via RTTI). */
if (opts.objectprint)
- {
- value = var->value.get ();
- lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
+ {
+ value = var->value.get ();
+ lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
|| var->type->code () == TYPE_CODE_PTR);
- }
+ }
adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
if (((type->code ()) == TYPE_CODE_STRUCT)
/* It is necessary to access a real type (via RTTI). */
if (opts.objectprint)
- {
+ {
const struct varobj *parent = var->parent;
value = parent->value.get ();
lookup_actual_type = (TYPE_IS_REFERENCE (parent->type)
|| parent->type->code () == TYPE_CODE_PTR);
- }
+ }
adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
cplus_class_num_children (type, kids);
/* Cast the parent to the base' type. Note that in gdb,
expression like
- (Base1)d
+ (Base1)d
will create an lvalue, for all appearences, so we don't
need to use more fancy:
- *(Base1*)(&d)
+ *(Base1*)(&d)
construct.
When we are in the scope of the base class or of one
if (!strcmp (value, "auto"))
fprintf_filtered (file,
_("The target character set is \"auto; "
- "currently %s\".\n"),
+ "currently %s\".\n"),
gdbarch_auto_charset (get_current_arch ()));
else
fprintf_filtered (file, _("The target character set is \"%s\".\n"),
if (!strcmp (value, "auto"))
fprintf_filtered (file,
_("The target wide character set is \"auto; "
- "currently %s\".\n"),
+ "currently %s\".\n"),
gdbarch_auto_wide_charset (get_current_arch ()));
else
fprintf_filtered (file, _("The target wide character set is \"%s\".\n"),
if (cwd == NULL)
error (_("Error finding name of working directory: %s"),
- safe_strerror (errno));
+ safe_strerror (errno));
if (strcmp (cwd.get (), current_directory) != 0)
printf_unfiltered (_("Working directory %ps\n (canonically %ps).\n"),
if (IS_DIR_SEPARATOR (dir[len - 1]))
{
/* Remove the trailing slash unless this is a root directory
- (including a drive letter on non-Unix systems). */
+ (including a drive letter on non-Unix systems). */
if (!(len == 1) /* "/" */
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
&& !(len == 3 && dir[1] == ':') /* "d:/" */
if (found_real_path)
{
/* Search backwards for the directory just before the "/.."
- and obliterate it and the "/..". */
+ and obliterate it and the "/..". */
char *q = p;
while (q != current_directory && !IS_DIR_SEPARATOR (q[-1]))
if (!opened)
{
/* The script wasn't found, or was otherwise inaccessible.
- If the source command was invoked interactively, throw an
+ If the source command was invoked interactively, throw an
error. Otherwise (e.g. if it was invoked by a script),
just emit a warning, rather than cause an error. */
if (from_tty)
sal = sals[0];
if (*arg1)
- error (_("Junk at end of line specification."));
+ error (_("Junk at end of line specification."));
/* If line was specified by address, first print exactly which
- line, and which file. In this case, sal.symtab == 0 means
- address is outside of all known source files, not that user
- failed to give a filename. */
+ line, and which file. In this case, sal.symtab == 0 means
+ address is outside of all known source files, not that user
+ failed to give a filename. */
if (*arg == '*')
- {
+ {
struct gdbarch *gdbarch;
- if (sal.symtab == 0)
+ if (sal.symtab == 0)
error (_("No source file for address %s."),
paddress (get_current_arch (), sal.pc));
gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
- sym = find_pc_function (sal.pc);
- if (sym)
+ sym = find_pc_function (sal.pc);
+ if (sym)
printf_filtered ("%s is in %s (%s:%d).\n",
paddress (gdbarch, sal.pc),
sym->print_name (),
symtab_to_filename_for_display (sal.symtab),
sal.line);
- else
+ else
printf_filtered ("%s is at %s:%d.\n",
paddress (gdbarch, sal.pc),
symtab_to_filename_for_display (sal.symtab),
sal.line);
- }
+ }
/* If what was given does not imply a symtab, it must be an
- undebuggable symbol which means no source code. */
+ undebuggable symbol which means no source code. */
if (sal.symtab == 0)
- error (_("No line number known for %s."), arg);
+ error (_("No line number known for %s."), arg);
}
if ((editor = getenv ("EDITOR")) == NULL)
if (exit_status < 0)
error (_("shell command \"%s\" failed: %s"), shell_command,
- safe_strerror (errno));
+ safe_strerror (errno));
exit_status_set_internal_vars (exit_status);
}
printf_filtered (_("for function %ps:\n"),
styled_string (function_name_style.style (), name));
if (block == nullptr || BLOCK_CONTIGUOUS_P (block))
- {
+ {
if (name == NULL)
printf_filtered (_("from %ps to %ps:\n"),
styled_string (address_style.style (),
gdb_disassembly (gdbarch, current_uiout, flags, -1, low, high);
}
else
- {
+ {
for (int i = 0; i < BLOCK_NRANGES (block); i++)
{
CORE_ADDR range_low = BLOCK_RANGE_START (block, i);
/* We must recursively update the prefix field to cover
e.g. 'info auto-load libthread-db' where the creation
order was:
- libthread-db
- auto-load
- info
+ libthread-db
+ auto-load
+ info
In such a case, when 'auto-load' was created by do_add_cmd,
- the 'libthread-db' prefix field could not be updated, as the
+ the 'libthread-db' prefix field could not be updated, as the
'auto-load' command was not yet reachable by
lookup_cmd_for_prefixlist (list, cmdlist)
that searches from the top level 'cmdlist'. */
struct cmd_list_element *
add_prefix_cmd_suppress_notification
- (const char *name, enum command_class theclass,
+ (const char *name, enum command_class theclass,
cmd_const_cfunc_ftype *fun,
const char *doc, struct cmd_list_element **prefixlist,
const char *prefixname, int allow_unknown,
if (c->hook_pre || c->hook_post)
fprintf_filtered (stream,
- "\nThis command has a hook (or hooks) defined:\n");
+ "\nThis command has a hook (or hooks) defined:\n");
if (c->hook_pre)
fprintf_filtered (stream,
- "\tThis command is run after : %s (pre hook)\n",
- c->hook_pre->name);
+ "\tThis command is run after : %s (pre hook)\n",
+ c->hook_pre->name);
if (c->hook_post)
fprintf_filtered (stream,
- "\tThis command is run before : %s (post hook)\n",
- c->hook_post->name);
+ "\tThis command is run before : %s (post hook)\n",
+ c->hook_post->name);
}
/*
for (c = cmdlist; c; c = c->next)
{
if (c->abbrev_flag)
- continue;
+ continue;
/* If this is a class name, print all of the commands in the
class. */
for (c = cmdlist; c; c = c->next)
{
if (c->abbrev_flag)
- continue;
+ continue;
if (c->theclass == no_class)
{
|| (theclass == c->theclass && c->func != NULL))
{
/* show C when
- - showing all commands
+ - showing all commands
- showing all classes and C is a help class
- showing commands of THECLASS and C is not the help class */
if (result_list != nullptr)
if (!*result_list)
/* This used to say *result_list = *found->prefixlist.
- If that was correct, need to modify the documentation
- at the top of this function to clarify what is
- supposed to be going on. */
+ If that was correct, need to modify the documentation
+ at the top of this function to clarify what is
+ supposed to be going on. */
*result_list = found;
/* For ambiguous commands, do not return any default_args args. */
if (default_args != nullptr)
else if (c == CMD_LIST_AMBIGUOUS)
{
/* Ambigous. Local values should be off prefixlist or called
- values. */
+ values. */
int local_allow_unknown = (last_list ? last_list->allow_unknown :
allow_unknown);
const char *local_cmdtype = last_list ? last_list->prefixname : cmdtype;
else
{
if (c->type == set_cmd && **line != '\0' && !isspace (**line))
- error (_("Argument must be preceded by space."));
+ error (_("Argument must be preceded by space."));
/* We've got something. It may still not be what the caller
- wants (if this command *needs* a subcommand). */
+ wants (if this command *needs* a subcommand). */
while (**line == ' ' || **line == '\t')
(*line)++;
/* The user needs to be warned that this is a deprecated command.
The user should only be warned the first time a command is
used. */
-
+
unsigned int deprecated_warn_user : 1;
/* When functions are deprecated at compile time (this is the way
}
/* loop_continue to jump to the start of a while loop, print it
- and continue. */
+ and continue. */
if (list->control_type == continue_control)
{
uiout->field_string (NULL, "loop_continue");
print_command_trace ("loop_continue");
/* Return for "continue", and "break" so we can either
- continue the loop at the top, or break out. */
+ continue the loop at the top, or break out. */
ret = cmd->control_type;
break;
print_command_trace ("loop_break");
/* Return for "continue", and "break" so we can either
- continue the loop at the top, or break out. */
+ continue the loop at the top, or break out. */
ret = cmd->control_type;
break;
child_tail = next;
/* If the latest line is another control structure, then recurse
- on it. */
+ on it. */
if (multi_line_command_p (next->control_type))
{
control_level++;
if (hookc)
{
switch (hook_type)
- {
- case CMD_PRE_HOOK:
- hookc->hook_pre = newc; /* Target gets hooked. */
- newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */
- break;
- case CMD_POST_HOOK:
- hookc->hook_post = newc; /* Target gets hooked. */
- newc->hookee_post = hookc; /* We are marked as hooking
+ {
+ case CMD_PRE_HOOK:
+ hookc->hook_pre = newc; /* Target gets hooked. */
+ newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */
+ break;
+ case CMD_POST_HOOK:
+ hookc->hook_post = newc; /* Target gets hooked. */
+ newc->hookee_post = hookc; /* We are marked as hooking
target cmd. */
- break;
- default:
- /* Should never come here as hookc would be 0. */
+ break;
+ default:
+ /* Should never come here as hookc would be 0. */
internal_error (__FILE__, __LINE__, _("bad switch"));
- }
+ }
}
}
/* We skip show command aliases to avoid showing duplicated values. */
/* If we find a prefix, run its list, prefixing our output by its
- prefix (with "show " skipped). */
+ prefix (with "show " skipped). */
if (list->prefixlist && list->cmd_pointer == nullptr)
{
ui_out_emit_tuple optionlist_emitter (uiout, "optionlist");
if (sectix != PE_SECTION_INDEX_INVALID)
{
/* Data within the section start at rva_start in the pe and at
- bfd_get_section_vma() within memory. Store the offset. */
+ bfd_get_section_vma() within memory. Store the offset. */
sections[sectix].vma_offset
= bfd_section_vma (sectp) - sections[sectix].rva_start;
/* Pointer to the function address vector. */
/* This is relative to ordinal value. */
unsigned long func_rva = pe_as32 (erva + exp_funcbase +
- ordinal * 4);
+ ordinal * 4);
/* Find this symbol's section in our own array. */
int sectix = 0;
const char *s;
/* We can have multiple .stab sections if linked with
- --split-by-reloc. */
+ --split-by-reloc. */
for (s = name + sizeof ".stab" - 1; *s != '\0'; s++)
if (!isdigit (*s))
break;
bfd_map_over_sections (abfd, find_linenos, (void *) info);
val = init_lineno (abfd, info->min_lineno_offset,
- info->max_lineno_offset - info->min_lineno_offset,
+ info->max_lineno_offset - info->min_lineno_offset,
&linetab_storage);
if (val < 0)
- error (_("\"%s\": error reading line numbers."), filename);
+ error (_("\"%s\": error reading line numbers."), filename);
}
/* Now read the string table, all at once. */
int lead = bfd_get_symbol_leading_char (objfile->obfd);
struct bound_minimal_symbol found;
- if (lead != '\0' && *name1 == lead)
+ if (lead != '\0' && *name1 == lead)
name1 += 1;
found = lookup_minimal_symbol (name1, NULL, objfile);
}
/* FIXME: dubious. Why can't we use something normal like
- bfd_get_section_contents? */
+ bfd_get_section_contents? */
bfd_seek (abfd, abfd->where, 0);
stabstrsize = bfd_section_size (info->stabstrsect);
/* Value contains address of first non-init type
code. */
/* main_aux.x_sym.x_misc.x_lnsz.x_lnno
- contains line number of '{' }. */
+ contains line number of '{' }. */
if (cs->c_naux != 1)
complaint (_("`.bf' symbol %d has no aux entry"),
cs->c_symnum);
fcn_first_line_addr = cs->c_value;
/* Might want to check that locals are 0 and
- context_stack_depth is zero, and complain if not. */
+ context_stack_depth is zero, and complain if not. */
depth = 0;
newobj = push_context (depth, fcn_start_addr);
if (!within_function)
error (_("Bad coff function information."));
/* The value of .ef is the address of epilogue code;
- not useful for gdb. */
+ not useful for gdb. */
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
- contains number of lines to '}' */
+ contains number of lines to '}' */
if (outermost_context_p ())
{ /* We attempted to pop an empty context stack. */
fcn_last_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
}
/* fcn_first_line is the line number of the opening '{'.
- Do not record it - because it would affect gdb's idea
- of the line number of the first statement of the
- function - except for one-line functions, for which
- it is also the line number of all the statements and
- of the closing '}', and for which we do not have any
- other statement-line-number. */
+ Do not record it - because it would affect gdb's idea
+ of the line number of the first statement of the
+ function - except for one-line functions, for which
+ it is also the line number of all the statements and
+ of the closing '}', and for which we do not have any
+ other statement-line-number. */
if (fcn_last_line == 1)
record_line (get_current_subfile (), fcn_first_line,
gdbarch_addr_bits_remove (gdbarch,
sym->n_type, sym->n_sclass,
0, cs->c_naux, (char *) aux);
/* If more than one aux entry, read past it (only the first aux
- is important). */
+ is important). */
for (i = 1; i < cs->c_naux; i++)
{
bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global);
if (symbol_entry->_n._n_n._n_zeroes == 0)
{
/* FIXME: Probably should be detecting corrupt symbol files by
- seeing whether offset points to within the stringtab. */
+ seeing whether offset points to within the stringtab. */
result = stringtab + symbol_entry->_n._n_n._n_offset;
}
else
ALL_BLOCK_SYMBOLS (b, iter, real_sym)
{
/* Find completed typedefs to use to fix opaque ones.
- Remove syms from the chain when their types are stored,
- but search the whole chain, as there may be several syms
- from different files with the same name. */
+ Remove syms from the chain when their types are stored,
+ but search the whole chain, as there may be several syms
+ from different files with the same name. */
if (SYMBOL_CLASS (real_sym) == LOC_TYPEDEF
&& SYMBOL_DOMAIN (real_sym) == VAR_DOMAIN
&& SYMBOL_TYPE (real_sym)->code () == TYPE_CODE_PTR
{
scope_component comp
= {
- decl_name (type->name ()).get (),
+ decl_name (type->name ()).get (),
lookup_symbol (type->name (), block (), VAR_DOMAIN, nullptr)
};
scope.push_back (comp);
static void
link_callbacks_warning (struct bfd_link_info *link_info, const char *xwarning,
- const char *symbol, bfd *abfd, asection *section,
+ const char *symbol, bfd *abfd, asection *section,
bfd_vma address)
{
warning (_("Compiled module \"%s\" section \"%s\": warning: %s"),
gdb_bfd_ref_ptr abfd (gdb_bfd_open (filename.get (), gnutarget));
if (abfd == NULL)
error (_("\"%s\": could not open as compiled module: %s"),
- filename.get (), bfd_errmsg (bfd_get_error ()));
+ filename.get (), bfd_errmsg (bfd_get_error ()));
if (!bfd_check_format_matches (abfd.get (), bfd_object, &matching))
error (_("\"%s\": not in loadable format: %s"),
will loop indefinitely. */
subsequent_name = 1;
/* Like emacs, don't complete on old versions. Especially
- useful in the "source" command. */
+ useful in the "source" command. */
const char *p = p_rl.get ();
if (p[strlen (p) - 1] == '~')
continue;
else if (temp[1] == '\0')
{
for (x = temp - 1; x > pathname; x--)
- if (*x == '/')
- break;
+ if (*x == '/')
+ break;
return ((*x == '/') ? x + 1 : pathname);
}
else
while (*s)
{
if (CTRL_CHAR (*s))
- {
- displayer->putch (displayer, '^');
- displayer->putch (displayer, UNCTRL (*s));
- printed_len += 2;
- s++;
+ {
+ displayer->putch (displayer, '^');
+ displayer->putch (displayer, UNCTRL (*s));
+ printed_len += 2;
+ s++;
#if defined (HANDLE_MULTIBYTE)
memset (&ps, 0, sizeof (mbstate_t));
#endif
- }
+ }
else if (*s == RUBOUT)
{
displayer->putch (displayer, '^');
}
/* Grow the hook array by one and add the new hook to the end.
- Yes, it's inefficient to grow it by one each time but since
- this is hardly ever called it's not a big deal. */
+ Yes, it's inefficient to grow it by one each time but since
+ this is hardly ever called it's not a big deal. */
exec_file_hook_count++;
new_array = (hook_type *)
xrealloc (exec_file_extra_hooks,
/* read_core_file_mappings will invoke this lambda for each mapping
that it finds. */
[&] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
- const char *filename, const void *other)
+ const char *filename, const void *other)
{
/* Architecture-specific read_core_mapping methods are expected to
weed out non-file-backed mappings. */
}
bfd = bfd_map[filename] = bfd_openr (expanded_fname.get (),
- "binary");
+ "binary");
if (bfd == nullptr || !bfd_check_format (bfd, bfd_object))
{
exit_inferior_silent (current_inferior ());
/* Clear out solib state while the bfd is still open. See
- comments in clear_solib in solib.c. */
+ comments in clear_solib in solib.c. */
clear_solib ();
current_program_space->cbfd.reset (nullptr);
{
/* Do it after the err msg */
/* FIXME: should be checking for errors from bfd_close (for one
- thing, on error it does not free all the storage associated
- with the bfd). */
+ thing, on error it does not free all the storage associated
+ with the bfd). */
error (_("\"%s\" is not a core dump: %s"),
filename.get (), bfd_errmsg (bfd_get_error ()));
}
for (const auto &mr : m_core_unavailable_mappings)
{
if (address_in_mem_range (memaddr, &mr))
- {
+ {
if (!address_in_mem_range (memend, &mr))
len = mr.start + mr.length - memaddr;
{
add_target (core_target_info, core_target_open, filename_completer);
add_cmd ("core-file-backed-mappings", class_maintenance,
- maintenance_print_core_file_backed_mappings,
+ maintenance_print_core_file_backed_mappings,
_("Print core file's file-backed mappings."),
&maintenanceprintlist);
}
FULL, TOP, and USING_ENC can each be zero, in which case we don't
provide the corresponding piece of information. */
extern struct type *value_rtti_type (struct value *value,
- int *full, LONGEST *top,
+ int *full, LONGEST *top,
int *using_enc);
/* Compute the offset of the baseclass which is the INDEXth baseclass
char c;
/* The GDB lexer checks the result of scanf at this point. Not doing
- this leaves our error checking slightly weaker but only for invalid
- data. */
+ this leaves our error checking slightly weaker but only for invalid
+ data. */
/* See if it has `f' or `l' suffix (float or long double). */
}
toktype = state->parse_number (tokstart, p - tokstart, got_dot|got_e,
lvalp);
- if (toktype == ERROR)
+ if (toktype == ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
{
case 16:
if (strncmp (tokstart, "reinterpret_cast", 16) == 0)
- return REINTERPRET_CAST;
+ return REINTERPRET_CAST;
break;
case 12:
if (strncmp (tokstart, "construction vtable for ", 24) == 0)
return CONSTRUCTION_VTABLE;
}
if (strncmp (tokstart, "dynamic_cast", 12) == 0)
- return DYNAMIC_CAST;
+ return DYNAMIC_CAST;
break;
case 11:
if (strncmp (tokstart, "static_cast", 11) == 0)
- return STATIC_CAST;
+ return STATIC_CAST;
break;
case 9:
HANDLE_SPECIAL ("covariant return thunk to ", DEMANGLE_COMPONENT_COVARIANT_THUNK);
namespace A {
using namespace X;
namespace B {
- using namespace Y;
+ using namespace Y;
}
}
len = strlen (current->import_dest);
directive_match = (search_parents
- ? (startswith (scope, current->import_dest)
- && (len == 0
- || scope[len] == ':'
+ ? (startswith (scope, current->import_dest)
+ && (len == 0
+ || scope[len] == ':'
|| scope[len] == '\0'))
- : strcmp (scope, current->import_dest) == 0);
+ : strcmp (scope, current->import_dest) == 0);
/* If the import destination is the current scope or one of its
- ancestors then it is applicable. */
+ ancestors then it is applicable. */
if (directive_match && !current->searched)
{
/* Mark this import as searched so that the recursive call
struct block_symbol
cp_lookup_symbol_namespace (const char *scope,
- const char *name,
- const struct block *block,
- const domain_enum domain)
+ const char *name,
+ const struct block *block,
+ const domain_enum domain)
{
struct block_symbol sym;
case DEMANGLE_COMPONENT_RESTRICT_THIS:
case DEMANGLE_COMPONENT_VOLATILE_THIS:
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
- ret_comp = d_left (ret_comp);
- break;
+ ret_comp = d_left (ret_comp);
+ break;
default:
done = 1;
break;
case DEMANGLE_COMPONENT_QUAL_NAME:
case DEMANGLE_COMPONENT_LOCAL_NAME:
prev_comp = cur_comp;
- cur_comp = d_right (cur_comp);
- break;
+ cur_comp = d_right (cur_comp);
+ break;
case DEMANGLE_COMPONENT_TEMPLATE:
case DEMANGLE_COMPONENT_NAME:
case DEMANGLE_COMPONENT_CTOR:
{
case DEMANGLE_COMPONENT_QUAL_NAME:
case DEMANGLE_COMPONENT_LOCAL_NAME:
- ret_comp = d_right (ret_comp);
- break;
+ ret_comp = d_right (ret_comp);
+ break;
case DEMANGLE_COMPONENT_TYPED_NAME:
- ret_comp = d_left (ret_comp);
- break;
+ ret_comp = d_left (ret_comp);
+ break;
case DEMANGLE_COMPONENT_TEMPLATE:
gdb_assert (last_template == NULL);
last_template = ret_comp;
case DEMANGLE_COMPONENT_RESTRICT_THIS:
case DEMANGLE_COMPONENT_VOLATILE_THIS:
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
- ret_comp = d_left (ret_comp);
- break;
+ ret_comp = d_left (ret_comp);
+ break;
case DEMANGLE_COMPONENT_NAME:
case DEMANGLE_COMPONENT_CTOR:
case DEMANGLE_COMPONENT_DTOR:
case DEMANGLE_COMPONENT_RESTRICT_THIS:
case DEMANGLE_COMPONENT_VOLATILE_THIS:
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
- ret_comp = d_left (ret_comp);
- break;
+ ret_comp = d_left (ret_comp);
+ break;
default:
done = true;
break;
while (type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
- || type->code () == TYPE_CODE_ARRAY
- || type->code () == TYPE_CODE_TYPEDEF)
+ || type->code () == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_TYPEDEF)
{
if (type->code () == TYPE_CODE_TYPEDEF)
type = check_typedef (type);
if (current->searched)
continue;
- /* If this is a namespace alias or imported declaration ignore
+ /* If this is a namespace alias or imported declaration ignore
it. */
- if (current->alias != NULL || current->declaration != NULL)
- continue;
+ if (current->alias != NULL || current->declaration != NULL)
+ continue;
- if (strcmp (the_namespace, current->import_dest) == 0)
+ if (strcmp (the_namespace, current->import_dest) == 0)
{
/* Mark this import as searched so that the recursive call
does not search it again. */
if (catch_demangler_crashes)
{
/* The signal handler may keep the signal blocked when we longjmp out
- of it. If we have sigprocmask, we can use it to unblock the signal
+ of it. If we have sigprocmask, we can use it to unblock the signal
afterwards and we can avoid the performance overhead of saving the
signal mask just in case the signal gets triggered. Otherwise, just
tell sigsetjmp to save the mask. */
if (catch_demangler_crashes)
{
if (crash_signal != 0)
- {
+ {
#ifdef HAVE_SIGPROCMASK
/* If we got the signal, SIGSEGV may still be blocked; restore it. */
sigset_t segv_sig_set;
/* If there was a failure, we can't report it here, because
we might be in a background thread. Instead, arrange for
the reporting to happen on the main thread. */
- std::string copy = name;
- run_on_main_thread ([=] ()
- {
- report_failed_demangle (copy.c_str (), core_dump_allowed,
- crash_signal);
- });
-
- result = NULL;
- }
+ std::string copy = name;
+ run_on_main_thread ([=] ()
+ {
+ report_failed_demangle (copy.c_str (), core_dump_allowed,
+ crash_signal);
+ });
+
+ result = NULL;
+ }
}
#endif
|| type->code () == TYPE_CODE_PTR) /* if using thunks */
{
/* Virtual functions tables are full of pointers
- to virtual functions. */
+ to virtual functions. */
return cp_is_vtbl_ptr_type (type);
}
}
struct value *v;
/* Bitfields require special handling, especially due to
- byte order problems. */
+ byte order problems. */
if (TYPE_FIELD_IGNORE (type, i))
{
fputs_styled ("<optimized out or zero length>",
if (dont_print_statmem == 0)
{
size_t obstack_final_size =
- obstack_object_size (&dont_print_statmem_obstack);
+ obstack_object_size (&dont_print_statmem_obstack);
if (obstack_final_size > statmem_obstack_initial_size)
{
if (dont_print_vb == 0)
{
/* If we're at top level, carve out a completely fresh chunk of
- the obstack and use that until this particular invocation
- returns. */
+ the obstack and use that until this particular invocation
+ returns. */
/* Bump up the high-water mark. Now alpha is omega. */
obstack_finish (&dont_print_vb_obstack);
}
}
fputs_filtered ("<", stream);
/* Not sure what the best notation is in the case where there is
- no baseclass name. */
+ no baseclass name. */
fputs_filtered (basename ? basename : "", stream);
fputs_filtered ("> = ", stream);
if (dont_print_vb == 0)
{
/* Free the space used to deal with the printing
- of this type from top level. */
+ of this type from top level. */
obstack_free (&dont_print_vb_obstack, last_dont_print);
/* Reset watermark so that we can continue protecting
- ourselves from whatever we were protecting ourselves. */
+ ourselves from whatever we were protecting ourselves. */
dont_print_vb_obstack = tmp_obstack;
}
}
if (tdep->cris_version == 32)
/* Threaded debugging is only supported on CRISv32 for now. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
set_solib_svr4_fetch_link_map_offsets (gdbarch,
svr4_ilp32_fetch_link_map_offsets);
static void
cris_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
struct cris_unwind_cache *cache =
cris_sigtramp_frame_unwind_cache (this_frame, this_cache);
void **this_cache, int regnum);
static struct value *
cris_sigtramp_frame_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+ void **this_cache, int regnum)
{
/* Make sure we've initialized the cache. */
cris_sigtramp_frame_unwind_cache (this_frame, this_cache);
/* Functions for opcodes. The general form of the ETRAX 16-bit instruction:
Bit 15 - 12 Operand2
11 - 10 Mode
- 9 - 6 Opcode
- 5 - 4 Size
- 3 - 0 Operand1 */
+ 9 - 6 Opcode
+ 5 - 4 Size
+ 3 - 0 Operand1 */
static int
cris_get_operand2 (unsigned short insn)
inst_env_type *);
static struct gdbarch *cris_gdbarch_init (struct gdbarch_info,
- struct gdbarch_list *);
+ struct gdbarch_list *);
static void cris_dump_tdep (struct gdbarch *, struct ui_file *);
static CORE_ADDR
cris_push_dummy_code (struct gdbarch *gdbarch,
- CORE_ADDR sp, CORE_ADDR funaddr,
- struct value **args, int nargs,
- struct type *value_type,
- CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
+ CORE_ADDR sp, CORE_ADDR funaddr,
+ struct value **args, int nargs,
+ struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
struct regcache *regcache)
{
/* Allocate space sufficient for a breakpoint. */
/* How may registers worth of storage do we need for this argument? */
reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);
-
+
if (len <= (2 * 4) && (argreg + reg_demand - 1 <= ARG4_REGNUM))
- {
- /* Data passed by value. Fits in available register(s). */
- for (i = 0; i < reg_demand; i++)
- {
- regcache->cooked_write (argreg, val);
- argreg++;
- val += 4;
- }
- }
+ {
+ /* Data passed by value. Fits in available register(s). */
+ for (i = 0; i < reg_demand; i++)
+ {
+ regcache->cooked_write (argreg, val);
+ argreg++;
+ val += 4;
+ }
+ }
else if (len <= (2 * 4) && argreg <= ARG4_REGNUM)
- {
- /* Data passed by value. Does not fit in available register(s).
- Use the register(s) first, then the stack. */
- for (i = 0; i < reg_demand; i++)
- {
- if (argreg <= ARG4_REGNUM)
- {
- regcache->cooked_write (argreg, val);
- argreg++;
- val += 4;
- }
- else
- {
+ {
+ /* Data passed by value. Does not fit in available register(s).
+ Use the register(s) first, then the stack. */
+ for (i = 0; i < reg_demand; i++)
+ {
+ if (argreg <= ARG4_REGNUM)
+ {
+ regcache->cooked_write (argreg, val);
+ argreg++;
+ val += 4;
+ }
+ else
+ {
/* Push item for later so that pushed arguments
come in the right order. */
si = push_stack_item (si, val, 4);
- val += 4;
- }
- }
- }
+ val += 4;
+ }
+ }
+ }
else if (len > (2 * 4))
- {
+ {
/* Data passed by reference. Push copy of data onto stack
and pass pointer to this copy as argument. */
sp = (sp - len) & ~3;
store_unsigned_integer (buf, 4, byte_order, sp);
si = push_stack_item (si, buf, 4);
}
- }
+ }
else
- {
- /* Data passed by value. No available registers. Put it on
- the stack. */
+ {
+ /* Data passed by value. No available registers. Put it on
+ the stack. */
si = push_stack_item (si, val, len);
- }
+ }
}
while (si)
insn = read_memory_unsigned_integer (pc, 2, byte_order);
pc += 2;
if (insn == 0xE1FC)
- {
- /* push <reg> 32 bit instruction. */
- insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
- pc += 2;
- regno = cris_get_operand2 (insn_next);
+ {
+ /* push <reg> 32 bit instruction. */
+ insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
+ pc += 2;
+ regno = cris_get_operand2 (insn_next);
if (info)
{
info->sp_offset += 4;
}
- /* This check, meant to recognize srp, used to be regno ==
- (SRP_REGNUM - NUM_GENREGS), but that covers r11 also. */
- if (insn_next == 0xBE7E)
- {
+ /* This check, meant to recognize srp, used to be regno ==
+ (SRP_REGNUM - NUM_GENREGS), but that covers r11 also. */
+ if (insn_next == 0xBE7E)
+ {
if (info)
{
info->leaf_function = 0;
}
- }
+ }
else if (insn_next == 0x8FEE)
- {
+ {
/* push $r8 */
if (info)
{
info->r8_offset = info->sp_offset;
}
- }
- }
+ }
+ }
else if (insn == 0x866E)
- {
- /* move.d sp,r8 */
+ {
+ /* move.d sp,r8 */
if (info)
{
info->uses_frame = 1;
}
- continue;
- }
+ continue;
+ }
else if (cris_get_operand2 (insn) == gdbarch_sp_regnum (gdbarch)
- && cris_get_mode (insn) == 0x0000
- && cris_get_opcode (insn) == 0x000A)
- {
- /* subq <val>,sp */
+ && cris_get_mode (insn) == 0x0000
+ && cris_get_opcode (insn) == 0x000A)
+ {
+ /* subq <val>,sp */
if (info)
{
info->sp_offset += cris_get_quick_value (insn);
}
- }
+ }
else if (cris_get_mode (insn) == 0x0002
- && cris_get_opcode (insn) == 0x000F
- && cris_get_size (insn) == 0x0003
- && cris_get_operand1 (insn) == gdbarch_sp_regnum (gdbarch))
- {
- /* movem r<regsave>,[sp] */
- regsave = cris_get_operand2 (insn);
- }
+ && cris_get_opcode (insn) == 0x000F
+ && cris_get_size (insn) == 0x0003
+ && cris_get_operand1 (insn) == gdbarch_sp_regnum (gdbarch))
+ {
+ /* movem r<regsave>,[sp] */
+ regsave = cris_get_operand2 (insn);
+ }
else if (cris_get_operand2 (insn) == gdbarch_sp_regnum (gdbarch)
- && ((insn & 0x0F00) >> 8) == 0x0001
- && (cris_get_signed_offset (insn) < 0))
- {
- /* Immediate byte offset addressing prefix word with sp as base
- register. Used for CRIS v8 i.e. ETRAX 100 and newer if <val>
- is between 64 and 128.
- movem r<regsave>,[sp=sp-<val>] */
+ && ((insn & 0x0F00) >> 8) == 0x0001
+ && (cris_get_signed_offset (insn) < 0))
+ {
+ /* Immediate byte offset addressing prefix word with sp as base
+ register. Used for CRIS v8 i.e. ETRAX 100 and newer if <val>
+ is between 64 and 128.
+ movem r<regsave>,[sp=sp-<val>] */
if (info)
{
info->sp_offset += -cris_get_signed_offset (insn);
}
insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
- pc += 2;
- if (cris_get_mode (insn_next) == PREFIX_ASSIGN_MODE
- && cris_get_opcode (insn_next) == 0x000F
- && cris_get_size (insn_next) == 0x0003
- && cris_get_operand1 (insn_next) == gdbarch_sp_regnum
+ pc += 2;
+ if (cris_get_mode (insn_next) == PREFIX_ASSIGN_MODE
+ && cris_get_opcode (insn_next) == 0x000F
+ && cris_get_size (insn_next) == 0x0003
+ && cris_get_operand1 (insn_next) == gdbarch_sp_regnum
(gdbarch))
- {
- regsave = cris_get_operand2 (insn_next);
- }
- else
- {
- /* The prologue ended before the limit was reached. */
- pc -= 4;
- break;
- }
- }
+ {
+ regsave = cris_get_operand2 (insn_next);
+ }
+ else
+ {
+ /* The prologue ended before the limit was reached. */
+ pc -= 4;
+ break;
+ }
+ }
else if (cris_get_mode (insn) == 0x0001
- && cris_get_opcode (insn) == 0x0009
- && cris_get_size (insn) == 0x0002)
- {
- /* move.d r<10..13>,r<0..15> */
- source_register = cris_get_operand1 (insn);
-
- /* FIXME? In the glibc solibs, the prologue might contain something
- like (this example taken from relocate_doit):
- move.d $pc,$r0
- sub.d 0xfffef426,$r0
- which isn't covered by the source_register check below. Question
- is whether to add a check for this combo, or make better use of
- the limit variable instead. */
- if (source_register < ARG1_REGNUM || source_register > ARG4_REGNUM)
- {
- /* The prologue ended before the limit was reached. */
- pc -= 2;
- break;
- }
- }
+ && cris_get_opcode (insn) == 0x0009
+ && cris_get_size (insn) == 0x0002)
+ {
+ /* move.d r<10..13>,r<0..15> */
+ source_register = cris_get_operand1 (insn);
+
+ /* FIXME? In the glibc solibs, the prologue might contain something
+ like (this example taken from relocate_doit):
+ move.d $pc,$r0
+ sub.d 0xfffef426,$r0
+ which isn't covered by the source_register check below. Question
+ is whether to add a check for this combo, or make better use of
+ the limit variable instead. */
+ if (source_register < ARG1_REGNUM || source_register > ARG4_REGNUM)
+ {
+ /* The prologue ended before the limit was reached. */
+ pc -= 2;
+ break;
+ }
+ }
else if (cris_get_operand2 (insn) == CRIS_FP_REGNUM
- /* The size is a fixed-size. */
- && ((insn & 0x0F00) >> 8) == 0x0001
- /* A negative offset. */
- && (cris_get_signed_offset (insn) < 0))
- {
- /* move.S rZ,[r8-U] (?) */
- insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
- pc += 2;
- regno = cris_get_operand2 (insn_next);
- if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
- && cris_get_mode (insn_next) == PREFIX_OFFSET_MODE
- && cris_get_opcode (insn_next) == 0x000F)
- {
- /* move.S rZ,[r8-U] */
- continue;
- }
- else
- {
- /* The prologue ended before the limit was reached. */
- pc -= 4;
- break;
- }
- }
+ /* The size is a fixed-size. */
+ && ((insn & 0x0F00) >> 8) == 0x0001
+ /* A negative offset. */
+ && (cris_get_signed_offset (insn) < 0))
+ {
+ /* move.S rZ,[r8-U] (?) */
+ insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
+ pc += 2;
+ regno = cris_get_operand2 (insn_next);
+ if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
+ && cris_get_mode (insn_next) == PREFIX_OFFSET_MODE
+ && cris_get_opcode (insn_next) == 0x000F)
+ {
+ /* move.S rZ,[r8-U] */
+ continue;
+ }
+ else
+ {
+ /* The prologue ended before the limit was reached. */
+ pc -= 4;
+ break;
+ }
+ }
else if (cris_get_operand2 (insn) == CRIS_FP_REGNUM
- /* The size is a fixed-size. */
- && ((insn & 0x0F00) >> 8) == 0x0001
- /* A positive offset. */
- && (cris_get_signed_offset (insn) > 0))
- {
- /* move.S [r8+U],rZ (?) */
+ /* The size is a fixed-size. */
+ && ((insn & 0x0F00) >> 8) == 0x0001
+ /* A positive offset. */
+ && (cris_get_signed_offset (insn) > 0))
+ {
+ /* move.S [r8+U],rZ (?) */
insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
- pc += 2;
- regno = cris_get_operand2 (insn_next);
- if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
- && cris_get_mode (insn_next) == PREFIX_OFFSET_MODE
- && cris_get_opcode (insn_next) == 0x0009
- && cris_get_operand1 (insn_next) == regno)
- {
- /* move.S [r8+U],rZ */
- continue;
- }
- else
- {
- /* The prologue ended before the limit was reached. */
- pc -= 4;
- break;
- }
- }
+ pc += 2;
+ regno = cris_get_operand2 (insn_next);
+ if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
+ && cris_get_mode (insn_next) == PREFIX_OFFSET_MODE
+ && cris_get_opcode (insn_next) == 0x0009
+ && cris_get_operand1 (insn_next) == regno)
+ {
+ /* move.S [r8+U],rZ */
+ continue;
+ }
+ else
+ {
+ /* The prologue ended before the limit was reached. */
+ pc -= 4;
+ break;
+ }
+ }
else
- {
- /* The prologue ended before the limit was reached. */
- pc -= 2;
- break;
- }
+ {
+ /* The prologue ended before the limit was reached. */
+ pc -= 2;
+ break;
+ }
}
/* We only want to know the end of the prologue when this_frame and info
{
ULONGEST this_base;
/* The SP was moved to the FP. This indicates that a new frame
- was created. Get THIS frame's FP value by unwinding it from
- the next frame. */
+ was created. Get THIS frame's FP value by unwinding it from
+ the next frame. */
this_base = get_frame_register_unsigned (this_frame, CRIS_FP_REGNUM);
info->base = this_base;
info->saved_regs[CRIS_FP_REGNUM].addr = info->base;
/* The FP points at the last saved register. Adjust the FP back
- to before the first saved register giving the SP. */
+ to before the first saved register giving the SP. */
info->prev_sp = info->base + info->r8_offset;
}
else
{
ULONGEST this_base;
/* Assume that the FP is this frame's SP but with that pushed
- stack space added back. */
+ stack space added back. */
this_base = get_frame_register_unsigned (this_frame,
gdbarch_sp_regnum (gdbarch));
info->base = this_base;
else if (regno >= NUM_GENREGS && regno < (NUM_GENREGS + NUM_SPECREGS))
{
/* Special register (R16 - R31). cris_spec_regs is zero-based.
- Adjust regno accordingly. */
+ Adjust regno accordingly. */
spec_regno = regno - NUM_GENREGS;
for (i = 0; cris_spec_regs[i].name != NULL; i++)
- {
- if (cris_spec_regs[i].number == spec_regno
- && cris_spec_reg_applicable (gdbarch, cris_spec_regs[i]))
- /* Go with the first applicable register. */
- return cris_spec_regs[i].reg_size;
- }
+ {
+ if (cris_spec_regs[i].number == spec_regno
+ && cris_spec_reg_applicable (gdbarch, cris_spec_regs[i]))
+ /* Go with the first applicable register. */
+ return cris_spec_regs[i].reg_size;
+ }
/* Special register not applicable to this CRIS version. */
return 0;
}
cris_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
{
return ((regno < 0 || regno >= gdbarch_num_regs (gdbarch))
- || (cris_register_size (gdbarch, regno) == 0));
+ || (cris_register_size (gdbarch, regno) == 0));
}
/* Nonzero if regno should not be written to the target, for various
crisv32_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
{
return ((regno < 0 || regno >= gdbarch_num_regs (gdbarch))
- || (cris_register_size (gdbarch, regno) == 0));
+ || (cris_register_size (gdbarch, regno) == 0));
}
/* Nonzero if regno should not be written to the target, for various
static void
cris_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
- struct dwarf2_frame_state_reg *reg,
+ struct dwarf2_frame_state_reg *reg,
struct frame_info *this_frame)
{
/* The return address column. */
static int
constraint (unsigned int insn, const char *inst_args,
- inst_env_type *inst_env)
+ inst_env_type *inst_env)
{
int retval = 0;
int tmp, i;
switch (*s)
{
case 'm':
- if ((insn & 0x30) == 0x30)
- return -1;
- break;
-
+ if ((insn & 0x30) == 0x30)
+ return -1;
+ break;
+
case 'S':
- /* A prefix operand. */
- if (inst_env->prefix_found)
- break;
- else
- return -1;
+ /* A prefix operand. */
+ if (inst_env->prefix_found)
+ break;
+ else
+ return -1;
case 'B':
- /* A "push" prefix. (This check was REMOVED by san 970921.) Check for
- valid "push" size. In case of special register, it may be != 4. */
- if (inst_env->prefix_found)
- break;
- else
- return -1;
+ /* A "push" prefix. (This check was REMOVED by san 970921.) Check for
+ valid "push" size. In case of special register, it may be != 4. */
+ if (inst_env->prefix_found)
+ break;
+ else
+ return -1;
case 'D':
- retval = (((insn >> 0xC) & 0xF) == (insn & 0xF));
- if (!retval)
- return -1;
- else
- retval += 4;
- break;
+ retval = (((insn >> 0xC) & 0xF) == (insn & 0xF));
+ if (!retval)
+ return -1;
+ else
+ retval += 4;
+ break;
case 'P':
- tmp = (insn >> 0xC) & 0xF;
-
- for (i = 0; cris_spec_regs[i].name != NULL; i++)
- {
- /* Since we match four bits, we will give a value of
- 4 - 1 = 3 in a match. If there is a corresponding
- exact match of a special register in another pattern, it
- will get a value of 4, which will be higher. This should
- be correct in that an exact pattern would match better that
- a general pattern.
- Note that there is a reason for not returning zero; the
- pattern for "clear" is partly matched in the bit-pattern
- (the two lower bits must be zero), while the bit-pattern
- for a move from a special register is matched in the
- register constraint.
- This also means we will will have a race condition if
- there is a partly match in three bits in the bit pattern. */
- if (tmp == cris_spec_regs[i].number)
- {
- retval += 3;
- break;
- }
- }
-
- if (cris_spec_regs[i].name == NULL)
- return -1;
- break;
+ tmp = (insn >> 0xC) & 0xF;
+
+ for (i = 0; cris_spec_regs[i].name != NULL; i++)
+ {
+ /* Since we match four bits, we will give a value of
+ 4 - 1 = 3 in a match. If there is a corresponding
+ exact match of a special register in another pattern, it
+ will get a value of 4, which will be higher. This should
+ be correct in that an exact pattern would match better that
+ a general pattern.
+ Note that there is a reason for not returning zero; the
+ pattern for "clear" is partly matched in the bit-pattern
+ (the two lower bits must be zero), while the bit-pattern
+ for a move from a special register is matched in the
+ register constraint.
+ This also means we will will have a race condition if
+ there is a partly match in three bits in the bit pattern. */
+ if (tmp == cris_spec_regs[i].number)
+ {
+ retval += 3;
+ break;
+ }
+ }
+
+ if (cris_spec_regs[i].name == NULL)
+ return -1;
+ break;
}
return retval;
}
for (i = 0; cris_opcodes[i].name != NULL; i++)
{
if (((cris_opcodes[i].match & insn) == cris_opcodes[i].match)
- && ((cris_opcodes[i].lose & insn) == 0)
+ && ((cris_opcodes[i].lose & insn) == 0)
/* Only CRISv10 instructions, please. */
&& (cris_opcodes[i].applicable_version != cris_ver_v32p))
- {
- level_of_match = constraint (insn, cris_opcodes[i].args, inst_env);
- if (level_of_match >= 0)
- {
- level_of_match +=
- number_of_bits (cris_opcodes[i].match | cris_opcodes[i].lose);
- if (level_of_match > max_level_of_match)
- {
- max_matched = i;
- max_level_of_match = level_of_match;
- if (level_of_match == 16)
- {
- /* All bits matched, cannot find better. */
- break;
- }
- }
- }
- }
+ {
+ level_of_match = constraint (insn, cris_opcodes[i].args, inst_env);
+ if (level_of_match >= 0)
+ {
+ level_of_match +=
+ number_of_bits (cris_opcodes[i].match | cris_opcodes[i].lose);
+ if (level_of_match > max_level_of_match)
+ {
+ max_matched = i;
+ max_level_of_match = level_of_match;
+ if (level_of_match == 16)
+ {
+ /* All bits matched, cannot find better. */
+ break;
+ }
+ }
+ }
+ }
}
return max_matched;
}
(inst_env->reg[gdbarch_pc_regnum (gdbarch)], 2, byte_order);
/* If the instruction is not in a delay slot the new content of the
- PC is [PC] + 2. If the instruction is in a delay slot it is not
- that simple. Since a instruction in a delay slot cannot change
- the content of the PC, it does not matter what value PC will have.
- Just make sure it is a valid instruction. */
+ PC is [PC] + 2. If the instruction is in a delay slot it is not
+ that simple. Since a instruction in a delay slot cannot change
+ the content of the PC, it does not matter what value PC will have.
+ Just make sure it is a valid instruction. */
if (!inst_env->delay_slot_pc_active)
- {
- inst_env->reg[gdbarch_pc_regnum (gdbarch)] += 2;
- }
+ {
+ inst_env->reg[gdbarch_pc_regnum (gdbarch)] += 2;
+ }
else
- {
- inst_env->delay_slot_pc_active = 0;
- inst_env->reg[gdbarch_pc_regnum (gdbarch)]
+ {
+ inst_env->delay_slot_pc_active = 0;
+ inst_env->reg[gdbarch_pc_regnum (gdbarch)]
= inst_env->delay_slot_pc;
- }
+ }
/* Analyse the present instruction. */
i = find_cris_op (insn, inst_env);
if (i == -1)
- {
- inst_env->invalid = 1;
- }
+ {
+ inst_env->invalid = 1;
+ }
else
- {
- cris_gdb_func (gdbarch, cris_opcodes[i].op, insn, inst_env);
- }
+ {
+ cris_gdb_func (gdbarch, cris_opcodes[i].op, insn, inst_env);
+ }
} while (!inst_env->invalid
- && (inst_env->prefix_found || inst_env->xflag_found
- || inst_env->slot_needed));
+ && (inst_env->prefix_found || inst_env->xflag_found
+ || inst_env->slot_needed));
return i;
}
else
{
/* Insert at most two breakpoints. One for the next PC content
- and possibly another one for a branch, jump, etc. */
+ and possibly another one for a branch, jump, etc. */
CORE_ADDR next_pc
= (CORE_ADDR) inst_env.reg[gdbarch_pc_regnum (gdbarch)];
inst_env->reg[cris_get_operand1 (inst)] += 1;
/* The PC must be word aligned, so increase the PC with one
- word even if the size is byte. */
+ word even if the size is byte. */
if (cris_get_operand1 (inst) == REG_PC)
- {
- inst_env->reg[REG_PC] += 1;
- }
+ {
+ inst_env->reg[REG_PC] += 1;
+ }
}
else if (size == INST_WORD_SIZE)
{
/* It's invalid to change to the PC if we are in a delay slot. */
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
value = (long) inst_env->reg[REG_PC];
/* The value of abs (SIGNED_DWORD_MASK) is SIGNED_DWORD_MASK. */
if (value != SIGNED_DWORD_MASK)
- {
- value = -value;
- inst_env->reg[REG_PC] = (long) value;
- }
+ {
+ value = -value;
+ inst_env->reg[REG_PC] = (long) value;
+ }
}
inst_env->slot_needed = 0;
{
/* It's invalid to change the PC in a delay slot. */
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
/* Get the number of bits to shift. */
shift_steps
= cris_get_asr_shift_steps (inst_env->reg[cris_get_operand1 (inst)]);
/* Find out how many bits the operation should apply to. */
if (cris_get_size (inst) == INST_BYTE_SIZE)
- {
- if (value & SIGNED_BYTE_MASK)
- {
- signed_extend_mask = 0xFF;
- signed_extend_mask = signed_extend_mask >> shift_steps;
- signed_extend_mask = ~signed_extend_mask;
- }
- value = value >> shift_steps;
- value |= signed_extend_mask;
- value &= 0xFF;
- inst_env->reg[REG_PC] &= 0xFFFFFF00;
- inst_env->reg[REG_PC] |= value;
- }
+ {
+ if (value & SIGNED_BYTE_MASK)
+ {
+ signed_extend_mask = 0xFF;
+ signed_extend_mask = signed_extend_mask >> shift_steps;
+ signed_extend_mask = ~signed_extend_mask;
+ }
+ value = value >> shift_steps;
+ value |= signed_extend_mask;
+ value &= 0xFF;
+ inst_env->reg[REG_PC] &= 0xFFFFFF00;
+ inst_env->reg[REG_PC] |= value;
+ }
else if (cris_get_size (inst) == INST_WORD_SIZE)
- {
- if (value & SIGNED_WORD_MASK)
- {
- signed_extend_mask = 0xFFFF;
- signed_extend_mask = signed_extend_mask >> shift_steps;
- signed_extend_mask = ~signed_extend_mask;
- }
- value = value >> shift_steps;
- value |= signed_extend_mask;
- value &= 0xFFFF;
- inst_env->reg[REG_PC] &= 0xFFFF0000;
- inst_env->reg[REG_PC] |= value;
- }
+ {
+ if (value & SIGNED_WORD_MASK)
+ {
+ signed_extend_mask = 0xFFFF;
+ signed_extend_mask = signed_extend_mask >> shift_steps;
+ signed_extend_mask = ~signed_extend_mask;
+ }
+ value = value >> shift_steps;
+ value |= signed_extend_mask;
+ value &= 0xFFFF;
+ inst_env->reg[REG_PC] &= 0xFFFF0000;
+ inst_env->reg[REG_PC] |= value;
+ }
else if (cris_get_size (inst) == INST_DWORD_SIZE)
- {
- if (value & SIGNED_DWORD_MASK)
- {
- signed_extend_mask = 0xFFFFFFFF;
- signed_extend_mask = signed_extend_mask >> shift_steps;
- signed_extend_mask = ~signed_extend_mask;
- }
- value = value >> shift_steps;
- value |= signed_extend_mask;
- inst_env->reg[REG_PC] = value;
- }
+ {
+ if (value & SIGNED_DWORD_MASK)
+ {
+ signed_extend_mask = 0xFFFFFFFF;
+ signed_extend_mask = signed_extend_mask >> shift_steps;
+ signed_extend_mask = ~signed_extend_mask;
+ }
+ value = value >> shift_steps;
+ value |= signed_extend_mask;
+ inst_env->reg[REG_PC] = value;
+ }
}
inst_env->slot_needed = 0;
inst_env->prefix_found = 0;
/* It's invalid to change the PC in a delay slot. */
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
/* The shift size is given as a 5 bit quick value, i.e. we don't
- want the sign bit of the quick value. */
+ want the sign bit of the quick value. */
shift_steps = cris_get_asr_shift_steps (inst);
value = inst_env->reg[REG_PC];
if (value & SIGNED_DWORD_MASK)
- {
- signed_extend_mask = 0xFFFFFFFF;
- signed_extend_mask = signed_extend_mask >> shift_steps;
- signed_extend_mask = ~signed_extend_mask;
- }
+ {
+ signed_extend_mask = 0xFFFFFFFF;
+ signed_extend_mask = signed_extend_mask >> shift_steps;
+ signed_extend_mask = ~signed_extend_mask;
+ }
value = value >> shift_steps;
value |= signed_extend_mask;
inst_env->reg[REG_PC] = value;
{
/* It's invalid to change the PC in a delay slot. */
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
process_autoincrement (cris_get_size (inst), inst, inst_env);
}
inst_env->slot_needed = 0;
/* The instruction will clear the instruction's size bits. */
int clear_size = cris_get_clear_size (inst);
if (clear_size == INST_BYTE_SIZE)
- {
- inst_env->delay_slot_pc = inst_env->reg[REG_PC] & 0xFFFFFF00;
- }
+ {
+ inst_env->delay_slot_pc = inst_env->reg[REG_PC] & 0xFFFFFF00;
+ }
if (clear_size == INST_WORD_SIZE)
- {
- inst_env->delay_slot_pc = inst_env->reg[REG_PC] & 0xFFFF0000;
- }
+ {
+ inst_env->delay_slot_pc = inst_env->reg[REG_PC] & 0xFFFF0000;
+ }
if (clear_size == INST_DWORD_SIZE)
- {
- inst_env->delay_slot_pc = 0x0;
- }
+ {
+ inst_env->delay_slot_pc = 0x0;
+ }
/* The jump will be delayed with one delay slot. So we need a delay
- slot. */
+ slot. */
inst_env->slot_needed = 1;
inst_env->delay_slot_pc_active = 1;
}
if (inst_env->prefix_found)
{
/* The only way the PC can change is if this instruction is in
- assign addressing mode. */
+ assign addressing mode. */
check_assign (inst, inst_env);
}
/* Indirect mode can't change the PC so just check if the mode is
{
/* Check if we have a prefix. */
if (inst_env->prefix_found)
- {
- check_assign (inst, inst_env);
-
- /* Get the new value for the PC. */
- newpc =
- read_memory_unsigned_integer ((CORE_ADDR) inst_env->prefix_value,
- 4, inst_env->byte_order);
- }
+ {
+ check_assign (inst, inst_env);
+
+ /* Get the new value for the PC. */
+ newpc =
+ read_memory_unsigned_integer ((CORE_ADDR) inst_env->prefix_value,
+ 4, inst_env->byte_order);
+ }
else
- {
- /* Get the new value for the PC. */
- address = (CORE_ADDR) inst_env->reg[cris_get_operand1 (inst)];
- newpc = read_memory_unsigned_integer (address,
+ {
+ /* Get the new value for the PC. */
+ address = (CORE_ADDR) inst_env->reg[cris_get_operand1 (inst)];
+ newpc = read_memory_unsigned_integer (address,
4, inst_env->byte_order);
- /* Check if we should increment a register. */
- if (cris_get_mode (inst) == AUTOINC_MODE)
- {
- inst_env->reg[cris_get_operand1 (inst)] += 4;
- }
- }
+ /* Check if we should increment a register. */
+ if (cris_get_mode (inst) == AUTOINC_MODE)
+ {
+ inst_env->reg[cris_get_operand1 (inst)] += 4;
+ }
+ }
inst_env->reg[REG_PC] = newpc;
}
inst_env->slot_needed = 0;
if (inst_env->prefix_found)
{
/* The instruction has a prefix that means we are only interested if
- the instruction is in assign mode. */
+ the instruction is in assign mode. */
if (cris_get_mode (inst) == PREFIX_ASSIGN_MODE)
- {
- /* The prefix handles the problem if we are in a delay slot. */
- if (cris_get_operand1 (inst) == REG_PC)
- {
- /* Just take care of the assign. */
- check_assign (inst, inst_env);
- }
- }
+ {
+ /* The prefix handles the problem if we are in a delay slot. */
+ if (cris_get_operand1 (inst) == REG_PC)
+ {
+ /* Just take care of the assign. */
+ check_assign (inst, inst_env);
+ }
+ }
}
else if (cris_get_mode (inst) == AUTOINC_MODE)
{
/* The instruction doesn't have a prefix, the only case left that we
- are interested in is the autoincrement mode. */
+ are interested in is the autoincrement mode. */
if (cris_get_operand1 (inst) == REG_PC)
- {
- /* If the PC is to be incremented it's invalid to be in a
- delay slot. */
- if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
-
- /* The increment depends on the size of the special register. */
- if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 1)
- {
- process_autoincrement (INST_BYTE_SIZE, inst, inst_env);
- }
- else if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 2)
- {
- process_autoincrement (INST_WORD_SIZE, inst, inst_env);
- }
- else
- {
- process_autoincrement (INST_DWORD_SIZE, inst, inst_env);
- }
- }
+ {
+ /* If the PC is to be incremented it's invalid to be in a
+ delay slot. */
+ if (inst_env->slot_needed)
+ {
+ inst_env->invalid = 1;
+ return;
+ }
+
+ /* The increment depends on the size of the special register. */
+ if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 1)
+ {
+ process_autoincrement (INST_BYTE_SIZE, inst, inst_env);
+ }
+ else if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 2)
+ {
+ process_autoincrement (INST_WORD_SIZE, inst, inst_env);
+ }
+ else
+ {
+ process_autoincrement (INST_DWORD_SIZE, inst, inst_env);
+ }
+ }
}
inst_env->slot_needed = 0;
inst_env->prefix_found = 0;
if (inst_env->prefix_found)
{
/* The instruction has a prefix that means we are only interested if
- the instruction is in assign mode. */
+ the instruction is in assign mode. */
if (cris_get_mode (inst) == PREFIX_ASSIGN_MODE)
- {
- /* The prefix handles the problem if we are in a delay slot. */
- if (cris_get_operand1 (inst) == REG_PC)
- {
- /* Just take care of the assign. */
- check_assign (inst, inst_env);
- }
- }
+ {
+ /* The prefix handles the problem if we are in a delay slot. */
+ if (cris_get_operand1 (inst) == REG_PC)
+ {
+ /* Just take care of the assign. */
+ check_assign (inst, inst_env);
+ }
+ }
}
/* The instruction doesn't have a prefix, the only case left that we
are interested in is the autoincrement mode. */
else if (cris_get_mode (inst) == AUTOINC_MODE)
{
if (cris_get_operand1 (inst) == REG_PC)
- {
- /* If the PC is to be incremented it's invalid to be in a
- delay slot. */
- if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
-
- /* The increment depends on the size of the special register. */
- if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 1)
- {
- process_autoincrement (INST_BYTE_SIZE, inst, inst_env);
- }
- else if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 2)
- {
- process_autoincrement (INST_WORD_SIZE, inst, inst_env);
- }
- else
- {
- process_autoincrement (INST_DWORD_SIZE, inst, inst_env);
- }
- }
+ {
+ /* If the PC is to be incremented it's invalid to be in a
+ delay slot. */
+ if (inst_env->slot_needed)
+ {
+ inst_env->invalid = 1;
+ return;
+ }
+
+ /* The increment depends on the size of the special register. */
+ if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 1)
+ {
+ process_autoincrement (INST_BYTE_SIZE, inst, inst_env);
+ }
+ else if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 2)
+ {
+ process_autoincrement (INST_WORD_SIZE, inst, inst_env);
+ }
+ else
+ {
+ process_autoincrement (INST_DWORD_SIZE, inst, inst_env);
+ }
+ }
}
inst_env->slot_needed = 0;
inst_env->prefix_found = 0;
{
/* It's invalid to change the PC in a delay slot. */
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
/* The destination is the PC, the jump will have a delay slot. */
inst_env->delay_slot_pc = inst_env->preg[cris_get_operand2 (inst)];
inst_env->slot_needed = 1;
if (inst_env->prefix_found)
{
/* The prefix handles the problem if we are in a delay slot. Is the
- MOVEM instruction going to change the PC? */
+ MOVEM instruction going to change the PC? */
if (cris_get_operand2 (inst) >= REG_PC)
- {
- inst_env->reg[REG_PC] =
- read_memory_unsigned_integer (inst_env->prefix_value,
+ {
+ inst_env->reg[REG_PC] =
+ read_memory_unsigned_integer (inst_env->prefix_value,
4, inst_env->byte_order);
- }
+ }
/* The assign value is the value after the increment. Normally, the
- assign value is the value before the increment. */
+ assign value is the value before the increment. */
if ((cris_get_operand1 (inst) == REG_PC)
- && (cris_get_mode (inst) == PREFIX_ASSIGN_MODE))
- {
- inst_env->reg[REG_PC] = inst_env->prefix_value;
- inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
- }
+ && (cris_get_mode (inst) == PREFIX_ASSIGN_MODE))
+ {
+ inst_env->reg[REG_PC] = inst_env->prefix_value;
+ inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
+ }
}
else
{
/* Is the MOVEM instruction going to change the PC? */
if (cris_get_operand2 (inst) == REG_PC)
- {
- /* It's invalid to change the PC in a delay slot. */
- if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
- inst_env->reg[REG_PC] =
- read_memory_unsigned_integer (inst_env->reg[cris_get_operand1 (inst)],
- 4, inst_env->byte_order);
- }
+ {
+ /* It's invalid to change the PC in a delay slot. */
+ if (inst_env->slot_needed)
+ {
+ inst_env->invalid = 1;
+ return;
+ }
+ inst_env->reg[REG_PC] =
+ read_memory_unsigned_integer (inst_env->reg[cris_get_operand1 (inst)],
+ 4, inst_env->byte_order);
+ }
/* The increment is not depending on the size, instead it's depending
- on the number of registers loaded from memory. */
+ on the number of registers loaded from memory. */
if ((cris_get_operand1 (inst) == REG_PC)
&& (cris_get_mode (inst) == AUTOINC_MODE))
- {
- /* It's invalid to change the PC in a delay slot. */
- if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
- inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
- }
+ {
+ /* It's invalid to change the PC in a delay slot. */
+ if (inst_env->slot_needed)
+ {
+ inst_env->invalid = 1;
+ return;
+ }
+ inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
+ }
}
inst_env->slot_needed = 0;
inst_env->prefix_found = 0;
if (inst_env->prefix_found)
{
/* The assign value is the value after the increment. Normally, the
- assign value is the value before the increment. */
+ assign value is the value before the increment. */
if ((cris_get_operand1 (inst) == REG_PC)
- && (cris_get_mode (inst) == PREFIX_ASSIGN_MODE))
- {
- /* The prefix handles the problem if we are in a delay slot. */
- inst_env->reg[REG_PC] = inst_env->prefix_value;
- inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
- }
+ && (cris_get_mode (inst) == PREFIX_ASSIGN_MODE))
+ {
+ /* The prefix handles the problem if we are in a delay slot. */
+ inst_env->reg[REG_PC] = inst_env->prefix_value;
+ inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
+ }
}
else
{
/* The increment is not depending on the size, instead it's depending
- on the number of registers loaded to memory. */
+ on the number of registers loaded to memory. */
if ((cris_get_operand1 (inst) == REG_PC)
&& (cris_get_mode (inst) == AUTOINC_MODE))
- {
- /* It's invalid to change the PC in a delay slot. */
- if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
- inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
- }
+ {
+ /* It's invalid to change the PC in a delay slot. */
+ if (inst_env->slot_needed)
+ {
+ inst_env->invalid = 1;
+ return;
+ }
+ inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
+ }
}
inst_env->slot_needed = 0;
inst_env->prefix_found = 0;
{
/* It's invalid to change the PC in a delay slot. */
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
inst_env->reg[REG_PC] ^= inst_env->reg[cris_get_operand1 (inst)];
}
inst_env->slot_needed = 0;
static void
add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env,
- unsigned long source1, unsigned long source2)
+ unsigned long source1, unsigned long source2)
{
unsigned long pc_mask;
unsigned long operation_mask;
value &= 0xFFFF;
/* Check if the instruction is signed extend. If so, check if value has
- the sign bit on. */
+ the sign bit on. */
if (cris_is_signed_extend_bit_on (*inst) && (value & SIGNED_WORD_MASK))
- {
- value |= SIGNED_WORD_EXTEND_MASK;
- }
+ {
+ value |= SIGNED_WORD_EXTEND_MASK;
+ }
}
else
{
value &= 0xFF;
/* Check if the instruction is signed extend. If so, check if value has
- the sign bit on. */
+ the sign bit on. */
if (cris_is_signed_extend_bit_on (*inst) && (value & SIGNED_BYTE_MASK))
- {
- value |= SIGNED_BYTE_EXTEND_MASK;
- }
+ {
+ value |= SIGNED_BYTE_EXTEND_MASK;
+ }
}
/* The size should now be dword. */
cris_set_size_to_dword (inst);
static void
reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
- inst_env_type *inst_env)
+ inst_env_type *inst_env)
{
unsigned long operand1;
unsigned long operand2;
if (cris_get_operand2 (inst) == REG_PC)
{
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
/* The instruction has the PC as its target register. */
operand1 = inst_env->reg[cris_get_operand1 (inst)];
operand2 = inst_env->reg[REG_PC];
/* Check if it's a extend, signed or zero instruction. */
if (cris_get_opcode (inst) < 4)
- {
- operand1 = do_sign_or_zero_extend (operand1, &inst);
- }
+ {
+ operand1 = do_sign_or_zero_extend (operand1, &inst);
+ }
/* Calculate the PC value after the instruction, i.e. where the
- breakpoint should be. The order of the udw_operands is vital. */
+ breakpoint should be. The order of the udw_operands is vital. */
add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand1);
}
inst_env->slot_needed = 0;
static void
handle_prefix_assign_mode_for_aritm_op (unsigned short inst,
- inst_env_type *inst_env)
+ inst_env_type *inst_env)
{
unsigned long operand2;
unsigned long operand3;
inst_env->byte_order);
/* Calculate the PC value after the instruction, i.e. where the
- breakpoint should be. The order of the udw_operands is vital. */
+ breakpoint should be. The order of the udw_operands is vital. */
add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand3);
}
inst_env->slot_needed = 0;
static void
three_operand_add_sub_cmp_and_or_op (unsigned short inst,
- inst_env_type *inst_env)
+ inst_env_type *inst_env)
{
unsigned long operand2;
unsigned long operand3;
inst_env->byte_order);
/* Calculate the PC value after the instruction, i.e. where the
- breakpoint should be. */
+ breakpoint should be. */
add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand3);
}
inst_env->slot_needed = 0;
static void
handle_prefix_index_mode_for_aritm_op (unsigned short inst,
- inst_env_type *inst_env)
+ inst_env_type *inst_env)
{
if (cris_get_operand1 (inst) != cris_get_operand2 (inst))
{
/* If the instruction is MOVE it's invalid. If the instruction is ADD,
- SUB, AND or OR something weird is going on (if everything works these
- instructions should end up in the three operand version). */
+ SUB, AND or OR something weird is going on (if everything works these
+ instructions should end up in the three operand version). */
inst_env->invalid = 1;
return;
}
else
{
/* three_operand_add_sub_cmp_and_or does the same as we should do here
- so use it. */
+ so use it. */
three_operand_add_sub_cmp_and_or_op (inst, inst_env);
}
inst_env->slot_needed = 0;
static void
handle_inc_and_index_mode_for_aritm_op (unsigned short inst,
- inst_env_type *inst_env)
+ inst_env_type *inst_env)
{
unsigned long operand1;
unsigned long operand2;
if (cris_get_operand2 (inst) == REG_PC)
{
/* Must be done here, get_data_from_address may change the size
- field. */
+ field. */
size = cris_get_size (inst);
operand2 = inst_env->reg[REG_PC];
operand3 = get_data_from_address (&inst, operand1, inst_env->byte_order);
/* Calculate the PC value after the instruction, i.e. where the
- breakpoint should be. The order of the udw_operands is vital. */
+ breakpoint should be. The order of the udw_operands is vital. */
add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand3);
}
/* If this is an autoincrement addressing mode, check if the increment
size = cris_get_size (inst);
/* If it's an extend instruction we don't want the signed extend bit,
- because it influences the size. */
+ because it influences the size. */
if (cris_get_opcode (inst) < 4)
- {
- size &= ~SIGNED_EXTEND_BIT_MASK;
- }
+ {
+ size &= ~SIGNED_EXTEND_BIT_MASK;
+ }
process_autoincrement (size, inst, inst_env);
}
inst_env->slot_needed = 0;
static void
none_reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
- inst_env_type *inst_env)
+ inst_env_type *inst_env)
{
if (inst_env->prefix_found)
{
if (cris_get_mode (inst) == PREFIX_INDEX_MODE)
- {
- handle_prefix_index_mode_for_aritm_op (inst, inst_env);
- }
+ {
+ handle_prefix_index_mode_for_aritm_op (inst, inst_env);
+ }
else if (cris_get_mode (inst) == PREFIX_ASSIGN_MODE)
- {
- handle_prefix_assign_mode_for_aritm_op (inst, inst_env);
- }
+ {
+ handle_prefix_assign_mode_for_aritm_op (inst, inst_env);
+ }
else
- {
- /* The mode is invalid for a prefixed base instruction. */
- inst_env->invalid = 1;
- return;
- }
+ {
+ /* The mode is invalid for a prefixed base instruction. */
+ inst_env->invalid = 1;
+ return;
+ }
}
else
{
if (cris_get_operand2 (inst) == REG_PC)
{
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
operand1 = cris_get_quick_value (inst);
operand2 = inst_env->reg[REG_PC];
cris_set_size_to_dword (&inst);
/* Calculate the PC value after the instruction, i.e. where the
- breakpoint should be. */
+ breakpoint should be. */
add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand1);
}
inst_env->slot_needed = 0;
if (cris_get_operand2 (inst) == REG_PC)
{
if (inst_env->slot_needed)
- {
- inst_env->invalid = 1;
- return;
- }
+ {
+ inst_env->invalid = 1;
+ return;
+ }
/* The instruction has the PC as its target register. */
operand1 = cris_get_quick_value (inst);
operand2 = inst_env->reg[REG_PC];
/* The quick value is signed, so check if we must do a signed extend. */
if (operand1 & SIGNED_QUICK_VALUE_MASK)
- {
- /* sign extend */
- operand1 |= SIGNED_QUICK_VALUE_EXTEND_MASK;
- }
+ {
+ /* sign extend */
+ operand1 |= SIGNED_QUICK_VALUE_EXTEND_MASK;
+ }
/* The size should now be dword. */
cris_set_size_to_dword (&inst);
/* Calculate the PC value after the instruction, i.e. where the
- breakpoint should be. */
+ breakpoint should be. */
add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand1);
}
inst_env->slot_needed = 0;
if (tdep != NULL)
{
fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_version = %i\n",
- tdep->cris_version);
+ tdep->cris_version);
fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_mode = %s\n",
- tdep->cris_mode);
+ tdep->cris_mode);
fprintf_unfiltered (file, "cris_dump_tdep: tdep->cris_dwarf2_cfi = %i\n",
- tdep->cris_dwarf2_cfi);
+ tdep->cris_dwarf2_cfi);
}
}
== usr_cmd_cris_mode)
&& (gdbarch_tdep (arches->gdbarch)->cris_dwarf2_cfi
== usr_cmd_cris_dwarf2_cfi))
- return arches->gdbarch;
+ return arches->gdbarch;
}
/* No matching architecture was found. Create a new one. */
case 10:
case 11:
/* CRIS v10 and v11, a.k.a. ETRAX 100LX. In addition to ETRAX 100,
- P7 (32 bits), and P15 (32 bits) have been implemented. */
+ P7 (32 bits), and P15 (32 bits) have been implemented. */
set_gdbarch_pc_regnum (gdbarch, 15);
set_gdbarch_register_type (gdbarch, cris_register_type);
/* There are 32 registers (some of which may not be implemented). */
{ write_dollar_variable (pstate, $1); }
| NAME_OR_INT
{ YYSTYPE val;
- parse_number (pstate, $1.ptr, $1.length, 0, &val);
+ parse_number (pstate, $1.ptr, $1.length, 0, &val);
write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate, val.typed_val_int.type);
write_exp_elt_longcst (pstate,
if (base > 10 && c >= 'a' && c <= 'f')
{
if (found_suffix)
- return ERROR;
+ return ERROR;
n += i = c - 'a' + 10;
}
else if (c == 'l' && long_p == 0)
else if (saw_structop)
return COMPLETE;
else
- return 0;
+ return 0;
case ' ':
case '\t':
const char *p = tokstart + namelen + 1;
while (*p == ' ' || *p == '\t')
- p++;
+ p++;
if (*p >= '0' && *p <= '9')
- return 0;
+ return 0;
}
pstate->lexptr += namelen;
if (next.token == IDENTIFIER && last_was_dot)
{
/* Update the partial name we are constructing. */
- obstack_grow_str (&name_obstack, ".");
+ obstack_grow_str (&name_obstack, ".");
obstack_grow (&name_obstack, next.value.sval.ptr,
next.value.sval.length);
if (context_type != NULL)
{
/* We don't want to put a leading "." into the name. */
- obstack_grow_str (&name_obstack, ".");
+ obstack_grow_str (&name_obstack, ".");
}
obstack_grow (&name_obstack, next.value.sval.ptr,
next.value.sval.length);
mach_port_t taskPort;
result =
- task_by_unix_pid (mach_task_self (), procInfo[index].kp_proc.p_pid,
- &taskPort);
+ task_by_unix_pid (mach_task_self (), procInfo[index].kp_proc.p_pid,
+ &taskPort);
if (KERN_SUCCESS == result)
- {
- printf_unfiltered (_(" %s is %d has task %#x\n"),
- procInfo[index].kp_proc.p_comm,
- procInfo[index].kp_proc.p_pid, taskPort);
- }
+ {
+ printf_unfiltered (_(" %s is %d has task %#x\n"),
+ procInfo[index].kp_proc.p_comm,
+ procInfo[index].kp_proc.p_pid, taskPort);
+ }
else
- {
- printf_unfiltered (_(" %s is %d unknown task port\n"),
- procInfo[index].kp_proc.p_comm,
- procInfo[index].kp_proc.p_pid);
- }
+ {
+ printf_unfiltered (_(" %s is %d unknown task port\n"),
+ procInfo[index].kp_proc.p_comm,
+ procInfo[index].kp_proc.p_pid);
+ }
}
xfree (procInfo);
printf_unfiltered (_("TASK_BASIC_INFO for 0x%x:\n"), task);
info_count = TASK_BASIC_INFO_COUNT;
result = task_info (task,
- TASK_BASIC_INFO,
- (task_info_t) & task_info_data.basic, &info_count);
+ TASK_BASIC_INFO,
+ (task_info_t) & task_info_data.basic, &info_count);
MACH_CHECK_ERROR (result);
PRINT_FIELD (&task_info_data.basic, suspend_count);
printf_unfiltered (_("\nTASK_EVENTS_INFO:\n"));
info_count = TASK_EVENTS_INFO_COUNT;
result = task_info (task,
- TASK_EVENTS_INFO,
- (task_info_t) & task_info_data.events, &info_count);
+ TASK_EVENTS_INFO,
+ (task_info_t) & task_info_data.events, &info_count);
MACH_CHECK_ERROR (result);
PRINT_FIELD (&task_info_data.events, faults);
printf_unfiltered (_("\nTASK_THREAD_TIMES_INFO:\n"));
info_count = TASK_THREAD_TIMES_INFO_COUNT;
result = task_info (task,
- TASK_THREAD_TIMES_INFO,
- (task_info_t) & task_info_data.thread_times,
- &info_count);
+ TASK_THREAD_TIMES_INFO,
+ (task_info_t) & task_info_data.thread_times,
+ &info_count);
MACH_CHECK_ERROR (result);
PRINT_TV_FIELD (&task_info_data.thread_times, user_time);
PRINT_TV_FIELD (&task_info_data.thread_times, system_time);
}
vm_deallocate (task_self (), (vm_address_t) names,
- (name_count * sizeof (mach_port_t)));
+ (name_count * sizeof (mach_port_t)));
vm_deallocate (task_self (), (vm_address_t) types,
- (type_count * sizeof (mach_port_type_t)));
+ (type_count * sizeof (mach_port_type_t)));
}
MACH_CHECK_ERROR (kret);
printf_unfiltered (_("Port 0x%lx in task 0x%lx:\n"), (unsigned long) port,
- (unsigned long) task);
+ (unsigned long) task);
printf_unfiltered (_(" port set: 0x%x\n"), status.mps_pset);
printf_unfiltered (_(" seqno: 0x%x\n"), status.mps_seqno);
printf_unfiltered (_(" mscount: 0x%x\n"), status.mps_mscount);
}
vm_deallocate (task_self (), (vm_address_t) threads,
- (thread_count * sizeof (thread_t)));
+ (thread_count * sizeof (thread_t)));
}
static void
/* Check to see if address space has wrapped around. */
if (address == 0)
- print = done = 1;
+ print = done = 1;
if (!done)
- {
- count = VM_REGION_BASIC_INFO_COUNT_64;
- kret =
- mach_vm_region (task, &address, &size, VM_REGION_BASIC_INFO_64,
- (vm_region_info_t) &info, &count, &object_name);
- if (kret != KERN_SUCCESS)
- {
- size = 0;
- print = done = 1;
- }
- }
+ {
+ count = VM_REGION_BASIC_INFO_COUNT_64;
+ kret =
+ mach_vm_region (task, &address, &size, VM_REGION_BASIC_INFO_64,
+ (vm_region_info_t) &info, &count, &object_name);
+ if (kret != KERN_SUCCESS)
+ {
+ size = 0;
+ print = done = 1;
+ }
+ }
if (address != prev_address + prev_size)
- print = 1;
+ print = 1;
if ((info.protection != prev_info.protection)
- || (info.max_protection != prev_info.max_protection)
- || (info.inheritance != prev_info.inheritance)
- || (info.shared != prev_info.reserved)
- || (info.reserved != prev_info.reserved))
- print = 1;
+ || (info.max_protection != prev_info.max_protection)
+ || (info.inheritance != prev_info.inheritance)
+ || (info.shared != prev_info.reserved)
+ || (info.reserved != prev_info.reserved))
+ print = 1;
if (print)
- {
- printf_filtered (_("%s-%s %s/%s %s %s %s"),
- paddress (target_gdbarch (), prev_address),
- paddress (target_gdbarch (), prev_address + prev_size),
- unparse_protection (prev_info.protection),
- unparse_protection (prev_info.max_protection),
- unparse_inheritance (prev_info.inheritance),
- prev_info.shared ? _("shrd") : _("priv"),
- prev_info.reserved ? _("reserved") : _("not-rsvd"));
-
- if (nsubregions > 1)
- printf_filtered (_(" (%d sub-rgn)"), nsubregions);
-
- printf_filtered (_("\n"));
-
- prev_address = address;
- prev_size = size;
- memcpy (&prev_info, &info, sizeof (vm_region_basic_info_data_64_t));
- nsubregions = 1;
-
- num_printed++;
- }
+ {
+ printf_filtered (_("%s-%s %s/%s %s %s %s"),
+ paddress (target_gdbarch (), prev_address),
+ paddress (target_gdbarch (), prev_address + prev_size),
+ unparse_protection (prev_info.protection),
+ unparse_protection (prev_info.max_protection),
+ unparse_inheritance (prev_info.inheritance),
+ prev_info.shared ? _("shrd") : _("priv"),
+ prev_info.reserved ? _("reserved") : _("not-rsvd"));
+
+ if (nsubregions > 1)
+ printf_filtered (_(" (%d sub-rgn)"), nsubregions);
+
+ printf_filtered (_("\n"));
+
+ prev_address = address;
+ prev_size = size;
+ memcpy (&prev_info, &info, sizeof (vm_region_basic_info_data_64_t));
+ nsubregions = 1;
+
+ num_printed++;
+ }
else
- {
- prev_size += size;
- nsubregions++;
- }
+ {
+ prev_size += size;
+ nsubregions++;
+ }
if ((max > 0) && (num_printed >= max))
- done = 1;
+ done = 1;
if (done)
- break;
+ break;
}
}
_initialize_darwin_info_commands ()
{
add_info ("mach-tasks", info_mach_tasks_command,
- _("Get list of tasks in system."));
+ _("Get list of tasks in system."));
add_info ("mach-ports", info_mach_ports_command,
- _("Get list of ports in a task."));
+ _("Get list of ports in a task."));
add_info ("mach-port", info_mach_port_command,
- _("Get info on a specific port."));
+ _("Get info on a specific port."));
add_info ("mach-task", info_mach_task_command,
- _("Get info on a specific task."));
+ _("Get info on a specific task."));
add_info ("mach-threads", info_mach_threads_command,
- _("Get list of threads in a task."));
+ _("Get list of threads in a task."));
add_info ("mach-thread", info_mach_thread_command,
- _("Get info on a specific thread."));
+ _("Get info on a specific thread."));
add_info ("mach-regions", info_mach_regions_command,
- _("Get information on all mach region for the task."));
+ _("Get information on all mach region for the task."));
add_info ("mach-regions-rec", info_mach_regions_recurse_command,
- _("Get information on all mach sub region for the task."));
+ _("Get information on all mach sub region for the task."));
add_info ("mach-region", info_mach_region_command,
- _("Get information on mach region at given address."));
+ _("Get information on mach region at given address."));
add_info ("mach-exceptions", info_mach_exceptions_command,
- _("Disp mach exceptions."));
+ _("Disp mach exceptions."));
}
void
mach_check_error (kern_return_t ret, const char *file,
- unsigned int line, const char *func)
+ unsigned int line, const char *func)
{
if (ret == KERN_SUCCESS)
return;
ret = 0;
inferior_debug (4, _("ptrace (%s, %d, 0x%lx, %d): %d (%s)\n"),
- name, pid, (unsigned long) arg3, arg4, ret,
- (ret != 0) ? safe_strerror (errno) : _("no error"));
+ name, pid, (unsigned long) arg3, arg4, ret,
+ (ret != 0) ? safe_strerror (errno) : _("no error"));
return ret;
}
darwin_suspend_inferior (inf);
if (tid == 0)
- darwin_resume_inferior_threads (inf, step, nsignal);
+ darwin_resume_inferior_threads (inf, step, nsignal);
else
- {
- darwin_thread_t *thread;
+ {
+ darwin_thread_t *thread;
- /* Suspend threads of the task. */
- darwin_suspend_inferior_threads (inf);
+ /* Suspend threads of the task. */
+ darwin_suspend_inferior_threads (inf);
- /* Resume the selected thread. */
- thread = darwin_find_thread (inf, tid);
- gdb_assert (thread);
- darwin_resume_thread (inf, thread, step, nsignal);
- }
+ /* Resume the selected thread. */
+ thread = darwin_find_thread (inf, tid);
+ gdb_assert (thread);
+ darwin_resume_thread (inf, thread, step, nsignal);
+ }
/* Resume the task. */
darwin_resume_inferior (inf);
for (i = 0; i < inf->exception_info.count; i++)
{
kret = task_set_exception_ports
- (inf->task, inf->exception_info.masks[i], inf->exception_info.ports[i],
+ (inf->task, inf->exception_info.masks[i], inf->exception_info.ports[i],
inf->exception_info.behaviors[i], inf->exception_info.flavors[i]);
if (kret != KERN_SUCCESS)
- return kret;
+ return kret;
}
return KERN_SUCCESS;
if (res == 0)
{
/* On MacOS version Sierra, the darwin_restore_exception_ports call
- does not work as expected.
- When the kill function is called, the SIGKILL signal is received
- by gdb whereas it should have been received by the kernel since
- the exception ports have been restored.
- This behavior is not the expected one thus gdb does not reply to
- the received SIGKILL message. This situation leads to a "busy"
- resource from the kernel point of view and the inferior is never
- released, causing it to remain as a zombie process, even after
+ does not work as expected.
+ When the kill function is called, the SIGKILL signal is received
+ by gdb whereas it should have been received by the kernel since
+ the exception ports have been restored.
+ This behavior is not the expected one thus gdb does not reply to
+ the received SIGKILL message. This situation leads to a "busy"
+ resource from the kernel point of view and the inferior is never
+ released, causing it to remain as a zombie process, even after
GDB exits.
- To work around this, we mark all the threads of the inferior as
- signaled thus darwin_decode_message function knows that the kill
- signal was sent by gdb and will take the appropriate action
- (cancel signal and reply to the signal message). */
+ To work around this, we mark all the threads of the inferior as
+ signaled thus darwin_decode_message function knows that the kill
+ signal was sent by gdb and will take the appropriate action
+ (cancel signal and reply to the signal message). */
for (darwin_thread_t *thread : priv->threads)
- thread->signaled = 1;
+ thread->signaled = 1;
darwin_resume_inferior (inf);
if (res != 0)
{
fprintf_unfiltered
- (gdb_stderr, "Cannot initialize attribute for posix_spawn\n");
+ (gdb_stderr, "Cannot initialize attribute for posix_spawn\n");
return;
}
{
unsigned long ver = strtoul (str, NULL, 10);
if (ver >= 16)
- return true;
+ return true;
}
return false;
}
if (pid == 0 || ::kill (pid, 0) < 0)
error (_("Can't attach to process %d: %s (%d)"),
- pid, safe_strerror (errno), errno);
+ pid, safe_strerror (errno), errno);
inf = current_inferior ();
inferior_appeared (inf, pid);
#ifdef TASK_DYLD_INFO_COUNT
case TARGET_OBJECT_DARWIN_DYLD_INFO:
if (writebuf != NULL || readbuf == NULL)
- {
- /* Support only read. */
- return TARGET_XFER_E_IO;
- }
+ {
+ /* Support only read. */
+ return TARGET_XFER_E_IO;
+ }
return darwin_read_dyld_info (priv->task, offset, readbuf, len,
xfered_len);
#endif
}
vm_deallocate (gdb_task, (vm_address_t) names,
- names_count * sizeof (mach_port_t));
+ names_count * sizeof (mach_port_t));
if (res)
return ptid_t (current_inferior ()->pid, 0, res);
ptid_t wait_1 (ptid_t, struct target_waitstatus *);
void check_new_threads (inferior *inf);
int decode_exception_message (mach_msg_header_t *hdr,
- inferior **pinf,
+ inferior **pinf,
darwin_thread_t **pthread);
ptid_t decode_message (mach_msg_header_t *hdr,
darwin_thread_t **pthread,
break;
case N_SETV:
/* I don't think this type actually exists; since a N_SETV is the result
- of going over many .o files, it doesn't make sense to have one
- file local. */
+ of going over many .o files, it doesn't make sense to have one
+ file local. */
ms_type = mst_file_data;
section = SECT_OFF_DATA (objfile);
break;
ms_type = mst_file_data;
/* Check for __DYNAMIC, which is used by Sun shared libraries.
- Record it as global even if it's local, not global, so
- lookup_minimal_symbol can find it. We don't check symbol_leading_char
- because for SunOS4 it always is '_'. */
+ Record it as global even if it's local, not global, so
+ lookup_minimal_symbol can find it. We don't check symbol_leading_char
+ because for SunOS4 it always is '_'. */
if (name[8] == 'C' && strcmp ("__DYNAMIC", name) == 0)
ms_type = mst_data;
if (STRING_TABLE_OFFSET == 0)
{
/* It appears that with the existing bfd code, STRING_TABLE_OFFSET
- will never be zero, even when there is no string table. This
- would appear to be a bug in bfd. */
+ will never be zero, even when there is no string table. This
+ would appear to be a bug in bfd. */
DBX_STRINGTAB_SIZE (objfile) = 0;
DBX_STRINGTAB (objfile) = NULL;
}
{
nbytes = sizeof (symbuf);
if (nbytes > symbuf_left)
- nbytes = symbuf_left;
+ nbytes = symbuf_left;
memcpy (symbuf, stabs_data + symbuf_read, nbytes);
}
else if (symbuf_sections == NULL)
if (msym.minsym == NULL)
{
/* Sun Fortran appends an underscore to the minimal symbol name,
- try again with an appended underscore if the minimal symbol
- was not found. */
+ try again with an appended underscore if the minimal symbol
+ was not found. */
p[n] = '_';
p[n + 1] = 0;
msym = lookup_minimal_symbol (p, filename, objfile);
OBJSTAT (objfile, n_stabs++);
/* Ok. There is a lot of code duplicated in the rest of this
- switch statement (for efficiency reasons). Since I don't
- like duplicating code, I will do my penance here, and
- describe the code which is duplicated:
+ switch statement (for efficiency reasons). Since I don't
+ like duplicating code, I will do my penance here, and
+ describe the code which is duplicated:
- *) The assignment to namestring.
- *) The call to strchr.
- *) The addition of a partial symbol the two partial
- symbol lists. This last is a large section of code, so
- I've imbedded it in the following macro. */
+ *) The assignment to namestring.
+ *) The call to strchr.
+ *) The addition of a partial symbol the two partial
+ symbol lists. This last is a large section of code, so
+ I've imbedded it in the following macro. */
switch (nlist.n_type)
{
{
/* Save the directory name SOs locally, then save it into
the psymtab when it's created below. */
- dirname_nso = namestring;
- continue;
+ dirname_nso = namestring;
+ continue;
}
/* Some other compilers (C++ ones in particular) emit useless
else
{
/* If we know our own starting text address, then walk through all other
- psymtabs for this objfile, and if any didn't know their ending text
- address, set it to our starting address. Take care to not set our
- own ending address to our starting address. */
+ psymtabs for this objfile, and if any didn't know their ending text
+ address, set it to our starting address. Take care to not set our
+ own ending address to our starting address. */
for (partial_symtab *p1 : objfile->psymtabs ())
if (!p1->text_high_valid && p1->text_low_valid && p1 != pst)
LDSYMLEN (subpst) = 0;
/* We could save slight bits of space by only making one of these,
- shared by the entire set of include files. FIXME-someday. */
+ shared by the entire set of include files. FIXME-someday. */
subpst->dependencies =
objfile->partial_symtabs->allocate_dependencies (1);
subpst->dependencies[0] = pst;
{
/* Throw away this psymtab, it's empty. */
/* Empty psymtabs happen as a result of header files which don't have
- any symbols in them. There can be a lot of them. But this check
- is wrong, in that a psymtab with N_SLINE entries but nothing else
- is not empty, but we don't realize that. Fixing that without slowing
- things down might be tricky. */
+ any symbols in them. There can be a lot of them. But this check
+ is wrong, in that a psymtab with N_SLINE entries but nothing else
+ is not empty, but we don't realize that. Fixing that without slowing
+ things down might be tricky. */
objfile->partial_symtabs->discard_psymtab (pst);
}
/* Match with global symbols. This only needs to be done once,
- after all of the symtabs and dependencies have been read in. */
+ after all of the symtabs and dependencies have been read in. */
scan_file_globals (objfile);
}
}
else
{
/* The N_SO starting this symtab is the first symbol, so we
- better not check the symbol before it. I'm not this can
- happen, but it doesn't hurt to check for it. */
+ better not check the symbol before it. I'm not this can
+ happen, but it doesn't hurt to check for it. */
stabs_seek (sym_offset);
processing_gcc_compilation = 0;
}
PST_LANGUAGE (pst));
}
/* We skip checking for a new .o or -l file; that should never
- happen in this routine. */
+ happen in this routine. */
else if (type == N_TEXT)
{
/* I don't think this code will ever be executed, because
if (get_last_source_file () == NULL && type != (unsigned char) N_SO)
{
/* Ignore any symbols which appear before an N_SO symbol.
- Currently no one puts symbols there, but we should deal
- gracefully with the case. A complain()t might be in order,
- but this should not be an error (). */
+ Currently no one puts symbols there, but we should deal
+ gracefully with the case. A complain()t might be in order,
+ but this should not be an error (). */
return;
}
case N_LBRAC:
/* This "symbol" just indicates the start of an inner lexical
- context within a function. */
+ context within a function. */
/* Ignore extra outermost context from SunPRO cc and acc. */
if (n_opt_found && desc == 1)
case N_RBRAC:
/* This "symbol" just indicates the end of an inner lexical
- context that was started with N_LBRAC. */
+ context that was started with N_LBRAC. */
/* Ignore extra outermost context from SunPRO cc and acc. */
if (n_opt_found && desc == 1)
case N_FN:
case N_FN_SEQ:
/* This kind of symbol indicates the start of an object file.
- Relocate for dynamic loading. */
+ Relocate for dynamic loading. */
valu += section_offsets[SECT_OFF_TEXT (objfile)];
break;
case N_SO:
/* This type of symbol indicates the start of data for one
- source file. Finish the symbol table of the previous source
- file (if any) and start accumulating a new symbol table.
- Relocate for dynamic loading. */
+ source file. Finish the symbol table of the previous source
+ file (if any) and start accumulating a new symbol table.
+ Relocate for dynamic loading. */
valu += section_offsets[SECT_OFF_TEXT (objfile)];
n_opt_found = 0;
}
/* Null name means this just marks the end of text for this .o
- file. Don't start a new symtab in this case. */
+ file. Don't start a new symtab in this case. */
if (*name == '\000')
break;
case N_SOL:
/* This type of symbol indicates the start of data for a
- sub-source-file, one whose contents were copied or included
- in the compilation of the main source file (whose name was
- given in the N_SO symbol). Relocate for dynamic loading. */
+ sub-source-file, one whose contents were copied or included
+ in the compilation of the main source file (whose name was
+ given in the N_SO symbol). Relocate for dynamic loading. */
valu += section_offsets[SECT_OFF_TEXT (objfile)];
start_subfile (name);
break;
case N_SLINE:
/* This type of "symbol" really just records one line-number --
- core-address correspondence. Enter it in the line list for
- this symbol table. */
+ core-address correspondence. Enter it in the line list for
+ this symbol table. */
/* Relocate for dynamic loading and for ELF acc
- function-relative symbols. */
+ function-relative symbols. */
valu += function_start_offset;
/* GCC 2.95.3 emits the first N_SLINE stab somewhere in the
break;
/* The following symbol types need to have the appropriate
- offset added to their value; then we process symbol
- definitions in the name. */
+ offset added to their value; then we process symbol
+ definitions in the name. */
case N_STSYM: /* Static symbol in data segment. */
case N_LCSYM: /* Static symbol in BSS segment. */
case N_ROSYM: /* Static symbol in read-only data segment. */
/* HORRID HACK DEPT. However, it's Sun's furgin' fault.
- Solaris 2's stabs-in-elf makes *most* symbols relative but
- leaves a few absolute (at least for Solaris 2.1 and version
- 2.0.1 of the SunPRO compiler). N_STSYM and friends sit on
- the fence. .stab "foo:S...",N_STSYM is absolute (ld
- relocates it) .stab "foo:V...",N_STSYM is relative (section
- base subtracted). This leaves us no choice but to search for
- the 'S' or 'V'... (or pass the whole section_offsets stuff
- down ONE MORE function call level, which we really don't want
- to do). */
+ Solaris 2's stabs-in-elf makes *most* symbols relative but
+ leaves a few absolute (at least for Solaris 2.1 and version
+ 2.0.1 of the SunPRO compiler). N_STSYM and friends sit on
+ the fence. .stab "foo:S...",N_STSYM is absolute (ld
+ relocates it) .stab "foo:V...",N_STSYM is relative (section
+ base subtracted). This leaves us no choice but to search for
+ the 'S' or 'V'... (or pass the whole section_offsets stuff
+ down ONE MORE function call level, which we really don't want
+ to do). */
{
const char *p;
}
}
/* Since it's not the kludge case, re-dispatch to the right
- handler. */
+ handler. */
switch (type)
{
case N_STSYM:
goto define_a_symbol;
/* The following symbol types we don't know how to process.
- Handle them in a "default" way, but complain to people who
- care. */
+ Handle them in a "default" way, but complain to people who
+ care. */
default:
case N_CATCH: /* Exception handler catcher. */
case N_EHDECL: /* Exception handler name. */
define_a_symbol:
/* These symbol types don't need the address field relocated,
- since it is either unused, or is absolute. */
+ since it is either unused, or is absolute. */
case N_GSYM: /* Global variable. */
case N_NSYMS: /* Number of symbols (Ultrix). */
case N_NOMAP: /* No map? (Ultrix). */
case 'f':
case 'F':
/* Deal with the SunPRO 3.0 compiler which omits the
- address from N_FUN symbols. */
+ address from N_FUN symbols. */
if (type == N_FUN
&& valu == section_offsets[SECT_OFF_TEXT (objfile)]
&& gdbarch_sofun_address_maybe_missing (gdbarch))
break;
/* We use N_OPT to carry the gcc2_compiled flag. Sun uses it
- for a bunch of other flags, too. Someday we may parse their
- flags; for now we ignore theirs and hope they'll ignore ours. */
+ for a bunch of other flags, too. Someday we may parse their
+ flags; for now we ignore theirs and hope they'll ignore ours. */
case N_OPT: /* Solaris 2: Compiler options. */
if (name)
{
case N_PATCH: /* Solaris 2: Patch Run Time Checker. */
/* N_UNDF: Solaris 2: File separator mark. */
/* N_UNDF: -- we will never encounter it, since we only process
- one file's symbols at once. */
+ one file's symbols at once. */
case N_ENDM: /* Solaris 2: End of module. */
case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
break;
if (name[0] == '#')
{
/* Initialize symbol reference names and determine if this is a
- definition. If a symbol reference is being defined, go ahead
- and add it. Otherwise, just return. */
+ definition. If a symbol reference is being defined, go ahead
+ and add it. Otherwise, just return. */
const char *s = name;
int refnum;
/* If this stab defines a new reference ID that is not on the
- reference list, then put it on the reference list.
+ reference list, then put it on the reference list.
- We go ahead and advance NAME past the reference, even though
- it is not strictly necessary at this time. */
+ We go ahead and advance NAME past the reference, even though
+ it is not strictly necessary at this time. */
refnum = symbol_reference_defined (&s);
if (refnum >= 0)
if (!ref_search (refnum))
reg_len = region->hi - memaddr;
/* Skip non-readable regions. The cache attribute can be ignored,
- since we may be loading this for a stack access. */
+ since we may be loading this for a stack access. */
if (region->attrib.mode == MEM_WO)
{
memaddr += reg_len;
db = dcache_alloc (dcache, addr);
if (!dcache_read_line (dcache, db))
- return 0;
+ return 0;
}
*ptr = db->data[XFORM (dcache, addr)];
if (linestart == exp || i < 0)
{
printf_filtered (_("Usage: info dcache [LINENUMBER]\n"));
- return;
+ return;
}
dcache_print_line (dcache, i);
if (mle1.start_pc != mle2.start_pc)
val = mle1.start_pc < mle2.start_pc;
else
- val = mle1.line < mle2.line;
+ val = mle1.line < mle2.line;
}
else
{
if (mle1.line != mle2.line)
val = mle1.line < mle2.line;
else
- val = mle1.start_pc < mle2.start_pc;
+ val = mle1.start_pc < mle2.start_pc;
}
return val;
}
std::string name, filename;
bool omit_fname = ((flags & DISASSEMBLY_OMIT_FNAME) != 0);
if (!build_address_symbolic (gdbarch, pc, false, omit_fname, &name,
- &offset, &filename, &line, &unmapped))
+ &offset, &filename, &line, &unmapped))
{
/* We don't care now about line, filename and unmapped. But we might in
the future. */
how_many, flags, NULL);
/* When we've reached the end of the mle array, or we've seen the last
- assembly range for this source line, close out the list/tuple. */
+ assembly range for this source line, close out the list/tuple. */
if (i == (newlines - 1) || mle[i + 1].line > mle[i].line)
{
inner_list_emitter.reset ();
int probe_argc = DOF_UINT (dof, probe->dofpr_nargc);
/* Store argument type descriptions. A description of the type
- of the argument is in the (J+1)th null-terminated string
- starting at 'strtab' + 'probe->dofpr_nargv'. */
+ of the argument is in the (J+1)th null-terminated string
+ starting at 'strtab' + 'probe->dofpr_nargv'. */
std::vector<struct dtrace_probe_arg> args;
p = strtab + DOF_UINT (dof, probe->dofpr_nargv);
for (j = 0; j < probe_argc; j++)
/* Try to parse a type expression from the type string. If
this does not work then we set the type to `long
int'. */
- struct type *type = builtin_type (gdbarch)->builtin_long;
+ struct type *type = builtin_type (gdbarch)->builtin_long;
try
{
extract the information of any probe defined into it. */
if (bfd_malloc_and_get_section (abfd, sect, &dof) && dof != NULL)
dtrace_process_dof (sect, objfile, probesp,
- (struct dtrace_dof_hdr *) dof);
- else
+ (struct dtrace_dof_hdr *) dof);
+ else
complaint (_("could not obtain the contents of"
"section '%s' in objfile `%s'."),
bfd_section_name (sect), bfd_get_filename (abfd));
abbrev_table->add_abbrev (cur_abbrev);
/* Get next abbreviation.
- Under Irix6 the abbreviations for a compilation unit are not
- always properly terminated with an abbrev number of 0.
- Exit loop if we encounter an abbreviation which we have
- already read (which means we are about to read the abbreviations
- for the next compile unit) or if the end of the abbreviation
- table is reached. */
+ Under Irix6 the abbreviations for a compilation unit are not
+ always properly terminated with an abbrev number of 0.
+ Exit loop if we encounter an abbreviation which we have
+ already read (which means we are about to read the abbreviations
+ for the next compile unit) or if the end of the abbreviation
+ table is reached. */
if ((unsigned int) (abbrev_ptr - section->buffer) >= section->size)
break;
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
attribute::form_is_section_offset () const
{
return (form == DW_FORM_data4
- || form == DW_FORM_data8
+ || form == DW_FORM_data8
|| form == DW_FORM_sec_offset
|| form == DW_FORM_loclistx);
}
stack.clear ();
/* FIXME: cagney/2003-03-26: This code should be using
- get_frame_base_address(), and then implement a dwarf2
- specific this_base method. */
+ get_frame_base_address(), and then implement a dwarf2
+ specific this_base method. */
this->get_frame_base (&datastart, &datalen);
eval (datastart, datalen);
if (this->location == DWARF_VALUE_MEMORY)
break;
case DW_OP_div:
result_val = value_binop (first, second, BINOP_DIV);
- break;
+ break;
case DW_OP_minus:
result_val = value_binop (first, second, BINOP_SUB);
break;
with. */
if (value_type (result_val) != value_type (second))
result_val = value_cast (value_type (second), result_val);
- break;
+ break;
case DW_OP_shra:
dwarf_require_integral (value_type (first));
dwarf_require_integral (value_type (second));
case DW_OP_nop:
goto no_push;
- case DW_OP_piece:
- {
- uint64_t size;
+ case DW_OP_piece:
+ {
+ uint64_t size;
- /* Record the piece. */
- op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
+ /* Record the piece. */
+ op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
add_piece (8 * size, 0);
- /* Pop off the address/regnum, and reset the location
+ /* Pop off the address/regnum, and reset the location
type. */
if (this->location != DWARF_VALUE_LITERAL
&& this->location != DWARF_VALUE_OPTIMIZED_OUT)
pop ();
- this->location = DWARF_VALUE_MEMORY;
- }
- goto no_push;
+ this->location = DWARF_VALUE_MEMORY;
+ }
+ goto no_push;
case DW_OP_bit_piece:
{
uint64_t size, uleb_offset;
- /* Record the piece. */
+ /* Record the piece. */
op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
op_ptr = safe_read_uleb128 (op_ptr, op_end, &uleb_offset);
add_piece (size, uleb_offset);
- /* Pop off the address/regnum, and reset the location
+ /* Pop off the address/regnum, and reset the location
type. */
if (this->location != DWARF_VALUE_LITERAL
&& this->location != DWARF_VALUE_OPTIMIZED_OUT)
pop ();
- this->location = DWARF_VALUE_MEMORY;
+ this->location = DWARF_VALUE_MEMORY;
}
goto no_push;
{
sect_offset sect_off
= (sect_offset) extract_unsigned_integer (op_ptr,
- this->ref_addr_size,
+ this->ref_addr_size,
byte_order);
op_ptr += this->ref_addr_size;
result_val = value_cast (address_type,
case DW_CFA_def_cfa_register:
insn_ptr = safe_read_uleb128 (insn_ptr, insn_end, ®);
fs->regs.cfa_reg = dwarf2_frame_adjust_regnum (gdbarch, reg,
- eh_frame_p);
+ eh_frame_p);
fs->regs.cfa_how = CFA_REG_OFFSET;
break;
case DW_CFA_def_cfa_sf:
insn_ptr = safe_read_uleb128 (insn_ptr, insn_end, ®);
fs->regs.cfa_reg = dwarf2_frame_adjust_regnum (gdbarch, reg,
- eh_frame_p);
+ eh_frame_p);
insn_ptr = safe_read_sleb128 (insn_ptr, insn_end, &offset);
fs->regs.cfa_offset = offset * fs->data_align;
fs->regs.cfa_how = CFA_REG_OFFSET;
ULONGEST retaddr_column = fs.retaddr_column;
/* It seems rather bizarre to specify an "empty" column as
- the return adress column. However, this is exactly
- what GCC does on some targets. It turns out that GCC
- assumes that the return address can be found in the
- register corresponding to the return address column.
- Incidentally, that's how we should treat a return
- address column specifying "same value" too. */
+ the return adress column. However, this is exactly
+ what GCC does on some targets. It turns out that GCC
+ assumes that the return address can be found in the
+ register corresponding to the return address column.
+ Incidentally, that's how we should treat a return
+ address column specifying "same value" too. */
if (fs.retaddr_column < fs.regs.reg.size ()
&& regs[retaddr_column].how != DWARF2_FRAME_REG_UNSPECIFIED
&& regs[retaddr_column].how != DWARF2_FRAME_REG_SAME_VALUE)
this_frame = get_prev_frame (this_frame);
if (get_frame_unwind_stop_reason (this_frame) == UNWIND_UNAVAILABLE)
throw_error (NOT_AVAILABLE_ERROR,
- _("can't compute CFA for this frame: "
- "required registers or memory are unavailable"));
+ _("can't compute CFA for this frame: "
+ "required registers or memory are unavailable"));
if (get_frame_id (this_frame).stack_status != FID_STACK_VALID)
throw_error (NOT_AVAILABLE_ERROR,
- _("can't compute CFA for this frame: "
- "frame base not available"));
+ _("can't compute CFA for this frame: "
+ "frame base not available"));
return get_frame_base (this_frame);
}
gdb_assert (!fde_table->empty ());
if (*pc < offset + (*fde_table)[0]->initial_location)
- continue;
+ continue;
seek_pc = *pc - offset;
auto it = gdb::binary_search (fde_table->begin (), fde_table->end (),
seek_pc, bsearch_fde_cmp);
if (it != fde_table->end ())
- {
- *pc = (*it)->initial_location + offset;
+ {
+ *pc = (*it)->initial_location + offset;
if (out_per_objfile != nullptr)
*out_per_objfile = get_dwarf2_per_objfile (objfile);
- return *it;
- }
+ return *it;
+ }
}
return NULL;
}
decode_frame_entry_1 (struct gdbarch *gdbarch,
struct comp_unit *unit, const gdb_byte *start,
int eh_frame_p,
- dwarf2_cie_table &cie_table,
- dwarf2_fde_table *fde_table,
- enum eh_frame_type entry_type)
+ dwarf2_cie_table &cie_table,
+ dwarf2_fde_table *fde_table,
+ enum eh_frame_type entry_type)
{
const gdb_byte *buf, *end;
ULONGEST length;
cie->cie_pointer = cie_pointer;
/* The encoding for FDE's in a normal .debug_frame section
- depends on the target address size. */
+ depends on the target address size. */
cie->encoding = DW_EH_PE_absptr;
/* We'll determine the final value later, but we need to
augmentation += strlen (augmentation);
/* The GCC 2.x "eh" augmentation has a pointer immediately
- following the augmentation string, so it must be handled
- first. */
+ following the augmentation string, so it must be handled
+ first. */
if (augmentation[0] == 'e' && augmentation[1] == 'h')
{
/* Skip. */
struct comp_unit *unit, const gdb_byte *start,
int eh_frame_p,
dwarf2_cie_table &cie_table,
- dwarf2_fde_table *fde_table,
- enum eh_frame_type entry_type)
+ dwarf2_fde_table *fde_table,
+ enum eh_frame_type entry_type)
{
enum { NONE, ALIGN4, ALIGN8, FAIL } workaround = NONE;
const gdb_byte *ret;
if (aa->initial_location == bb->initial_location)
{
if (aa->address_range != bb->address_range
- && aa->eh_frame_p == 0 && bb->eh_frame_p == 0)
- /* Linker bug, e.g. gold/10400.
- Work around it by keeping stable sort order. */
- return aa < bb;
+ && aa->eh_frame_p == 0 && bb->eh_frame_p == 0)
+ /* Linker bug, e.g. gold/10400.
+ Work around it by keeping stable sort order. */
+ return aa < bb;
else
- /* Put eh_frame entries after debug_frame ones. */
- return aa->eh_frame_p < bb->eh_frame_p;
+ /* Put eh_frame entries after debug_frame ones. */
+ return aa->eh_frame_p < bb->eh_frame_p;
}
return aa->initial_location < bb->initial_location;
if (objfile->separate_debug_objfile_backlink == NULL)
{
/* Do not read .eh_frame from separate file as they must be also
- present in the main file. */
+ present in the main file. */
dwarf2_get_section_info (objfile, DWARF2_EH_FRAME,
- &unit->dwarf_frame_section,
- &unit->dwarf_frame_buffer,
- &unit->dwarf_frame_size);
+ &unit->dwarf_frame_section,
+ &unit->dwarf_frame_buffer,
+ &unit->dwarf_frame_size);
if (unit->dwarf_frame_size)
- {
- asection *got, *txt;
-
- /* FIXME: kettenis/20030602: This is the DW_EH_PE_datarel base
- that is used for the i386/amd64 target, which currently is
- the only target in GCC that supports/uses the
- DW_EH_PE_datarel encoding. */
- got = bfd_get_section_by_name (unit->abfd, ".got");
- if (got)
- unit->dbase = got->vma;
-
- /* GCC emits the DW_EH_PE_textrel encoding type on sh and ia64
- so far. */
- txt = bfd_get_section_by_name (unit->abfd, ".text");
- if (txt)
- unit->tbase = txt->vma;
+ {
+ asection *got, *txt;
+
+ /* FIXME: kettenis/20030602: This is the DW_EH_PE_datarel base
+ that is used for the i386/amd64 target, which currently is
+ the only target in GCC that supports/uses the
+ DW_EH_PE_datarel encoding. */
+ got = bfd_get_section_by_name (unit->abfd, ".got");
+ if (got)
+ unit->dbase = got->vma;
+
+ /* GCC emits the DW_EH_PE_textrel encoding type on sh and ia64
+ so far. */
+ txt = bfd_get_section_by_name (unit->abfd, ".text");
+ if (txt)
+ unit->tbase = txt->vma;
try
{
}
cie_table.clear ();
- }
+ }
}
dwarf2_get_section_info (objfile, DWARF2_DEBUG_FRAME,
- &unit->dwarf_frame_section,
- &unit->dwarf_frame_buffer,
- &unit->dwarf_frame_size);
+ &unit->dwarf_frame_section,
+ &unit->dwarf_frame_buffer,
+ &unit->dwarf_frame_size);
if (unit->dwarf_frame_size)
{
size_t num_old_fde_entries = fde_table.size ();
}
if (debug_index_cache)
- printf_unfiltered ("index cache: writing index cache for objfile %s\n",
+ printf_unfiltered ("index cache: writing index cache for objfile %s\n",
objfile_name (obj));
/* Write the index itself to the directory, using the build id as the
- filename. */
+ filename. */
write_psymtabs_to_index (per_objfile, m_dir.c_str (),
build_id_str.c_str (), dwz_build_id_ptr,
dw_index_kind::GDB_INDEX);
try
{
if (debug_index_cache)
- printf_unfiltered ("index cache: trying to read %s\n",
+ printf_unfiltered ("index cache: trying to read %s\n",
filename.c_str ());
/* Try to map that file. */
#define DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE(cu_index, value) \
do { \
gdb_assert ((value) >= GDB_INDEX_SYMBOL_KIND_TYPE \
- && (value) <= GDB_INDEX_SYMBOL_KIND_OTHER); \
+ && (value) <= GDB_INDEX_SYMBOL_KIND_OTHER); \
GDB_INDEX_SYMBOL_KIND_SET_VALUE((cu_index), (value)); \
} while (0)
struct signatured_type_index_data
{
signatured_type_index_data (data_buf &types_list_,
- std::unordered_set<partial_symbol *> &psyms_seen_)
+ std::unordered_set<partial_symbol *> &psyms_seen_)
: types_list (types_list_), psyms_seen (psyms_seen_)
{}
{
public:
write_one_signatured_type_data (debug_names &nametable_,
- signatured_type_index_data &&info_)
+ signatured_type_index_data &&info_)
: nametable (nametable_), info (std::move (info_))
{}
debug_names &nametable;
symbol_value (int dwarf_tag_, int cu_index_, bool is_static_,
unit_kind kind_)
: dwarf_tag (dwarf_tag_), cu_index (cu_index_), is_static (is_static_),
- kind (kind_)
+ kind (kind_)
{}
bool
{
size_t new_size;
if (version >= 5)
- new_size = m_include_dirs.size ();
+ new_size = m_include_dirs.size ();
else
- new_size = m_include_dirs.size () + 1;
+ new_size = m_include_dirs.size () + 1;
fprintf_unfiltered (gdb_stdlog, "Adding dir %zu: %s\n",
new_size, include_dir);
}
{
size_t new_size;
if (version >= 5)
- new_size = file_names_size ();
+ new_size = file_names_size ();
else
- new_size = file_names_size () + 1;
+ new_size = file_names_size () + 1;
fprintf_unfiltered (gdb_stdlog, "Adding file %zu: %s\n",
new_size, name);
}
else
{
/* The compiler produced a bogus file number. We can at least
- record the macro definitions made in the file, even if we
- won't be able to find the file by name. */
+ record the macro definitions made in the file, even if we
+ won't be able to find the file by name. */
char fake_name[80];
xsnprintf (fake_name, sizeof (fake_name),
"<bad macro file number %d>", file);
complaint (_("bad file number in macro information (%d)"),
- file);
+ file);
return make_unique_xstrdup (fake_name);
}
if (dwarf_block_to_fb_offset (block, block + block_len, &kind_u.fb_offset))
return value_of_dwarf_reg_entry (type, frame, CALL_SITE_PARAMETER_FB_OFFSET,
- kind_u);
+ kind_u);
/* This can normally happen - throw NO_ENTRY_VALUE_ERROR to get the message
suppressed during normal operation. The expression can be arbitrary if
case DW_OP_nop:
break;
- case DW_OP_piece:
+ case DW_OP_piece:
case DW_OP_bit_piece:
{
uint64_t size;
error (_("Cannot translate empty pieces to agent expressions"));
previous_piece = op_ptr - 1;
- op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
+ op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
if (op == DW_OP_piece)
{
size *= 8;
64-bit LE machine):
DW_AT_location : 10 byte block: 3 4 0 0 0 0 0 0 0 e0
- (DW_OP_addr: 4; DW_OP_GNU_push_tls_address)
+ (DW_OP_addr: 4; DW_OP_GNU_push_tls_address)
0x3 is the encoding for DW_OP_addr, which has an operand as long
as the size of an address on the target machine (here is 8
/* With -gsplit-dwarf a TLS variable can also look like this:
DW_AT_location : 3 byte block: fc 4 e0
- (DW_OP_GNU_const_index: 4;
+ (DW_OP_GNU_const_index: 4;
DW_OP_GNU_push_tls_address) */
else if (data + 3 <= end
&& data + 1 + (leb128_size = skip_leb128 (data + 1, end)) < end
fprintf_filtered (stream, " offset %s", phex_nz (ul, offset_size));
break;
- case DW_OP_piece:
+ case DW_OP_piece:
data = safe_read_uleb128 (data, end, &ul);
fprintf_filtered (stream, " %s (bytes)", pulongest (ul));
break;
static struct macro_source_file *
macro_start_file (buildsym_compunit *builder,
int file, int line,
- struct macro_source_file *current_file,
- const struct line_header *lh)
+ struct macro_source_file *current_file,
+ const struct line_header *lh)
{
/* File name relative to the compilation directory of this source file. */
gdb::unique_xmalloc_ptr<char> file_name = lh->file_file_name (file);
body);
while (*p == ' ')
- p++;
+ p++;
}
return p;
static void
parse_macro_definition (struct macro_source_file *file, int line,
- const char *body)
+ const char *body)
{
const char *p;
/* The body string takes one of two forms. For object-like macro
definitions, it should be:
- <macro name> " " <definition>
+ <macro name> " " <definition>
For function-like macro definitions, it should be:
- <macro name> "() " <definition>
+ <macro name> "() " <definition>
or
- <macro name> "(" <arg name> ( "," <arg name> ) * ") " <definition>
+ <macro name> "(" <arg name> ( "," <arg name> ) * ") " <definition>
Spaces may appear only where explicitly indicated, and in the
<definition>.
const char *replacement;
if (*p == ' ')
- replacement = body + name_len + 1;
+ replacement = body + name_len + 1;
else
- {
+ {
dwarf2_macro_malformed_definition_complaint (body);
- replacement = body + name_len;
- }
+ replacement = body + name_len;
+ }
macro_define_object (file, line, name.c_str (), replacement);
}
/* Parse the formal argument list. */
while (*p && *p != ')')
- {
- /* Find the extent of the current argument name. */
- const char *arg_start = p;
+ {
+ /* Find the extent of the current argument name. */
+ const char *arg_start = p;
- while (*p && *p != ',' && *p != ')' && *p != ' ')
- p++;
+ while (*p && *p != ',' && *p != ')' && *p != ' ')
+ p++;
- if (! *p || p == arg_start)
+ if (! *p || p == arg_start)
dwarf2_macro_malformed_definition_complaint (body);
- else
- {
- /* Make sure argv has room for the new argument. */
- if (argc >= argv_size)
- {
- argv_size *= 2;
- argv = XRESIZEVEC (char *, argv, argv_size);
- }
-
- argv[argc++] = savestring (arg_start, p - arg_start);
- }
+ else
+ {
+ /* Make sure argv has room for the new argument. */
+ if (argc >= argv_size)
+ {
+ argv_size *= 2;
+ argv = XRESIZEVEC (char *, argv, argv_size);
+ }
+
+ argv[argc++] = savestring (arg_start, p - arg_start);
+ }
- p = consume_improper_spaces (p, body);
+ p = consume_improper_spaces (p, body);
- /* Consume the comma, if present. */
- if (*p == ',')
- {
- p++;
+ /* Consume the comma, if present. */
+ if (*p == ',')
+ {
+ p++;
- p = consume_improper_spaces (p, body);
- }
- }
+ p = consume_improper_spaces (p, body);
+ }
+ }
if (*p == ')')
- {
- p++;
-
- if (*p == ' ')
- /* Perfectly formed definition, no complaints. */
- macro_define_function (file, line, name.c_str (),
- argc, (const char **) argv,
- p + 1);
- else if (*p == '\0')
- {
- /* Complain, but do define it. */
+ {
+ p++;
+
+ if (*p == ' ')
+ /* Perfectly formed definition, no complaints. */
+ macro_define_function (file, line, name.c_str (),
+ argc, (const char **) argv,
+ p + 1);
+ else if (*p == '\0')
+ {
+ /* Complain, but do define it. */
dwarf2_macro_malformed_definition_complaint (body);
- macro_define_function (file, line, name.c_str (),
- argc, (const char **) argv,
- p);
- }
- else
- /* Just complain. */
+ macro_define_function (file, line, name.c_str (),
+ argc, (const char **) argv,
+ p);
+ }
+ else
+ /* Just complain. */
dwarf2_macro_malformed_definition_complaint (body);
- }
+ }
else
- /* Just complain. */
+ /* Just complain. */
dwarf2_macro_malformed_definition_complaint (body);
{
- int i;
+ int i;
- for (i = 0; i < argc; i++)
- xfree (argv[i]);
+ for (i = 0; i < argc; i++)
+ xfree (argv[i]);
}
xfree (argv);
}
case 0:
break;
- case DW_MACRO_define:
- case DW_MACRO_undef:
+ case DW_MACRO_define:
+ case DW_MACRO_undef:
case DW_MACRO_define_strp:
case DW_MACRO_undef_strp:
case DW_MACRO_define_sup:
case DW_MACRO_undef_sup:
- {
- unsigned int bytes_read;
- int line;
- const char *body;
+ {
+ unsigned int bytes_read;
+ int line;
+ const char *body;
int is_define;
line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
is_define = (macinfo_type == DW_MACRO_define
|| macinfo_type == DW_MACRO_define_strp
|| macinfo_type == DW_MACRO_define_sup);
- if (! current_file)
+ if (! current_file)
{
/* DWARF violation as no main source is present. */
complaint (_("debug info with no main source gives macro %s "
|| macinfo_type == DW_MACRO_undef_sup);
macro_undef (current_file, line, body);
}
- }
- break;
+ }
+ break;
case DW_MACRO_define_strx:
case DW_MACRO_undef_strx:
}
break;
- case DW_MACRO_start_file:
- {
- unsigned int bytes_read;
- int line, file;
+ case DW_MACRO_start_file:
+ {
+ unsigned int bytes_read;
+ int line, file;
- line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
- mac_ptr += bytes_read;
- file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
- mac_ptr += bytes_read;
+ line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
+ file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
if ((line == 0 && !at_commandline)
|| (line != 0 && at_commandline))
else
current_file = macro_start_file (builder, file, line,
current_file, lh);
- }
- break;
+ }
+ break;
- case DW_MACRO_end_file:
- if (! current_file)
+ case DW_MACRO_end_file:
+ if (! current_file)
complaint (_("macro debug info has an unmatched "
"`close_file' directive"));
- else
- {
- current_file = current_file->included_by;
- if (! current_file)
- {
- enum dwarf_macro_record_type next_type;
-
- /* GCC circa March 2002 doesn't produce the zero
- type byte marking the end of the compilation
- unit. Complain if it's not there, but exit no
- matter what. */
-
- /* Do we at least have room for a macinfo type byte? */
- if (mac_ptr >= mac_end)
- {
+ else
+ {
+ current_file = current_file->included_by;
+ if (! current_file)
+ {
+ enum dwarf_macro_record_type next_type;
+
+ /* GCC circa March 2002 doesn't produce the zero
+ type byte marking the end of the compilation
+ unit. Complain if it's not there, but exit no
+ matter what. */
+
+ /* Do we at least have room for a macinfo type byte? */
+ if (mac_ptr >= mac_end)
+ {
section->overflow_complaint ();
- return;
- }
+ return;
+ }
- /* We don't increment mac_ptr here, so this is just
- a look-ahead. */
- next_type
+ /* We don't increment mac_ptr here, so this is just
+ a look-ahead. */
+ next_type
= (enum dwarf_macro_record_type) read_1_byte (abfd,
mac_ptr);
- if (next_type != 0)
+ if (next_type != 0)
complaint (_("no terminating 0-type entry for "
"macros in `.debug_macinfo' section"));
- return;
- }
- }
- break;
+ return;
+ }
+ }
+ break;
case DW_MACRO_import:
case DW_MACRO_import_sup:
}
break;
- case DW_MACINFO_vendor_ext:
+ case DW_MACINFO_vendor_ext:
if (!section_is_gnu)
{
unsigned int bytes_read;
if (mac_ptr == NULL)
return;
break;
- }
+ }
DIAGNOSTIC_POP
} while (macinfo_type != 0);
}
{
/* Do we at least have room for a macinfo type byte? */
if (mac_ptr >= mac_end)
- {
+ {
/* Complaint is printed during the second pass as GDB will probably
stop the first pass earlier upon finding
DW_MACINFO_start_file. */
break;
- }
+ }
macinfo_type = (enum dwarf_macro_record_type) read_1_byte (abfd, mac_ptr);
mac_ptr++;
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
switch (macinfo_type)
- {
- /* A zero macinfo type indicates the end of the macro
- information. */
- case 0:
+ {
+ /* A zero macinfo type indicates the end of the macro
+ information. */
+ case 0:
break;
case DW_MACRO_define:
struct dwarf2_cu *);
static const char *dwarf2_string_attr (struct die_info *die, unsigned int name,
- struct dwarf2_cu *cu);
+ struct dwarf2_cu *cu);
static const char *dwarf2_dwo_name (struct die_info *die, struct dwarf2_cu *cu);
static int dwarf2_flag_true_p (struct die_info *die, unsigned name,
- struct dwarf2_cu *cu);
+ struct dwarf2_cu *cu);
static int die_is_declaration (struct die_info *, struct dwarf2_cu *cu);
struct dwarf2_cu *);
static void dwarf2_record_block_ranges (struct die_info *, struct block *,
- CORE_ADDR, struct dwarf2_cu *);
+ CORE_ADDR, struct dwarf2_cu *);
static void dwarf2_add_field (struct field_info *, struct die_info *,
struct dwarf2_cu *);
int
dwarf2_has_info (struct objfile *objfile,
- const struct dwarf2_debug_sections *names,
+ const struct dwarf2_debug_sections *names,
bool can_copy)
{
if (objfile->flags & OBJF_READNEVER)
dwarf2_per_bfd *per_bfd;
/* We can share a "dwarf2_per_bfd" with other objfiles if the BFD
- doesn't require relocations and if there aren't partial symbols
+ doesn't require relocations and if there aren't partial symbols
from some other reader. */
if (!objfile_has_partial_symbols (objfile)
&& !gdb_bfd_requires_relocations (objfile->obfd))
static int
section_is_p (const char *section_name,
- const struct dwarf2_section_names *names)
+ const struct dwarf2_section_names *names)
{
if (names->normal != NULL
&& strcmp (section_name, names->normal) == 0)
void
dwarf2_get_section_info (struct objfile *objfile,
- enum dwarf2_section_enum sect,
- asection **sectp, const gdb_byte **bufp,
- bfd_size_type *sizep)
+ enum dwarf2_section_enum sect,
+ asection **sectp, const gdb_byte **bufp,
+ bfd_size_type *sizep)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
struct dwarf2_section_info *info;
if (addr + entry_length > section->buffer + section->size)
{
warning (_("Section .debug_aranges in %s entry at offset %s "
- "length %s exceeds section length %s, "
+ "length %s exceeds section length %s, "
"ignoring .debug_aranges."),
objfile_name (objfile),
plongest (entry_addr - section->buffer),
}
/* Must pad to an alignment boundary that is twice the address
- size. It is undocumented by the DWARF standard but GCC does
- use it. */
+ size. It is undocumented by the DWARF standard but GCC does
+ use it. */
for (size_t padding = ((-(addr - section->buffer))
& (2 * address_size - 1));
- padding > 0; padding--)
+ padding > 0; padding--)
if (*addr++ != 0)
{
warning (_("Section .debug_aranges in %s entry at offset %s "
indices for case insensitive languages are built in lowercase, therefore
simulate our NAME being searched is also lowercased. */
hash = mapped_index_string_hash ((index->version == 4
- && case_sensitivity == case_sensitive_off
+ && case_sensitivity == case_sensitive_off
? 5 : index->version),
name);
= lang->get_symbol_name_matcher (lookup_name_without_params);
name_and_matcher key {
- name_matcher,
+ name_matcher,
lookup_name_without_params.language_lookup_name (lang_e)
};
static void
dwarf2_create_include_psymtab (const char *name, dwarf2_psymtab *pst,
- struct objfile *objfile)
+ struct objfile *objfile)
{
dwarf2_include_psymtab *subpst = new dwarf2_include_psymtab (name, objfile);
else
{
/* If an existing_cu is provided, a dwarf2_cu must not exist for this_cu
- in per_objfile yet. */
+ in per_objfile yet. */
gdb_assert (per_objfile->get_cu (this_cu) == nullptr);
m_new_cu.reset (new dwarf2_cu (this_cu, per_objfile));
cu = m_new_cu.get ();
else
{
/* If an existing_cu is provided, a dwarf2_cu must not exist for this_cu
- in per_objfile yet. */
+ in per_objfile yet. */
gdb_assert (per_objfile->get_cu (this_cu) == nullptr);
m_new_cu.reset (new dwarf2_cu (this_cu, per_objfile));
cu = m_new_cu.get ();
if (m_new_cu != NULL)
{
/* Save this dwarf2_cu in the per_objfile. The per_objfile owns it
- now. */
+ now. */
dwarf2_per_objfile *per_objfile = m_new_cu->per_objfile;
per_objfile->set_cu (m_this_cu, m_new_cu.release ());
}
add_partial_enumeration (pdi, cu);
break;
case DW_TAG_base_type:
- case DW_TAG_subrange_type:
+ case DW_TAG_subrange_type:
/* File scope base type definitions are added to the partial
- symbol table. */
+ symbol table. */
add_partial_symbol (pdi, cu);
break;
case DW_TAG_namespace:
&& pdi->die_parent != NULL
&& pdi->die_parent->tag == DW_TAG_subprogram))
{
- /* Normally, only "external" DIEs are part of the global scope.
- But in Ada and Fortran, we want to be able to access nested
- procedures globally. So all Ada and Fortran subprograms are
- stored in the global scope. */
+ /* Normally, only "external" DIEs are part of the global scope.
+ But in Ada and Fortran, we want to be able to access nested
+ procedures globally. So all Ada and Fortran subprograms are
+ stored in the global scope. */
where = psymbol_placement::GLOBAL;
}
else
break;
case DW_TAG_module:
/* With Fortran 77 there might be a "BLOCK DATA" module
- available without any name. If so, we skip the module as it
- doesn't bring any value. */
+ available without any name. If so, we skip the module as it
+ doesn't bring any value. */
if (actual_name != nullptr)
{
psymbol.domain = MODULE_DOMAIN;
case DW_TAG_union_type:
case DW_TAG_enumeration_type:
/* Skip external references. The DWARF standard says in the section
- about "Structure, Union, and Class Type Entries": "An incomplete
- structure, union or class type is represented by a structure,
- union or class entry that does not have a byte size attribute
- and that has a DW_AT_declaration attribute." */
+ about "Structure, Union, and Class Type Entries": "An incomplete
+ structure, union or class type is represented by a structure,
+ union or class entry that does not have a byte size attribute
+ and that has a DW_AT_declaration attribute." */
if (!pdi->has_byte_size && pdi->is_declaration)
return;
if (pdi->tag == DW_TAG_subprogram || pdi->tag == DW_TAG_inlined_subroutine)
{
if (pdi->has_pc_info)
- {
- if (pdi->lowpc < *lowpc)
- *lowpc = pdi->lowpc;
- if (pdi->highpc > *highpc)
- *highpc = pdi->highpc;
+ {
+ if (pdi->lowpc < *lowpc)
+ *lowpc = pdi->lowpc;
+ if (pdi->highpc > *highpc)
+ *highpc = pdi->highpc;
if (set_addrmap)
{
struct objfile *objfile = cu->per_objfile->objfile;
this_lowpc, this_highpc - 1,
cu->per_cu->v.psymtab);
}
- }
+ }
if (pdi->has_pc_info || (!pdi->is_external && pdi->may_be_inlined))
{
- if (!pdi->is_declaration)
+ if (!pdi->is_declaration)
/* Ignore subprogram DIEs that do not have a name, they are
illegal. Do not emit a complaint at this point, we will
do so when we convert this psymtab into a symtab. */
if (pdi->name (cu))
add_partial_symbol (pdi, cu);
- }
+ }
}
if (! pdi->has_children)
case DW_TAG_subrange_type:
case DW_TAG_typedef:
/* Add a typedef symbol for the type definition, if it has a
- DW_AT_name. */
+ DW_AT_name. */
new_symbol (die, read_type_die (die, cu), cu);
break;
case DW_TAG_common_block:
{
/* GCC bug: https://bugzilla.redhat.com/show_bug.cgi?id=506524
- The import in the following code:
- namespace A
- {
- typedef int B;
- }
-
- int main ()
- {
- using A::B;
- B b;
- return b;
- }
-
- ...
- <2><51>: Abbrev Number: 3 (DW_TAG_imported_declaration)
- <52> DW_AT_decl_file : 1
- <53> DW_AT_decl_line : 6
- <54> DW_AT_import : <0x75>
- <2><58>: Abbrev Number: 4 (DW_TAG_typedef)
- <59> DW_AT_name : B
- <5b> DW_AT_decl_file : 1
- <5c> DW_AT_decl_line : 2
- <5d> DW_AT_type : <0x6e>
- ...
- <1><75>: Abbrev Number: 7 (DW_TAG_base_type)
- <76> DW_AT_byte_size : 4
- <77> DW_AT_encoding : 5 (signed)
-
- imports the wrong die ( 0x75 instead of 0x58 ).
- This case will be ignored until the gcc bug is fixed. */
+ The import in the following code:
+ namespace A
+ {
+ typedef int B;
+ }
+
+ int main ()
+ {
+ using A::B;
+ B b;
+ return b;
+ }
+
+ ...
+ <2><51>: Abbrev Number: 3 (DW_TAG_imported_declaration)
+ <52> DW_AT_decl_file : 1
+ <53> DW_AT_decl_line : 6
+ <54> DW_AT_import : <0x75>
+ <2><58>: Abbrev Number: 4 (DW_TAG_typedef)
+ <59> DW_AT_name : B
+ <5b> DW_AT_decl_file : 1
+ <5c> DW_AT_decl_line : 2
+ <5d> DW_AT_type : <0x6e>
+ ...
+ <1><75>: Abbrev Number: 7 (DW_TAG_base_type)
+ <76> DW_AT_byte_size : 4
+ <77> DW_AT_encoding : 5 (signed)
+
+ imports the wrong die ( 0x75 instead of 0x58 ).
+ This case will be ignored until the gcc bug is fixed. */
return;
}
else
{
/* We cannot free any current entry in (*slot) as that struct line_header
- may be already used by multiple CUs. Create only temporary decoded
+ may be already used by multiple CUs. Create only temporary decoded
line_header for this CU - it may happen at most once for each line
number information unit. And if we're not using line_header_hash
then this is what we want as well. */
dwo_unit->section =
XOBNEW (&per_objfile->per_bfd->obstack, struct dwarf2_section_info);
*dwo_unit->section = create_dwp_v2_or_v5_section
- (per_objfile,
+ (per_objfile,
is_debug_types
? &dwp_file->sections.types
: &dwp_file->sections.info,
if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Reading %s %s/%s in DWP V5 file: %s\n",
- kind,
- pulongest (unit_index), hex_string (signature),
- dwp_file->name);
+ kind,
+ pulongest (unit_index), hex_string (signature),
+ dwp_file->name);
}
/* Fetch the section offsets of this DWO unit. */
for (int i = 0; i < dwp_htab->nr_columns; ++i)
{
uint32_t offset = read_4_bytes (dbfd,
- dwp_htab->section_pool.v5.offsets
- + (((unit_index - 1)
- * dwp_htab->nr_columns
- + i)
- * sizeof (uint32_t)));
+ dwp_htab->section_pool.v5.offsets
+ + (((unit_index - 1)
+ * dwp_htab->nr_columns
+ + i)
+ * sizeof (uint32_t)));
uint32_t size = read_4_bytes (dbfd,
- dwp_htab->section_pool.v5.sizes
- + (((unit_index - 1) * dwp_htab->nr_columns
- + i)
- * sizeof (uint32_t)));
+ dwp_htab->section_pool.v5.sizes
+ + (((unit_index - 1) * dwp_htab->nr_columns
+ + i)
+ * sizeof (uint32_t)));
switch (dwp_htab->section_pool.v5.section_ids[i])
- {
- case DW_SECT_ABBREV_V5:
- sections.abbrev_offset = offset;
- sections.abbrev_size = size;
- break;
- case DW_SECT_INFO_V5:
- sections.info_or_types_offset = offset;
- sections.info_or_types_size = size;
- break;
- case DW_SECT_LINE_V5:
- sections.line_offset = offset;
- sections.line_size = size;
- break;
- case DW_SECT_LOCLISTS_V5:
- sections.loclists_offset = offset;
- sections.loclists_size = size;
- break;
- case DW_SECT_MACRO_V5:
- sections.macro_offset = offset;
- sections.macro_size = size;
- break;
- case DW_SECT_RNGLISTS_V5:
- sections.rnglists_offset = offset;
- sections.rnglists_size = size;
- break;
- case DW_SECT_STR_OFFSETS_V5:
- sections.str_offsets_offset = offset;
- sections.str_offsets_size = size;
- break;
- case DW_SECT_RESERVED_V5:
- default:
- break;
- }
+ {
+ case DW_SECT_ABBREV_V5:
+ sections.abbrev_offset = offset;
+ sections.abbrev_size = size;
+ break;
+ case DW_SECT_INFO_V5:
+ sections.info_or_types_offset = offset;
+ sections.info_or_types_size = size;
+ break;
+ case DW_SECT_LINE_V5:
+ sections.line_offset = offset;
+ sections.line_size = size;
+ break;
+ case DW_SECT_LOCLISTS_V5:
+ sections.loclists_offset = offset;
+ sections.loclists_size = size;
+ break;
+ case DW_SECT_MACRO_V5:
+ sections.macro_offset = offset;
+ sections.macro_size = size;
+ break;
+ case DW_SECT_RNGLISTS_V5:
+ sections.rnglists_offset = offset;
+ sections.rnglists_size = size;
+ break;
+ case DW_SECT_STR_OFFSETS_V5:
+ sections.str_offsets_offset = offset;
+ sections.str_offsets_size = size;
+ break;
+ case DW_SECT_RESERVED_V5:
+ default:
+ break;
+ }
}
/* It's easier for the rest of the code if we fake a struct dwo_file and
std::string virtual_dwo_name =
string_printf ("virtual-dwo/%ld-%ld-%ld-%ld-%ld-%ld",
- (long) (sections.abbrev_size ? sections.abbrev_offset : 0),
- (long) (sections.line_size ? sections.line_offset : 0),
- (long) (sections.loclists_size ? sections.loclists_offset : 0),
- (long) (sections.str_offsets_size
- ? sections.str_offsets_offset : 0),
- (long) (sections.macro_size ? sections.macro_offset : 0),
- (long) (sections.rnglists_size ? sections.rnglists_offset: 0));
+ (long) (sections.abbrev_size ? sections.abbrev_offset : 0),
+ (long) (sections.line_size ? sections.line_offset : 0),
+ (long) (sections.loclists_size ? sections.loclists_offset : 0),
+ (long) (sections.str_offsets_size
+ ? sections.str_offsets_offset : 0),
+ (long) (sections.macro_size ? sections.macro_offset : 0),
+ (long) (sections.rnglists_size ? sections.rnglists_offset: 0));
/* Can we use an existing virtual DWO file? */
dwo_file_slot = lookup_dwo_file_slot (per_objfile,
- virtual_dwo_name.c_str (),
- comp_dir);
+ virtual_dwo_name.c_str (),
+ comp_dir);
/* Create one if necessary. */
if (*dwo_file_slot == NULL)
{
if (dwarf_read_debug)
- {
- fprintf_unfiltered (gdb_stdlog, "Creating virtual DWO: %s\n",
- virtual_dwo_name.c_str ());
- }
+ {
+ fprintf_unfiltered (gdb_stdlog, "Creating virtual DWO: %s\n",
+ virtual_dwo_name.c_str ());
+ }
dwo_file = new struct dwo_file;
dwo_file->dwo_name = per_objfile->objfile->intern (virtual_dwo_name);
dwo_file->comp_dir = comp_dir;
dwo_file->sections.abbrev =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.abbrev,
- sections.abbrev_offset,
- sections.abbrev_size);
+ create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.abbrev,
+ sections.abbrev_offset,
+ sections.abbrev_size);
dwo_file->sections.line =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.line,
- sections.line_offset, sections.line_size);
+ create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.line,
+ sections.line_offset, sections.line_size);
dwo_file->sections.macro =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.macro,
- sections.macro_offset,
- sections.macro_size);
+ create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.macro,
+ sections.macro_offset,
+ sections.macro_size);
dwo_file->sections.loclists =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.loclists,
- sections.loclists_offset,
- sections.loclists_size);
+ create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.loclists,
+ sections.loclists_offset,
+ sections.loclists_size);
dwo_file->sections.rnglists =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.rnglists,
- sections.rnglists_offset,
- sections.rnglists_size);
+ create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.rnglists,
+ sections.rnglists_offset,
+ sections.rnglists_size);
dwo_file->sections.str_offsets =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.str_offsets,
- sections.str_offsets_offset,
- sections.str_offsets_size);
+ create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.str_offsets,
+ sections.str_offsets_offset,
+ sections.str_offsets_size);
/* The "str" section is global to the entire DWP file. */
dwo_file->sections.str = dwp_file->sections.str;
/* The info or types section is assigned below to dwo_unit,
- there's no need to record it in dwo_file.
- Also, we can't simply record type sections in dwo_file because
- we record a pointer into the vector in dwo_unit. As we collect more
- types we'll grow the vector and eventually have to reallocate space
- for it, invalidating all copies of pointers into the previous
- contents. */
+ there's no need to record it in dwo_file.
+ Also, we can't simply record type sections in dwo_file because
+ we record a pointer into the vector in dwo_unit. As we collect more
+ types we'll grow the vector and eventually have to reallocate space
+ for it, invalidating all copies of pointers into the previous
+ contents. */
*dwo_file_slot = dwo_file;
}
else
{
if (dwarf_read_debug)
- {
- fprintf_unfiltered (gdb_stdlog, "Using existing virtual DWO: %s\n",
- virtual_dwo_name.c_str ());
- }
+ {
+ fprintf_unfiltered (gdb_stdlog, "Using existing virtual DWO: %s\n",
+ virtual_dwo_name.c_str ());
+ }
dwo_file = (struct dwo_file *) *dwo_file_slot;
}
dwo_unit->section
= XOBNEW (&per_objfile->per_bfd->obstack, struct dwarf2_section_info);
*dwo_unit->section = create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.info,
- sections.info_or_types_offset,
- sections.info_or_types_size);
+ &dwp_file->sections.info,
+ sections.info_or_types_offset,
+ sections.info_or_types_size);
/* dwo_unit->{offset,length,type_offset_in_tu} are set later. */
return dwo_unit;
present in the abstract instance but not referenced in the concrete
one. */
if (child_die->tag == DW_TAG_call_site
- || child_die->tag == DW_TAG_GNU_call_site)
+ || child_die->tag == DW_TAG_GNU_call_site)
continue;
/* For each CHILD_DIE, find the corresponding child of
templ_func->n_template_arguments = template_args.size ();
templ_func->template_arguments
- = XOBNEWVEC (&objfile->objfile_obstack, struct symbol *,
+ = XOBNEWVEC (&objfile->objfile_obstack, struct symbol *,
templ_func->n_template_arguments);
memcpy (templ_func->template_arguments,
template_args.data (),
|| (*cu->get_builder ()->get_local_using_directives ()) != NULL)
{
struct block *block
- = cu->get_builder ()->finish_block (0, cstk.old_blocks, NULL,
+ = cu->get_builder ()->finish_block (0, cstk.old_blocks, NULL,
cstk.start_addr, highpc);
/* Note that recording ranges after traversing children, as we
- do here, means that recording a parent's ranges entails
- walking across all its children's ranges as they appear in
- the address map, which is quadratic behavior.
-
- It would be nicer to record the parent's ranges before
- traversing its children, simply overriding whatever you find
- there. But since we don't even decide whether to create a
- block until after we've traversed its children, that's hard
- to do. */
+ do here, means that recording a parent's ranges entails
+ walking across all its children's ranges as they appear in
+ the address map, which is quadratic behavior.
+
+ It would be nicer to record the parent's ranges before
+ traversing its children, simply overriding whatever you find
+ there. But since we don't even decide whether to create a
+ block until after we've traversed its children, that's hard
+ to do. */
dwarf2_record_block_ranges (die, block, baseaddr, cu);
}
*cu->get_builder ()->get_local_symbols () = cstk.locals;
child_die = child_die->sibling)
{
if (child_die->tag != DW_TAG_call_site_parameter
- && child_die->tag != DW_TAG_GNU_call_site_parameter)
+ && child_die->tag != DW_TAG_GNU_call_site_parameter)
{
complaint (_("Tag %d is not DW_TAG_call_site_parameter in "
"DW_TAG_call_site child DIE %s [in module %s]"),
/* DW_AT_call_all_calls is a superset
of DW_AT_call_all_tail_calls. */
if (func_die
- && !dwarf2_flag_true_p (func_die, DW_AT_call_all_calls, cu)
- && !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_call_sites, cu)
+ && !dwarf2_flag_true_p (func_die, DW_AT_call_all_calls, cu)
+ && !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_call_sites, cu)
&& !dwarf2_flag_true_p (func_die, DW_AT_call_all_tail_calls, cu)
&& !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_tail_call_sites, cu))
{
target_physname = dwarf2_physname (NULL, target_die, target_cu);
if (target_physname == NULL)
complaint (_("DW_AT_call_target target DIE has invalid "
- "physname, for referencing DIE %s [in module %s]"),
+ "physname, for referencing DIE %s [in module %s]"),
sect_offset_str (die->sect_off), objfile_name (objfile));
else
SET_FIELD_PHYSNAME (call_site->target, target_physname);
if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
<= PC_BOUNDS_INVALID)
complaint (_("DW_AT_call_target target DIE has invalid "
- "low pc, for referencing DIE %s [in module %s]"),
+ "low pc, for referencing DIE %s [in module %s]"),
sect_offset_str (die->sect_off), objfile_name (objfile));
else
{
struct attribute *loc, *origin;
if (child_die->tag != DW_TAG_call_site_parameter
- && child_die->tag != DW_TAG_GNU_call_site_parameter)
+ && child_die->tag != DW_TAG_GNU_call_site_parameter)
{
/* Already printed the complaint above. */
continue;
base = cu->header.read_address (obfd, buffer, &bytes_read);
buffer += bytes_read;
break;
- case DW_RLE_base_addressx:
- addr_index = read_unsigned_leb128 (obfd, buffer, &bytes_read);
- buffer += bytes_read;
- base = read_addr_index (cu, addr_index);
- break;
+ case DW_RLE_base_addressx:
+ addr_index = read_unsigned_leb128 (obfd, buffer, &bytes_read);
+ buffer += bytes_read;
+ base = read_addr_index (cu, addr_index);
+ break;
case DW_RLE_start_length:
if (buffer + cu->header.addr_size > buf_end)
{
}
break;
case DW_RLE_startx_length:
- addr_index = read_unsigned_leb128 (obfd, buffer, &bytes_read);
- buffer += bytes_read;
- range_beginning = read_addr_index (cu, addr_index);
- if (buffer > buf_end)
- {
- overflow = true;
- break;
- }
- range_end = (range_beginning
- + read_unsigned_leb128 (obfd, buffer, &bytes_read));
- buffer += bytes_read;
- break;
+ addr_index = read_unsigned_leb128 (obfd, buffer, &bytes_read);
+ buffer += bytes_read;
+ range_beginning = read_addr_index (cu, addr_index);
+ if (buffer > buf_end)
+ {
+ overflow = true;
+ break;
+ }
+ range_end = (range_beginning
+ + read_unsigned_leb128 (obfd, buffer, &bytes_read));
+ buffer += bytes_read;
+ break;
case DW_RLE_offset_pair:
range_beginning = read_unsigned_leb128 (obfd, buffer, &bytes_read);
buffer += bytes_read;
buffer += bytes_read;
break;
case DW_RLE_startx_endx:
- addr_index = read_unsigned_leb128 (obfd, buffer, &bytes_read);
- buffer += bytes_read;
- range_beginning = read_addr_index (cu, addr_index);
- if (buffer > buf_end)
- {
- overflow = true;
- break;
- }
- addr_index = read_unsigned_leb128 (obfd, buffer, &bytes_read);
- buffer += bytes_read;
- range_end = read_addr_index (cu, addr_index);
- break;
+ addr_index = read_unsigned_leb128 (obfd, buffer, &bytes_read);
+ buffer += bytes_read;
+ range_beginning = read_addr_index (cu, addr_index);
+ if (buffer > buf_end)
+ {
+ overflow = true;
+ break;
+ }
+ addr_index = read_unsigned_leb128 (obfd, buffer, &bytes_read);
+ buffer += bytes_read;
+ range_end = read_addr_index (cu, addr_index);
+ break;
default:
complaint (_("Invalid .debug_rnglists data (no base address)"));
return false;
{
attr = dwarf2_attr (die, DW_AT_low_pc, cu);
if (attr != nullptr)
- {
+ {
low = attr->as_address ();
high = attr_high->as_address ();
if (cu->header.version >= 4 && attr_high->form_is_constant ())
static void
dwarf2_get_subprogram_pc_bounds (struct die_info *die,
- CORE_ADDR *lowpc, CORE_ADDR *highpc,
- struct dwarf2_cu *cu)
+ CORE_ADDR *lowpc, CORE_ADDR *highpc,
+ struct dwarf2_cu *cu)
{
CORE_ADDR low, high;
struct die_info *child = die->child;
while (child && child->tag)
{
if (child->tag == DW_TAG_subprogram
- || child->tag == DW_TAG_lexical_block)
- dwarf2_get_subprogram_pc_bounds (child, lowpc, highpc, cu);
+ || child->tag == DW_TAG_lexical_block)
+ dwarf2_get_subprogram_pc_bounds (child, lowpc, highpc, cu);
child = child->sibling;
}
}
{
switch (child->tag) {
case DW_TAG_subprogram:
- dwarf2_get_subprogram_pc_bounds (child, &best_low, &best_high, cu);
+ dwarf2_get_subprogram_pc_bounds (child, &best_low, &best_high, cu);
break;
case DW_TAG_namespace:
case DW_TAG_module:
static void
dwarf2_record_block_ranges (struct die_info *die, struct block *block,
- CORE_ADDR baseaddr, struct dwarf2_cu *cu)
+ CORE_ADDR baseaddr, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->per_objfile->objfile;
struct gdbarch *gdbarch = objfile->arch ();
{
attr = dwarf2_attr (die, DW_AT_low_pc, cu);
if (attr != nullptr)
- {
+ {
CORE_ADDR low = attr->as_address ();
CORE_ADDR high = attr_high->as_address ();
low = gdbarch_adjust_dwarf2_addr (gdbarch, low + baseaddr);
high = gdbarch_adjust_dwarf2_addr (gdbarch, high + baseaddr);
cu->get_builder ()->record_block_range (block, low, high - 1);
- }
+ }
}
attr = dwarf2_attr (die, DW_AT_ranges, cu);
&& attr->form != DW_FORM_rnglistx);
/* The value of the DW_AT_ranges attribute is the offset of the
- address range list in the .debug_ranges section. */
+ address range list in the .debug_ranges section. */
unsigned long offset = (attr->as_unsigned ()
+ (need_ranges_base ? cu->ranges_base : 0));
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
/* For big endian bits, the DW_AT_bit_offset gives the
- additional bit offset from the MSB of the containing
- anonymous object to the MSB of the field. We don't
- have to do anything special since we don't need to
- know the size of the anonymous object. */
+ additional bit offset from the MSB of the containing
+ anonymous object to the MSB of the field. We don't
+ have to do anything special since we don't need to
+ know the size of the anonymous object. */
SET_FIELD_BITPOS (*fp, (FIELD_BITPOS (*fp)
+ attr->constant_value (0)));
}
else
{
/* For little endian bits, compute the bit offset to the
- MSB of the anonymous object, subtract off the number of
- bits from the MSB of the field to the MSB of the
- object, and then subtract off the number of bits of
- the field itself. The result is the bit offset of
- the LSB of the field. */
+ MSB of the anonymous object, subtract off the number of
+ bits from the MSB of the field to the MSB of the
+ object, and then subtract off the number of bits of
+ the field itself. The result is the bit offset of
+ the LSB of the field. */
int anonymous_size;
int bit_offset = attr->constant_value (0);
fp->name = fieldname;
/* Change accessibility for artificial fields (e.g. virtual table
- pointer or virtual base class pointer) to private. */
+ pointer or virtual base class pointer) to private. */
if (dwarf2_attr (die, DW_AT_artificial, cu))
{
FIELD_ARTIFICIAL (*fp) = 1;
this_type->has_varargs ());
/* Handle static member functions.
- Dwarf2 has no clean way to discern C++ static and non-static
- member functions. G++ helps GDB by marking the first
- parameter for non-static member functions (which is the this
- pointer) as artificial. We obtain this information from
- read_subroutine_type via TYPE_FIELD_ARTIFICIAL. */
+ Dwarf2 has no clean way to discern C++ static and non-static
+ member functions. G++ helps GDB by marking the first
+ parameter for non-static member functions (which is the this
+ pointer) as artificial. We obtain this information from
+ read_subroutine_type via TYPE_FIELD_ARTIFICIAL. */
if (nparams == 0 || TYPE_FIELD_ARTIFICIAL (this_type, 0) == 0)
fnp->voffset = VOFFSET_STATIC;
}
if (attr != nullptr)
{
if (attr->form_is_block () && attr->as_block ()->size > 0)
- {
+ {
struct dwarf_block *block = attr->as_block ();
if (block->data[0] == DW_OP_constu)
}
}
else if (attr->form_is_section_offset ())
- {
+ {
dwarf2_complex_location_expr_complaint ();
- }
+ }
else
- {
+ {
dwarf2_invalid_attrib_class_complaint ("DW_AT_vtable_elem_location",
fieldname);
- }
+ }
}
else
{
if (attr != nullptr)
{
if (attr->form_is_constant ())
- TYPE_LENGTH (type) = attr->constant_value (0);
+ TYPE_LENGTH (type) = attr->constant_value (0);
else
{
struct dynamic_prop prop;
if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type ()))
type->add_dyn_prop (DYN_PROP_BYTE_SIZE, prop);
- TYPE_LENGTH (type) = 0;
+ TYPE_LENGTH (type) = 0;
}
}
else
{
const char *fieldname = TYPE_FIELD_NAME (t, i);
- if (is_vtable_name (fieldname, cu))
+ if (is_vtable_name (fieldname, cu))
{
set_type_vptr_fieldno (type, i);
break;
&& startswith (cu->producer, "IBM(R) XL C/C++ Advanced Edition"))
{
/* The IBM XLC compiler does not provide direct indication
- of the containing type, but the vtable pointer is
- always named __vfp. */
+ of the containing type, but the vtable pointer is
+ always named __vfp. */
int i;
{
struct type *child_type = read_type_die (child_die, cu);
- if (child_type != NULL)
- {
+ if (child_type != NULL)
+ {
/* The range type was succesfully read. Save it for the
- array type creation. */
+ array type creation. */
range_types.push_back (child_type);
- }
+ }
}
child_die = child_die->sibling;
}
{
/* Support the .debug_loc offsets. */
if (attr->form_is_block ())
- {
+ {
/* Ok. */
- }
+ }
else if (attr->form_is_section_offset ())
- {
+ {
dwarf2_complex_location_expr_complaint ();
attr = NULL;
- }
+ }
else
- {
+ {
dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
"common block member");
attr = NULL;
- }
+ }
}
if (die->child != NULL)
static struct type *
read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu,
- enum type_code refcode)
+ enum type_code refcode)
{
struct comp_unit_head *cu_header = &cu->header;
struct type *type, *target_type;
int nparams, iparams;
/* Count the number of parameters.
- FIXME: GDB currently ignores vararg functions, but knows about
- vararg member functions. */
+ FIXME: GDB currently ignores vararg functions, but knows about
+ vararg member functions. */
nparams = 0;
child_die = die->child;
while (child_die && child_die->tag)
attribute attr;
info_ptr = read_attribute (reader, &attr, &abbrev.attrs[i], info_ptr);
/* String and address offsets that need to do the reprocessing have
- already been read at this point, so there is no need to wait until
+ already been read at this point, so there is no need to wait until
the loop terminates to do the reprocessing. */
if (attr.requires_reprocessing_p ())
read_attribute_reprocess (reader, &attr, tag);
/* Store the data if it is of an attribute we want to keep in a
- partial symbol table. */
+ partial symbol table. */
switch (attr.name)
{
case DW_AT_name:
high_pc_relative = 1;
break;
case DW_AT_location:
- /* Support the .debug_loc offsets. */
- if (attr.form_is_block ())
- {
+ /* Support the .debug_loc offsets. */
+ if (attr.form_is_block ())
+ {
d.locdesc = attr.as_block ();
- }
- else if (attr.form_is_section_offset ())
- {
+ }
+ else if (attr.form_is_section_offset ())
+ {
dwarf2_complex_location_expr_complaint ();
- }
- else
- {
+ }
+ else
+ {
dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
"partial symbol information");
- }
+ }
break;
case DW_AT_external:
is_external = attr.as_boolean ();
sibling = sibling_ptr;
}
break;
- case DW_AT_byte_size:
- has_byte_size = 1;
- break;
- case DW_AT_const_value:
- has_const_value = 1;
- break;
+ case DW_AT_byte_size:
+ has_byte_size = 1;
+ break;
+ case DW_AT_const_value:
+ has_const_value = 1;
+ break;
case DW_AT_calling_convention:
/* DWARF doesn't provide a way to identify a program's source-level
entry point. DW_AT_calling_convention attributes are only meant
does not appear in DW_TAG_compile_unit of DWO files.
Attributes of the form DW_FORM_rnglistx have already had
- their value changed by read_rnglist_index and already
+ their value changed by read_rnglist_index and already
include DW_AT_rnglists_base, so don't need to add the ranges
base, either. */
int need_ranges_base = (tag != DW_TAG_compile_unit
section->read (objfile);
if (section->buffer == NULL)
complaint (_("DW_FORM_loclistx used without .debug_loclists "
- "section [in module %s]"), objfile_name (objfile));
+ "section [in module %s]"), objfile_name (objfile));
struct loclists_rnglists_header header;
read_loclists_rnglists_header (&header, section);
if (loclist_index >= header.offset_entry_count)
complaint (_("DW_FORM_loclistx pointing outside of "
- ".debug_loclists offset array [in module %s]"),
- objfile_name (objfile));
+ ".debug_loclists offset array [in module %s]"),
+ objfile_name (objfile));
if (loclist_base + loclist_index * cu->header.offset_size
>= section->size)
complaint (_("DW_FORM_loclistx pointing outside of "
- ".debug_loclists section [in module %s]"),
- objfile_name (objfile));
+ ".debug_loclists section [in module %s]"),
+ objfile_name (objfile));
const gdb_byte *info_ptr
= section->buffer + loclist_base + loclist_index * cu->header.offset_size;
/* Validate that the offset is within the section's range. */
if (start_offset >= section->size)
error (_("DW_FORM_rnglistx pointing outside of "
- ".debug_rnglists section [in module %s]"),
+ ".debug_rnglists section [in module %s]"),
objfile_name (objfile));
/* Validate that reading won't go beyond the end of the section. */
case DW_FORM_GNU_addr_index:
attr->set_address (read_addr_index (cu,
attr->as_unsigned_reprocess ()));
- break;
+ break;
case DW_FORM_loclistx:
attr->set_address (read_loclist_index (cu, attr->as_unsigned ()));
break;
case DW_FORM_rnglistx:
attr->set_address (read_rnglist_index (cu, attr->as_unsigned (), tag));
- break;
+ break;
case DW_FORM_strx:
case DW_FORM_strx1:
case DW_FORM_strx2:
&& attr->as_unsigned () >= 0xffffffff)
{
complaint
- (_("Suspicious DW_AT_byte_size value treated as zero instead of %s"),
- hex_string (attr->as_unsigned ()));
+ (_("Suspicious DW_AT_byte_size value treated as zero instead of %s"),
+ hex_string (attr->as_unsigned ()));
attr->set_unsigned (0);
}
error (_("%s used without %s section"
" in CU at offset %s [in module %s]"),
form_name, str_section->get_name (),
- sect_offset_str (cu->header.sect_off), objf_name);
+ sect_offset_str (cu->header.sect_off), objf_name);
if (str_offsets_section->buffer == NULL)
error (_("%s used without %s section"
" in CU at offset %s [in module %s]"),
form_name, str_section->get_name (),
- sect_offset_str (cu->header.sect_off), objf_name);
+ sect_offset_str (cu->header.sect_off), objf_name);
info_ptr = (str_offsets_section->buffer
+ str_offsets_base
+ str_index * cu->header.offset_size);
{
str = attr->as_string ();
if (str == nullptr)
- complaint (_("string type expected for attribute %s for "
+ complaint (_("string type expected for attribute %s for "
"DIE at %s in module %s"),
dwarf_attr_name (name), sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
bool file_changed
= m_last_subfile != m_cu->get_builder ()->get_current_subfile ();
bool ignore_this_line
- = ((file_changed && !end_sequence && m_last_address == m_address
- && !m_is_stmt && m_stmt_at_address)
- || (!end_sequence && m_line == 0));
+ = ((file_changed && !end_sequence && m_last_address == m_address
+ && !m_is_stmt && m_stmt_at_address)
+ || (!end_sequence && m_line == 0));
if ((file_changed && !ignore_this_line) || end_sequence)
{
}
break;
case DW_LNE_define_file:
- {
- const char *cur_file;
+ {
+ const char *cur_file;
unsigned int mod_time, length;
dir_index dindex;
- cur_file = read_direct_string (abfd, line_ptr,
+ cur_file = read_direct_string (abfd, line_ptr,
&bytes_read);
- line_ptr += bytes_read;
- dindex = (dir_index)
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- mod_time =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- length =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- lh->add_file_name (cur_file, dindex, mod_time, length);
- }
+ line_ptr += bytes_read;
+ dindex = (dir_index)
+ read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ mod_time =
+ read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ length =
+ read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ lh->add_file_name (cur_file, dindex, mod_time, length);
+ }
break;
case DW_LNE_set_discriminator:
{
if (decode_for_pst_p)
{
/* Now that we're done scanning the Line Header Program, we can
- create the psymtab of each included file. */
+ create the psymtab of each included file. */
for (auto &file_entry : lh->file_names ())
- if (file_entry.included_p == 1)
- {
+ if (file_entry.included_p == 1)
+ {
gdb::unique_xmalloc_ptr<char> name_holder;
const char *include_name =
psymtab_include_file_name (lh, file_entry, pst,
comp_dir, &name_holder);
if (include_name != NULL)
- dwarf2_create_include_psymtab (include_name, pst, objfile);
- }
+ dwarf2_create_include_psymtab (include_name, pst, objfile);
+ }
}
else
{
if ((block->data[0] == DW_OP_addr
&& block->size == 1 + cu_header->addr_size)
|| ((block->data[0] == DW_OP_GNU_addr_index
- || block->data[0] == DW_OP_addrx)
+ || block->data[0] == DW_OP_addrx)
&& (block->size
== 1 + leb128_size (&block->data[1]))))
{
}
/* Default assumptions.
- Use the passed type or decode it from the die. */
+ Use the passed type or decode it from the die. */
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
if (type != NULL)
|| cu->language == language_ada
|| cu->language == language_fortran)
{
- /* Subprograms marked external are stored as a global symbol.
- Ada and Fortran subprograms, whether marked external or
- not, are always stored as a global symbol, because we want
- to be able to access them globally. For instance, we want
- to be able to break on a nested subprogram without having
- to specify the context. */
+ /* Subprograms marked external are stored as a global symbol.
+ Ada and Fortran subprograms, whether marked external or
+ not, are always stored as a global symbol, because we want
+ to be able to access them globally. For instance, we want
+ to be able to break on a nested subprogram without having
+ to specify the context. */
list_to_add = cu->get_builder ()->get_global_symbols ();
}
else
else
{
/* We do not know the address of this symbol.
- If it is an external symbol and we have type information
- for it, enter the symbol as a LOC_UNRESOLVED symbol.
- The address of the variable will then be determined from
- the minimal symbol table whenever the variable is
- referenced. */
+ If it is an external symbol and we have type information
+ for it, enter the symbol as a LOC_UNRESOLVED symbol.
+ The address of the variable will then be determined from
+ the minimal symbol table whenever the variable is
+ referenced. */
attr2 = dwarf2_attr (die, DW_AT_external, cu);
/* Fortran explicitly imports any global symbols to the local
list_to_add = cu->list_in_scope;
break;
case DW_TAG_base_type:
- case DW_TAG_subrange_type:
+ case DW_TAG_subrange_type:
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
list_to_add = cu->list_in_scope;
template class <class Enum> Class{};
Class<enum E> class_e;
- 1: DW_TAG_class_type (Class)
- 2: DW_TAG_enumeration_type (E)
- 3: DW_TAG_enumerator (enum1:0)
- 3: DW_TAG_enumerator (enum2:1)
- ...
- 2: DW_TAG_template_type_param
- DW_AT_type DW_FORM_ref_udata (E)
+ 1: DW_TAG_class_type (Class)
+ 2: DW_TAG_enumeration_type (E)
+ 3: DW_TAG_enumerator (enum1:0)
+ 3: DW_TAG_enumerator (enum2:1)
+ ...
+ 2: DW_TAG_template_type_param
+ DW_AT_type DW_FORM_ref_udata (E)
Besides being broken debug info, it can put GDB into an
infinite loop. Consider:
static char *
typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
- int physname, struct dwarf2_cu *cu)
+ int physname, struct dwarf2_cu *cu)
{
const char *lead = "";
const char *sep;
if (sig_type == NULL)
{
error (_("Dwarf Error: Cannot find signatured DIE %s referenced"
- " from DIE at %s [in module %s]"),
- hex_string (signature), sect_offset_str (src_die->sect_off),
+ " from DIE at %s [in module %s]"),
+ hex_string (signature), sect_offset_str (src_die->sect_off),
objfile_name ((*ref_cu)->per_objfile->objfile));
}
}
break;
- case DW_OP_GNU_push_tls_address:
+ case DW_OP_GNU_push_tls_address:
case DW_OP_form_tls_address:
/* The top of the stack has the offset from the beginning
of the thread control block at which the variable is located. */
return 0;
}
stack[stacki]++;
- break;
+ break;
case DW_OP_GNU_uninit:
if (computed != nullptr)
}
/* Enforce maximum stack depth of SIZE-1 to avoid writing
- outside of the allocated space. Also enforce minimum>0. */
+ outside of the allocated space. Also enforce minimum>0. */
if (stacki >= ARRAY_SIZE (stack) - 1)
{
if (computed == nullptr)
{
struct type *prop_type = cu->addr_sized_int_type (false);
if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
- type->add_dyn_prop (DYN_PROP_ALLOCATED, prop);
+ type->add_dyn_prop (DYN_PROP_ALLOCATED, prop);
}
/* Read DW_AT_associated and set in type. */
{
struct type *prop_type = cu->addr_sized_int_type (false);
if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
- type->add_dyn_prop (DYN_PROP_ASSOCIATED, prop);
+ type->add_dyn_prop (DYN_PROP_ASSOCIATED, prop);
}
/* Read DW_AT_data_location and set in type. */
for (i = 0; i < (dwarf2_per_bfd->n_comp_units
+ dwarf2_per_bfd->n_type_units); ++i)
{
- dwarf2_per_cu_data *per_cu = dwarf2_per_bfd->get_cutu (i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_bfd->get_cutu (i);
- ...;
+ ...;
}
*/
dwarf2_per_cu_data *get_cutu (int index);
const struct ecoff_debug_swap *swap;
/* .mdebug section, presumably holding ECOFF debugging
- information. */
+ information. */
swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
if (swap)
elfmdebug_build_psymtabs (objfile, swap, ei.mdebugsect);
asection *str_sect;
/* Stab sections have an associated string table that looks like
- a separate section. */
+ a separate section. */
str_sect = bfd_get_section_by_name (abfd, ".stabstr");
/* FIXME should probably warn about a stab section without a stabstr. */
int unsigned_operation;
/* Determine type length and signedness after promotion for
- both operands. */
+ both operands. */
if (promoted_len1 < TYPE_LENGTH (builtin->builtin_int))
{
is_unsigned1 = 0;
if (regno == -1)
error (_("Register $%s not available."), name);
- /* In EVAL_AVOID_SIDE_EFFECTS mode, we only need to return
- a value with the appropriate register type. Unfortunately,
- we don't have easy access to the type of user registers.
- So for these registers, we fetch the register value regardless
- of the evaluation mode. */
+ /* In EVAL_AVOID_SIDE_EFFECTS mode, we only need to return
+ a value with the appropriate register type. Unfortunately,
+ we don't have easy access to the type of user registers.
+ So for these registers, we fetch the register value regardless
+ of the evaluation mode. */
if (noside == EVAL_AVOID_SIDE_EFFECTS
&& regno < gdbarch_num_cooked_regs (exp->gdbarch))
val = value_zero (register_type (exp->gdbarch, regno), not_lval);
range_low = range_high = value_as_long (elem_val);
/* Check types of elements to avoid mixture of elements from
- different types. Also check if type of element is "compatible"
- with element type of powerset. */
+ different types. Also check if type of element is "compatible"
+ with element type of powerset. */
if (range_low_type->code () == TYPE_CODE_RANGE)
range_low_type = TYPE_TARGET_TYPE (range_low_type);
if (range_high_type->code () == TYPE_CODE_RANGE)
}
/* If we found a method with symbol information, check to see
- if it returns a struct. Otherwise assume it doesn't. */
+ if it returns a struct. Otherwise assume it doesn't. */
if (method)
{
case OP_COMPLEX:
/* We have a complex number, There should be 2 floating
- point numbers that compose it. */
+ point numbers that compose it. */
(*pos) += 2;
arg1 = evaluate_subexp (nullptr, exp, pos, noside);
arg2 = evaluate_subexp (nullptr, exp, pos, noside);
return eval_skip_value (exp);
/* Check to see if operator '->' has been overloaded. If so replace
- arg1 with the value returned by evaluating operator->(). */
+ arg1 with the value returned by evaluating operator->(). */
while (unop_user_defined_p (op, arg1))
{
struct value *value = NULL;
with rtti type in order to continue on with successful
lookup of member / method only available in the rtti type. */
{
- struct type *arg_type = value_type (arg1);
- struct type *real_type;
- int full, using_enc;
- LONGEST top;
+ struct type *arg_type = value_type (arg1);
+ struct type *real_type;
+ int full, using_enc;
+ LONGEST top;
struct value_print_options opts;
get_user_print_options (&opts);
- if (opts.objectprint && TYPE_TARGET_TYPE (arg_type)
- && (TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_STRUCT))
- {
- real_type = value_rtti_indirect_type (arg1, &full, &top,
+ if (opts.objectprint && TYPE_TARGET_TYPE (arg_type)
+ && (TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_STRUCT))
+ {
+ real_type = value_rtti_indirect_type (arg1, &full, &top,
&using_enc);
- if (real_type)
- arg1 = value_cast (real_type, arg1);
- }
+ if (real_type)
+ arg1 = value_cast (real_type, arg1);
+ }
}
arg3 = value_struct_elt (&arg1, NULL, &exp->elts[pc + 2].string,
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
/* If the user attempts to subscript something that has no target
- type (like a plain int variable for example), then report this
- as an error. */
+ type (like a plain int variable for example), then report this
+ as an error. */
type = TYPE_TARGET_TYPE (check_typedef (value_type (arg1)));
if (type != NULL)
return eval_skip_value (exp);
type = check_typedef (value_type (arg2));
if (type->code () != TYPE_CODE_INT
- && type->code () != TYPE_CODE_ENUM)
+ && type->code () != TYPE_CODE_ENUM)
error (_("Non-integral right operand for \"@\" operator."));
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
case OP_TYPE:
/* The value is not supposed to be used. This is here to make it
- easier to accommodate expressions that contain types. */
+ easier to accommodate expressions that contain types. */
(*pos) += 2;
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
return allocate_value (exp->elts[pc + 1].type);
else
- error (_("Attempt to use a type name as an expression"));
+ error (_("Attempt to use a type name as an expression"));
case OP_TYPEOF:
case OP_DECLTYPE:
return result;
}
else
- error (_("Attempt to use a type as an expression"));
+ error (_("Attempt to use a type as an expression"));
case OP_TYPEID:
{
default:
/* Removing this case and compiling with gcc -Wall reveals that
- a lot of cases are hitting this case. Some of these should
- probably be removed from expression.h; others are legitimate
- expressions which are (apparently) not fully implemented.
+ a lot of cases are hitting this case. Some of these should
+ probably be removed from expression.h; others are legitimate
+ expressions which are (apparently) not fully implemented.
- If there are any cases landing here which mean a user error,
- then they should be separate cases, with more descriptive
- error messages. */
+ If there are any cases landing here which mean a user error,
+ then they should be separate cases, with more descriptive
+ error messages. */
error (_("GDB does not (yet) know how to "
"evaluate that kind of expression"));
switch (op)
{
/* This case is handled specially
- so that we avoid creating a value for the result type.
- If the result type is very big, it's desirable not to
- create a value unnecessarily. */
+ so that we avoid creating a value for the result type.
+ If the result type is very big, it's desirable not to
+ create a value unnecessarily. */
case UNOP_IND:
(*pos)++;
val = evaluate_subexp (nullptr, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
val = evaluate_subexp (nullptr, exp, pos, EVAL_NORMAL);
type = value_type (val);
if (type->code () == TYPE_CODE_ARRAY
- && is_dynamic_type (type->index_type ())
- && type->bounds ()->high.kind () == PROP_UNDEFINED)
+ && is_dynamic_type (type->index_type ())
+ && type->bounds ()->high.kind () == PROP_UNDEFINED)
return allocate_optimized_out_value (size_type);
}
else
else
{
/* Don't use a _filtered function here. It causes the assumed
- character position to be off, since the newline we read from
- the user is not accounted for. */
+ character position to be off, since the newline we read from
+ the user is not accounted for. */
fprintf_unfiltered (gdb_stdout, "%s", actual_gdb_prompt.c_str ());
gdb_flush (gdb_stdout);
}
if (server_command)
{
/* Note that we don't call `save_command_line'. Between this
- and the check in dont_repeat, this insures that repeating
- will still do the right thing. */
+ and the check in dont_repeat, this insures that repeating
+ will still do the right thing. */
return cmd + strlen (SERVER_COMMAND_PREFIX);
}
while (1)
{
/* Read from stdin if we are executing a user defined command.
- This is the right thing for prompt_for_continue, at least. */
+ This is the right thing for prompt_for_continue, at least. */
c = fgetc (ui->instream != NULL ? ui->instream : ui->stdin_stream);
if (c == EOF)
if (!filename)
{
if (from_tty)
- printf_unfiltered (_("No executable file now.\n"));
+ printf_unfiltered (_("No executable file now.\n"));
set_gdbarch_from_file (NULL);
}
if (args)
{
/* Scan through the args and pick up the first non option arg
- as the filename. */
+ as the filename. */
gdb_argv built_argv (args);
char **argv = built_argv.get ();
for (; (*argv != NULL) && (**argv == '-'); argv++)
- {;
- }
+ {;
+ }
if (*argv == NULL)
- error (_("No executable file name was specified"));
+ error (_("No executable file name was specified"));
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (*argv));
exec_file_attach (filename.get (), from_tty);
if (match_cb != nullptr && !match_cb (&p))
continue; /* not the section we need. */
if (memaddr >= p.addr)
- {
+ {
if (memend <= p.endaddr)
{
/* Entire transfer is within this section. */
else
return TARGET_XFER_EOF;
}
- }
+ }
}
return TARGET_XFER_EOF; /* We can't help. */
const target_section_table &,
gdb::function_view<bool
(const struct target_section *)> match_cb
- = nullptr);
+ = nullptr);
/* Read from mappable read-only sections of BFD executable files.
Similar to exec_read_partial_read_only, but return
if ((int) prec > (int) PREC_COMMA)
fputs_filtered ("(", stream);
/* Print the subexpressions, forcing parentheses
- around any binary operations within them.
- This is more parentheses than are strictly necessary,
- but it looks clearer. */
+ around any binary operations within them.
+ This is more parentheses than are strictly necessary,
+ but it looks clearer. */
print_subexp (exp, pos, stream, PREC_HYPER);
fputs_filtered (" ? ", stream);
print_subexp (exp, pos, stream, PREC_HYPER);
{
/* Binary operator. */
/* Print left operand.
- If operator is right-associative,
- increment precedence for this operand. */
+ If operator is right-associative,
+ increment precedence for this operand. */
print_subexp (exp, pos, stream,
(enum precedence) ((int) myprec + assoc));
/* Print the operator itself. */
else
fprintf_filtered (stream, " %s ", op_str);
/* Print right operand.
- If operator is left-associative,
- increment precedence for this operand. */
+ If operator is left-associative,
+ increment precedence for this operand. */
print_subexp (exp, pos, stream,
(enum precedence) ((int) myprec + !assoc));
}
;
exp : '(' exp ')'
- { }
- ;
+ { }
+ ;
/* Expressions, not including the comma operator. */
exp : '*' exp %prec UNARY
;
complexnum: exp ',' exp
- { }
- ;
+ { }
+ ;
exp : '(' complexnum ')'
{ write_exp_elt_opcode (pstate, OP_COMPLEX);
;
exp : exp '%' name
- { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
- write_exp_string (pstate, $3);
- write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
- ;
+ { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
+ write_exp_string (pstate, $3);
+ write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
+ ;
/* Binary operators in order of decreasing precedence. */
write_exp_elt_longcst (pstate, (LONGEST) $1);
write_exp_elt_opcode (pstate, OP_BOOL);
}
- ;
+ ;
exp : STRING_LITERAL
{
type : ptype
- ;
+ ;
ptype : typebase
| typebase abs_decl
case '8':
case '9':
{
- /* It's a number. */
+ /* It's a number. */
int got_dot = 0, got_e = 0, got_d = 0, toktype;
const char *p = tokstart;
int hex = input_radix > 10;
toktype = parse_number (pstate, tokstart, p - tokstart,
got_dot|got_e|got_d,
&yylval);
- if (toktype == ERROR)
- {
+ if (toktype == ERROR)
+ {
char *err_copy = (char *) alloca (p - tokstart + 1);
memcpy (err_copy, tokstart, p - tokstart);
type = value_type (arg1);
if (type->code () != value_type (arg2)->code ())
error (_("non-matching types for parameters to MODULO ()"));
- /* MODULO(A, P) = A - FLOOR (A / P) * P */
+ /* MODULO(A, P) = A - FLOOR (A / P) * P */
switch (type->code ())
{
case TYPE_CODE_INT:
type = value_type (arg1);
switch (type->code ())
- {
- case TYPE_CODE_STRUCT:
- case TYPE_CODE_UNION:
- case TYPE_CODE_MODULE:
- case TYPE_CODE_FUNC:
- error (_("argument to kind must be an intrinsic type"));
- }
+ {
+ case TYPE_CODE_STRUCT:
+ case TYPE_CODE_UNION:
+ case TYPE_CODE_MODULE:
+ case TYPE_CODE_FUNC:
+ error (_("argument to kind must be an intrinsic type"));
+ }
if (!TYPE_TARGET_TYPE (type))
- return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
+ return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
TYPE_LENGTH (type));
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
case OP_F77_UNDETERMINED_ARGLIST:
/* Remember that in F77, functions, substring ops and array subscript
- operations cannot be disambiguated at parse time. We have made
- all array subscript operations, substring operations as well as
- function calls come here and we now have to discover what the heck
- this thing actually was. If it is a function, we process just as
- if we got an OP_FUNCALL. */
+ operations cannot be disambiguated at parse time. We have made
+ all array subscript operations, substring operations as well as
+ function calls come here and we now have to discover what the heck
+ this thing actually was. If it is a function, we process just as
+ if we got an OP_FUNCALL. */
int nargs = longest_to_int (exp->elts[pc + 1].longconst);
(*pos) += 2;
will print just a type name. */
|| ((show > 0
|| type->name () == 0)
- && (code == TYPE_CODE_FUNC
+ && (code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD
|| code == TYPE_CODE_ARRAY
|| ((code == TYPE_CODE_PTR
fputs_filtered (varstring, stream);
/* For demangled function names, we have the arglist as part of the name,
- so don't print an additional pair of ()'s. */
+ so don't print an additional pair of ()'s. */
demangled_args = (*varstring != '\0'
&& varstring[strlen (varstring) - 1] == ')');
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types need no prefix. They are listed here so that
- gcc -Wall will reveal any types that haven't been handled. */
+ gcc -Wall will reveal any types that haven't been handled. */
break;
}
}
{
LONGEST lower_bound = f77_get_lowerbound (type);
if (lower_bound != 1) /* Not the default. */
- fprintf_filtered (stream, "%s:", plongest (lower_bound));
+ fprintf_filtered (stream, "%s:", plongest (lower_bound));
/* Make sure that, if we have an assumed size array, we
print out a warning and print the upperbound as '*'. */
{
LONGEST upper_bound = f77_get_upperbound (type);
- fputs_filtered (plongest (upper_bound), stream);
+ fputs_filtered (plongest (upper_bound), stream);
}
}
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types do not need a suffix. They are listed so that
- gcc -Wall will report types that may not have been considered. */
+ gcc -Wall will report types that may not have been considered. */
break;
}
}
case TYPE_CODE_CHAR:
case TYPE_CODE_INT:
/* There may be some character types that attempt to come
- through as TYPE_CODE_INT since dbxstclass.h is so
- C-oriented, we must change these to "character" from "char". */
+ through as TYPE_CODE_INT since dbxstclass.h is so
+ C-oriented, we must change these to "character" from "char". */
if (strcmp (type->name (), "char") == 0)
fprintfi_filtered (level, stream, "character");
fprintfi_filtered (level, stream, "Type ");
fputs_filtered (type->name (), stream);
/* According to the definition,
- we only print structure elements in case show > 0. */
+ we only print structure elements in case show > 0. */
if (show > 0)
{
fputs_filtered ("\n", stream);
default_case:
default:
/* Handle types not explicitly handled by the other cases,
- such as fundamental types. For these, just print whatever
- the type name is, as recorded in the type itself. If there
- is no type name, then complain. */
+ such as fundamental types. For these, just print whatever
+ the type name is, as recorded in the type itself. If there
+ is no type name, then complain. */
if (type->name () != NULL)
fprintfi_filtered (level, stream, "%s", type->name ());
else
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
/* Starting from the Fortran 90 standard, Fortran supports derived
- types. */
+ types. */
fprintf_filtered (stream, "( ");
for (index = 0; index < type->num_fields (); index++)
- {
+ {
struct value *field = value_field (val, index);
struct type *field_type = check_typedef (type->field (index).type ());
gdb_assert (SYMBOL_CLASS (sym) == LOC_COMMON_BLOCK);
if (comname && (!sym->linkage_name ()
- || strcmp (comname, sym->linkage_name ()) != 0))
+ || strcmp (comname, sym->linkage_name ()) != 0))
continue;
if (*any_printed)
{
info_common_command_for_block (block, comname, &values_printed);
/* After handling the function's top-level block, stop. Don't
- continue to its superblock, the block of per-file symbols. */
+ continue to its superblock, the block of per-file symbols. */
if (BLOCK_FUNCTION (block))
break;
block = BLOCK_SUPERBLOCK (block);
inferior *inf = find_inferior_ptid (this, ptid);
for (thread_info *tp : inf->non_exited_threads ())
- {
+ {
int request;
if (tp->ptid.lwp () == ptid.lwp ())
static int
fbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
- enum gdb_signal signal)
+ enum gdb_signal signal)
{
switch (signal)
{
switch (SYMBOL_CLASS (sym))
{
/* All cases listed explicitly so that gcc -Wall will detect it if
- we failed to consider one. */
+ we failed to consider one. */
case LOC_COMPUTED:
gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
case LOC_LABEL:
/* Getting the address of a label can be done independently of the block,
- even if some *uses* of that address wouldn't work so well without
- the right frame. */
+ even if some *uses* of that address wouldn't work so well without
+ the right frame. */
case LOC_BLOCK:
case LOC_CONST_BYTES:
if (regval == NULL)
error (_("Value of register variable not available for `%s'."),
- var->print_name ());
+ var->print_name ());
addr = value_as_address (regval);
}
if (regval == NULL)
error (_("Value of register variable not available for `%s'."),
- var->print_name ());
+ var->print_name ());
return regval;
}
}
struct value *
default_value_from_register (struct gdbarch *gdbarch, struct type *type,
- int regnum, struct frame_id frame_id)
+ int regnum, struct frame_id frame_id)
{
int len = TYPE_LENGTH (type);
struct value *value = allocate_value (type);
int reg_len = type_length_units (value_type (regval)) - reg_offset;
/* If the register length is larger than the number of bytes
- remaining to copy, then only copy the appropriate bytes. */
+ remaining to copy, then only copy the appropriate bytes. */
if (reg_len > len)
reg_len = len;
int optim, unavail, ok;
/* The ISA/ABI need to something weird when obtaining the
- specified value from this register. It might need to
- re-order non-adjacent, starting with REGNUM (see MIPS and
- i386). It might need to convert the [float] register into
- the corresponding [integer] type (see Alpha). The assumption
- is that gdbarch_register_to_value populates the entire value
- including the location. */
+ specified value from this register. It might need to
+ re-order non-adjacent, starting with REGNUM (see MIPS and
+ i386). It might need to convert the [float] register into
+ the corresponding [integer] type (see Alpha). The assumption
+ is that gdbarch_register_to_value populates the entire value
+ including the location. */
v = allocate_value (type);
VALUE_LVAL (v) = lval_register;
VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame));
&setlist, &showlist);
add_cmd ("exec-wrapper", class_run, unset_exec_wrapper_command,
- _("Disable use of an execution wrapper."),
- &unsetlist);
+ _("Disable use of an execution wrapper."),
+ &unsetlist);
add_setshow_boolean_cmd ("startup-with-shell", class_support,
&startup_with_shell, _("\
static int
frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
- const struct frame_unwind *unwinder)
+ const struct frame_unwind *unwinder)
{
int res = 0;
unwinder_from_target = target_get_unwinder ();
if (unwinder_from_target != NULL
&& frame_unwind_try_unwinder (this_frame, this_cache,
- unwinder_from_target))
+ unwinder_from_target))
return;
unwinder_from_target = target_get_tailcall_unwinder ();
if (unwinder_from_target != NULL
&& frame_unwind_try_unwinder (this_frame, this_cache,
- unwinder_from_target))
+ unwinder_from_target))
return;
for (entry = table->list; entry != NULL; entry = entry->next)
inside BUF. */
struct value *frame_unwind_got_bytes (struct frame_info *frame, int regnum,
- gdb_byte *buf);
+ gdb_byte *buf);
/* Return a value which indicates that FRAME's saved version of REGNUM
has a known constant (computed) value of ADDR. Convert the
catch (const gdb_exception &ex)
{
/* On error, revert the frame id status to not computed. If the frame
- cache generation changed, the frame object doesn't exist anymore, so
+ cache generation changed, the frame object doesn't exist anymore, so
don't touch it. */
if (get_frame_cache_generation () == entry_generation)
fi->this_id.p = frame_id_status::NOT_COMPUTED;
struct frame_id
frame_id_build_special (CORE_ADDR stack_addr, CORE_ADDR code_addr,
- CORE_ADDR special_addr)
+ CORE_ADDR special_addr)
{
struct frame_id id = null_frame_id;
CORE_ADDR addr_in_block;
/* Make certain that this, and not the adjacent, function is
- found. */
+ found. */
if (!get_frame_address_in_block_if_available (this_frame, &addr_in_block))
{
next_frame->prev_func.status = CC_UNAVAILABLE;
size_t size;
/* The error needs to live as long as the frame does.
- Allocate using stack local STOP_STRING then assign the
- pointer to the frame, this allows the STOP_STRING on the
- frame to be of type 'const char *'. */
+ Allocate using stack local STOP_STRING then assign the
+ pointer to the frame, this allows the STOP_STRING on the
+ frame to be of type 'const char *'. */
size = ex.message->size () + 1;
stop_string = (char *) frame_obstack_zalloc (size);
memcpy (stop_string, ex.what (), size);
static LONGEST
frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno,
- CORE_ADDR *sc_addr_cache_ptr)
+ CORE_ADDR *sc_addr_cache_ptr)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
static void
frv_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
+ struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
int regi;
not. (E.g, -1 will be returned if the ABI isn't the FDPIC ABI.) */
int
frv_fdpic_loadmap_addresses (struct gdbarch *gdbarch, CORE_ADDR *interp_addr,
- CORE_ADDR *exec_addr)
+ CORE_ADDR *exec_addr)
{
if (frv_abi (gdbarch) != FRV_ABI_FDPIC)
return -1;
static enum register_status
frv_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int reg, gdb_byte *buffer)
+ int reg, gdb_byte *buffer)
{
enum register_status status;
else if (accg0_regnum <= reg && reg <= accg7_regnum)
{
/* The accg raw registers have four values in each slot with the
- lowest register number occupying the first byte. */
+ lowest register number occupying the first byte. */
int raw_regnum = accg0123_regnum + (reg - accg0_regnum) / 4;
int byte_num = (reg - accg0_regnum) % 4;
static void
frv_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
- int reg, const gdb_byte *buffer)
+ int reg, const gdb_byte *buffer)
{
if (reg == iacc0_regnum)
{
else if (accg0_regnum <= reg && reg <= accg7_regnum)
{
/* The accg raw registers have four values in each slot with the
- lowest register number occupying the first byte. */
+ lowest register number occupying the first byte. */
int raw_regnum = accg0123_regnum + (reg - accg0_regnum) / 4;
int byte_num = (reg - accg0_regnum) % 4;
else if (pc_regnum == reg)
return SIM_FRV_PC_REGNUM;
else if (reg >= first_spr_regnum
- && reg < first_spr_regnum + sizeof (spr_map) / sizeof (spr_map[0]))
+ && reg < first_spr_regnum + sizeof (spr_map) / sizeof (spr_map[0]))
{
int spr_reg_offset = spr_map[reg - first_spr_regnum];
break;
/* This is a big endian architecture, so byte zero will have most
- significant byte. The most significant bit of this byte is the
- packing bit. */
+ significant byte. The most significant bit of this byte is the
+ packing bit. */
if (instr[0] & 0x80)
break;
is_caller_saves_reg (int reg)
{
return ((4 <= reg && reg <= 7)
- || (14 <= reg && reg <= 15)
- || (32 <= reg && reg <= 47));
+ || (14 <= reg && reg <= 15)
+ || (32 <= reg && reg <= 47));
}
is_callee_saves_reg (int reg)
{
return ((16 <= reg && reg <= 31)
- || (48 <= reg && reg <= 63));
+ || (48 <= reg && reg <= 63));
}
static CORE_ADDR
frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
struct frame_info *this_frame,
- struct frv_unwind_cache *info)
+ struct frv_unwind_cache *info)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
Media Trap
X XXXX XX 0000100 XXXXXX XXXX 10 XXXXXX */
if ((op & 0x01d80000) == 0x00180000 /* Conditional branches and Call */
- || (op & 0x01f80000) == 0x00300000 /* Jump and Link */
+ || (op & 0x01f80000) == 0x00300000 /* Jump and Link */
|| (op & 0x01f80000) == 0x00100000 /* Return from Trap, Trap */
|| (op & 0x01f80000) == 0x00700000) /* Trap immediate */
{
}
/* Loading something from memory into fp probably means that
- we're in the epilogue. Stop scanning the prologue.
- ld @(GRi, GRk), fp
+ we're in the epilogue. Stop scanning the prologue.
+ ld @(GRi, GRk), fp
X 000010 0000010 XXXXXX 000100 XXXXXX
ldi @(GRi, d12), fp
X 000010 0110010 XXXXXX XXXXXXXXXXXX */
else if ((op & 0x7ffc0fc0) == 0x04080100
- || (op & 0x7ffc0000) == 0x04c80000)
+ || (op & 0x7ffc0000) == 0x04c80000)
{
break;
}
ori sp, 0, fp
P 000010 0100010 000001 000000000000 = 0x04881000
0 111111 1111111 111111 111111111111 = 0x7fffffff
- . . . . . . . .
+ . . . . . . . .
We treat this as part of the prologue. */
else if ((op & 0x7fffffff) == 0x04881000)
{
}
/* Move the link register to the scratch register grJ, before saving:
- movsg lr, grJ
- P 000100 0000011 010000 000111 JJJJJJ = 0x080d01c0
- 0 111111 1111111 111111 111111 000000 = 0x7fffffc0
- . . . . . . . .
+ movsg lr, grJ
+ P 000100 0000011 010000 000111 JJJJJJ = 0x080d01c0
+ 0 111111 1111111 111111 111111 000000 = 0x7fffffc0
+ . . . . . . . .
We treat this as part of the prologue. */
else if ((op & 0x7fffffc0) == 0x080d01c0)
- {
- int gr_j = op & 0x3f;
+ {
+ int gr_j = op & 0x3f;
- /* If we're moving it to a scratch register, that's fine. */
- if (is_caller_saves_reg (gr_j))
+ /* If we're moving it to a scratch register, that's fine. */
+ if (is_caller_saves_reg (gr_j))
{
lr_save_reg = gr_j;
last_prologue_pc = next_pc;
}
- }
+ }
/* To save multiple callee-saves registers on the stack, at
- offset zero:
+ offset zero:
std grK,@(sp,gr0)
P KKKKKK 0000011 000001 000011 000000 = 0x000c10c0
stq grK,@(sp,gr0)
P KKKKKK 0000011 000001 000100 000000 = 0x000c1100
0 000000 1111111 111111 111111 111111 = 0x01ffffff
- . . . . . . . .
- We treat this as part of the prologue, and record the register's
+ . . . . . . . .
+ We treat this as part of the prologue, and record the register's
saved address in the frame structure. */
else if ((op & 0x01ffffff) == 0x000c10c0
- || (op & 0x01ffffff) == 0x000c1100)
+ || (op & 0x01ffffff) == 0x000c1100)
{
int gr_k = ((op >> 25) & 0x3f);
int ope = ((op >> 6) & 0x3f);
- int count;
+ int count;
int i;
- /* Is it an std or an stq? */
- if (ope == 0x03)
- count = 2;
- else
- count = 4;
+ /* Is it an std or an stq? */
+ if (ope == 0x03)
+ count = 2;
+ else
+ count = 4;
/* Is it really a callee-saves register? */
if (is_callee_saves_reg (gr_k))
{
for (i = 0; i < count; i++)
- {
+ {
gr_saved[gr_k + i] = 1;
gr_sp_offset[gr_k + i] = 4 * i;
}
/* Adjusting the stack pointer. (The stack pointer is GR1.)
addi sp, S, sp
- P 000001 0010000 000001 SSSSSSSSSSSS = 0x02401000
- 0 111111 1111111 111111 000000000000 = 0x7ffff000
- . . . . . . . .
+ P 000001 0010000 000001 SSSSSSSSSSSS = 0x02401000
+ 0 111111 1111111 111111 000000000000 = 0x7ffff000
+ . . . . . . . .
We treat this as part of the prologue. */
else if ((op & 0x7ffff000) == 0x02401000)
- {
+ {
if (framesize == 0)
{
/* Sign-extend the twelve-bit field.
else
{
/* If the prologue is being adjusted again, we've
- likely gone too far; i.e. we're probably in the
+ likely gone too far; i.e. we're probably in the
epilogue. */
break;
}
/* Setting the FP to a constant distance from the SP:
addi sp, S, fp
- P 000010 0010000 000001 SSSSSSSSSSSS = 0x04401000
- 0 111111 1111111 111111 000000000000 = 0x7ffff000
- . . . . . . . .
+ P 000010 0010000 000001 SSSSSSSSSSSS = 0x04401000
+ 0 111111 1111111 111111 000000000000 = 0x7ffff000
+ . . . . . . . .
We treat this as part of the prologue. */
else if ((op & 0x7ffff000) == 0x04401000)
{
{
int gr_i = ((op >> 12) & 0x3f);
- /* Make sure that the source is an arg register; if it is, we'll
+ /* Make sure that the source is an arg register; if it is, we'll
treat it as a prologue instruction. */
if (is_argument_reg (gr_i))
last_prologue_pc = next_pc;
sthi GRk, @(fp, s)
P KKKKKK 1010001 000010 SSSSSSSSSSSS = 0x01442000
0 000000 1111111 111111 000000000000 = 0x01fff000
- . . . . . . . .
- And for 8-bit values, we use STB instructions.
+ . . . . . . . .
+ And for 8-bit values, we use STB instructions.
stbi GRk, @(fp, s)
P KKKKKK 1010000 000010 SSSSSSSSSSSS = 0x01402000
0 000000 1111111 111111 000000000000 = 0x01fff000
. . . . . . . .
- We check that GRk is really an argument register, and treat
- all such as part of the prologue. */
+ We check that GRk is really an argument register, and treat
+ all such as part of the prologue. */
else if ( (op & 0x01fff000) == 0x01442000
|| (op & 0x01fff000) == 0x01402000)
{
int gr_k = ((op >> 25) & 0x3f);
- /* Make sure that GRk is really an argument register; treat
+ /* Make sure that GRk is really an argument register; treat
it as a prologue instruction if so. */
if (is_argument_reg (gr_k))
last_prologue_pc = next_pc;
}
/* To save multiple callee-saves register on the stack, at a
- non-zero offset:
+ non-zero offset:
stdi GRk, @(sp, s)
P KKKKKK 1010011 000001 SSSSSSSSSSSS = 0x014c1000
0 000000 1111111 111111 000000000000 = 0x01fff000
- . . . . . . . .
+ . . . . . . . .
stqi GRk, @(sp, s)
P KKKKKK 1010100 000001 SSSSSSSSSSSS = 0x01501000
0 000000 1111111 111111 000000000000 = 0x01fff000
. . . . . . . .
- We treat this as part of the prologue, and record the register's
+ We treat this as part of the prologue, and record the register's
saved address in the frame structure. */
else if ((op & 0x01fff000) == 0x014c1000
- || (op & 0x01fff000) == 0x01501000)
+ || (op & 0x01fff000) == 0x01501000)
{
int gr_k = ((op >> 25) & 0x3f);
- int count;
+ int count;
int i;
- /* Is it a stdi or a stqi? */
- if ((op & 0x01fff000) == 0x014c1000)
- count = 2;
- else
- count = 4;
+ /* Is it a stdi or a stqi? */
+ if ((op & 0x01fff000) == 0x014c1000)
+ count = 2;
+ else
+ count = 4;
/* Is it really a callee-saves register? */
if (is_callee_saves_reg (gr_k))
}
/* Storing any kind of integer register at any constant offset
- from any other register.
+ from any other register.
st GRk, @(GRi, gr0)
- P KKKKKK 0000011 IIIIII 000010 000000 = 0x000c0080
- 0 000000 1111111 000000 111111 111111 = 0x01fc0fff
- . . . . . . . .
+ P KKKKKK 0000011 IIIIII 000010 000000 = 0x000c0080
+ 0 000000 1111111 000000 111111 111111 = 0x01fc0fff
+ . . . . . . . .
sti GRk, @(GRi, d12)
P KKKKKK 1010010 IIIIII SSSSSSSSSSSS = 0x01480000
0 000000 1111111 000000 000000000000 = 0x01fc0000
- . . . . . . . .
- These could be almost anything, but a lot of prologue
- instructions fall into this pattern, so let's decode the
- instruction once, and then work at a higher level. */
+ . . . . . . . .
+ These could be almost anything, but a lot of prologue
+ instructions fall into this pattern, so let's decode the
+ instruction once, and then work at a higher level. */
else if (((op & 0x01fc0fff) == 0x000c0080)
- || ((op & 0x01fc0000) == 0x01480000))
- {
- int gr_k = ((op >> 25) & 0x3f);
- int gr_i = ((op >> 12) & 0x3f);
- int offset;
-
- /* Are we storing with gr0 as an offset, or using an
- immediate value? */
- if ((op & 0x01fc0fff) == 0x000c0080)
- offset = 0;
- else
- offset = (((op & 0xfff) - 0x800) & 0xfff) - 0x800;
-
- /* If the address isn't relative to the SP or FP, it's not a
- prologue instruction. */
- if (gr_i != sp_regnum && gr_i != fp_regnum)
+ || ((op & 0x01fc0000) == 0x01480000))
+ {
+ int gr_k = ((op >> 25) & 0x3f);
+ int gr_i = ((op >> 12) & 0x3f);
+ int offset;
+
+ /* Are we storing with gr0 as an offset, or using an
+ immediate value? */
+ if ((op & 0x01fc0fff) == 0x000c0080)
+ offset = 0;
+ else
+ offset = (((op & 0xfff) - 0x800) & 0xfff) - 0x800;
+
+ /* If the address isn't relative to the SP or FP, it's not a
+ prologue instruction. */
+ if (gr_i != sp_regnum && gr_i != fp_regnum)
{
/* Do nothing; not a prologue instruction. */
}
- /* Saving the old FP in the new frame (relative to the SP). */
- else if (gr_k == fp_regnum && gr_i == sp_regnum)
+ /* Saving the old FP in the new frame (relative to the SP). */
+ else if (gr_k == fp_regnum && gr_i == sp_regnum)
{
gr_saved[fp_regnum] = 1;
- gr_sp_offset[fp_regnum] = offset;
+ gr_sp_offset[fp_regnum] = offset;
last_prologue_pc = next_pc;
}
- /* Saving callee-saves register(s) on the stack, relative to
- the SP. */
- else if (gr_i == sp_regnum
- && is_callee_saves_reg (gr_k))
- {
- gr_saved[gr_k] = 1;
+ /* Saving callee-saves register(s) on the stack, relative to
+ the SP. */
+ else if (gr_i == sp_regnum
+ && is_callee_saves_reg (gr_k))
+ {
+ gr_saved[gr_k] = 1;
if (gr_i == sp_regnum)
gr_sp_offset[gr_k] = offset;
else
gr_sp_offset[gr_k] = offset + fp_offset;
last_prologue_pc = next_pc;
- }
+ }
- /* Saving the scratch register holding the return address. */
- else if (lr_save_reg != -1
- && gr_k == lr_save_reg)
+ /* Saving the scratch register holding the return address. */
+ else if (lr_save_reg != -1
+ && gr_k == lr_save_reg)
{
lr_saved_on_stack = 1;
if (gr_i == sp_regnum)
lr_sp_offset = offset;
else
- lr_sp_offset = offset + fp_offset;
+ lr_sp_offset = offset + fp_offset;
last_prologue_pc = next_pc;
}
- /* Spilling int-sized arguments to the stack. */
- else if (is_argument_reg (gr_k))
+ /* Spilling int-sized arguments to the stack. */
+ else if (is_argument_reg (gr_k))
last_prologue_pc = next_pc;
- }
+ }
pc = next_pc;
}
ULONGEST this_base;
/* If we know the relationship between the stack and frame
- pointers, record the addresses of the registers we noticed.
- Note that we have to do this as a separate step at the end,
- because instructions may save relative to the SP, but we need
- their addresses relative to the FP. */
+ pointers, record the addresses of the registers we noticed.
+ Note that we have to do this as a separate step at the end,
+ because instructions may save relative to the SP, but we need
+ their addresses relative to the FP. */
if (fp_set)
this_base = get_frame_register_unsigned (this_frame, fp_regnum);
else
call label24
P HHHHHH 0001111 LLLLLLLLLLLLLLLLLL = 0x003c0000
0 000000 1111111 000000000000000000 = 0x01fc0000
- . . . . . . . .
+ . . . . . . . .
where label24 is constructed by concatenating the H bits with the
L bits. The call target is PC + (4 * sign_ext(label24)). */
s = lookup_minimal_symbol_by_pc (call_dest);
if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
+ && s.minsym->linkage_name () != NULL
&& strcmp (s.minsym->linkage_name (), "__main") == 0)
{
pc += 4;
static void
frv_extract_return_value (struct type *type, struct regcache *regcache,
- gdb_byte *valbuf)
+ gdb_byte *valbuf)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
store_unsigned_integer (valbuf, 4, byte_order, entry_point);
write_memory (descr, valbuf, 4);
store_unsigned_integer (valbuf, 4, byte_order,
- frv_fdpic_find_global_pointer (entry_point));
+ frv_fdpic_find_global_pointer (entry_point));
write_memory (descr + 4, valbuf, 4);
return descr;
}
static CORE_ADDR
frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
- struct target_ops *targ)
+ struct target_ops *targ)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR entry_point;
static CORE_ADDR
frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
if (return_method == return_method_struct)
regcache_cooked_write_unsigned (regcache, struct_return_regnum,
- struct_addr);
+ struct_addr);
for (argnum = 0; argnum < nargs; ++argnum)
{
}
else if (abi == FRV_ABI_FDPIC
&& len == 4
- && typecode == TYPE_CODE_PTR
- && TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_FUNC)
+ && typecode == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_FUNC)
{
/* The FDPIC ABI requires function descriptors to be passed instead
of entry points. */
/* Set the GOT register for the FDPIC ABI. */
regcache_cooked_write_unsigned
(regcache, first_gpr_regnum + 15,
- frv_fdpic_find_global_pointer (func_addr));
+ frv_fdpic_find_global_pointer (func_addr));
}
/* Finally, update the SP register. */
static void
frv_store_return_value (struct type *type, struct regcache *regcache,
- const gdb_byte *valbuf)
+ const gdb_byte *valbuf)
{
int len = TYPE_LENGTH (type);
}
else
internal_error (__FILE__, __LINE__,
- _("Don't know how to return a %d-byte value."), len);
+ _("Don't know how to return a %d-byte value."), len);
}
static enum return_value_convention
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- frv_fetch_objfile_link_map);
+ frv_fetch_objfile_link_map);
return gdbarch;
}
library support) for the FDPIC ABI. Return 0 if successful, -1 if
not. (E.g, -1 will be returned if the ABI isn't the FDPIC ABI.) */
int frv_fdpic_loadmap_addresses (struct gdbarch *gdbarch,
- CORE_ADDR *interp_addr, CORE_ADDR *exec_addr);
+ CORE_ADDR *interp_addr, CORE_ADDR *exec_addr);
/* Given a function entry point, find and return the GOT address for the
containing load module. */
static ULONGEST
ft32_fetch_instruction (CORE_ADDR a, int *isize,
- enum bfd_endian byte_order)
+ enum bfd_endian byte_order)
{
unsigned int sc[2];
ULONGEST inst;
if (read == 0 && write == 0 && exec == 0 && modified == 0)
{
if (info_verbose)
- {
- fprintf_filtered (gdb_stdout, "Ignore segment, %s bytes at %s\n",
- plongest (size), paddress (target_gdbarch (), vaddr));
- }
+ {
+ fprintf_filtered (gdb_stdout, "Ignore segment, %s bytes at %s\n",
+ plongest (size), paddress (target_gdbarch (), vaddr));
+ }
return 0;
}
switch (errnum)
{
case FILEIO_EPERM:
- return EPERM;
+ return EPERM;
case FILEIO_ENOENT:
- return ENOENT;
+ return ENOENT;
case FILEIO_EINTR:
- return EINTR;
+ return EINTR;
case FILEIO_EIO:
- return EIO;
+ return EIO;
case FILEIO_EBADF:
- return EBADF;
+ return EBADF;
case FILEIO_EACCES:
- return EACCES;
+ return EACCES;
case FILEIO_EFAULT:
- return EFAULT;
+ return EFAULT;
case FILEIO_EBUSY:
- return EBUSY;
+ return EBUSY;
case FILEIO_EEXIST:
- return EEXIST;
+ return EEXIST;
case FILEIO_ENODEV:
- return ENODEV;
+ return ENODEV;
case FILEIO_ENOTDIR:
- return ENOTDIR;
+ return ENOTDIR;
case FILEIO_EISDIR:
- return EISDIR;
+ return EISDIR;
case FILEIO_EINVAL:
- return EINVAL;
+ return EINVAL;
case FILEIO_ENFILE:
- return ENFILE;
+ return ENFILE;
case FILEIO_EMFILE:
- return EMFILE;
+ return EMFILE;
case FILEIO_EFBIG:
- return EFBIG;
+ return EFBIG;
case FILEIO_ENOSPC:
- return ENOSPC;
+ return ENOSPC;
case FILEIO_ESPIPE:
- return ESPIPE;
+ return ESPIPE;
case FILEIO_EROFS:
- return EROFS;
+ return EROFS;
case FILEIO_ENOSYS:
- return ENOSYS;
+ return ENOSYS;
case FILEIO_ENAMETOOLONG:
- return ENAMETOOLONG;
+ return ENAMETOOLONG;
}
return -1;
}
nbytes - pos, offset + pos,
&target_errno);
if (bytes == 0)
- /* Success, but no bytes, means end-of-file. */
- break;
+ /* Success, but no bytes, means end-of-file. */
+ break;
if (bytes == -1)
{
errno = fileio_errno_to_host (target_errno);
-e <regexp> Regular expression for selecting the targets to build.
--force Force rebuild.
-j <makejobs> Run <makejobs> in parallel. Passed to make.
- On a single cpu machine, 2 is recommended.
+ On a single cpu machine, 2 is recommended.
Arguments:
<srcdir> Source code directory.
<builddir> Build directory.
makejobs="-j $1"
;;
--clean )
- # Shall the build directory be deleted after processing?
- clean=true
- ;;
+ # Shall the build directory be deleted after processing?
+ clean=true
+ ;;
-e )
# A regular expression for selecting targets
shift
Usage: gdb_mbuild.sh [ <options> ... ] <srcdir> <builddir>
Options:
-j <makejobs> Run <makejobs> in parallel. Passed to make.
- On a single cpu machine, 2 is recommended.
+ On a single cpu machine, 2 is recommended.
-k Keep going. Do not stop after the first build fails.
--keep Keep builds. Do not remove each build when finished.
-e <regexp> Regular expression for selecting the targets to build.
keepgoing=-k
;;
--keep )
- keep=true
+ keep=true
;;
-e )
# A regular expression for selecting targets
unsigned int gdbarch_debug = GDBARCH_DEBUG;
static void
show_gdbarch_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("Architecture debugging is %s.\n"), value);
}
struct gdbarch *
gdbarch_alloc (const struct gdbarch_info *info,
- struct gdbarch_tdep *tdep)
+ struct gdbarch_tdep *tdep)
{
struct gdbarch *gdbarch;
/* Skip verify of read_core_file_mappings, invalid_p == 0 */
if (!log.empty ())
internal_error (__FILE__, __LINE__,
- _("verify_gdbarch: the following are invalid ...%s"),
- log.c_str ());
+ _("verify_gdbarch: the following are invalid ...%s"),
+ log.c_str ());
}
gdb_nm_file = GDB_NM_FILE;
#endif
fprintf_unfiltered (file,
- "gdbarch_dump: GDB_NM_FILE = %s\n",
- gdb_nm_file);
+ "gdbarch_dump: GDB_NM_FILE = %s\n",
+ gdb_nm_file);
fprintf_unfiltered (file,
"gdbarch_dump: addr_bit = %s\n",
plongest (gdbarch->addr_bit));
const struct bfd_arch_info *ap;
ap = bfd_lookup_arch (rego->bfd_architecture, 0);
if (ap == NULL)
- internal_error (__FILE__, __LINE__,
- _("gdbarch_architecture_names: multi-arch unknown"));
+ internal_error (__FILE__, __LINE__,
+ _("gdbarch_architecture_names: multi-arch unknown"));
do
- {
- append_name (&arches, &nr_arches, ap->printable_name);
- ap = ap->next;
- }
+ {
+ append_name (&arches, &nr_arches, ap->printable_name);
+ ap = ap->next;
+ }
while (ap != NULL);
}
append_name (&arches, &nr_arches, NULL);
void
gdbarch_register (enum bfd_architecture bfd_architecture,
- gdbarch_init_ftype *init,
+ gdbarch_init_ftype *init,
gdbarch_dump_tdep_ftype *dump_tdep)
{
struct gdbarch_registration **curr;
if (bfd_arch_info == NULL)
{
internal_error (__FILE__, __LINE__,
- _("gdbarch: Attempt to register "
+ _("gdbarch: Attempt to register "
"unknown architecture (%d)"),
- bfd_architecture);
+ bfd_architecture);
}
/* Check that we haven't seen this architecture before. */
for (curr = &gdbarch_registry;
{
if (bfd_architecture == (*curr)->bfd_architecture)
internal_error (__FILE__, __LINE__,
- _("gdbarch: Duplicate registration "
+ _("gdbarch: Duplicate registration "
"of architecture (%s)"),
- bfd_arch_info->printable_name);
+ bfd_arch_info->printable_name);
}
/* log it */
if (gdbarch_debug)
struct gdbarch_list *
gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
- const struct gdbarch_info *info)
+ const struct gdbarch_info *info)
{
for (; arches != NULL; arches = arches->next)
{
Set architecture debugging."), _("\
Show architecture debugging."), _("\
When non-zero, architecture debugging is enabled."),
- NULL,
- show_gdbarch_debug,
- &setdebuglist, &showdebuglist);
+ NULL,
+ show_gdbarch_debug,
+ &setdebuglist, &showdebuglist);
}
extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
extern void gdbarch_register (enum bfd_architecture architecture,
- gdbarch_init_ftype *,
- gdbarch_dump_tdep_ftype *);
+ gdbarch_init_ftype *,
+ gdbarch_dump_tdep_ftype *);
/* Return a freshly allocated, NULL terminated, array of the valid
# hiding something from the ``struct info'' object
# m -> multi-arch function
# hiding a multi-arch function (parameterised with the architecture)
- # M -> multi-arch function + predicate
+ # M -> multi-arch function + predicate
# hiding a multi-arch function + predicate to test function validity
returntype ) : ;;
extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
extern void gdbarch_register (enum bfd_architecture architecture,
- gdbarch_init_ftype *,
- gdbarch_dump_tdep_ftype *);
+ gdbarch_init_ftype *,
+ gdbarch_dump_tdep_ftype *);
/* Return a freshly allocated, NULL terminated, array of the valid
unsigned int gdbarch_debug = GDBARCH_DEBUG;
static void
show_gdbarch_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("Architecture debugging is %s.\\n"), value);
}
cat <<EOF
struct gdbarch *
gdbarch_alloc (const struct gdbarch_info *info,
- struct gdbarch_tdep *tdep)
+ struct gdbarch_tdep *tdep)
{
struct gdbarch *gdbarch;
cat <<EOF
if (!log.empty ())
internal_error (__FILE__, __LINE__,
- _("verify_gdbarch: the following are invalid ...%s"),
- log.c_str ());
+ _("verify_gdbarch: the following are invalid ...%s"),
+ log.c_str ());
}
EOF
gdb_nm_file = GDB_NM_FILE;
#endif
fprintf_unfiltered (file,
- "gdbarch_dump: GDB_NM_FILE = %s\\n",
- gdb_nm_file);
+ "gdbarch_dump: GDB_NM_FILE = %s\\n",
+ gdb_nm_file);
EOF
function_list | sort '-t;' -k 3 | while do_read
do
print="core_addr_to_string_nz (gdbarch->${function})"
;;
:* )
- fmt="%s"
+ fmt="%s"
print="plongest (gdbarch->${function})"
;;
* )
- fmt="%s"
+ fmt="%s"
;;
- esac
+ esac
printf " fprintf_unfiltered (file,\n"
printf " \"gdbarch_dump: %s = %s\\\\n\",\n" "$function" "$fmt"
printf " %s);\n" "$print"
printf "bool\n"
printf "gdbarch_%s_p (struct gdbarch *gdbarch)\n" "$function"
printf "{\n"
- printf " gdb_assert (gdbarch != NULL);\n"
+ printf " gdb_assert (gdbarch != NULL);\n"
printf " return %s;\n" "$predicate"
printf "}\n"
fi
printf "gdbarch_%s (struct gdbarch *gdbarch, %s)\n" "$function" "$formal"
fi
printf "{\n"
- printf " gdb_assert (gdbarch != NULL);\n"
+ printf " gdb_assert (gdbarch != NULL);\n"
printf " gdb_assert (gdbarch->%s != NULL);\n" "$function"
if class_is_predicate_p && test -n "${predefault}"
then
else
params="${actual}"
fi
- fi
+ fi
if [ "x${returntype}" = "xvoid" ]
then
printf " gdbarch->%s (%s);\n" "$function" "$params"
printf "%s\n" "$returntype"
printf "gdbarch_%s (struct gdbarch *gdbarch)\n" "$function"
printf "{\n"
- printf " gdb_assert (gdbarch != NULL);\n"
+ printf " gdb_assert (gdbarch != NULL);\n"
if [ "x${invalid_p}" = "x0" ]
then
printf " /* Skip verify of %s, invalid_p == 0 */\n" "$function"
printf "%s\n" "$returntype"
printf "gdbarch_%s (struct gdbarch *gdbarch)\n" "$function"
printf "{\n"
- printf " gdb_assert (gdbarch != NULL);\n"
+ printf " gdb_assert (gdbarch != NULL);\n"
printf " if (gdbarch_debug >= 2)\n"
printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_%s called\\\\n\");\n" "$function"
printf " return gdbarch->%s;\n" "$function"
const struct bfd_arch_info *ap;
ap = bfd_lookup_arch (rego->bfd_architecture, 0);
if (ap == NULL)
- internal_error (__FILE__, __LINE__,
- _("gdbarch_architecture_names: multi-arch unknown"));
+ internal_error (__FILE__, __LINE__,
+ _("gdbarch_architecture_names: multi-arch unknown"));
do
- {
- append_name (&arches, &nr_arches, ap->printable_name);
- ap = ap->next;
- }
+ {
+ append_name (&arches, &nr_arches, ap->printable_name);
+ ap = ap->next;
+ }
while (ap != NULL);
}
append_name (&arches, &nr_arches, NULL);
void
gdbarch_register (enum bfd_architecture bfd_architecture,
- gdbarch_init_ftype *init,
+ gdbarch_init_ftype *init,
gdbarch_dump_tdep_ftype *dump_tdep)
{
struct gdbarch_registration **curr;
if (bfd_arch_info == NULL)
{
internal_error (__FILE__, __LINE__,
- _("gdbarch: Attempt to register "
+ _("gdbarch: Attempt to register "
"unknown architecture (%d)"),
- bfd_architecture);
+ bfd_architecture);
}
/* Check that we haven't seen this architecture before. */
for (curr = &gdbarch_registry;
{
if (bfd_architecture == (*curr)->bfd_architecture)
internal_error (__FILE__, __LINE__,
- _("gdbarch: Duplicate registration "
+ _("gdbarch: Duplicate registration "
"of architecture (%s)"),
- bfd_arch_info->printable_name);
+ bfd_arch_info->printable_name);
}
/* log it */
if (gdbarch_debug)
struct gdbarch_list *
gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
- const struct gdbarch_info *info)
+ const struct gdbarch_info *info)
{
for (; arches != NULL; arches = arches->next)
{
Set architecture debugging."), _("\\
Show architecture debugging."), _("\\
When non-zero, architecture debugging is enabled."),
- NULL,
- show_gdbarch_debug,
- &setdebuglist, &showdebuglist);
+ NULL,
+ show_gdbarch_debug,
+ &setdebuglist, &showdebuglist);
}
EOF
/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
extern void write_memory_unsigned_integer (CORE_ADDR addr, int len,
- enum bfd_endian byte_order,
+ enum bfd_endian byte_order,
ULONGEST value);
/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
extern void write_memory_signed_integer (CORE_ADDR addr, int len,
- enum bfd_endian byte_order,
- LONGEST value);
+ enum bfd_endian byte_order,
+ LONGEST value);
\f
/* Hook for `exec_file_command' command to call. */
a) The thread ID (Id). This consists of the pair of:
- - the number of the thread's inferior and,
+ - the number of the thread's inferior and,
- - the thread's thread number in its inferior, aka, the
- per-inferior thread number. This number is unique in the
- inferior but not unique between inferiors.
+ - the thread's thread number in its inferior, aka, the
+ per-inferior thread number. This number is unique in the
+ inferior but not unique between inferiors.
b) The global ID (GId). This is a a single integer unique
- between all inferiors.
+ between all inferiors.
E.g.:
struct type *
make_reference_type (struct type *type, struct type **typeptr,
- enum type_code refcode)
+ enum type_code refcode)
{
struct type *ntype; /* New type */
struct type **reftype;
gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
ntype = (refcode == TYPE_CODE_REF ? TYPE_REFERENCE_TYPE (type)
- : TYPE_RVALUE_REFERENCE_TYPE (type));
+ : TYPE_RVALUE_REFERENCE_TYPE (type));
if (ntype)
{
TYPE_TARGET_TYPE (ntype) = type;
reftype = (refcode == TYPE_CODE_REF ? &TYPE_REFERENCE_TYPE (type)
- : &TYPE_RVALUE_REFERENCE_TYPE (type));
+ : &TYPE_RVALUE_REFERENCE_TYPE (type));
*reftype = ntype;
else if (!strcmp (space_identifier, "data"))
return TYPE_INSTANCE_FLAG_DATA_SPACE;
else if (gdbarch_address_class_name_to_type_flags_p (gdbarch)
- && gdbarch_address_class_name_to_type_flags (gdbarch,
+ && gdbarch_address_class_name_to_type_flags (gdbarch,
space_identifier,
&type_flags))
return type_flags;
else if (space_flag & TYPE_INSTANCE_FLAG_DATA_SPACE)
return "data";
else if ((space_flag & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
- && gdbarch_address_class_type_flags_to_name_p (gdbarch))
+ && gdbarch_address_class_type_flags_to_name_p (gdbarch))
return gdbarch_address_class_type_flags_to_name (gdbarch, space_flag);
else
return NULL;
{
case TYPE_CODE_RANGE:
/* This function currently only works for ranges with two defined,
- constant bounds. */
+ constant bounds. */
if (type->bounds ()->low.kind () != PROP_CONST
|| type->bounds ()->high.kind () != PROP_CONST)
return -1;
case TYPE_CODE_CHAR:
*lowp = 0;
/* This round-about calculation is to avoid shifting by
- TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work
- if TYPE_LENGTH (type) == sizeof (LONGEST). */
+ TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work
+ if TYPE_LENGTH (type) == sizeof (LONGEST). */
*highp = 1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1);
*highp = (*highp - 1) | *highp;
return 0;
int i;
for (i = 0; i < type->num_fields (); i += 1)
- {
- if (val == TYPE_FIELD_ENUMVAL (type, i))
+ {
+ if (val == TYPE_FIELD_ENUMVAL (type, i))
{
*pos = i;
return 1;
}
- }
+ }
/* Invalid enumeration value. */
return 0;
}
if (!update_static_array_size (result_type))
{
/* This type is dynamic and its length needs to be computed
- on demand. In the meantime, avoid leaving the TYPE_LENGTH
- undefined by setting it to zero. Although we are not expected
- to trust TYPE_LENGTH in this case, setting the size to zero
- allows us to avoid allocating objects of random sizes in case
- we accidently do. */
+ on demand. In the meantime, avoid leaving the TYPE_LENGTH
+ undefined by setting it to zero. Although we are not expected
+ to trust TYPE_LENGTH in this case, setting the size to zero
+ allows us to avoid allocating objects of random sizes in case
+ we accidently do. */
TYPE_LENGTH (result_type) = 0;
}
int i;
/* We must start at zero in case the first (and only) baseclass
- is virtual (and hence we cannot share the table pointer). */
+ is virtual (and hence we cannot share the table pointer). */
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
{
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
bit_stride = TYPE_FIELD_BITSIZE (type, 0);
return create_array_type_with_stride (type, elt_type, range_type, NULL,
- bit_stride);
+ bit_stride);
}
/* Resolve dynamic bounds of members of the union TYPE to static
while (node != NULL)
{
if (node->prop_kind == prop_kind)
- return &node->prop;
+ return &node->prop;
node = node->next;
}
return NULL;
{
const char *name = type->name ();
/* FIXME: shouldn't we look in STRUCT_DOMAIN and/or VAR_DOMAIN
- as appropriate? */
+ as appropriate? */
struct symbol *sym;
if (name == NULL)
}
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol;
if (sym)
- {
- /* Same as above for opaque types, we can replace the stub
- with the complete type only if they are in the same
- objfile. */
+ {
+ /* Same as above for opaque types, we can replace the stub
+ with the complete type only if they are in the same
+ objfile. */
if (TYPE_OBJFILE (SYMBOL_TYPE (sym)) == TYPE_OBJFILE (type))
type = make_qualified_type (SYMBOL_TYPE (sym),
type->instance_flags (), type);
else
type = SYMBOL_TYPE (sym);
- }
+ }
}
if (type->target_is_stub ())
if (depth <= 0 && (*p == ',' || *p == ')'))
{
/* Avoid parsing of ellipsis, they will be handled below.
- Also avoid ``void'' as above. */
+ Also avoid ``void'' as above. */
if (strncmp (argtypetext, "...", p - argtypetext) != 0
&& strncmp (argtypetext, "void", p - argtypetext) != 0)
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_NAMESPACE:
- INIT_CPLUS_SPECIFIC (type);
- break;
+ INIT_CPLUS_SPECIFIC (type);
+ break;
case TYPE_CODE_FLT:
- TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
- break;
+ TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
+ break;
case TYPE_CODE_FUNC:
INIT_FUNC_SPECIFIC (type);
- break;
+ break;
}
}
class_or_union_p (const struct type *t)
{
return (t->code () == TYPE_CODE_STRUCT
- || t->code () == TYPE_CODE_UNION);
+ || t->code () == TYPE_CODE_UNION);
}
/* A helper function which returns true if types A and B represent the
if (type->endianity_is_not_default ())
{
if (byteorder == BFD_ENDIAN_BIG)
- return BFD_ENDIAN_LITTLE;
+ return BFD_ENDIAN_LITTLE;
else
{
gdb_assert (byteorder == BFD_ENDIAN_LITTLE);
if (a->code () == TYPE_CODE_PTR
|| a->code () == TYPE_CODE_REF)
return types_equal (TYPE_TARGET_TYPE (a),
- TYPE_TARGET_TYPE (b));
+ TYPE_TARGET_TYPE (b));
/* Well, damnit, if the names are exactly the same, I'll say they
are exactly the same. This happens when we generate method
if (TYPE_IS_REFERENCE (arg))
return (sum_ranks (rank_one_type (parm, TYPE_TARGET_TYPE (arg), NULL),
- REFERENCE_SEE_THROUGH_BADNESS));
+ REFERENCE_SEE_THROUGH_BADNESS));
if (TYPE_IS_REFERENCE (parm))
return (sum_ranks (rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL),
- REFERENCE_SEE_THROUGH_BADNESS));
+ REFERENCE_SEE_THROUGH_BADNESS));
if (overload_debug)
/* Debugging only. */
fprintf_filtered (gdb_stderr,
case TYPE_SPECIFIC_FUNC:
printfi_filtered (spaces, "calling_convention %d\n",
- TYPE_CALLING_CONVENTION (type));
+ TYPE_CALLING_CONVENTION (type));
/* tail_call_list is not printed. */
break;
if (type->code () == TYPE_CODE_RANGE)
{
range_bounds *bounds
- = ((struct range_bounds *) TYPE_ALLOC
+ = ((struct range_bounds *) TYPE_ALLOC
(new_type, sizeof (struct range_bounds)));
*bounds = *type->bounds ();
classes. */
#define TYPE_ADDRESS_CLASS_1(t) (((t)->instance_flags ()) \
- & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
+ & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
#define TYPE_ADDRESS_CLASS_2(t) (((t)->instance_flags ()) \
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
#define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
#define TYPE_ALLOC(t,size) \
(obstack_alloc ((TYPE_OBJFILE_OWNED (t) \
- ? &TYPE_OBJFILE (t)->objfile_obstack \
- : gdbarch_obstack (TYPE_OWNER (t).gdbarch)), \
- size))
+ ? &TYPE_OBJFILE (t)->objfile_obstack \
+ : gdbarch_obstack (TYPE_OWNER (t).gdbarch)), \
+ size))
/* See comment on TYPE_ALLOC. */
extern struct type *make_reference_type (struct type *, struct type **,
- enum type_code);
+ enum type_code);
extern struct type *make_cv_type (int, int, struct type *, struct type **);
/* This is the name used in older versions. */
if (! fixup.minsym)
- fixup = lookup_minimal_symbol ("fixup", NULL, resolver.objfile);
+ fixup = lookup_minimal_symbol ("fixup", NULL, resolver.objfile);
if (fixup.minsym && BMSYMBOL_VALUE_ADDRESS (fixup) == pc)
return frame_unwind_caller_pc (get_current_frame ());
if (set)
{
/* XXX We don't get the exception unless the thread has its own
- exception port???? */
+ exception port???? */
if (proc->exc_port == MACH_PORT_NULL)
proc_steal_exc_port (proc, proc->inf->event_port);
THREAD_STATE_SET_TRACED (state);
proc_steal_exc_port (proc, inf->event_port);
else
/* Just clear thread exception ports -- they default to the
- task one. */
+ task one. */
proc_steal_exc_port (proc, MACH_PORT_NULL);
}
if (inf->task->cur_sc < pi->taskinfo.suspend_count && suspend_count == -1)
{
/* The proc server might have suspended the task while stopping
- it. This happens when the task is handling a traced signal.
- Refetch the suspend count. The proc server should be
- finished stopping the task by now. */
+ it. This happens when the task is handling a traced signal.
+ Refetch the suspend count. The proc server should be
+ finished stopping the task by now. */
suspend_count = pi->taskinfo.suspend_count;
goto retry;
}
inf->running = thread_running && task_running;
/* Once any thread has executed some code, we can't depend on the
- threads list any more. */
+ threads list any more. */
if (inf->running)
inf->threads_up_to_date = 0;
push_target (this);
pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
- NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
/* We have something that executes now. We'll be running through
the shell at this point (if startup-with-shell is true), but the
#define debug(msg, args...) \
do { if (gnu_debug_flag) \
- fprintf_unfiltered (gdb_stdlog, "%s:%d: " msg "\r\n", \
+ fprintf_unfiltered (gdb_stdlog, "%s:%d: " msg "\r\n", \
__FILE__ , __LINE__ , ##args); } while (0)
/* A prototype generic GNU/Hurd target. The client can override it
&& TYPE_TARGET_TYPE (value_type (vtbl))->code () == TYPE_CODE_ARRAY)
{
/* Handle the case where the vtbl field points to an
- array of structures. */
+ array of structures. */
vtbl = value_ind (vtbl);
/* Index into the virtual function table. This is hard-coded because
- looking up a field is not cheap, and it may be important to save
- time, e.g. if the user has set a conditional breakpoint calling
- a virtual function. */
+ looking up a field is not cheap, and it may be important to save
+ time, e.g. if the user has set a conditional breakpoint calling
+ a virtual function. */
entry = value_subscript (vtbl, vi);
}
else
{
v = value_cast (btype, v);
if (using_enc)
- *using_enc=1;
+ *using_enc=1;
}
/* We can't use value_ind here, because it would want to use RTTI, and
we'd waste a bunch of time figuring out we already know the type.
if (TYPE_N_BASECLASSES(rtti_type) > 1 && full && (*full) != 1)
{
if (top)
- *top = TYPE_BASECLASS_BITPOS (rtti_type,
+ *top = TYPE_BASECLASS_BITPOS (rtti_type,
TYPE_VPTR_FIELDNO(rtti_type)) / 8;
if (top && ((*top) >0))
- {
- if (TYPE_LENGTH(rtti_type) > TYPE_LENGTH(known_type))
- {
- if (full)
- *full=0;
- }
- else
- {
- if (full)
- *full=1;
- }
- }
+ {
+ if (TYPE_LENGTH(rtti_type) > TYPE_LENGTH(known_type))
+ {
+ if (full)
+ *full=0;
+ }
+ else
+ {
+ if (full)
+ *full=1;
+ }
+ }
}
else
{
if (full)
- *full=1;
+ *full=1;
}
return rtti_type;
int n_baseclasses = TYPE_N_BASECLASSES (type);
/* First look for the virtual baseclass pointer
- in the fields. */
+ in the fields. */
for (i = n_baseclasses; i < len; i++)
{
if (vb_match (type, i, basetype))
struct gdb_gnu_v3_abi_vtable {
/ * An array of virtual call and virtual base offsets. The real
- length of this array depends on the class hierarchy; we use
- negative subscripts to access the elements. Yucky, but
- better than the alternatives. * /
+ length of this array depends on the class hierarchy; we use
+ negative subscripts to access the elements. Yucky, but
+ better than the alternatives. * /
ptrdiff_t vcall_and_vbase_offsets[0];
/ * The offset from a virtual pointer referring to this table
- to the top of the complete object. * /
+ to the top of the complete object. * /
ptrdiff_t offset_to_top;
/ * The type_info pointer for this class. This is really a
- std::type_info *, but GDB doesn't really look at the
- type_info object itself, so we don't bother to get the type
- exactly right. * /
+ std::type_info *, but GDB doesn't really look at the
+ type_info object itself, so we don't bother to get the type
+ exactly right. * /
void *type_info;
/ * Virtual table pointers in objects point here. * /
/ * Virtual function pointers. Like the vcall/vbase array, the
- real length of this table depends on the class hierarchy. * /
+ real length of this table depends on the class hierarchy. * /
void (*virtual_functions[0]) ();
};
= (struct type *) gdbarch_data (gdbarch, vtable_type_gdbarch_data);
return (TYPE_FIELD_BITPOS (vtable_type, vtable_field_virtual_functions)
- / TARGET_CHAR_BIT);
+ / TARGET_CHAR_BIT);
}
static struct type *
gnuv3_rtti_type (struct value *value,
- int *full_p, LONGEST *top_p, int *using_enc_p)
+ int *full_p, LONGEST *top_p, int *using_enc_p)
{
struct gdbarch *gdbarch;
struct type *values_type = check_typedef (value_type (value));
/* Find the linker symbol for this vtable. */
vtable_symbol
= lookup_minimal_symbol_by_pc (value_address (vtable)
- + value_embedded_offset (vtable)).minsym;
+ + value_embedded_offset (vtable)).minsym;
if (! vtable_symbol)
return NULL;
if (full_p)
*full_p = (- offset_to_top == value_embedded_offset (value)
- && (TYPE_LENGTH (value_enclosing_type (value))
- >= TYPE_LENGTH (run_time_type)));
+ && (TYPE_LENGTH (value_enclosing_type (value))
+ >= TYPE_LENGTH (run_time_type)));
if (top_p)
*top_p = - offset_to_top;
return run_time_type;
/* Fetch the appropriate function pointer from the vtable. */
vfn = value_subscript (value_field (vtable, vtable_field_virtual_functions),
- vtable_index);
+ vtable_index);
/* If this architecture uses function descriptors directly in the vtable,
then the address of the vtable entry is actually a "function pointer"
static struct value *
gnuv3_virtual_fn_field (struct value **value_p,
- struct fn_field *f, int j,
+ struct fn_field *f, int j,
struct type *vfn_base, int offset)
{
struct type *values_type = check_typedef (value_type (*value_p));
}
/* Default type for floating-point literals is float64. */
else
- {
+ {
putithere->typed_val_float.type
= builtin_go_types->builtin_float64;
- }
+ }
if (!parse_float (p, len,
putithere->typed_val_float.type,
putithere->typed_val_float.val))
- return ERROR;
+ return ERROR;
return FLOAT;
}
&& (un >> (gdbarch_int_bit (par_state->gdbarch ()) - 2)) == 0)
{
high_bit
- = ((ULONGEST)1) << (gdbarch_int_bit (par_state->gdbarch ()) - 1);
+ = ((ULONGEST)1) << (gdbarch_int_bit (par_state->gdbarch ()) - 1);
/* A large decimal (not hex or octal) constant (between INT_MAX
and UINT_MAX) is a long or unsigned long, according to ANSI,
else if (saw_structop)
return COMPLETE;
else
- return 0;
+ return 0;
case ' ':
case '\t':
case ',':
if (pstate->comma_terminates
- && paren_depth == 0)
+ && paren_depth == 0)
return 0;
par_state->lexptr++;
return c;
}
toktype = parse_number (par_state, tokstart, p - tokstart,
got_dot|got_e, &yylval);
- if (toktype == ERROR)
+ if (toktype == ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
/* CPUID with EAX = 0 returns the Vendor ID. */
#if 0
/* Ideally we would use x86_cpuid(), but it needs someone to run
- native tests first to make sure things actually work. They should.
- http://sourceware.org/ml/gdb-patches/2013-05/msg00164.html */
+ native tests first to make sure things actually work. They should.
+ http://sourceware.org/ml/gdb-patches/2013-05/msg00164.html */
unsigned int eax, ebx, ecx, edx;
if (x86_cpuid (0, &eax, &ebx, &ecx, &edx))
}
}
xsnprintf (cpu_string, sizeof (cpu_string), "%s%s Model %d Stepping %d",
- intel_p ? "Pentium" : (amd_p ? "AMD" : (hygon_p ? "Hygon" : "ix86")),
- cpu_brand, cpu_model, cpuid_eax & 0xf);
+ intel_p ? "Pentium" : (amd_p ? "AMD" : (hygon_p ? "Hygon" : "ix86")),
+ cpu_brand, cpu_model, cpuid_eax & 0xf);
printfi_filtered (31, "%s\n", cpu_string);
if (((cpuid_edx & (6 | (0x0d << 23))) != 0)
|| ((cpuid_edx & 1) == 0)
if (exception.reason < 0) \
{ \
gdbscm_throw_gdb_exception (exception); \
- /*NOTREACHED */ \
+ /*NOTREACHED */ \
} \
} while (0)
One of the COMPLETE_* constants defined in the gdb module.
A procedure of three arguments: (lambda (self text word) ...).
Its result is one of:
- A list of strings.
- A <gdb:iterator> object that returns the set of possible completions,
- ending with #f.
+ A list of strings.
+ A <gdb:iterator> object that returns the set of possible completions,
+ ending with #f.
TODO(dje): Once PR 16699 is fixed, add support for returning
a COMPLETE_* constant.
If not specified, then completion is not supported for this command.
Return the value of the symbol in the frame.\n\
\n\
Arguments: <gdb:frame> <gdb:symbol>\n\
- Or: <gdb:frame> string [#:block <gdb:block>]" },
+ Or: <gdb:frame> string [#:block <gdb:block>]" },
{ "frame-read-register", 2, 0, 0,
as_a_scm_t_subr (gdbscm_frame_read_register),
(let ((next! (lambda (iter)
(let ((l (iterator-progress iter)))
(if (eq? l '())
- end-marker
- (begin
+ end-marker
+ (begin
(set-iterator-progress! iter (cdr l))
(car l)))))))
(make-iterator l l next!)))
int result;
switch (op)
{
- case BINOP_LESS:
+ case BINOP_LESS:
result = value_less (v1, v2);
break;
case BINOP_LEQ:
break;
case BINOP_NOTEQUAL:
gdb_assert_not_reached ("not-equal not implemented");
- case BINOP_GTR:
+ case BINOP_GTR:
result = value_less (v2, v1);
break;
case BINOP_GEQ:
{
/* Guile doesn't export SIGINT hooks like Python does.
For now pass EINTR to scm_syserror, that's what fports.c does. */
- scm_syserror (FUNC_NAME);
+ scm_syserror (FUNC_NAME);
}
return num_found > 0 && FD_ISSET (fdes, &input_fds);
}
3. Other. Always print a ",". */
if (i == 0)
{
- if (printed_nothing)
- fputs_filtered ("{", stream);
- else
- fputs_filtered (" = {", stream);
+ if (printed_nothing)
+ fputs_filtered ("{", stream);
+ else
+ fputs_filtered (" = {", stream);
}
else if (! is_map || i % 2 == 0)
struct value *res_val;
switch (check_typedef (value_type (value))->code ())
- {
- case TYPE_CODE_PTR:
- res_val = value_ind (value);
- break;
- case TYPE_CODE_REF:
- res_val = coerce_ref (value);
- break;
- default:
- error (_("Trying to get the referenced value from a value which is"
+ {
+ case TYPE_CODE_PTR:
+ res_val = value_ind (value);
+ break;
+ case TYPE_CODE_REF:
+ res_val = coerce_ref (value);
+ break;
+ default:
+ error (_("Trying to get the referenced value from a value which is"
" neither a pointer nor a reference"));
- }
+ }
return vlscm_scm_from_value (res_val);
});
If LENGTH is provided, only fetch string to the length provided.\n\
\n\
Arguments: <gdb:value>\n\
- [#:encoding encoding] [#:errors \"error\"|\"substitute\"]\n\
- [#:length length]" },
+ [#:encoding encoding] [#:errors \"error\"|\"substitute\"]\n\
+ [#:length length]" },
{ "value->lazy-string", 1, 0, 1,
as_a_scm_t_subr (gdbscm_value_to_lazy_string),
cache->saved_regs[E_FP_REGNUM] = 0;
pc += 4;
if (pc >= current_pc)
- return current_pc;
+ return current_pc;
op = read_memory_unsigned_integer (pc, 2, byte_order);
if (IS_MOV_SP_FP (op))
{
pc += 2;
}
else if (IS_MOV_IMM_Rn (op))
- {
+ {
int offset = read_memory_integer (pc + 2, 2, byte_order);
regno = op & 0x000f;
op = read_memory_unsigned_integer (pc + 4, 2, byte_order);
if (IS_PUSH (op1))
{
/* Since the prefix is 0x01x0, this is not a simple pushm but a
- stm.l reglist,@-sp */
+ stm.l reglist,@-sp */
i = ((op & 0x0030) >> 4) + 1;
regno = op1 & 0x000f;
for (; i > 0; regno++, --i)
This could also be an initializing store from non-prologue code,
but I don't think there's any harm in skipping that. */
while ((spill_size = h8300_is_argument_spill (gdbarch, pc)) > 0
- && pc + spill_size <= current_pc)
+ && pc + spill_size <= current_pc)
pc += spill_size;
return pc;
if (!cache->uses_fp)
{
/* We didn't find a valid frame, which means that CACHE->base
- currently holds the frame pointer for our calling frame. If
- we're at the start of a function, or somewhere half-way its
- prologue, the function's frame probably hasn't been fully
- setup yet. Try to reconstruct the base address for the stack
- frame by looking at the stack pointer. For truly "frameless"
- functions this might work too. */
+ currently holds the frame pointer for our calling frame. If
+ we're at the start of a function, or somewhere half-way its
+ prologue, the function's frame probably hasn't been fully
+ setup yet. Try to reconstruct the base address for the stack
+ frame by looking at the stack pointer. For truly "frameless"
+ functions this might work too. */
cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM)
+ cache->sp_offset;
if (regnum < gdbarch_num_regs (gdbarch)
&& cache->saved_regs[regnum] != -1)
return frame_unwind_got_memory (this_frame, regnum,
- cache->saved_regs[regnum]);
+ cache->saved_regs[regnum]);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
/* Found a function. */
sal = find_pc_line (func_addr, 0);
if (sal.end && sal.end < func_end)
- /* Found a line number, use it as end of prologue. */
- return sal.end;
+ /* Found a line number, use it as end of prologue. */
+ return sal.end;
/* No useable line symbol. Use prologue parsing method. */
h8300_init_frame_cache (gdbarch, &cache);
stack_offset += padded_len;
/* That's right --- even though we passed the argument
- on the stack, we consume the registers anyway! Love
- me, love my dog. */
+ on the stack, we consume the registers anyway! Love
+ me, love my dog. */
reg += padded_len / wordsize;
}
else
{
/* Heavens to Betsy --- it's really going in registers!
- Note that on the h8/300s, there are gaps between the
- registers in the register file. */
+ Note that on the h8/300s, there are gaps between the
+ registers in the register file. */
int offset;
for (offset = 0; offset < padded_len; offset += wordsize)
for (regno = 0;
regno < gdbarch_num_regs (regcache->arch ());
regno++)
- fetch_register (regcache, regno);
+ fetch_register (regcache, regno);
}
else
{
matched. */
static int
insns_match_pattern (struct gdbarch *gdbarch, CORE_ADDR pc,
- struct insn_pattern *pattern,
- unsigned int *insn)
+ struct insn_pattern *pattern,
+ unsigned int *insn)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i;
target_read_memory (npc, buf, 4);
insn[i] = extract_unsigned_integer (buf, 4, byte_order);
if ((insn[i] & pattern[i].mask) == pattern[i].data)
- npc += 4;
+ npc += 4;
else
- return 0;
+ return 0;
}
return 1;
}
if (insns_match_pattern (gdbarch, sp + pcoffs[attempt],
hppa_sigtramp, dummy))
{
- offs = sfoffs[attempt];
+ offs = sfoffs[attempt];
break;
}
}
}
else
{
- return 0;
+ return 0;
}
}
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
}
void _initialize_hppa_linux_tdep ();
hppanbsd_gregset_supplies_p (int regnum)
{
return ((regnum >= HPPA_R0_REGNUM && regnum <= HPPA_R31_REGNUM) ||
- (regnum >= HPPA_SAR_REGNUM && regnum <= HPPA_PCSQ_TAIL_REGNUM) ||
- regnum == HPPA_IPSW_REGNUM ||
+ (regnum >= HPPA_SAR_REGNUM && regnum <= HPPA_PCSQ_TAIL_REGNUM) ||
+ regnum == HPPA_IPSW_REGNUM ||
(regnum >= HPPA_SR4_REGNUM && regnum <= HPPA_SR4_REGNUM + 5));
}
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_("Couldn't get registers"));
hppanbsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_("Couldn't write registers"));
}
if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum))
};
static void hppanbsd_sigtramp_cache_init (const struct tramp_frame *,
- struct frame_info *,
- struct trad_frame_cache *,
- CORE_ADDR);
+ struct frame_info *,
+ struct trad_frame_cache *,
+ CORE_ADDR);
static const struct tramp_frame hppanbsd_sigtramp_si4 =
{
static void
hppanbsd_sigtramp_cache_init (const struct tramp_frame *self,
- struct frame_info *this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct frame_info *this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func)
{
CORE_ADDR sp = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
CORE_ADDR base;
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_("Couldn't get registers"));
hppaobsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_("Couldn't write registers"));
}
if (regnum == -1 || hppaobsd_fpregset_supplies_p (regnum))
CORE_ADDR *low_text_segment_address = (CORE_ADDR *)data;
if (value < *low_text_segment_address)
- *low_text_segment_address = value;
+ *low_text_segment_address = value;
}
}
passed in. */
if (gdbarch_tdep (gdbarch)->is_elf && text_offset == 0)
{
- low_text_segment_address = -1;
+ low_text_segment_address = -1;
bfd_map_over_sections (objfile->obfd,
record_text_segment_lowaddr,
text_offset = low_text_segment_address;
}
else if (gdbarch_tdep (gdbarch)->solib_get_text_base)
- {
+ {
text_offset = gdbarch_tdep (gdbarch)->solib_get_text_base (objfile);
}
bfd_get_section_contents (objfile->obfd, section, buf, 0, size);
/* Now internalize the information being careful to handle host/target
- endian issues. */
+ endian issues. */
for (i = 0; i < entries; i++)
{
table[i].region_start = bfd_get_32 (objfile->obfd,
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "{ find_unwind_entry %s -> ",
- hex_string (pc));
+ hex_string (pc));
/* A function at address 0? Not in HP-UX! */
if (pc == (CORE_ADDR) 0)
{
CORE_ADDR struct_ptr = 0;
/* The first parameter goes into sp-36, each stack slot is 4-bytes.
- struct_ptr is adjusted for each argument below, so the first
+ struct_ptr is adjusted for each argument below, so the first
argument will end up at sp-36. */
CORE_ADDR param_ptr = 32;
int i;
value_contents (arg)));
}
else if (type->code () == TYPE_CODE_FLT)
- {
+ {
/* Floating point value store, right aligned. */
param_len = align_up (TYPE_LENGTH (type), 4);
memcpy (param_val, value_contents (arg), param_len);
- }
+ }
else
{
param_len = align_up (TYPE_LENGTH (type), 4);
value_contents (arg), TYPE_LENGTH (type));
/* Structures of size 5, 6 and 7 bytes are special in that
- the higher-ordered word is stored in the lower-ordered
+ the higher-ordered word is stored in the lower-ordered
argument, and even though it is a 8-byte quantity the
registers need not be 8-byte aligned. */
if (param_len > 4 && param_len < 8)
param_ptr += param_len;
if (param_len == 8 && !small_struct)
- param_ptr = align_up (param_ptr, 8);
+ param_ptr = align_up (param_ptr, 8);
/* First 4 non-FP arguments are passed in gr26-gr23.
First 4 32-bit FP arguments are passed in fr4L-fr7L.
if (hppa64_integral_or_pointer_p (type))
{
/* "Integral scalar parameters smaller than 64 bits are
- padded on the left (i.e., the value is in the
- least-significant bits of the 64-bit storage unit, and
- the high-order bits are undefined)." Therefore we can
- safely sign-extend them. */
+ padded on the left (i.e., the value is in the
+ least-significant bits of the 64-bit storage unit, and
+ the high-order bits are undefined)." Therefore we can
+ safely sign-extend them. */
if (len < 8)
{
arg = value_cast (builtin_type (gdbarch)->builtin_int64, arg);
offset = align_up (offset, 16);
/* "Double-extended- and quad-precision floating-point
- parameters within the first 64 bytes of the parameter
- list are always passed in general registers." */
+ parameters within the first 64 bytes of the parameter
+ list are always passed in general registers." */
}
else
{
}
/* "Single- and double-precision floating-point
- parameters in this area are passed according to the
- available formal parameter information in a function
- prototype. [...] If no prototype is in scope,
- floating-point parameters must be passed both in the
- corresponding general registers and in the
- corresponding floating-point registers." */
+ parameters in this area are passed according to the
+ available formal parameter information in a function
+ prototype. [...] If no prototype is in scope,
+ floating-point parameters must be passed both in the
+ corresponding general registers and in the
+ corresponding floating-point registers." */
regnum = HPPA64_FP4_REGNUM + offset / 8;
if (regnum < HPPA64_FP4_REGNUM + 8)
}
/* If we are passing a function pointer, make sure we pass a function
- descriptor instead of the function entry address. */
+ descriptor instead of the function entry address. */
if (type->code () == TYPE_CODE_PTR
- && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC)
- {
+ && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC)
+ {
ULONGEST codeptr, fptr;
codeptr = unpack_long (type, value_contents (arg));
valbuf = fptrbuf;
}
else
- {
- valbuf = value_contents (arg);
+ {
+ valbuf = value_contents (arg);
}
/* Always store the argument in memory. */
if (len > 16)
{
/* All return values larger than 128 bits must be aggregate
- return values. */
+ return values. */
gdb_assert (!hppa64_integral_or_pointer_p (type));
gdb_assert (!hppa64_floating_p (type));
if (hppa64_integral_or_pointer_p (type))
{
/* "Integral return values are returned in GR 28. Values
- smaller than 64 bits are padded on the left (with garbage)." */
+ smaller than 64 bits are padded on the left (with garbage)." */
regnum = HPPA_RET0_REGNUM;
offset = 8 - len;
}
else
{
/* "Aggregate return values up to 64 bits in size are returned
- in GR 28. Aggregates smaller than 64 bits are left aligned
- in the register; the pad bits on the right are undefined."
+ in GR 28. Aggregates smaller than 64 bits are left aligned
+ in the register; the pad bits on the right are undefined."
"Aggregate return values between 65 and 128 bits are returned
in GRs 28 and 29. The first 64 bits are placed in GR 28, and
the general registers are:
Store: stb, sth, stw, std (according to Chapter 7, they
- are only in both "inst >> 26" and "inst >> 6".
+ are only in both "inst >> 26" and "inst >> 6".
Store Absolute: stwa, stda (according to Chapter 7, they are only
- in "inst >> 6".
+ in "inst >> 6".
Store Bytes: stby, stdby (according to Chapter 7, they are
- only in "inst >> 6").
+ only in "inst >> 6").
For (inst >> 26), according to Chapter 7:
unsigned long old_save_rp, old_save_sp, next_inst;
/* Save copies of all the triggers so we can compare them later
- (only for HPC). */
+ (only for HPC). */
old_save_gr = save_gr;
old_save_fr = save_fr;
old_save_rp = save_rp;
save_rp = 0;
/* These are the only ways we save SP into the stack. At this time
- the HP compilers never bother to save SP into the stack. */
+ the HP compilers never bother to save SP into the stack. */
if ((inst & 0xffffc000) == 0x6fc10000
|| (inst & 0xffffc00c) == 0x73c10008)
save_sp = 0;
/* Are we loading some register with an offset from the argument
- pointer? */
+ pointer? */
if ((inst & 0xffe00000) == 0x37a00000
|| (inst & 0xffffffe0) == 0x081d0240)
{
save_gr &= ~(1 << reg_num);
/* Ugh. Also account for argument stores into the stack.
- Unfortunately args_stored only tells us that some arguments
- where stored into the stack. Not how many or what kind!
+ Unfortunately args_stored only tells us that some arguments
+ where stored into the stack. Not how many or what kind!
- This is a kludge as on the HP compiler sets this bit and it
- never does prologue scheduling. So once we see one, skip past
- all of them. We have similar code for the fp arg stores below.
+ This is a kludge as on the HP compiler sets this bit and it
+ never does prologue scheduling. So once we see one, skip past
+ all of them. We have similar code for the fp arg stores below.
- FIXME. Can still die if we have a mix of GR and FR argument
- stores! */
+ FIXME. Can still die if we have a mix of GR and FR argument
+ stores! */
if (reg_num >= (gdbarch_ptr_bit (gdbarch) == 64 ? 19 : 23)
&& reg_num <= 26)
{
return pc;
/* We've got to be read to handle the ldo before the fp register
- save. */
+ save. */
if ((inst & 0xfc000000) == 0x34000000
&& inst_saves_fr (next_inst) >= 4
&& inst_saves_fr (next_inst)
}
/* Ugh. Also account for argument stores into the stack.
- This is a kludge as on the HP compiler sets this bit and it
- never does prologue scheduling. So once we see one, skip past
- all of them. */
+ This is a kludge as on the HP compiler sets this bit and it
+ never does prologue scheduling. So once we see one, skip past
+ all of them. */
if (reg_num >= 4
&& reg_num <= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
{
}
/* Quit if we hit any kind of branch. This can happen if a prologue
- instruction is in the delay slot of the first call/branch. */
+ instruction is in the delay slot of the first call/branch. */
if (is_branch (inst) && stop_before_branch)
break;
/* What a crock. The HP compilers set args_stored even if no
- arguments were stored into the stack (boo hiss). This could
- cause this code to then skip a bunch of user insns (up to the
- first branch).
-
- To combat this we try to identify when args_stored was bogusly
- set and clear it. We only do this when args_stored is nonzero,
- all other resources are accounted for, and nothing changed on
- this pass. */
+ arguments were stored into the stack (boo hiss). This could
+ cause this code to then skip a bunch of user insns (up to the
+ first branch).
+
+ To combat this we try to identify when args_stored was bogusly
+ set and clear it. We only do this when args_stored is nonzero,
+ all other resources are accounted for, and nothing changed on
+ this pass. */
if (args_stored
&& !(save_gr || save_fr || save_rp || save_sp || stack_remaining > 0)
&& old_save_gr == save_gr && old_save_fr == save_fr
pc += 4;
/* !stop_before_branch, so also look at the insn in the delay slot
- of the branch. */
+ of the branch. */
if (final_iteration)
break;
if (is_branch (inst))
if ((*this_cache) != NULL)
{
if (hppa_debug)
- fprintf_unfiltered (gdb_stdlog, "base=%s (cached) }",
- paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
+ fprintf_unfiltered (gdb_stdlog, "base=%s (cached) }",
+ paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
return (struct hppa_frame_cache *) (*this_cache);
}
cache = FRAME_OBSTACK_ZALLOC (struct hppa_frame_cache);
if (!u)
{
if (hppa_debug)
- fprintf_unfiltered (gdb_stdlog, "base=NULL (no unwind entry) }");
+ fprintf_unfiltered (gdb_stdlog, "base=NULL (no unwind entry) }");
return (struct hppa_frame_cache *) (*this_cache);
}
cache->saved_regs[HPPA_RP_REGNUM].addr = -24;
}
else if (inst == 0x0fc212c1
- || inst == 0x73c23fe1) /* std rp,-0x10(sr0,sp) */
+ || inst == 0x73c23fe1) /* std rp,-0x10(sr0,sp) */
{
looking_for_rp = 0;
cache->saved_regs[HPPA_RP_REGNUM].addr = -16;
the current function (and is thus equivalent to the "saved"
stack pointer. */
CORE_ADDR this_sp = get_frame_register_unsigned (this_frame,
- HPPA_SP_REGNUM);
+ HPPA_SP_REGNUM);
CORE_ADDR fp;
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (this_sp=%s, pc=%s, "
- "prologue_end=%s) ",
- paddress (gdbarch, this_sp),
+ "prologue_end=%s) ",
+ paddress (gdbarch, this_sp),
paddress (gdbarch, get_frame_pc (this_frame)),
paddress (gdbarch, prologue_end));
/* Check to see if a frame pointer is available, and use it for
- frame unwinding if it is.
+ frame unwinding if it is.
- There are some situations where we need to rely on the frame
- pointer to do stack unwinding. For example, if a function calls
- alloca (), the stack pointer can get adjusted inside the body of
- the function. In this case, the ABI requires that the compiler
- maintain a frame pointer for the function.
+ There are some situations where we need to rely on the frame
+ pointer to do stack unwinding. For example, if a function calls
+ alloca (), the stack pointer can get adjusted inside the body of
+ the function. In this case, the ABI requires that the compiler
+ maintain a frame pointer for the function.
- The unwind record has a flag (alloca_frame) that indicates that
- a function has a variable frame; unfortunately, gcc/binutils
- does not set this flag. Instead, whenever a frame pointer is used
- and saved on the stack, the Save_SP flag is set. We use this to
- decide whether to use the frame pointer for unwinding.
+ The unwind record has a flag (alloca_frame) that indicates that
+ a function has a variable frame; unfortunately, gcc/binutils
+ does not set this flag. Instead, whenever a frame pointer is used
+ and saved on the stack, the Save_SP flag is set. We use this to
+ decide whether to use the frame pointer for unwinding.
- TODO: For the HP compiler, maybe we should use the alloca_frame flag
+ TODO: For the HP compiler, maybe we should use the alloca_frame flag
instead of Save_SP. */
fp = get_frame_register_unsigned (this_frame, HPPA_FP_REGNUM);
fp -= u->Total_frame_size << 3;
if (get_frame_pc (this_frame) >= prologue_end
- && (u->Save_SP || u->alloca_frame) && fp != 0)
+ && (u->Save_SP || u->alloca_frame) && fp != 0)
{
cache->base = fp;
else if (u->Save_SP
&& trad_frame_addr_p (cache->saved_regs, HPPA_SP_REGNUM))
{
- /* Both we're expecting the SP to be saved and the SP has been
+ /* Both we're expecting the SP to be saved and the SP has been
saved. The entry SP value is saved at this frame's SP
address. */
- cache->base = read_memory_integer (this_sp, word_size, byte_order);
+ cache->base = read_memory_integer (this_sp, word_size, byte_order);
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (base=%s) [saved]",
- paddress (gdbarch, cache->base));
+ paddress (gdbarch, cache->base));
}
else
{
- /* The prologue has been slowly allocating stack space. Adjust
+ /* The prologue has been slowly allocating stack space. Adjust
the SP back. */
- cache->base = this_sp - frame_size;
+ cache->base = this_sp - frame_size;
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (base=%s) [unwind adjust]",
paddress (gdbarch, cache->base));
if (u->Millicode)
{
if (trad_frame_addr_p (cache->saved_regs, 31))
- {
- cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM] = cache->saved_regs[31];
+ {
+ cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM] = cache->saved_regs[31];
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (pc=r31) [stack] } ");
- }
+ }
else
{
ULONGEST r31 = get_frame_register_unsigned (this_frame, 31);
trad_frame_set_value (cache->saved_regs, HPPA_PCOQ_HEAD_REGNUM, r31);
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (pc=r31) [frame] } ");
- }
+ }
}
else
{
if (trad_frame_addr_p (cache->saved_regs, HPPA_RP_REGNUM))
- {
- cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM] =
+ {
+ cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM] =
cache->saved_regs[HPPA_RP_REGNUM];
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (pc=rp) [stack] } ");
- }
+ }
else
{
ULONGEST rp = get_frame_register_unsigned (this_frame,
- HPPA_RP_REGNUM);
+ HPPA_RP_REGNUM);
trad_frame_set_value (cache->saved_regs, HPPA_PCOQ_HEAD_REGNUM, rp);
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (pc=rp) [frame] } ");
static int
hppa_frame_unwind_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame, void **this_cache)
+ struct frame_info *this_frame, void **this_cache)
{
if (hppa_find_unwind_entry_in_block (this_frame))
return 1;
found_rp = 1;
}
else if (insn == 0x0fc212c1
- || insn == 0x73c23fe1) /* std rp,-0x10(sr0,sp) */
+ || insn == 0x73c23fe1) /* std rp,-0x10(sr0,sp) */
{
cache->saved_regs[HPPA_RP_REGNUM].addr = -16;
found_rp = 1;
static struct value *
hppa_fallback_frame_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+ void **this_cache, int regnum)
{
struct hppa_frame_cache *info
= hppa_fallback_frame_cache (this_frame, this_cache);
static int
hppa_stub_unwind_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
+ struct frame_info *this_frame,
+ void **this_cache)
{
CORE_ADDR pc = get_frame_address_in_block (this_frame);
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct bound_minimal_symbol
hppa_lookup_stub_minimal_symbol (const char *name,
- enum unwind_stub_types stub_type)
+ enum unwind_stub_types stub_type)
{
struct bound_minimal_symbol result = { NULL, NULL };
{
printf_unfiltered ("\tstub type = ");
switch (u->stub_unwind.stub_type)
- {
+ {
case LONG_BRANCH:
printf_unfiltered ("long branch\n");
break;
hppa32_cannot_store_register (struct gdbarch *gdbarch, int regnum)
{
return (regnum == 0
- || regnum == HPPA_PCSQ_HEAD_REGNUM
- || (regnum >= HPPA_PCSQ_TAIL_REGNUM && regnum < HPPA_IPSW_REGNUM)
- || (regnum > HPPA_IPSW_REGNUM && regnum < HPPA_FP4_REGNUM));
+ || regnum == HPPA_PCSQ_HEAD_REGNUM
+ || (regnum >= HPPA_PCSQ_TAIL_REGNUM && regnum < HPPA_IPSW_REGNUM)
+ || (regnum > HPPA_IPSW_REGNUM && regnum < HPPA_FP4_REGNUM));
}
static int
hppa64_cannot_store_register (struct gdbarch *gdbarch, int regnum)
{
return (regnum == 0
- || regnum == HPPA_PCSQ_HEAD_REGNUM
- || (regnum >= HPPA_PCSQ_TAIL_REGNUM && regnum < HPPA_IPSW_REGNUM)
- || (regnum > HPPA_IPSW_REGNUM && regnum < HPPA64_FP4_REGNUM));
+ || regnum == HPPA_PCSQ_HEAD_REGNUM
+ || (regnum >= HPPA_PCSQ_TAIL_REGNUM && regnum < HPPA_IPSW_REGNUM)
+ || (regnum > HPPA_IPSW_REGNUM && regnum < HPPA64_FP4_REGNUM));
}
static int
struct value *
hppa_frame_prev_register_helper (struct frame_info *this_frame,
- struct trad_frame_saved_reg saved_regs[],
+ struct trad_frame_saved_reg saved_regs[],
int regnum)
{
struct gdbarch *arch = get_frame_arch (this_frame);
int size = register_size (arch, HPPA_PCOQ_HEAD_REGNUM);
CORE_ADDR pc;
struct value *pcoq_val =
- trad_frame_get_prev_register (this_frame, saved_regs,
- HPPA_PCOQ_HEAD_REGNUM);
+ trad_frame_get_prev_register (this_frame, saved_regs,
+ HPPA_PCOQ_HEAD_REGNUM);
pc = extract_unsigned_integer (value_contents_all (pcoq_val),
size, byte_order);
target_read_memory (npc, buf, HPPA_INSN_SIZE);
insn[i] = extract_unsigned_integer (buf, HPPA_INSN_SIZE, byte_order);
if ((insn[i] & pattern[i].mask) == pattern[i].data)
- npc += 4;
+ npc += 4;
else
- return 0;
+ return 0;
}
return 1;
pc = hppa_extract_21 (insn[0]) + hppa_extract_14 (insn[1]);
if (dp_rel)
- pc += get_frame_register_unsigned (frame, HPPA_DP_REGNUM);
+ pc += get_frame_register_unsigned (frame, HPPA_DP_REGNUM);
else
- pc += get_frame_register_unsigned (frame, HPPA_R0_REGNUM + 19);
+ pc += get_frame_register_unsigned (frame, HPPA_R0_REGNUM + 19);
/* fallthrough */
}
pc = read_memory_typed_address (pc, func_ptr_type);
/* If the PLT slot has not yet been resolved, the target will be
- the PLT stub. */
+ the PLT stub. */
if (in_plt_section (pc))
{
/* Sanity check: are we pointing to the PLT stub? */
switch (tdep->bytes_per_address)
{
case 4:
- set_gdbarch_num_regs (gdbarch, hppa32_num_regs);
- set_gdbarch_register_name (gdbarch, hppa32_register_name);
- set_gdbarch_register_type (gdbarch, hppa32_register_type);
+ set_gdbarch_num_regs (gdbarch, hppa32_num_regs);
+ set_gdbarch_register_name (gdbarch, hppa32_register_name);
+ set_gdbarch_register_type (gdbarch, hppa32_register_type);
set_gdbarch_cannot_store_register (gdbarch,
hppa32_cannot_store_register);
set_gdbarch_cannot_fetch_register (gdbarch,
hppa32_cannot_fetch_register);
- break;
+ break;
case 8:
- set_gdbarch_num_regs (gdbarch, hppa64_num_regs);
- set_gdbarch_register_name (gdbarch, hppa64_register_name);
- set_gdbarch_register_type (gdbarch, hppa64_register_type);
- set_gdbarch_dwarf2_reg_to_regnum (gdbarch, hppa64_dwarf_reg_to_regnum);
+ set_gdbarch_num_regs (gdbarch, hppa64_num_regs);
+ set_gdbarch_register_name (gdbarch, hppa64_register_name);
+ set_gdbarch_register_type (gdbarch, hppa64_register_type);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, hppa64_dwarf_reg_to_regnum);
set_gdbarch_cannot_store_register (gdbarch,
hppa64_cannot_store_register);
set_gdbarch_cannot_fetch_register (gdbarch,
hppa64_cannot_fetch_register);
- break;
+ break;
default:
- internal_error (__FILE__, __LINE__, _("Unsupported address size: %d"),
- tdep->bytes_per_address);
+ internal_error (__FILE__, __LINE__, _("Unsupported address size: %d"),
+ tdep->bytes_per_address);
}
set_gdbarch_long_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
set_gdbarch_push_dummy_call (gdbarch, hppa32_push_dummy_call);
set_gdbarch_frame_align (gdbarch, hppa32_frame_align);
set_gdbarch_convert_from_func_ptr_addr
- (gdbarch, hppa32_convert_from_func_ptr_addr);
+ (gdbarch, hppa32_convert_from_func_ptr_addr);
break;
case 8:
set_gdbarch_push_dummy_call (gdbarch, hppa64_push_dummy_call);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
fprintf_unfiltered (file, "bytes_per_address = %d\n",
- tdep->bytes_per_address);
+ tdep->bytes_per_address);
fprintf_unfiltered (file, "elf = %s\n", tdep->is_elf ? "yes" : "no");
}
extern struct bound_minimal_symbol
hppa_lookup_stub_minimal_symbol (const char *name,
- enum unwind_stub_types stub_type);
+ enum unwind_stub_types stub_type);
extern int hppa_in_solib_call_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc);
{
have_ptrace_xmmregs = 0;
#endif
- if (gdb_ptrace (PT_GETFPREGS, ptid,
+ if (gdb_ptrace (PT_GETFPREGS, ptid,
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
struct reg regs;
if (gdb_ptrace (PT_GETREGS, ptid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_("Couldn't get registers"));
i386bsd_collect_gregset (regcache, ®s, regnum);
if (gdb_ptrace (PT_SETREGS, ptid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
return;
if (gdb_ptrace (PT_SETXMMREGS, ptid,
(PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
- perror_with_name (_("Couldn't write XMM registers"));
+ perror_with_name (_("Couldn't write XMM registers"));
}
else
{
have_ptrace_xmmregs = 0;
#endif
- if (gdb_ptrace (PT_GETFPREGS, ptid,
+ if (gdb_ptrace (PT_GETFPREGS, ptid,
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- i387_collect_fsave (regcache, regnum, &fpregs);
+ i387_collect_fsave (regcache, regnum, &fpregs);
- if (gdb_ptrace (PT_SETFPREGS, ptid,
+ if (gdb_ptrace (PT_SETFPREGS, ptid,
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
#ifdef HAVE_PT_GETXMMREGS
- }
+ }
#endif
}
}
if (gdbarch_ptr_bit (gdbarch) == 64)
{
if (regno == -1 || amd64_native_gregset_supplies_p (gdbarch, regno))
- {
- x86_thread_state_t gp_regs;
- unsigned int gp_count = x86_THREAD_STATE_COUNT;
- kern_return_t ret;
+ {
+ x86_thread_state_t gp_regs;
+ unsigned int gp_count = x86_THREAD_STATE_COUNT;
+ kern_return_t ret;
ret = thread_get_state
- (current_thread, x86_THREAD_STATE, (thread_state_t) & gp_regs,
- &gp_count);
+ (current_thread, x86_THREAD_STATE, (thread_state_t) & gp_regs,
+ &gp_count);
if (ret != KERN_SUCCESS)
{
printf_unfiltered (_("Error calling thread_get_state for "
gp_regs.uts.ts64.__gs &= 0xffff;
amd64_supply_native_gregset (regcache, &gp_regs.uts, -1);
- fetched++;
- }
+ fetched++;
+ }
if (regno == -1 || !amd64_native_gregset_supplies_p (gdbarch, regno))
- {
- x86_float_state_t fp_regs;
- unsigned int fp_count = x86_FLOAT_STATE_COUNT;
- kern_return_t ret;
+ {
+ x86_float_state_t fp_regs;
+ unsigned int fp_count = x86_FLOAT_STATE_COUNT;
+ kern_return_t ret;
ret = thread_get_state
- (current_thread, x86_FLOAT_STATE, (thread_state_t) & fp_regs,
- &fp_count);
+ (current_thread, x86_FLOAT_STATE, (thread_state_t) & fp_regs,
+ &fp_count);
if (ret != KERN_SUCCESS)
{
printf_unfiltered (_("Error calling thread_get_state for "
(unsigned long) current_thread);
MACH_CHECK_ERROR (ret);
}
- amd64_supply_fxsave (regcache, -1, &fp_regs.ufs.fs64.__fpu_fcw);
- fetched++;
- }
+ amd64_supply_fxsave (regcache, -1, &fp_regs.ufs.fs64.__fpu_fcw);
+ fetched++;
+ }
}
else
#endif
{
if (regno == -1 || regno < I386_NUM_GREGS)
- {
- x86_thread_state32_t gp_regs;
- unsigned int gp_count = x86_THREAD_STATE32_COUNT;
- kern_return_t ret;
+ {
+ x86_thread_state32_t gp_regs;
+ unsigned int gp_count = x86_THREAD_STATE32_COUNT;
+ kern_return_t ret;
int i;
ret = thread_get_state
- (current_thread, x86_THREAD_STATE32, (thread_state_t) &gp_regs,
- &gp_count);
+ (current_thread, x86_THREAD_STATE32, (thread_state_t) &gp_regs,
+ &gp_count);
if (ret != KERN_SUCCESS)
{
printf_unfiltered (_("Error calling thread_get_state for "
regcache->raw_supply
(i, (char *) &gp_regs + i386_darwin_thread_state_reg_offset[i]);
- fetched++;
- }
+ fetched++;
+ }
if (regno == -1
|| (regno >= I386_ST0_REGNUM && regno < I386_SSE_NUM_REGS))
- {
- x86_float_state32_t fp_regs;
- unsigned int fp_count = x86_FLOAT_STATE32_COUNT;
- kern_return_t ret;
+ {
+ x86_float_state32_t fp_regs;
+ unsigned int fp_count = x86_FLOAT_STATE32_COUNT;
+ kern_return_t ret;
ret = thread_get_state
- (current_thread, x86_FLOAT_STATE32, (thread_state_t) &fp_regs,
- &fp_count);
+ (current_thread, x86_FLOAT_STATE32, (thread_state_t) &fp_regs,
+ &fp_count);
if (ret != KERN_SUCCESS)
{
printf_unfiltered (_("Error calling thread_get_state for "
(unsigned long) current_thread);
MACH_CHECK_ERROR (ret);
}
- i387_supply_fxsave (regcache, -1, &fp_regs.__fpu_fcw);
- fetched++;
- }
+ i387_supply_fxsave (regcache, -1, &fp_regs.__fpu_fcw);
+ fetched++;
+ }
}
if (! fetched)
if (gdbarch_ptr_bit (gdbarch) == 64)
{
if (regno == -1 || amd64_native_gregset_supplies_p (gdbarch, regno))
- {
- x86_thread_state_t gp_regs;
- kern_return_t ret;
+ {
+ x86_thread_state_t gp_regs;
+ kern_return_t ret;
unsigned int gp_count = x86_THREAD_STATE_COUNT;
ret = thread_get_state
(current_thread, x86_THREAD_STATE, (thread_state_t) &gp_regs,
&gp_count);
- MACH_CHECK_ERROR (ret);
+ MACH_CHECK_ERROR (ret);
gdb_assert (gp_regs.tsh.flavor == x86_THREAD_STATE64);
- gdb_assert (gp_regs.tsh.count == x86_THREAD_STATE64_COUNT);
+ gdb_assert (gp_regs.tsh.count == x86_THREAD_STATE64_COUNT);
amd64_collect_native_gregset (regcache, &gp_regs.uts, regno);
gp_regs.uts.ts64.__fs &= 0xffff;
gp_regs.uts.ts64.__gs &= 0xffff;
- ret = thread_set_state (current_thread, x86_THREAD_STATE,
- (thread_state_t) &gp_regs,
- x86_THREAD_STATE_COUNT);
- MACH_CHECK_ERROR (ret);
- }
+ ret = thread_set_state (current_thread, x86_THREAD_STATE,
+ (thread_state_t) &gp_regs,
+ x86_THREAD_STATE_COUNT);
+ MACH_CHECK_ERROR (ret);
+ }
if (regno == -1 || !amd64_native_gregset_supplies_p (gdbarch, regno))
- {
- x86_float_state_t fp_regs;
- kern_return_t ret;
+ {
+ x86_float_state_t fp_regs;
+ kern_return_t ret;
unsigned int fp_count = x86_FLOAT_STATE_COUNT;
ret = thread_get_state
(current_thread, x86_FLOAT_STATE, (thread_state_t) & fp_regs,
&fp_count);
- MACH_CHECK_ERROR (ret);
- gdb_assert (fp_regs.fsh.flavor == x86_FLOAT_STATE64);
- gdb_assert (fp_regs.fsh.count == x86_FLOAT_STATE64_COUNT);
+ MACH_CHECK_ERROR (ret);
+ gdb_assert (fp_regs.fsh.flavor == x86_FLOAT_STATE64);
+ gdb_assert (fp_regs.fsh.count == x86_FLOAT_STATE64_COUNT);
amd64_collect_fxsave (regcache, regno, &fp_regs.ufs.fs64.__fpu_fcw);
(thread_state_t) & fp_regs,
x86_FLOAT_STATE_COUNT);
MACH_CHECK_ERROR (ret);
- }
+ }
}
else
#endif
{
if (regno == -1 || regno < I386_NUM_GREGS)
- {
- x86_thread_state32_t gp_regs;
- kern_return_t ret;
- unsigned int gp_count = x86_THREAD_STATE32_COUNT;
+ {
+ x86_thread_state32_t gp_regs;
+ kern_return_t ret;
+ unsigned int gp_count = x86_THREAD_STATE32_COUNT;
int i;
- ret = thread_get_state
- (current_thread, x86_THREAD_STATE32, (thread_state_t) &gp_regs,
- &gp_count);
+ ret = thread_get_state
+ (current_thread, x86_THREAD_STATE32, (thread_state_t) &gp_regs,
+ &gp_count);
MACH_CHECK_ERROR (ret);
for (i = 0; i < I386_NUM_GREGS; i++)
regcache->raw_collect
(i, (char *) &gp_regs + i386_darwin_thread_state_reg_offset[i]);
- ret = thread_set_state (current_thread, x86_THREAD_STATE32,
- (thread_state_t) &gp_regs,
- x86_THREAD_STATE32_COUNT);
- MACH_CHECK_ERROR (ret);
- }
+ ret = thread_set_state (current_thread, x86_THREAD_STATE32,
+ (thread_state_t) &gp_regs,
+ x86_THREAD_STATE32_COUNT);
+ MACH_CHECK_ERROR (ret);
+ }
if (regno == -1
|| (regno >= I386_ST0_REGNUM && regno < I386_SSE_NUM_REGS))
- {
- x86_float_state32_t fp_regs;
- unsigned int fp_count = x86_FLOAT_STATE32_COUNT;
- kern_return_t ret;
+ {
+ x86_float_state32_t fp_regs;
+ unsigned int fp_count = x86_FLOAT_STATE32_COUNT;
+ kern_return_t ret;
ret = thread_get_state
- (current_thread, x86_FLOAT_STATE32, (thread_state_t) & fp_regs,
- &fp_count);
+ (current_thread, x86_FLOAT_STATE32, (thread_state_t) & fp_regs,
+ &fp_count);
MACH_CHECK_ERROR (ret);
i387_collect_fxsave (regcache, regno, &fp_regs.__fpu_fcw);
(thread_state_t) &fp_regs,
x86_FLOAT_STATE32_COUNT);
MACH_CHECK_ERROR (ret);
- }
+ }
}
}
dr_regs.dsh.count = x86_DEBUG_STATE_COUNT;
dr_count = x86_DEBUG_STATE_COUNT;
ret = thread_get_state (current_thread, x86_DEBUG_STATE,
- (thread_state_t) &dr_regs, &dr_count);
+ (thread_state_t) &dr_regs, &dr_count);
MACH_CHECK_ERROR (ret);
switch (dr_regs.dsh.flavor)
}
ret = thread_set_state (current_thread, dr_regs.dsh.flavor,
- (thread_state_t) &dr_regs.uds, dr_count);
+ (thread_state_t) &dr_regs.uds, dr_count);
MACH_CHECK_ERROR (ret);
}
dr_regs.dsh.count = x86_DEBUG_STATE_COUNT;
dr_count = x86_DEBUG_STATE_COUNT;
ret = thread_get_state (current_thread, x86_DEBUG_STATE,
- (thread_state_t) &dr_regs, &dr_count);
+ (thread_state_t) &dr_regs, &dr_count);
MACH_CHECK_ERROR (ret);
switch (dr_regs.dsh.flavor)
i386_m128_p (struct type *type)
{
return (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
- && TYPE_LENGTH (type) == 16);
+ && TYPE_LENGTH (type) == 16);
}
/* Return the alignment for TYPE when passed as an argument. */
type = check_typedef (type);
/* According to Mac OS X ABI document (passing arguments):
6. The caller places 64-bit vectors (__m64) on the parameter area,
- aligned to 8-byte boundaries.
+ aligned to 8-byte boundaries.
7. [...] The caller aligns 128-bit vectors in the parameter area to
- 16-byte boundaries. */
+ 16-byte boundaries. */
if (type->code () == TYPE_CODE_ARRAY && type->is_vector ())
return TYPE_LENGTH (type);
/* 4. The caller places all the fields of structures (or unions) with no
- vector elements in the parameter area. These structures are 4-byte
- aligned.
+ vector elements in the parameter area. These structures are 4-byte
+ aligned.
5. The caller places structures with vector elements on the stack,
- 16-byte aligned. */
+ 16-byte aligned. */
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION)
{
store_unsigned_integer (buf, 4, byte_order, struct_addr);
write_memory (sp, buf, 4);
}
- args_space += 4;
+ args_space += 4;
}
for (i = 0; i < nargs; i++)
{
- struct type *arg_type = value_enclosing_type (args[i]);
-
- if (i386_m128_p (arg_type) && num_m128 < 4)
- {
- if (write_pass)
- {
- const gdb_byte *val = value_contents_all (args[i]);
- regcache->raw_write (I387_MM0_REGNUM(tdep) + num_m128, val);
- }
- num_m128++;
- }
- else
- {
- args_space = align_up (args_space,
+ struct type *arg_type = value_enclosing_type (args[i]);
+
+ if (i386_m128_p (arg_type) && num_m128 < 4)
+ {
+ if (write_pass)
+ {
+ const gdb_byte *val = value_contents_all (args[i]);
+ regcache->raw_write (I387_MM0_REGNUM(tdep) + num_m128, val);
+ }
+ num_m128++;
+ }
+ else
+ {
+ args_space = align_up (args_space,
i386_darwin_arg_type_alignment (arg_type));
- if (write_pass)
- write_memory (sp + args_space,
- value_contents_all (args[i]),
+ if (write_pass)
+ write_memory (sp + args_space,
+ value_contents_all (args[i]),
TYPE_LENGTH (arg_type));
- /* The System V ABI says that:
-
- "An argument's size is increased, if necessary, to make it a
- multiple of [32-bit] words. This may require tail padding,
- depending on the size of the argument."
-
- This makes sure the stack stays word-aligned. */
- args_space += align_up (TYPE_LENGTH (arg_type), 4);
- }
- }
+ /* The System V ABI says that:
+
+ "An argument's size is increased, if necessary, to make it a
+ multiple of [32-bit] words. This may require tail padding,
+ depending on the size of the argument."
+
+ This makes sure the stack stays word-aligned. */
+ args_space += align_up (TYPE_LENGTH (arg_type), 4);
+ }
+ }
/* Darwin i386 ABI:
1. The caller ensures that the stack is 16-byte aligned at the point
_initialize_i386_darwin_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_unknown, bfd_target_mach_o_flavour,
- i386_mach_o_osabi_sniffer);
+ i386_mach_o_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_i386_i386,
GDB_OSABI_DARWIN, i386_darwin_init_abi);
_initialize_i386_dicos_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
- i386_dicos_osabi_sniffer);
+ i386_dicos_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_DICOS,
- i386_dicos_init_abi);
+ i386_dicos_init_abi);
}
}
/* Save the T bit. We might try to restore the %eflags register
- below, but changing the T bit would seriously confuse GDB. */
+ below, but changing the T bit would seriously confuse GDB. */
trace = ((struct i386_thread_state *)state)->efl & 0x100;
if (!was_aborted && was_valid)
if (errno == EIO)
{
/* The kernel we're running on doesn't support the GETREGS
- request. Reset `have_ptrace_getregs'. */
+ request. Reset `have_ptrace_getregs'. */
have_ptrace_getregs = 0;
return;
}
gdbarch_pc_regnum (gdbarch), &pc);
/* Returning from a signal trampoline is done by calling a
- special system call (sigreturn or rt_sigreturn, see
- i386-linux-tdep.c for more information). This system call
- restores the registers that were saved when the signal was
- raised, including %eflags. That means that single-stepping
- won't work. Instead, we'll have to modify the signal context
- that's about to be restored, and set the trace flag there. */
+ special system call (sigreturn or rt_sigreturn, see
+ i386-linux-tdep.c for more information). This system call
+ restores the registers that were saved when the signal was
+ raised, including %eflags. That means that single-stepping
+ won't work. Instead, we'll have to modify the signal context
+ that's about to be restored, and set the trace flag there. */
/* First check if PC is at a system call. */
if (target_read_memory (pc, buf, LINUX_SYSCALL_LEN) == 0
addr = sp;
/* Set the trace flag in the context that's about to be
- restored. */
+ restored. */
addr += LINUX_SIGCONTEXT_EFLAGS_OFFSET;
read_memory (addr, (gdb_byte *) &eflags, 4);
eflags |= 0x0100;
sig_code = parse_and_eval_long ("$_siginfo.si_code\n");
lower_bound
- = parse_and_eval_long ("$_siginfo._sifields._sigfault._addr_bnd._lower");
+ = parse_and_eval_long ("$_siginfo._sifields._sigfault._addr_bnd._lower");
upper_bound
- = parse_and_eval_long ("$_siginfo._sifields._sigfault._addr_bnd._upper");
+ = parse_and_eval_long ("$_siginfo._sifields._sigfault._addr_bnd._upper");
access
- = parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
+ = parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
}
catch (const gdb_exception &exception)
{
if (syscall_gdb < 0)
{
printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
+ "support syscall number %s\n"),
plongest (syscall_native));
return -1;
}
static int
i386_linux_record_signal (struct gdbarch *gdbarch,
- struct regcache *regcache,
- enum gdb_signal signal)
+ struct regcache *regcache,
+ enum gdb_signal signal)
{
ULONGEST esp;
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
/* Core file support. */
set_gdbarch_iterate_over_regset_sections
/* Displaced stepping. */
set_gdbarch_displaced_step_copy_insn (gdbarch,
- i386_linux_displaced_step_copy_insn);
+ i386_linux_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, i386_displaced_step_fixup);
set_gdbarch_displaced_step_location (gdbarch,
- linux_displaced_step_location);
+ linux_displaced_step_location);
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_I386);
set_gdbarch_get_syscall_number (gdbarch,
- i386_linux_get_syscall_number);
+ i386_linux_get_syscall_number);
set_gdbarch_get_siginfo_type (gdbarch, x86_linux_get_siginfo_type);
set_gdbarch_report_signal_info (gdbarch, i386_linux_report_signal_info);
if (first_four)
{
/* fpu_control_word, fpu_status_word, fpu_tag_word, fpu_operand
- registers. */
+ registers. */
regsize = 2; /* Two bytes each. */
off_adjust = 0;
regno_base = I387_FCTRL_REGNUM (tdep);
/* Our loader handles solib relocations differently than svr4. */
nto_svr4_so_ops.relocate_section_addresses
- = nto_relocate_section_addresses;
+ = nto_relocate_section_addresses;
/* Supply a nice function to find our solibs. */
nto_svr4_so_ops.find_and_open_solib
- = nto_find_and_open_solib;
+ = nto_find_and_open_solib;
/* Our linker code is in libc. */
nto_svr4_so_ops.in_dynsym_resolve_code
- = nto_in_dynsym_resolve_code;
+ = nto_in_dynsym_resolve_code;
}
set_solib_ops (gdbarch, &nto_svr4_so_ops);
sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
/* Adjust the stack pointer such that it looks as if we just
- returned from _thread_machdep_switch. */
+ returned from _thread_machdep_switch. */
offset = i386obsd_uthread_reg_offset[I386_EIP_REGNUM] + 4;
store_unsigned_integer (buf, 4, byte_order, sp + offset);
regcache->raw_supply (I386_ESP_REGNUM, buf);
&& (regnum == -1 || regnum == i))
{
/* Fetch stack pointer from thread structure (if we didn't
- do so already). */
+ do so already). */
if (sp == 0)
sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
int offset;
/* Calculate the stack pointer (frame pointer) that will be
- stored into the thread structure. */
+ stored into the thread structure. */
offset = i386obsd_uthread_reg_offset[I386_EIP_REGNUM] + 4;
regcache->raw_collect (I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4, byte_order) - offset;
write_memory_unsigned_integer (sp_addr, 4, byte_order, sp);
/* The stack pointer was (potentially) modified. Make sure we
- build a proper stack frame. */
+ build a proper stack frame. */
regnum = -1;
}
&& (regnum == -1 || regnum == i))
{
/* Fetch stack pointer from thread structure (if we didn't
- calculate it already). */
+ calculate it already). */
if (sp == 0)
sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
and the floating-point set by:
typedef struct fpregset {
- union {
- struct fpchip_state // fp extension state //
- {
- int state[27]; // 287/387 saved state //
- int status; // status word saved at //
- // exception //
- } fpchip_state;
- struct fp_emul_space // for emulators //
- {
- char fp_emul[246];
- char fp_epad[2];
- } fp_emul_space;
- int f_fpregs[62]; // union of the above //
- } fp_reg_set;
- long f_wregs[33]; // saved weitek state //
+ union {
+ struct fpchip_state // fp extension state //
+ {
+ int state[27]; // 287/387 saved state //
+ int status; // status word saved at //
+ // exception //
+ } fpchip_state;
+ struct fp_emul_space // for emulators //
+ {
+ char fp_emul[246];
+ char fp_epad[2];
+ } fp_emul_space;
+ int f_fpregs[62]; // union of the above //
+ } fp_reg_set;
+ long f_wregs[33]; // saved weitek state //
} fpregset_t;
Incidentally fpchip_state contains the FPU state in the same format
if (reg >= 0 && reg <= 7)
{
/* General-purpose registers. The debug info calls %ebp
- register 4, and %esp register 5. */
+ register 4, and %esp register 5. */
if (reg == 4)
- return 5;
+ return 5;
else if (reg == 5)
- return 4;
+ return 4;
else return reg;
}
else if (reg >= 12 && reg <= 19)
{
/* jump near, absolute indirect (/4). */
if ((insn[1] & 0x38) == 0x20)
- return 1;
+ return 1;
/* jump far, absolute indirect (/5). */
if ((insn[1] & 0x38) == 0x28)
- return 1;
+ return 1;
}
return 0;
{
/* Call near, absolute indirect (/2). */
if ((insn[1] & 0x38) == 0x10)
- return 1;
+ return 1;
/* Call far, absolute indirect (/3). */
if ((insn[1] & 0x38) == 0x18)
- return 1;
+ return 1;
}
return 0;
write_memory (to, buf, len);
displaced_debug_printf ("%s->%s: %s",
- paddress (gdbarch, from), paddress (gdbarch, to),
+ paddress (gdbarch, from), paddress (gdbarch, to),
displaced_step_dump_bytes (buf, len).c_str ());
/* This is a work around for a problem with g++ 4.8. */
void
i386_displaced_step_fixup (struct gdbarch *gdbarch,
- struct displaced_step_closure *closure_,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+ struct displaced_step_closure *closure_,
+ CORE_ADDR from, CORE_ADDR to,
+ struct regcache *regs)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
regcache_cooked_read_unsigned (regs, I386_EIP_REGNUM, &orig_eip);
/* A signal trampoline system call changes the %eip, resuming
- execution of the main program after the signal handler has
- returned. That makes them like 'return' instructions; we
- shouldn't relocate %eip.
-
- But most system calls don't, and we do need to relocate %eip.
-
- Our heuristic for distinguishing these cases: if stepping
- over the system call instruction left control directly after
- the instruction, the we relocate --- control almost certainly
- doesn't belong in the displaced copy. Otherwise, we assume
- the instruction has put control where it belongs, and leave
- it unrelocated. Goodness help us if there are PC-relative
- system calls. */
+ execution of the main program after the signal handler has
+ returned. That makes them like 'return' instructions; we
+ shouldn't relocate %eip.
+
+ But most system calls don't, and we do need to relocate %eip.
+
+ Our heuristic for distinguishing these cases: if stepping
+ over the system call instruction left control directly after
+ the instruction, the we relocate --- control almost certainly
+ doesn't belong in the displaced copy. Otherwise, we assume
+ the instruction has put control where it belongs, and leave
+ it unrelocated. Goodness help us if there are PC-relative
+ system calls. */
if (i386_syscall_p (insn, &insn_len)
- && orig_eip != to + (insn - insn_start) + insn_len
+ && orig_eip != to + (insn - insn_start) + insn_len
/* GDB can get control back after the insn after the syscall.
Presumably this is a kernel bug.
i386_displaced_step_copy_insn ensures its a nop,
&& orig_eip != to + (insn - insn_start) + insn_len + 1)
displaced_debug_printf ("syscall changed %%eip; not relocating");
else
- {
- ULONGEST eip = (orig_eip - insn_offset) & 0xffffffffUL;
+ {
+ ULONGEST eip = (orig_eip - insn_offset) & 0xffffffffUL;
/* If we just stepped over a breakpoint insn, we don't backup
the pc on purpose; this is to match behaviour without
stepping. */
- regcache_cooked_write_unsigned (regs, I386_EIP_REGNUM, eip);
+ regcache_cooked_write_unsigned (regs, I386_EIP_REGNUM, eip);
displaced_debug_printf ("relocated %%eip from %s to %s",
paddress (gdbarch, orig_eip),
paddress (gdbarch, eip));
- }
+ }
}
/* If the instruction was PUSHFL, then the TF bit will be set in the
delta = read_memory_integer (pc + 2, 2, byte_order);
/* Include the size of the jmp instruction (including the
- 0x66 prefix). */
+ 0x66 prefix). */
delta += 4;
}
else
{
/* Functions that return a structure or union start with:
- popl %eax 0x58
- xchgl %eax, (%esp) 0x87 0x04 0x24
+ popl %eax 0x58
+ xchgl %eax, (%esp) 0x87 0x04 0x24
or xchgl %eax, 0(%esp) 0x87 0x44 0x24 0x00
(the System V compiler puts out the second `xchg' instruction,
{
/* A function may start with
- pushl constant
- call _probe
+ pushl constant
+ call _probe
addl $4, %esp
followed by
- pushl %ebp
+ pushl %ebp
etc. */
gdb_byte buf[8];
struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
/* LLVM backend (Clang/Flang) always emits a line note before the
- prologue and another one after. We trust clang to emit usable
- line notes. */
+ prologue and another one after. We trust clang to emit usable
+ line notes. */
if (post_prologue_pc
&& (cust != NULL
&& COMPUNIT_PRODUCER (cust) != NULL
&& producer_is_llvm (COMPUNIT_PRODUCER (cust))))
- return std::max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
cache.locals = -1;
to get the address of the global offset table (GOT) into register
%ebx:
- call 0x0
+ call 0x0
popl %ebx
- movl %ebx,x(%ebp) (optional)
- addl y,%ebx
+ movl %ebx,x(%ebp) (optional)
+ addl y,%ebx
This code is with the rest of the prologue (at the end of the
function), so we have to skip it to get to the first real
else /* Unexpected instruction. */
delta = 0;
- if (target_read_code (pc + delta, &op, 1))
+ if (target_read_code (pc + delta, &op, 1))
return pc;
}
}
/* Returning floating-point values is a bit tricky. Apart from
- storing the return value in %st(0), we have to simulate the
- state of the FPU at function return point. */
+ storing the return value in %st(0), we have to simulate the
+ state of the FPU at function return point. */
/* Convert the value found in VALBUF to the extended
floating-point format used by the FPU. This is probably
regcache->raw_write (I386_ST0_REGNUM, buf);
/* Set the top of the floating-point register stack to 7. The
- actual value doesn't really matter, but 7 is what a normal
- function return would end up with if the program started out
- with a freshly initialized FPU. */
+ actual value doesn't really matter, but 7 is what a normal
+ function return would end up with if the program started out
+ with a freshly initialized FPU. */
regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM (tdep), &fstat);
fstat |= (7 << 11);
regcache_raw_write_unsigned (regcache, I387_FSTAT_REGNUM (tdep), fstat);
/* Mark %st(1) through %st(7) as empty. Since we set the top of
- the floating-point register stack to 7, the appropriate value
- for the tag word is 0x3fff. */
+ the floating-point register stack to 7, the appropriate value
+ for the tag word is 0x3fff. */
regcache_raw_write_unsigned (regcache, I387_FTAG_REGNUM (tdep), 0x3fff);
}
else
int len = TYPE_LENGTH (type);
gdb_assert (code == TYPE_CODE_STRUCT
- || code == TYPE_CODE_UNION
- || code == TYPE_CODE_ARRAY);
+ || code == TYPE_CODE_UNION
+ || code == TYPE_CODE_ARRAY);
if (struct_convention == pcc_struct_convention
|| (struct_convention == default_struct_convention
value just after the function has returned. */
/* Note that the ABI doesn't mention functions returning arrays,
- which is something possible in certain languages such as Ada.
- In this case, the value is returned as if it was wrapped in
- a record, so the convention applied to records also applies
- to arrays. */
+ which is something possible in certain languages such as Ada.
+ In this case, the value is returned as if it was wrapped in
+ a record, so the convention applied to records also applies
+ to arrays. */
if (readbuf)
{
#if 0
union __gdb_builtin_type_vec256i
{
- int128_t v2_int128[2];
- int64_t v4_int64[4];
- int32_t v8_int32[8];
- int16_t v16_int16[16];
- int8_t v32_int8[32];
- double v4_double[4];
- float v8_float[8];
- bfloat16_t v16_bfloat16[16];
+ int128_t v2_int128[2];
+ int64_t v4_int64[4];
+ int32_t v8_int32[8];
+ int16_t v16_int16[16];
+ int8_t v32_int8[32];
+ double v4_double[4];
+ float v8_float[8];
+ bfloat16_t v16_bfloat16[16];
};
#endif
#if 0
union __gdb_builtin_type_vec64i
{
- int64_t uint64;
- int32_t v2_int32[2];
- int16_t v4_int16[4];
- int8_t v8_int8[8];
+ int64_t uint64;
+ int32_t v2_int32[2];
+ int16_t v4_int16[4];
+ int8_t v8_int8[8];
};
#endif
offset64 = 0;
if (base != 0xff)
- {
+ {
if (base == 4 && irp->popl_esp_hack)
*addr += irp->popl_esp_hack;
regcache_raw_read_unsigned (irp->regcache, irp->regmap[base],
- &offset64);
+ &offset64);
}
if (irp->aflag == 2)
- {
+ {
*addr += offset64;
- }
+ }
else
- *addr = (uint32_t) (offset64 + *addr);
+ *addr = (uint32_t) (offset64 + *addr);
if (havesib && (index != 4 || scale != 0))
{
regcache_raw_read_unsigned (irp->regcache, irp->regmap[index],
- &offset64);
+ &offset64);
if (irp->aflag == 2)
*addr += offset64 << scale;
else
case 0:
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REBX_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_RESI_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
break;
case 1:
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REBX_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REDI_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
break;
case 2:
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REBP_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_RESI_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
break;
case 3:
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REBP_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REDI_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
break;
case 4:
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_RESI_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
break;
case 5:
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REDI_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
break;
case 6:
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REBP_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
break;
case 7:
regcache_raw_read_unsigned (irp->regcache,
irp->regmap[X86_RECORD_REBX_REGNUM],
- &offset64);
+ &offset64);
*addr = (uint32_t) (*addr + offset64);
break;
}
if (irp->override >= 0)
{
if (record_full_memory_query)
- {
- if (yquery (_("\
+ {
+ if (yquery (_("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
- paddress (gdbarch, irp->orig_addr)))
+ paddress (gdbarch, irp->orig_addr)))
return -1;
- }
+ }
return 0;
}
wrong, 0 otherwise. */
static int i386_record_floats (struct gdbarch *gdbarch,
- struct i386_record_s *ir,
- uint32_t iregnum)
+ struct i386_record_s *ir,
+ uint32_t iregnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int i;
if (I386_SAVE_FPU_REGS == iregnum)
{
for (i = I387_ST0_REGNUM (tdep); i <= I387_ST0_REGNUM (tdep) + 7; i++)
- {
- if (record_full_arch_list_add_reg (ir->regcache, i))
- return -1;
- }
+ {
+ if (record_full_arch_list_add_reg (ir->regcache, i))
+ return -1;
+ }
}
else if (I386_SAVE_FPU_ENV == iregnum)
{
for (i = I387_FCTRL_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
{
if (record_full_arch_list_add_reg (ir->regcache, i))
- return -1;
+ return -1;
}
}
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;
+ if (record_full_arch_list_add_reg (ir->regcache, i))
+ return -1;
}
}
else if ((iregnum >= I387_ST0_REGNUM (tdep)) &&
- (iregnum <= I387_FOP_REGNUM (tdep)))
+ (iregnum <= I387_FOP_REGNUM (tdep)))
{
if (record_full_arch_list_add_reg (ir->regcache,iregnum))
- return -1;
+ return -1;
}
else
{
for (i = I387_FCTRL_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
{
if (record_full_arch_list_add_reg (ir->regcache, i))
- return -1;
+ return -1;
}
}
return 0;
if (record_debug > 1)
fprintf_unfiltered (gdb_stdlog, "Process record: i386_process_record "
- "addr = %s\n",
+ "addr = %s\n",
paddress (gdbarch, ir.addr));
/* prefixes */
case ADDR_PREFIX_OPCODE:
prefixes |= PREFIX_ADDR;
break;
- case 0x40: /* i386 inc %eax */
- case 0x41: /* i386 inc %ecx */
- case 0x42: /* i386 inc %edx */
- case 0x43: /* i386 inc %ebx */
- case 0x44: /* i386 inc %esp */
- case 0x45: /* i386 inc %ebp */
- case 0x46: /* i386 inc %esi */
- case 0x47: /* i386 inc %edi */
- case 0x48: /* i386 dec %eax */
- case 0x49: /* i386 dec %ecx */
- case 0x4a: /* i386 dec %edx */
- case 0x4b: /* i386 dec %ebx */
- case 0x4c: /* i386 dec %esp */
- case 0x4d: /* i386 dec %ebp */
- case 0x4e: /* i386 dec %esi */
- case 0x4f: /* i386 dec %edi */
- if (ir.regmap[X86_RECORD_R8_REGNUM]) /* 64 bit target */
- {
- /* REX */
- rex_w = (opcode8 >> 3) & 1;
- rex_r = (opcode8 & 0x4) << 1;
- ir.rex_x = (opcode8 & 0x2) << 2;
- ir.rex_b = (opcode8 & 0x1) << 3;
- }
+ case 0x40: /* i386 inc %eax */
+ case 0x41: /* i386 inc %ecx */
+ case 0x42: /* i386 inc %edx */
+ case 0x43: /* i386 inc %ebx */
+ case 0x44: /* i386 inc %esp */
+ case 0x45: /* i386 inc %ebp */
+ case 0x46: /* i386 inc %esi */
+ case 0x47: /* i386 inc %edi */
+ case 0x48: /* i386 dec %eax */
+ case 0x49: /* i386 dec %ecx */
+ case 0x4a: /* i386 dec %edx */
+ case 0x4b: /* i386 dec %ebx */
+ case 0x4c: /* i386 dec %esp */
+ case 0x4d: /* i386 dec %ebp */
+ case 0x4e: /* i386 dec %esi */
+ case 0x4f: /* i386 dec %edi */
+ if (ir.regmap[X86_RECORD_R8_REGNUM]) /* 64 bit target */
+ {
+ /* REX */
+ rex_w = (opcode8 >> 3) & 1;
+ rex_r = (opcode8 & 0x4) << 1;
+ ir.rex_x = (opcode8 & 0x2) << 2;
+ ir.rex_b = (opcode8 & 0x1) << 3;
+ }
else /* 32 bit target */
goto out_prefixes;
- break;
+ break;
default:
goto out_prefixes;
break;
else
{
if (prefixes & PREFIX_DATA)
- ir.dflag ^= 1;
+ ir.dflag ^= 1;
}
if (prefixes & PREFIX_ADDR)
ir.aflag ^= 1;
}
else
{
- ir.rm |= ir.rex_b;
+ ir.rm |= ir.rex_b;
if (ir.ot == OT_BYTE && !ir.regmap[X86_RECORD_R8_REGNUM])
ir.rm &= 0x3;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm);
case 1: /* OP Gv, Ev */
if (i386_record_modrm (&ir))
return -1;
- ir.reg |= rex_r;
+ ir.reg |= rex_r;
if (ir.ot == OT_BYTE && !ir.regmap[X86_RECORD_R8_REGNUM])
ir.reg &= 0x3;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg);
if (ir.mod != 3)
{
- if (opcode == 0x83)
- ir.rip_offset = 1;
- else
- ir.rip_offset = (ir.ot > OT_LONG) ? 4 : (1 << ir.ot);
+ if (opcode == 0x83)
+ ir.rip_offset = 1;
+ else
+ ir.rip_offset = (ir.ot > OT_LONG) ? 4 : (1 << ir.ot);
if (i386_record_lea_modrm (&ir))
return -1;
}
return -1;
if (ir.mod != 3 && ir.reg == 0)
- ir.rip_offset = (ir.ot > OT_LONG) ? 4 : (1 << ir.ot);
+ ir.rip_offset = (ir.ot > OT_LONG) ? 4 : (1 << ir.ot);
switch (ir.reg)
{
}
else
{
- ir.rm |= ir.rex_b;
+ ir.rm |= ir.rex_b;
if (ir.ot == OT_BYTE && !ir.regmap[X86_RECORD_R8_REGNUM])
ir.rm &= 0x3;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm);
{
case 0: /* inc */
case 1: /* dec */
- if ((opcode & 1) == 0)
+ if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
- else
+ else
ir.ot = ir.dflag + OT_WORD;
if (ir.mod != 3)
{
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 2: /* call */
- if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
- ir.dflag = 2;
+ if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
+ ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
return -1;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 6: /* push */
- if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
- ir.dflag = 2;
+ if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
+ ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
return -1;
break;
if (i386_record_modrm (&ir))
return -1;
if (opcode == 0x69)
- ir.rip_offset = (ir.ot > OT_LONG) ? 4 : (1 << ir.ot);
+ ir.rip_offset = (ir.ot > OT_LONG) ? 4 : (1 << ir.ot);
else if (opcode == 0x6b)
- ir.rip_offset = 1;
+ ir.rip_offset = 1;
ir.reg |= rex_r;
if (ir.ot == OT_BYTE && !ir.regmap[X86_RECORD_R8_REGNUM])
ir.reg &= 0x3;
return -1;
if (ir.mod == 3)
{
- ir.reg |= rex_r;
+ ir.reg |= rex_r;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
if (ir.ot == OT_BYTE && !ir.regmap[X86_RECORD_R8_REGNUM])
ir.reg &= 0x3;
case 0x68:
case 0x6a:
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
- ir.dflag = 2;
+ ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
return -1;
break;
case 0x16: /* push ss */
case 0x1e: /* push ds */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
+ {
ir.addr -= 1;
goto no_support;
}
case 0x0fa0: /* push fs */
case 0x0fa8: /* push gs */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
+ {
ir.addr -= 2;
goto no_support;
}
case 0x60: /* pusha */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
+ {
ir.addr -= 1;
goto no_support;
}
case 0x61: /* popa */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
+ {
ir.addr -= 1;
goto no_support;
}
if (ir.regmap[X86_RECORD_R8_REGNUM])
ir.ot = ir.dflag ? OT_QUAD : OT_WORD;
else
- ir.ot = ir.dflag + OT_WORD;
+ ir.ot = ir.dflag + OT_WORD;
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
else
{
- ir.popl_esp_hack = 1 << ir.ot;
+ ir.popl_esp_hack = 1 << ir.ot;
if (i386_record_lea_modrm (&ir))
return -1;
}
case 0xc8: /* enter */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REBP_REGNUM);
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
- ir.dflag = 2;
+ ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
return -1;
break;
case 0x07: /* pop es */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
+ {
ir.addr -= 1;
goto no_support;
}
case 0x17: /* pop ss */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
+ {
ir.addr -= 1;
goto no_support;
}
case 0x1f: /* pop ds */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
+ {
ir.addr -= 1;
goto no_support;
}
if (ir.mod != 3)
{
- if (opcode == 0xc6 || opcode == 0xc7)
+ if (opcode == 0xc6 || opcode == 0xc7)
ir.rip_offset = (ir.ot > OT_LONG) ? 4 : (1 << ir.ot);
if (i386_record_lea_modrm (&ir))
return -1;
}
else
{
- if (opcode == 0xc6 || opcode == 0xc7)
+ if (opcode == 0xc6 || opcode == 0xc7)
ir.rm |= ir.rex_b;
if (ir.ot == OT_BYTE && !ir.regmap[X86_RECORD_R8_REGNUM])
ir.rm &= 0x3;
case 0xa2: /* mov EAX */
case 0xa3:
if (ir.override >= 0)
- {
- if (record_full_memory_query)
- {
- if (yquery (_("\
+ {
+ if (record_full_memory_query)
+ {
+ if (yquery (_("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
- paddress (gdbarch, ir.orig_addr)))
- return -1;
- }
+ paddress (gdbarch, ir.orig_addr)))
+ return -1;
+ }
}
else
{
- if ((opcode & 1) == 0)
+ if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
else
ir.ot = ir.dflag + OT_WORD;
if (ir.aflag == 2)
{
- if (record_read_memory (gdbarch, ir.addr, buf, 8))
+ if (record_read_memory (gdbarch, ir.addr, buf, 8))
return -1;
ir.addr += 8;
addr = extract_unsigned_integer (buf, 8, byte_order);
}
- else if (ir.aflag)
+ else if (ir.aflag)
{
- if (record_read_memory (gdbarch, ir.addr, buf, 4))
+ if (record_read_memory (gdbarch, ir.addr, buf, 4))
return -1;
ir.addr += 4;
- addr = extract_unsigned_integer (buf, 4, byte_order);
+ addr = extract_unsigned_integer (buf, 4, byte_order);
}
- else
+ else
{
- if (record_read_memory (gdbarch, ir.addr, buf, 2))
+ if (record_read_memory (gdbarch, ir.addr, buf, 2))
return -1;
ir.addr += 2;
- addr = extract_unsigned_integer (buf, 2, byte_order);
+ addr = extract_unsigned_integer (buf, 2, byte_order);
}
if (record_full_arch_list_add_mem (addr, 1 << ir.ot))
return -1;
- }
+ }
break;
case 0xb0: /* mov R, Ib */
case 0xc4: /* les Gv */
case 0xc5: /* lds Gv */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
+ {
ir.addr -= 1;
goto no_support;
}
switch (ir.reg)
{
case 0x02:
- case 0x12:
- case 0x22:
- case 0x32:
+ case 0x12:
+ case 0x22:
+ case 0x32:
/* For fcom, ficom nothing to do. */
- break;
+ break;
case 0x03:
- case 0x13:
- case 0x23:
- case 0x33:
+ case 0x13:
+ case 0x23:
+ case 0x33:
/* For fcomp, ficomp pop FPU stack, store all. */
- if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_REGS))
- return -1;
- break;
- case 0x00:
- case 0x01:
+ if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_REGS))
+ return -1;
+ break;
+ case 0x00:
+ case 0x01:
case 0x04:
case 0x05:
case 0x06:
case 0x35:
case 0x36:
case 0x37:
- /* For fadd, fmul, fsub, fsubr, fdiv, fdivr, fiadd, fimul,
- fisub, fisubr, fidiv, fidivr, modR/M.reg is an extension
- of code, always affects st(0) register. */
- if (i386_record_floats (gdbarch, &ir, I387_ST0_REGNUM (tdep)))
- return -1;
+ /* For fadd, fmul, fsub, fsubr, fdiv, fdivr, fiadd, fimul,
+ fisub, fisubr, fidiv, fidivr, modR/M.reg is an extension
+ of code, always affects st(0) register. */
+ if (i386_record_floats (gdbarch, &ir, I387_ST0_REGNUM (tdep)))
+ return -1;
break;
case 0x08:
case 0x0a:
case 0x19:
case 0x1a:
case 0x1b:
- case 0x1d:
+ case 0x1d:
case 0x28:
case 0x29:
case 0x2a:
case 0x39:
case 0x3a:
case 0x3b:
- case 0x3c:
- case 0x3d:
+ case 0x3c:
+ case 0x3d:
switch (ir.reg & 7)
{
case 0:
}
break;
case 0x0c:
- /* Insn fldenv. */
- if (i386_record_floats (gdbarch, &ir,
- I386_SAVE_FPU_ENV_REG_STACK))
- return -1;
- break;
+ /* Insn fldenv. */
+ if (i386_record_floats (gdbarch, &ir,
+ I386_SAVE_FPU_ENV_REG_STACK))
+ return -1;
+ break;
case 0x0d:
- /* Insn fldcw. */
- if (i386_record_floats (gdbarch, &ir, I387_FCTRL_REGNUM (tdep)))
- return -1;
- break;
+ /* Insn fldcw. */
+ if (i386_record_floats (gdbarch, &ir, I387_FCTRL_REGNUM (tdep)))
+ return -1;
+ break;
case 0x2c:
- /* Insn frstor. */
- if (i386_record_floats (gdbarch, &ir,
- I386_SAVE_FPU_ENV_REG_STACK))
- return -1;
+ /* Insn frstor. */
+ if (i386_record_floats (gdbarch, &ir,
+ I386_SAVE_FPU_ENV_REG_STACK))
+ return -1;
break;
case 0x0e:
if (ir.dflag)
case 0x2f:
if (record_full_arch_list_add_mem (addr64, 2))
return -1;
- /* Insn fstp, fbstp. */
- if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_REGS))
- return -1;
+ /* Insn fstp, fbstp. */
+ if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_REGS))
+ return -1;
break;
case 0x1f:
case 0x3e:
}
/* Opcode is an extension of modR/M byte. */
else
- {
+ {
switch (opcode)
{
case 0xd8:
I386_SAVE_FPU_REGS))
return -1;
}
- else
+ else
{
if (i386_record_floats (gdbarch, &ir,
I387_ST0_REGNUM (tdep)))
}
}
}
- else
- {
+ else
+ {
switch (ir.modrm)
{
case 0xe0:
break;
}
}
- break;
- case 0xda:
- if (0xe9 == ir.modrm)
- {
+ break;
+ case 0xda:
+ if (0xe9 == ir.modrm)
+ {
if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_REGS))
return -1;
- }
- else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
- {
+ }
+ else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
+ {
if (i386_record_floats (gdbarch, &ir,
I387_ST0_REGNUM (tdep)))
return -1;
((ir.modrm & 0x0f) - 0x08)))
return -1;
}
- }
- break;
- case 0xdb:
- if (0xe3 == ir.modrm)
- {
+ }
+ break;
+ case 0xdb:
+ if (0xe3 == ir.modrm)
+ {
if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_ENV))
return -1;
- }
- else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
- {
+ }
+ else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
+ {
if (i386_record_floats (gdbarch, &ir,
I387_ST0_REGNUM (tdep)))
return -1;
((ir.modrm & 0x0f) - 0x08)))
return -1;
}
- }
- break;
- case 0xdc:
- if ((0x0c == ir.modrm >> 4)
+ }
+ break;
+ case 0xdc:
+ if ((0x0c == ir.modrm >> 4)
|| (0x0d == ir.modrm >> 4)
|| (0x0f == ir.modrm >> 4))
- {
+ {
if ((ir.modrm & 0x0f) <= 7)
{
if (i386_record_floats (gdbarch, &ir,
((ir.modrm & 0x0f) - 0x08)))
return -1;
}
- }
+ }
break;
- case 0xdd:
- if (0x0c == ir.modrm >> 4)
- {
- if (i386_record_floats (gdbarch, &ir,
- I387_FTAG_REGNUM (tdep)))
- return -1;
- }
- else if ((0x0d == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
- {
- if ((ir.modrm & 0x0f) <= 7)
- {
+ case 0xdd:
+ if (0x0c == ir.modrm >> 4)
+ {
+ if (i386_record_floats (gdbarch, &ir,
+ I387_FTAG_REGNUM (tdep)))
+ return -1;
+ }
+ else if ((0x0d == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
+ {
+ if ((ir.modrm & 0x0f) <= 7)
+ {
if (i386_record_floats (gdbarch, &ir,
I387_ST0_REGNUM (tdep) +
(ir.modrm & 0x0f)))
return -1;
- }
- else
- {
- if (i386_record_floats (gdbarch, &ir,
+ }
+ else
+ {
+ if (i386_record_floats (gdbarch, &ir,
I386_SAVE_FPU_REGS))
- return -1;
- }
- }
- break;
- case 0xde:
- if ((0x0c == ir.modrm >> 4)
+ return -1;
+ }
+ }
+ break;
+ case 0xde:
+ if ((0x0c == ir.modrm >> 4)
|| (0x0e == ir.modrm >> 4)
|| (0x0f == ir.modrm >> 4)
|| (0xd9 == ir.modrm))
- {
+ {
if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_REGS))
return -1;
- }
- break;
- case 0xdf:
- if (0xe0 == ir.modrm)
- {
+ }
+ break;
+ case 0xdf:
+ if (0xe0 == ir.modrm)
+ {
if (record_full_arch_list_add_reg (ir.regcache,
I386_EAX_REGNUM))
return -1;
- }
- else if ((0x0f == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
- {
+ }
+ else if ((0x0f == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
+ {
if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_REGS))
return -1;
- }
- break;
+ }
+ break;
}
}
break;
case 0x6c: /* insS */
case 0x6d:
regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_RECX_REGNUM],
- &addr);
+ ir.regmap[X86_RECORD_RECX_REGNUM],
+ &addr);
if (addr)
- {
- ULONGEST es, ds;
+ {
+ ULONGEST es, ds;
- if ((opcode & 1) == 0)
+ if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
- else
+ else
ir.ot = ir.dflag + OT_WORD;
- regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_REDI_REGNUM],
- &addr);
-
- regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_ES_REGNUM],
- &es);
- regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_DS_REGNUM],
- &ds);
- if (ir.aflag && (es != ds))
- {
- /* addr += ((uint32_t) read_register (I386_ES_REGNUM)) << 4; */
- if (record_full_memory_query)
- {
- if (yquery (_("\
+ regcache_raw_read_unsigned (ir.regcache,
+ ir.regmap[X86_RECORD_REDI_REGNUM],
+ &addr);
+
+ regcache_raw_read_unsigned (ir.regcache,
+ ir.regmap[X86_RECORD_ES_REGNUM],
+ &es);
+ regcache_raw_read_unsigned (ir.regcache,
+ ir.regmap[X86_RECORD_DS_REGNUM],
+ &ds);
+ if (ir.aflag && (es != ds))
+ {
+ /* addr += ((uint32_t) read_register (I386_ES_REGNUM)) << 4; */
+ if (record_full_memory_query)
+ {
+ if (yquery (_("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
- paddress (gdbarch, ir.orig_addr)))
- return -1;
- }
- }
- else
- {
- if (record_full_arch_list_add_mem (addr, 1 << ir.ot))
- return -1;
- }
-
- if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
- if (opcode == 0xa4 || opcode == 0xa5)
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ paddress (gdbarch, ir.orig_addr)))
+ return -1;
+ }
+ }
+ else
+ {
+ if (record_full_arch_list_add_mem (addr, 1 << ir.ot))
+ return -1;
+ }
+
+ if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
+ if (opcode == 0xa4 || opcode == 0xa5)
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
}
break;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 0xaf:
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 0x6f:
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 0xe8: /* call im */
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
- ir.dflag = 2;
+ ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
- return -1;
+ return -1;
break;
case 0x9a: /* lcall im */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- ir.addr -= 1;
- goto no_support;
- }
+ {
+ ir.addr -= 1;
+ goto no_support;
+ }
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_CS_REGNUM);
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
- return -1;
+ return -1;
break;
case 0xe9: /* jmp im */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rex_b ? (ir.rm | ir.rex_b)
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rex_b ? (ir.rm | ir.rex_b)
: (ir.rm & 0x3));
else
{
case 0x9c: /* pushf */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
- ir.dflag = 2;
+ ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
- return -1;
+ return -1;
break;
case 0x9d: /* popf */
case 0x9e: /* sahf */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- ir.addr -= 1;
- goto no_support;
- }
+ {
+ ir.addr -= 1;
+ goto no_support;
+ }
/* FALLTHROUGH */
case 0xf5: /* cmc */
case 0xf8: /* clc */
case 0x9f: /* lahf */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- ir.addr -= 1;
- goto no_support;
- }
+ {
+ ir.addr -= 1;
+ goto no_support;
+ }
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
break;
}
if (ir.reg != 4)
{
- if (ir.mod == 3)
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
+ if (ir.mod == 3)
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
else
{
if (i386_record_lea_modrm (&ir))
case 0x0fbb: /* btc */
ir.ot = ir.dflag + OT_WORD;
if (i386_record_modrm (&ir))
- return -1;
+ return -1;
if (ir.mod == 3)
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
else
- {
- uint64_t addr64;
- if (i386_record_lea_modrm_addr (&ir, &addr64))
- return -1;
- regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[ir.reg | rex_r],
- &addr);
- switch (ir.dflag)
- {
- case 0:
- addr64 += ((int16_t) addr >> 4) << 4;
- break;
- case 1:
- addr64 += ((int32_t) addr >> 5) << 5;
- break;
- case 2:
- addr64 += ((int64_t) addr >> 6) << 6;
- break;
- }
- if (record_full_arch_list_add_mem (addr64, 1 << ir.ot))
- return -1;
- if (i386_record_lea_modrm (&ir))
- return -1;
- }
+ {
+ uint64_t addr64;
+ if (i386_record_lea_modrm_addr (&ir, &addr64))
+ return -1;
+ regcache_raw_read_unsigned (ir.regcache,
+ ir.regmap[ir.reg | rex_r],
+ &addr);
+ switch (ir.dflag)
+ {
+ case 0:
+ addr64 += ((int16_t) addr >> 4) << 4;
+ break;
+ case 1:
+ addr64 += ((int32_t) addr >> 5) << 5;
+ break;
+ case 2:
+ addr64 += ((int64_t) addr >> 6) << 6;
+ break;
+ }
+ if (record_full_arch_list_add_mem (addr64, 1 << ir.ot))
+ return -1;
+ if (i386_record_lea_modrm (&ir))
+ return -1;
+ }
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 0xd4: /* aam */
case 0xd5: /* aad */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- ir.addr -= 1;
- goto no_support;
- }
+ {
+ ir.addr -= 1;
+ goto no_support;
+ }
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 0xd6: /* salc */
if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- ir.addr -= 1;
- goto no_support;
- }
+ {
+ ir.addr -= 1;
+ goto no_support;
+ }
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 0x0f34: /* sysenter */
{
int ret;
- if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- ir.addr -= 2;
- goto no_support;
- }
+ if (ir.regmap[X86_RECORD_R8_REGNUM])
+ {
+ ir.addr -= 2;
+ goto no_support;
+ }
if (tdep->i386_sysenter_record == NULL)
{
printf_unfiltered (_("Process record does not support "
case 0x0f07: /* sysret */
printf_unfiltered (_("Process record does not support "
- "instruction sysret.\n"));
+ "instruction sysret.\n"));
ir.addr -= 2;
goto no_support;
break;
case 0: /* sldt */
case 1: /* str */
if (ir.mod == 3)
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
else
{
ir.ot = OT_WORD;
break;
case 4: /* verr */
case 5: /* verw */
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
default:
ir.addr -= 3;
}
if (ir.override >= 0)
{
- if (record_full_memory_query)
- {
- if (yquery (_("\
+ if (record_full_memory_query)
+ {
+ if (yquery (_("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
- paddress (gdbarch, ir.orig_addr)))
+ paddress (gdbarch, ir.orig_addr)))
return -1;
- }
+ }
}
else
{
if (record_full_arch_list_add_mem (addr64, 2))
return -1;
addr64 += 2;
- if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- if (record_full_arch_list_add_mem (addr64, 8))
+ if (ir.regmap[X86_RECORD_R8_REGNUM])
+ {
+ if (record_full_arch_list_add_mem (addr64, 8))
return -1;
- }
- else
- {
- if (record_full_arch_list_add_mem (addr64, 4))
+ }
+ else
+ {
+ if (record_full_arch_list_add_mem (addr64, 4))
return -1;
- }
+ }
}
}
break;
/* sidt */
if (ir.override >= 0)
{
- if (record_full_memory_query)
- {
- if (yquery (_("\
+ if (record_full_memory_query)
+ {
+ if (yquery (_("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
- paddress (gdbarch, ir.orig_addr)))
- return -1;
- }
+ paddress (gdbarch, ir.orig_addr)))
+ return -1;
+ }
}
else
{
if (record_full_arch_list_add_mem (addr64, 2))
return -1;
addr64 += 2;
- if (ir.regmap[X86_RECORD_R8_REGNUM])
- {
- if (record_full_arch_list_add_mem (addr64, 8))
- return -1;
- }
- else
- {
- if (record_full_arch_list_add_mem (addr64, 4))
- return -1;
- }
+ if (ir.regmap[X86_RECORD_R8_REGNUM])
+ {
+ if (record_full_arch_list_add_mem (addr64, 8))
+ return -1;
+ }
+ else
+ {
+ if (record_full_arch_list_add_mem (addr64, 4))
+ return -1;
+ }
}
}
break;
if (ir.mod == 3)
{
if (ir.rm == 0 && ir.regmap[X86_RECORD_R8_REGNUM])
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_GS_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_GS_REGNUM);
else
- {
- ir.addr -= 3;
- opcode = opcode << 8 | ir.modrm;
- goto no_support;
- }
+ {
+ ir.addr -= 3;
+ opcode = opcode << 8 | ir.modrm;
+ goto no_support;
+ }
}
else
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3 || ir.regmap[X86_RECORD_R8_REGNUM])
- {
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.regmap[X86_RECORD_R8_REGNUM]
+ {
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.regmap[X86_RECORD_R8_REGNUM]
? (ir.reg | rex_r) : ir.rm);
- }
+ }
else
- {
- ir.ot = ir.dflag ? OT_LONG : OT_WORD;
- if (i386_record_lea_modrm (&ir))
- return -1;
- }
+ {
+ ir.ot = ir.dflag ? OT_LONG : OT_WORD;
+ if (i386_record_lea_modrm (&ir))
+ return -1;
+ }
if (!ir.regmap[X86_RECORD_R8_REGNUM])
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
case 0x0f02: /* lar */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3 && ir.reg == 3)
- {
+ {
ir.addr -= 3;
opcode = opcode << 8 | ir.modrm;
goto no_support;
if (opcode & 2)
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
else
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
break;
default:
ir.addr -= 3;
goto no_support;
}
if (opcode & 2)
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
else
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
break;
case 0x0f0e: /* 3DNow! femms */
case 0x0f77: /* emms */
if (i386_fpc_regnum_p (gdbarch, I387_FTAG_REGNUM(tdep)))
- goto no_support;
+ goto no_support;
record_full_arch_list_add_reg (ir.regcache, I387_FTAG_REGNUM(tdep));
break;
return -1;
ir.addr++;
switch (opcode8)
- {
- case 0x0c: /* 3DNow! pi2fw */
- case 0x0d: /* 3DNow! pi2fd */
- case 0x1c: /* 3DNow! pf2iw */
- case 0x1d: /* 3DNow! pf2id */
- case 0x8a: /* 3DNow! pfnacc */
- case 0x8e: /* 3DNow! pfpnacc */
- case 0x90: /* 3DNow! pfcmpge */
- case 0x94: /* 3DNow! pfmin */
- case 0x96: /* 3DNow! pfrcp */
- case 0x97: /* 3DNow! pfrsqrt */
- case 0x9a: /* 3DNow! pfsub */
- case 0x9e: /* 3DNow! pfadd */
- case 0xa0: /* 3DNow! pfcmpgt */
- case 0xa4: /* 3DNow! pfmax */
- case 0xa6: /* 3DNow! pfrcpit1 */
- case 0xa7: /* 3DNow! pfrsqit1 */
- case 0xaa: /* 3DNow! pfsubr */
- case 0xae: /* 3DNow! pfacc */
- case 0xb0: /* 3DNow! pfcmpeq */
- case 0xb4: /* 3DNow! pfmul */
- case 0xb6: /* 3DNow! pfrcpit2 */
- case 0xb7: /* 3DNow! pmulhrw */
- case 0xbb: /* 3DNow! pswapd */
- case 0xbf: /* 3DNow! pavgusb */
- if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.reg))
- goto no_support_3dnow_data;
- record_full_arch_list_add_reg (ir.regcache, ir.reg);
- break;
-
- default:
+ {
+ case 0x0c: /* 3DNow! pi2fw */
+ case 0x0d: /* 3DNow! pi2fd */
+ case 0x1c: /* 3DNow! pf2iw */
+ case 0x1d: /* 3DNow! pf2id */
+ case 0x8a: /* 3DNow! pfnacc */
+ case 0x8e: /* 3DNow! pfpnacc */
+ case 0x90: /* 3DNow! pfcmpge */
+ case 0x94: /* 3DNow! pfmin */
+ case 0x96: /* 3DNow! pfrcp */
+ case 0x97: /* 3DNow! pfrsqrt */
+ case 0x9a: /* 3DNow! pfsub */
+ case 0x9e: /* 3DNow! pfadd */
+ case 0xa0: /* 3DNow! pfcmpgt */
+ case 0xa4: /* 3DNow! pfmax */
+ case 0xa6: /* 3DNow! pfrcpit1 */
+ case 0xa7: /* 3DNow! pfrsqit1 */
+ case 0xaa: /* 3DNow! pfsubr */
+ case 0xae: /* 3DNow! pfacc */
+ case 0xb0: /* 3DNow! pfcmpeq */
+ case 0xb4: /* 3DNow! pfmul */
+ case 0xb6: /* 3DNow! pfrcpit2 */
+ case 0xb7: /* 3DNow! pmulhrw */
+ case 0xbb: /* 3DNow! pswapd */
+ case 0xbf: /* 3DNow! pavgusb */
+ if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.reg))
+ goto no_support_3dnow_data;
+ record_full_arch_list_add_reg (ir.regcache, ir.reg);
+ break;
+
+ default:
no_support_3dnow_data:
- opcode = (opcode << 8) | opcode8;
- goto no_support;
- break;
- }
+ opcode = (opcode << 8) | opcode8;
+ goto no_support;
+ break;
+ }
break;
case 0x0faa: /* rsm */
if (i386_record_modrm (&ir))
return -1;
switch(ir.reg)
- {
- case 0: /* fxsave */
- {
- uint64_t tmpu64;
+ {
+ case 0: /* fxsave */
+ {
+ uint64_t tmpu64;
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
if (i386_record_lea_modrm_addr (&ir, &tmpu64))
return -1;
- if (record_full_arch_list_add_mem (tmpu64, 512))
- return -1;
- }
- break;
+ if (record_full_arch_list_add_mem (tmpu64, 512))
+ return -1;
+ }
+ break;
- case 1: /* fxrstor */
- {
- int i;
+ case 1: /* fxrstor */
+ {
+ int i;
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
- for (i = I387_MM0_REGNUM (tdep);
- i386_mmx_regnum_p (gdbarch, i); i++)
- record_full_arch_list_add_reg (ir.regcache, i);
+ for (i = I387_MM0_REGNUM (tdep);
+ i386_mmx_regnum_p (gdbarch, i); i++)
+ record_full_arch_list_add_reg (ir.regcache, i);
- for (i = I387_XMM0_REGNUM (tdep);
- i386_xmm_regnum_p (gdbarch, i); i++)
- record_full_arch_list_add_reg (ir.regcache, i);
+ for (i = I387_XMM0_REGNUM (tdep);
+ i386_xmm_regnum_p (gdbarch, i); i++)
+ record_full_arch_list_add_reg (ir.regcache, i);
- if (i386_mxcsr_regnum_p (gdbarch, I387_MXCSR_REGNUM(tdep)))
- record_full_arch_list_add_reg (ir.regcache,
+ if (i386_mxcsr_regnum_p (gdbarch, I387_MXCSR_REGNUM(tdep)))
+ record_full_arch_list_add_reg (ir.regcache,
I387_MXCSR_REGNUM(tdep));
- for (i = I387_ST0_REGNUM (tdep);
- i386_fp_regnum_p (gdbarch, i); i++)
- record_full_arch_list_add_reg (ir.regcache, i);
-
- for (i = I387_FCTRL_REGNUM (tdep);
- i386_fpc_regnum_p (gdbarch, i); i++)
- record_full_arch_list_add_reg (ir.regcache, i);
- }
- break;
-
- case 2: /* ldmxcsr */
- if (!i386_mxcsr_regnum_p (gdbarch, I387_MXCSR_REGNUM(tdep)))
- goto no_support;
- record_full_arch_list_add_reg (ir.regcache, I387_MXCSR_REGNUM(tdep));
- break;
-
- case 3: /* stmxcsr */
- ir.ot = OT_LONG;
- if (i386_record_lea_modrm (&ir))
- return -1;
- break;
-
- case 5: /* lfence */
- case 6: /* mfence */
- case 7: /* sfence clflush */
- break;
-
- default:
- opcode = (opcode << 8) | ir.modrm;
- goto no_support;
- break;
- }
+ for (i = I387_ST0_REGNUM (tdep);
+ i386_fp_regnum_p (gdbarch, i); i++)
+ record_full_arch_list_add_reg (ir.regcache, i);
+
+ for (i = I387_FCTRL_REGNUM (tdep);
+ i386_fpc_regnum_p (gdbarch, i); i++)
+ record_full_arch_list_add_reg (ir.regcache, i);
+ }
+ break;
+
+ case 2: /* ldmxcsr */
+ if (!i386_mxcsr_regnum_p (gdbarch, I387_MXCSR_REGNUM(tdep)))
+ goto no_support;
+ record_full_arch_list_add_reg (ir.regcache, I387_MXCSR_REGNUM(tdep));
+ break;
+
+ case 3: /* stmxcsr */
+ ir.ot = OT_LONG;
+ if (i386_record_lea_modrm (&ir))
+ return -1;
+ break;
+
+ case 5: /* lfence */
+ case 6: /* mfence */
+ case 7: /* sfence clflush */
+ break;
+
+ default:
+ opcode = (opcode << 8) | ir.modrm;
+ goto no_support;
+ break;
+ }
break;
case 0x0fc3: /* movnti */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
- goto no_support;
+ goto no_support;
ir.reg |= rex_r;
if (i386_record_lea_modrm (&ir))
- return -1;
+ return -1;
break;
/* Add prefix to opcode. */
case 0x0ffe:
/* Mask out PREFIX_ADDR. */
switch ((prefixes & ~PREFIX_ADDR))
- {
- case PREFIX_REPNZ:
- opcode |= 0xf20000;
- break;
- case PREFIX_DATA:
- opcode |= 0x660000;
- break;
- case PREFIX_REPZ:
- opcode |= 0xf30000;
- break;
- }
+ {
+ case PREFIX_REPNZ:
+ opcode |= 0xf20000;
+ break;
+ case PREFIX_DATA:
+ opcode |= 0x660000;
+ break;
+ case PREFIX_REPZ:
+ opcode |= 0xf30000;
+ break;
+ }
reswitch_prefix_add:
switch (opcode)
- {
- case 0x0f38:
- case 0x660f38:
- case 0xf20f38:
- case 0x0f3a:
- case 0x660f3a:
- if (record_read_memory (gdbarch, ir.addr, &opcode8, 1))
+ {
+ case 0x0f38:
+ case 0x660f38:
+ case 0xf20f38:
+ case 0x0f3a:
+ case 0x660f3a:
+ if (record_read_memory (gdbarch, ir.addr, &opcode8, 1))
return -1;
- ir.addr++;
- opcode = (uint32_t) opcode8 | opcode << 8;
- goto reswitch_prefix_add;
- break;
-
- case 0x0f10: /* movups */
- case 0x660f10: /* movupd */
- case 0xf30f10: /* movss */
- case 0xf20f10: /* movsd */
- case 0x0f12: /* movlps */
- case 0x660f12: /* movlpd */
- case 0xf30f12: /* movsldup */
- case 0xf20f12: /* movddup */
- case 0x0f14: /* unpcklps */
- case 0x660f14: /* unpcklpd */
- case 0x0f15: /* unpckhps */
- case 0x660f15: /* unpckhpd */
- case 0x0f16: /* movhps */
- case 0x660f16: /* movhpd */
- case 0xf30f16: /* movshdup */
- case 0x0f28: /* movaps */
- case 0x660f28: /* movapd */
- case 0x0f2a: /* cvtpi2ps */
- case 0x660f2a: /* cvtpi2pd */
- case 0xf30f2a: /* cvtsi2ss */
- case 0xf20f2a: /* cvtsi2sd */
- case 0x0f2c: /* cvttps2pi */
- case 0x660f2c: /* cvttpd2pi */
- case 0x0f2d: /* cvtps2pi */
- case 0x660f2d: /* cvtpd2pi */
- case 0x660f3800: /* pshufb */
- case 0x660f3801: /* phaddw */
- case 0x660f3802: /* phaddd */
- case 0x660f3803: /* phaddsw */
- case 0x660f3804: /* pmaddubsw */
- case 0x660f3805: /* phsubw */
- case 0x660f3806: /* phsubd */
- case 0x660f3807: /* phsubsw */
- case 0x660f3808: /* psignb */
- case 0x660f3809: /* psignw */
- case 0x660f380a: /* psignd */
- case 0x660f380b: /* pmulhrsw */
- case 0x660f3810: /* pblendvb */
- case 0x660f3814: /* blendvps */
- case 0x660f3815: /* blendvpd */
- case 0x660f381c: /* pabsb */
- case 0x660f381d: /* pabsw */
- case 0x660f381e: /* pabsd */
- case 0x660f3820: /* pmovsxbw */
- case 0x660f3821: /* pmovsxbd */
- case 0x660f3822: /* pmovsxbq */
- case 0x660f3823: /* pmovsxwd */
- case 0x660f3824: /* pmovsxwq */
- case 0x660f3825: /* pmovsxdq */
- case 0x660f3828: /* pmuldq */
- case 0x660f3829: /* pcmpeqq */
- case 0x660f382a: /* movntdqa */
- case 0x660f3a08: /* roundps */
- case 0x660f3a09: /* roundpd */
- case 0x660f3a0a: /* roundss */
- case 0x660f3a0b: /* roundsd */
- case 0x660f3a0c: /* blendps */
- case 0x660f3a0d: /* blendpd */
- case 0x660f3a0e: /* pblendw */
- case 0x660f3a0f: /* palignr */
- case 0x660f3a20: /* pinsrb */
- case 0x660f3a21: /* insertps */
- case 0x660f3a22: /* pinsrd pinsrq */
- case 0x660f3a40: /* dpps */
- case 0x660f3a41: /* dppd */
- case 0x660f3a42: /* mpsadbw */
- case 0x660f3a60: /* pcmpestrm */
- case 0x660f3a61: /* pcmpestri */
- case 0x660f3a62: /* pcmpistrm */
- case 0x660f3a63: /* pcmpistri */
- case 0x0f51: /* sqrtps */
- case 0x660f51: /* sqrtpd */
- case 0xf20f51: /* sqrtsd */
- case 0xf30f51: /* sqrtss */
- case 0x0f52: /* rsqrtps */
- case 0xf30f52: /* rsqrtss */
- case 0x0f53: /* rcpps */
- case 0xf30f53: /* rcpss */
- case 0x0f54: /* andps */
- case 0x660f54: /* andpd */
- case 0x0f55: /* andnps */
- case 0x660f55: /* andnpd */
- case 0x0f56: /* orps */
- case 0x660f56: /* orpd */
- case 0x0f57: /* xorps */
- case 0x660f57: /* xorpd */
- case 0x0f58: /* addps */
- case 0x660f58: /* addpd */
- case 0xf20f58: /* addsd */
- case 0xf30f58: /* addss */
- case 0x0f59: /* mulps */
- case 0x660f59: /* mulpd */
- case 0xf20f59: /* mulsd */
- case 0xf30f59: /* mulss */
- case 0x0f5a: /* cvtps2pd */
- case 0x660f5a: /* cvtpd2ps */
- case 0xf20f5a: /* cvtsd2ss */
- case 0xf30f5a: /* cvtss2sd */
- case 0x0f5b: /* cvtdq2ps */
- case 0x660f5b: /* cvtps2dq */
- case 0xf30f5b: /* cvttps2dq */
- case 0x0f5c: /* subps */
- case 0x660f5c: /* subpd */
- case 0xf20f5c: /* subsd */
- case 0xf30f5c: /* subss */
- case 0x0f5d: /* minps */
- case 0x660f5d: /* minpd */
- case 0xf20f5d: /* minsd */
- case 0xf30f5d: /* minss */
- case 0x0f5e: /* divps */
- case 0x660f5e: /* divpd */
- case 0xf20f5e: /* divsd */
- case 0xf30f5e: /* divss */
- case 0x0f5f: /* maxps */
- case 0x660f5f: /* maxpd */
- case 0xf20f5f: /* maxsd */
- case 0xf30f5f: /* maxss */
- case 0x660f60: /* punpcklbw */
- case 0x660f61: /* punpcklwd */
- case 0x660f62: /* punpckldq */
- case 0x660f63: /* packsswb */
- case 0x660f64: /* pcmpgtb */
- case 0x660f65: /* pcmpgtw */
- case 0x660f66: /* pcmpgtd */
- case 0x660f67: /* packuswb */
- case 0x660f68: /* punpckhbw */
- case 0x660f69: /* punpckhwd */
- case 0x660f6a: /* punpckhdq */
- case 0x660f6b: /* packssdw */
- case 0x660f6c: /* punpcklqdq */
- case 0x660f6d: /* punpckhqdq */
- case 0x660f6e: /* movd */
- case 0x660f6f: /* movdqa */
- case 0xf30f6f: /* movdqu */
- case 0x660f70: /* pshufd */
- case 0xf20f70: /* pshuflw */
- case 0xf30f70: /* pshufhw */
- case 0x660f74: /* pcmpeqb */
- case 0x660f75: /* pcmpeqw */
- case 0x660f76: /* pcmpeqd */
- case 0x660f7c: /* haddpd */
- case 0xf20f7c: /* haddps */
- case 0x660f7d: /* hsubpd */
- case 0xf20f7d: /* hsubps */
- case 0xf30f7e: /* movq */
- case 0x0fc2: /* cmpps */
- case 0x660fc2: /* cmppd */
- case 0xf20fc2: /* cmpsd */
- case 0xf30fc2: /* cmpss */
- case 0x660fc4: /* pinsrw */
- case 0x0fc6: /* shufps */
- case 0x660fc6: /* shufpd */
- case 0x660fd0: /* addsubpd */
- case 0xf20fd0: /* addsubps */
- case 0x660fd1: /* psrlw */
- case 0x660fd2: /* psrld */
- case 0x660fd3: /* psrlq */
- case 0x660fd4: /* paddq */
- case 0x660fd5: /* pmullw */
- case 0xf30fd6: /* movq2dq */
- case 0x660fd8: /* psubusb */
- case 0x660fd9: /* psubusw */
- case 0x660fda: /* pminub */
- case 0x660fdb: /* pand */
- case 0x660fdc: /* paddusb */
- case 0x660fdd: /* paddusw */
- case 0x660fde: /* pmaxub */
- case 0x660fdf: /* pandn */
- case 0x660fe0: /* pavgb */
- case 0x660fe1: /* psraw */
- case 0x660fe2: /* psrad */
- case 0x660fe3: /* pavgw */
- case 0x660fe4: /* pmulhuw */
- case 0x660fe5: /* pmulhw */
- case 0x660fe6: /* cvttpd2dq */
- case 0xf20fe6: /* cvtpd2dq */
- case 0xf30fe6: /* cvtdq2pd */
- case 0x660fe8: /* psubsb */
- case 0x660fe9: /* psubsw */
- case 0x660fea: /* pminsw */
- case 0x660feb: /* por */
- case 0x660fec: /* paddsb */
- case 0x660fed: /* paddsw */
- case 0x660fee: /* pmaxsw */
- case 0x660fef: /* pxor */
- case 0xf20ff0: /* lddqu */
- case 0x660ff1: /* psllw */
- case 0x660ff2: /* pslld */
- case 0x660ff3: /* psllq */
- case 0x660ff4: /* pmuludq */
- case 0x660ff5: /* pmaddwd */
- case 0x660ff6: /* psadbw */
- case 0x660ff8: /* psubb */
- case 0x660ff9: /* psubw */
- case 0x660ffa: /* psubd */
- case 0x660ffb: /* psubq */
- case 0x660ffc: /* paddb */
- case 0x660ffd: /* paddw */
- case 0x660ffe: /* paddd */
- if (i386_record_modrm (&ir))
+ ir.addr++;
+ opcode = (uint32_t) opcode8 | opcode << 8;
+ goto reswitch_prefix_add;
+ break;
+
+ case 0x0f10: /* movups */
+ case 0x660f10: /* movupd */
+ case 0xf30f10: /* movss */
+ case 0xf20f10: /* movsd */
+ case 0x0f12: /* movlps */
+ case 0x660f12: /* movlpd */
+ case 0xf30f12: /* movsldup */
+ case 0xf20f12: /* movddup */
+ case 0x0f14: /* unpcklps */
+ case 0x660f14: /* unpcklpd */
+ case 0x0f15: /* unpckhps */
+ case 0x660f15: /* unpckhpd */
+ case 0x0f16: /* movhps */
+ case 0x660f16: /* movhpd */
+ case 0xf30f16: /* movshdup */
+ case 0x0f28: /* movaps */
+ case 0x660f28: /* movapd */
+ case 0x0f2a: /* cvtpi2ps */
+ case 0x660f2a: /* cvtpi2pd */
+ case 0xf30f2a: /* cvtsi2ss */
+ case 0xf20f2a: /* cvtsi2sd */
+ case 0x0f2c: /* cvttps2pi */
+ case 0x660f2c: /* cvttpd2pi */
+ case 0x0f2d: /* cvtps2pi */
+ case 0x660f2d: /* cvtpd2pi */
+ case 0x660f3800: /* pshufb */
+ case 0x660f3801: /* phaddw */
+ case 0x660f3802: /* phaddd */
+ case 0x660f3803: /* phaddsw */
+ case 0x660f3804: /* pmaddubsw */
+ case 0x660f3805: /* phsubw */
+ case 0x660f3806: /* phsubd */
+ case 0x660f3807: /* phsubsw */
+ case 0x660f3808: /* psignb */
+ case 0x660f3809: /* psignw */
+ case 0x660f380a: /* psignd */
+ case 0x660f380b: /* pmulhrsw */
+ case 0x660f3810: /* pblendvb */
+ case 0x660f3814: /* blendvps */
+ case 0x660f3815: /* blendvpd */
+ case 0x660f381c: /* pabsb */
+ case 0x660f381d: /* pabsw */
+ case 0x660f381e: /* pabsd */
+ case 0x660f3820: /* pmovsxbw */
+ case 0x660f3821: /* pmovsxbd */
+ case 0x660f3822: /* pmovsxbq */
+ case 0x660f3823: /* pmovsxwd */
+ case 0x660f3824: /* pmovsxwq */
+ case 0x660f3825: /* pmovsxdq */
+ case 0x660f3828: /* pmuldq */
+ case 0x660f3829: /* pcmpeqq */
+ case 0x660f382a: /* movntdqa */
+ case 0x660f3a08: /* roundps */
+ case 0x660f3a09: /* roundpd */
+ case 0x660f3a0a: /* roundss */
+ case 0x660f3a0b: /* roundsd */
+ case 0x660f3a0c: /* blendps */
+ case 0x660f3a0d: /* blendpd */
+ case 0x660f3a0e: /* pblendw */
+ case 0x660f3a0f: /* palignr */
+ case 0x660f3a20: /* pinsrb */
+ case 0x660f3a21: /* insertps */
+ case 0x660f3a22: /* pinsrd pinsrq */
+ case 0x660f3a40: /* dpps */
+ case 0x660f3a41: /* dppd */
+ case 0x660f3a42: /* mpsadbw */
+ case 0x660f3a60: /* pcmpestrm */
+ case 0x660f3a61: /* pcmpestri */
+ case 0x660f3a62: /* pcmpistrm */
+ case 0x660f3a63: /* pcmpistri */
+ case 0x0f51: /* sqrtps */
+ case 0x660f51: /* sqrtpd */
+ case 0xf20f51: /* sqrtsd */
+ case 0xf30f51: /* sqrtss */
+ case 0x0f52: /* rsqrtps */
+ case 0xf30f52: /* rsqrtss */
+ case 0x0f53: /* rcpps */
+ case 0xf30f53: /* rcpss */
+ case 0x0f54: /* andps */
+ case 0x660f54: /* andpd */
+ case 0x0f55: /* andnps */
+ case 0x660f55: /* andnpd */
+ case 0x0f56: /* orps */
+ case 0x660f56: /* orpd */
+ case 0x0f57: /* xorps */
+ case 0x660f57: /* xorpd */
+ case 0x0f58: /* addps */
+ case 0x660f58: /* addpd */
+ case 0xf20f58: /* addsd */
+ case 0xf30f58: /* addss */
+ case 0x0f59: /* mulps */
+ case 0x660f59: /* mulpd */
+ case 0xf20f59: /* mulsd */
+ case 0xf30f59: /* mulss */
+ case 0x0f5a: /* cvtps2pd */
+ case 0x660f5a: /* cvtpd2ps */
+ case 0xf20f5a: /* cvtsd2ss */
+ case 0xf30f5a: /* cvtss2sd */
+ case 0x0f5b: /* cvtdq2ps */
+ case 0x660f5b: /* cvtps2dq */
+ case 0xf30f5b: /* cvttps2dq */
+ case 0x0f5c: /* subps */
+ case 0x660f5c: /* subpd */
+ case 0xf20f5c: /* subsd */
+ case 0xf30f5c: /* subss */
+ case 0x0f5d: /* minps */
+ case 0x660f5d: /* minpd */
+ case 0xf20f5d: /* minsd */
+ case 0xf30f5d: /* minss */
+ case 0x0f5e: /* divps */
+ case 0x660f5e: /* divpd */
+ case 0xf20f5e: /* divsd */
+ case 0xf30f5e: /* divss */
+ case 0x0f5f: /* maxps */
+ case 0x660f5f: /* maxpd */
+ case 0xf20f5f: /* maxsd */
+ case 0xf30f5f: /* maxss */
+ case 0x660f60: /* punpcklbw */
+ case 0x660f61: /* punpcklwd */
+ case 0x660f62: /* punpckldq */
+ case 0x660f63: /* packsswb */
+ case 0x660f64: /* pcmpgtb */
+ case 0x660f65: /* pcmpgtw */
+ case 0x660f66: /* pcmpgtd */
+ case 0x660f67: /* packuswb */
+ case 0x660f68: /* punpckhbw */
+ case 0x660f69: /* punpckhwd */
+ case 0x660f6a: /* punpckhdq */
+ case 0x660f6b: /* packssdw */
+ case 0x660f6c: /* punpcklqdq */
+ case 0x660f6d: /* punpckhqdq */
+ case 0x660f6e: /* movd */
+ case 0x660f6f: /* movdqa */
+ case 0xf30f6f: /* movdqu */
+ case 0x660f70: /* pshufd */
+ case 0xf20f70: /* pshuflw */
+ case 0xf30f70: /* pshufhw */
+ case 0x660f74: /* pcmpeqb */
+ case 0x660f75: /* pcmpeqw */
+ case 0x660f76: /* pcmpeqd */
+ case 0x660f7c: /* haddpd */
+ case 0xf20f7c: /* haddps */
+ case 0x660f7d: /* hsubpd */
+ case 0xf20f7d: /* hsubps */
+ case 0xf30f7e: /* movq */
+ case 0x0fc2: /* cmpps */
+ case 0x660fc2: /* cmppd */
+ case 0xf20fc2: /* cmpsd */
+ case 0xf30fc2: /* cmpss */
+ case 0x660fc4: /* pinsrw */
+ case 0x0fc6: /* shufps */
+ case 0x660fc6: /* shufpd */
+ case 0x660fd0: /* addsubpd */
+ case 0xf20fd0: /* addsubps */
+ case 0x660fd1: /* psrlw */
+ case 0x660fd2: /* psrld */
+ case 0x660fd3: /* psrlq */
+ case 0x660fd4: /* paddq */
+ case 0x660fd5: /* pmullw */
+ case 0xf30fd6: /* movq2dq */
+ case 0x660fd8: /* psubusb */
+ case 0x660fd9: /* psubusw */
+ case 0x660fda: /* pminub */
+ case 0x660fdb: /* pand */
+ case 0x660fdc: /* paddusb */
+ case 0x660fdd: /* paddusw */
+ case 0x660fde: /* pmaxub */
+ case 0x660fdf: /* pandn */
+ case 0x660fe0: /* pavgb */
+ case 0x660fe1: /* psraw */
+ case 0x660fe2: /* psrad */
+ case 0x660fe3: /* pavgw */
+ case 0x660fe4: /* pmulhuw */
+ case 0x660fe5: /* pmulhw */
+ case 0x660fe6: /* cvttpd2dq */
+ case 0xf20fe6: /* cvtpd2dq */
+ case 0xf30fe6: /* cvtdq2pd */
+ case 0x660fe8: /* psubsb */
+ case 0x660fe9: /* psubsw */
+ case 0x660fea: /* pminsw */
+ case 0x660feb: /* por */
+ case 0x660fec: /* paddsb */
+ case 0x660fed: /* paddsw */
+ case 0x660fee: /* pmaxsw */
+ case 0x660fef: /* pxor */
+ case 0xf20ff0: /* lddqu */
+ case 0x660ff1: /* psllw */
+ case 0x660ff2: /* pslld */
+ case 0x660ff3: /* psllq */
+ case 0x660ff4: /* pmuludq */
+ case 0x660ff5: /* pmaddwd */
+ case 0x660ff6: /* psadbw */
+ case 0x660ff8: /* psubb */
+ case 0x660ff9: /* psubw */
+ case 0x660ffa: /* psubd */
+ case 0x660ffb: /* psubq */
+ case 0x660ffc: /* paddb */
+ case 0x660ffd: /* paddw */
+ case 0x660ffe: /* paddd */
+ if (i386_record_modrm (&ir))
return -1;
- ir.reg |= rex_r;
- if (!i386_xmm_regnum_p (gdbarch, I387_XMM0_REGNUM (tdep) + ir.reg))
- goto no_support;
- record_full_arch_list_add_reg (ir.regcache,
+ ir.reg |= rex_r;
+ if (!i386_xmm_regnum_p (gdbarch, I387_XMM0_REGNUM (tdep) + ir.reg))
+ goto no_support;
+ record_full_arch_list_add_reg (ir.regcache,
I387_XMM0_REGNUM (tdep) + ir.reg);
- if ((opcode & 0xfffffffc) == 0x660f3a60)
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
- break;
-
- case 0x0f11: /* movups */
- case 0x660f11: /* movupd */
- case 0xf30f11: /* movss */
- case 0xf20f11: /* movsd */
- case 0x0f13: /* movlps */
- case 0x660f13: /* movlpd */
- case 0x0f17: /* movhps */
- case 0x660f17: /* movhpd */
- case 0x0f29: /* movaps */
- case 0x660f29: /* movapd */
- case 0x660f3a14: /* pextrb */
- case 0x660f3a15: /* pextrw */
- case 0x660f3a16: /* pextrd pextrq */
- case 0x660f3a17: /* extractps */
- case 0x660f7f: /* movdqa */
- case 0xf30f7f: /* movdqu */
- if (i386_record_modrm (&ir))
+ if ((opcode & 0xfffffffc) == 0x660f3a60)
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ break;
+
+ case 0x0f11: /* movups */
+ case 0x660f11: /* movupd */
+ case 0xf30f11: /* movss */
+ case 0xf20f11: /* movsd */
+ case 0x0f13: /* movlps */
+ case 0x660f13: /* movlpd */
+ case 0x0f17: /* movhps */
+ case 0x660f17: /* movhpd */
+ case 0x0f29: /* movaps */
+ case 0x660f29: /* movapd */
+ case 0x660f3a14: /* pextrb */
+ case 0x660f3a15: /* pextrw */
+ case 0x660f3a16: /* pextrd pextrq */
+ case 0x660f3a17: /* extractps */
+ case 0x660f7f: /* movdqa */
+ case 0xf30f7f: /* movdqu */
+ if (i386_record_modrm (&ir))
return -1;
- if (ir.mod == 3)
- {
- if (opcode == 0x0f13 || opcode == 0x660f13
- || opcode == 0x0f17 || opcode == 0x660f17)
- goto no_support;
- ir.rm |= ir.rex_b;
- if (!i386_xmm_regnum_p (gdbarch,
+ if (ir.mod == 3)
+ {
+ if (opcode == 0x0f13 || opcode == 0x660f13
+ || opcode == 0x0f17 || opcode == 0x660f17)
+ goto no_support;
+ ir.rm |= ir.rex_b;
+ if (!i386_xmm_regnum_p (gdbarch,
I387_XMM0_REGNUM (tdep) + ir.rm))
- goto no_support;
- record_full_arch_list_add_reg (ir.regcache,
+ goto no_support;
+ record_full_arch_list_add_reg (ir.regcache,
I387_XMM0_REGNUM (tdep) + ir.rm);
- }
- else
- {
- switch (opcode)
- {
- case 0x660f3a14:
- ir.ot = OT_BYTE;
- break;
- case 0x660f3a15:
- ir.ot = OT_WORD;
- break;
- case 0x660f3a16:
- ir.ot = OT_LONG;
- break;
- case 0x660f3a17:
- ir.ot = OT_QUAD;
- break;
- default:
- ir.ot = OT_DQUAD;
- break;
- }
- if (i386_record_lea_modrm (&ir))
- return -1;
- }
- break;
-
- case 0x0f2b: /* movntps */
- case 0x660f2b: /* movntpd */
- case 0x0fe7: /* movntq */
- case 0x660fe7: /* movntdq */
- if (ir.mod == 3)
- goto no_support;
- if (opcode == 0x0fe7)
- ir.ot = OT_QUAD;
- else
- ir.ot = OT_DQUAD;
- if (i386_record_lea_modrm (&ir))
- return -1;
- break;
-
- case 0xf30f2c: /* cvttss2si */
- case 0xf20f2c: /* cvttsd2si */
- case 0xf30f2d: /* cvtss2si */
- case 0xf20f2d: /* cvtsd2si */
- case 0xf20f38f0: /* crc32 */
- case 0xf20f38f1: /* crc32 */
- case 0x0f50: /* movmskps */
- case 0x660f50: /* movmskpd */
- case 0x0fc5: /* pextrw */
- case 0x660fc5: /* pextrw */
- case 0x0fd7: /* pmovmskb */
- case 0x660fd7: /* pmovmskb */
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg | rex_r);
- break;
-
- case 0x0f3800: /* pshufb */
- case 0x0f3801: /* phaddw */
- case 0x0f3802: /* phaddd */
- case 0x0f3803: /* phaddsw */
- case 0x0f3804: /* pmaddubsw */
- case 0x0f3805: /* phsubw */
- case 0x0f3806: /* phsubd */
- case 0x0f3807: /* phsubsw */
- case 0x0f3808: /* psignb */
- case 0x0f3809: /* psignw */
- case 0x0f380a: /* psignd */
- case 0x0f380b: /* pmulhrsw */
- case 0x0f381c: /* pabsb */
- case 0x0f381d: /* pabsw */
- case 0x0f381e: /* pabsd */
- case 0x0f382b: /* packusdw */
- case 0x0f3830: /* pmovzxbw */
- case 0x0f3831: /* pmovzxbd */
- case 0x0f3832: /* pmovzxbq */
- case 0x0f3833: /* pmovzxwd */
- case 0x0f3834: /* pmovzxwq */
- case 0x0f3835: /* pmovzxdq */
- case 0x0f3837: /* pcmpgtq */
- case 0x0f3838: /* pminsb */
- case 0x0f3839: /* pminsd */
- case 0x0f383a: /* pminuw */
- case 0x0f383b: /* pminud */
- case 0x0f383c: /* pmaxsb */
- case 0x0f383d: /* pmaxsd */
- case 0x0f383e: /* pmaxuw */
- case 0x0f383f: /* pmaxud */
- case 0x0f3840: /* pmulld */
- case 0x0f3841: /* phminposuw */
- case 0x0f3a0f: /* palignr */
- case 0x0f60: /* punpcklbw */
- case 0x0f61: /* punpcklwd */
- case 0x0f62: /* punpckldq */
- case 0x0f63: /* packsswb */
- case 0x0f64: /* pcmpgtb */
- case 0x0f65: /* pcmpgtw */
- case 0x0f66: /* pcmpgtd */
- case 0x0f67: /* packuswb */
- case 0x0f68: /* punpckhbw */
- case 0x0f69: /* punpckhwd */
- case 0x0f6a: /* punpckhdq */
- case 0x0f6b: /* packssdw */
- case 0x0f6e: /* movd */
- case 0x0f6f: /* movq */
- case 0x0f70: /* pshufw */
- case 0x0f74: /* pcmpeqb */
- case 0x0f75: /* pcmpeqw */
- case 0x0f76: /* pcmpeqd */
- case 0x0fc4: /* pinsrw */
- case 0x0fd1: /* psrlw */
- case 0x0fd2: /* psrld */
- case 0x0fd3: /* psrlq */
- case 0x0fd4: /* paddq */
- case 0x0fd5: /* pmullw */
- case 0xf20fd6: /* movdq2q */
- case 0x0fd8: /* psubusb */
- case 0x0fd9: /* psubusw */
- case 0x0fda: /* pminub */
- case 0x0fdb: /* pand */
- case 0x0fdc: /* paddusb */
- case 0x0fdd: /* paddusw */
- case 0x0fde: /* pmaxub */
- case 0x0fdf: /* pandn */
- case 0x0fe0: /* pavgb */
- case 0x0fe1: /* psraw */
- case 0x0fe2: /* psrad */
- case 0x0fe3: /* pavgw */
- case 0x0fe4: /* pmulhuw */
- case 0x0fe5: /* pmulhw */
- case 0x0fe8: /* psubsb */
- case 0x0fe9: /* psubsw */
- case 0x0fea: /* pminsw */
- case 0x0feb: /* por */
- case 0x0fec: /* paddsb */
- case 0x0fed: /* paddsw */
- case 0x0fee: /* pmaxsw */
- case 0x0fef: /* pxor */
- case 0x0ff1: /* psllw */
- case 0x0ff2: /* pslld */
- case 0x0ff3: /* psllq */
- case 0x0ff4: /* pmuludq */
- case 0x0ff5: /* pmaddwd */
- case 0x0ff6: /* psadbw */
- case 0x0ff8: /* psubb */
- case 0x0ff9: /* psubw */
- case 0x0ffa: /* psubd */
- case 0x0ffb: /* psubq */
- case 0x0ffc: /* paddb */
- case 0x0ffd: /* paddw */
- case 0x0ffe: /* paddd */
- if (i386_record_modrm (&ir))
+ }
+ else
+ {
+ switch (opcode)
+ {
+ case 0x660f3a14:
+ ir.ot = OT_BYTE;
+ break;
+ case 0x660f3a15:
+ ir.ot = OT_WORD;
+ break;
+ case 0x660f3a16:
+ ir.ot = OT_LONG;
+ break;
+ case 0x660f3a17:
+ ir.ot = OT_QUAD;
+ break;
+ default:
+ ir.ot = OT_DQUAD;
+ break;
+ }
+ if (i386_record_lea_modrm (&ir))
+ return -1;
+ }
+ break;
+
+ case 0x0f2b: /* movntps */
+ case 0x660f2b: /* movntpd */
+ case 0x0fe7: /* movntq */
+ case 0x660fe7: /* movntdq */
+ if (ir.mod == 3)
+ goto no_support;
+ if (opcode == 0x0fe7)
+ ir.ot = OT_QUAD;
+ else
+ ir.ot = OT_DQUAD;
+ if (i386_record_lea_modrm (&ir))
return -1;
- if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.reg))
- goto no_support;
- record_full_arch_list_add_reg (ir.regcache,
+ break;
+
+ case 0xf30f2c: /* cvttss2si */
+ case 0xf20f2c: /* cvttsd2si */
+ case 0xf30f2d: /* cvtss2si */
+ case 0xf20f2d: /* cvtsd2si */
+ case 0xf20f38f0: /* crc32 */
+ case 0xf20f38f1: /* crc32 */
+ case 0x0f50: /* movmskps */
+ case 0x660f50: /* movmskpd */
+ case 0x0fc5: /* pextrw */
+ case 0x660fc5: /* pextrw */
+ case 0x0fd7: /* pmovmskb */
+ case 0x660fd7: /* pmovmskb */
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg | rex_r);
+ break;
+
+ case 0x0f3800: /* pshufb */
+ case 0x0f3801: /* phaddw */
+ case 0x0f3802: /* phaddd */
+ case 0x0f3803: /* phaddsw */
+ case 0x0f3804: /* pmaddubsw */
+ case 0x0f3805: /* phsubw */
+ case 0x0f3806: /* phsubd */
+ case 0x0f3807: /* phsubsw */
+ case 0x0f3808: /* psignb */
+ case 0x0f3809: /* psignw */
+ case 0x0f380a: /* psignd */
+ case 0x0f380b: /* pmulhrsw */
+ case 0x0f381c: /* pabsb */
+ case 0x0f381d: /* pabsw */
+ case 0x0f381e: /* pabsd */
+ case 0x0f382b: /* packusdw */
+ case 0x0f3830: /* pmovzxbw */
+ case 0x0f3831: /* pmovzxbd */
+ case 0x0f3832: /* pmovzxbq */
+ case 0x0f3833: /* pmovzxwd */
+ case 0x0f3834: /* pmovzxwq */
+ case 0x0f3835: /* pmovzxdq */
+ case 0x0f3837: /* pcmpgtq */
+ case 0x0f3838: /* pminsb */
+ case 0x0f3839: /* pminsd */
+ case 0x0f383a: /* pminuw */
+ case 0x0f383b: /* pminud */
+ case 0x0f383c: /* pmaxsb */
+ case 0x0f383d: /* pmaxsd */
+ case 0x0f383e: /* pmaxuw */
+ case 0x0f383f: /* pmaxud */
+ case 0x0f3840: /* pmulld */
+ case 0x0f3841: /* phminposuw */
+ case 0x0f3a0f: /* palignr */
+ case 0x0f60: /* punpcklbw */
+ case 0x0f61: /* punpcklwd */
+ case 0x0f62: /* punpckldq */
+ case 0x0f63: /* packsswb */
+ case 0x0f64: /* pcmpgtb */
+ case 0x0f65: /* pcmpgtw */
+ case 0x0f66: /* pcmpgtd */
+ case 0x0f67: /* packuswb */
+ case 0x0f68: /* punpckhbw */
+ case 0x0f69: /* punpckhwd */
+ case 0x0f6a: /* punpckhdq */
+ case 0x0f6b: /* packssdw */
+ case 0x0f6e: /* movd */
+ case 0x0f6f: /* movq */
+ case 0x0f70: /* pshufw */
+ case 0x0f74: /* pcmpeqb */
+ case 0x0f75: /* pcmpeqw */
+ case 0x0f76: /* pcmpeqd */
+ case 0x0fc4: /* pinsrw */
+ case 0x0fd1: /* psrlw */
+ case 0x0fd2: /* psrld */
+ case 0x0fd3: /* psrlq */
+ case 0x0fd4: /* paddq */
+ case 0x0fd5: /* pmullw */
+ case 0xf20fd6: /* movdq2q */
+ case 0x0fd8: /* psubusb */
+ case 0x0fd9: /* psubusw */
+ case 0x0fda: /* pminub */
+ case 0x0fdb: /* pand */
+ case 0x0fdc: /* paddusb */
+ case 0x0fdd: /* paddusw */
+ case 0x0fde: /* pmaxub */
+ case 0x0fdf: /* pandn */
+ case 0x0fe0: /* pavgb */
+ case 0x0fe1: /* psraw */
+ case 0x0fe2: /* psrad */
+ case 0x0fe3: /* pavgw */
+ case 0x0fe4: /* pmulhuw */
+ case 0x0fe5: /* pmulhw */
+ case 0x0fe8: /* psubsb */
+ case 0x0fe9: /* psubsw */
+ case 0x0fea: /* pminsw */
+ case 0x0feb: /* por */
+ case 0x0fec: /* paddsb */
+ case 0x0fed: /* paddsw */
+ case 0x0fee: /* pmaxsw */
+ case 0x0fef: /* pxor */
+ case 0x0ff1: /* psllw */
+ case 0x0ff2: /* pslld */
+ case 0x0ff3: /* psllq */
+ case 0x0ff4: /* pmuludq */
+ case 0x0ff5: /* pmaddwd */
+ case 0x0ff6: /* psadbw */
+ case 0x0ff8: /* psubb */
+ case 0x0ff9: /* psubw */
+ case 0x0ffa: /* psubd */
+ case 0x0ffb: /* psubq */
+ case 0x0ffc: /* paddb */
+ case 0x0ffd: /* paddw */
+ case 0x0ffe: /* paddd */
+ if (i386_record_modrm (&ir))
+ return -1;
+ if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.reg))
+ goto no_support;
+ record_full_arch_list_add_reg (ir.regcache,
I387_MM0_REGNUM (tdep) + ir.reg);
- break;
+ break;
- case 0x0f71: /* psllw */
- case 0x0f72: /* pslld */
- case 0x0f73: /* psllq */
- if (i386_record_modrm (&ir))
+ case 0x0f71: /* psllw */
+ case 0x0f72: /* pslld */
+ case 0x0f73: /* psllq */
+ if (i386_record_modrm (&ir))
return -1;
- if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.rm))
- goto no_support;
- record_full_arch_list_add_reg (ir.regcache,
+ if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.rm))
+ goto no_support;
+ record_full_arch_list_add_reg (ir.regcache,
I387_MM0_REGNUM (tdep) + ir.rm);
- break;
+ break;
- case 0x660f71: /* psllw */
- case 0x660f72: /* pslld */
- case 0x660f73: /* psllq */
- if (i386_record_modrm (&ir))
+ case 0x660f71: /* psllw */
+ case 0x660f72: /* pslld */
+ case 0x660f73: /* psllq */
+ if (i386_record_modrm (&ir))
return -1;
- ir.rm |= ir.rex_b;
- if (!i386_xmm_regnum_p (gdbarch, I387_XMM0_REGNUM (tdep) + ir.rm))
- goto no_support;
- record_full_arch_list_add_reg (ir.regcache,
+ ir.rm |= ir.rex_b;
+ if (!i386_xmm_regnum_p (gdbarch, I387_XMM0_REGNUM (tdep) + ir.rm))
+ goto no_support;
+ record_full_arch_list_add_reg (ir.regcache,
I387_XMM0_REGNUM (tdep) + ir.rm);
- break;
+ break;
- case 0x0f7e: /* movd */
- case 0x660f7e: /* movd */
- if (i386_record_modrm (&ir))
+ case 0x0f7e: /* movd */
+ case 0x660f7e: /* movd */
+ if (i386_record_modrm (&ir))
return -1;
- if (ir.mod == 3)
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
- else
- {
- if (ir.dflag == 2)
- ir.ot = OT_QUAD;
- else
- ir.ot = OT_LONG;
- if (i386_record_lea_modrm (&ir))
- return -1;
- }
- break;
-
- case 0x0f7f: /* movq */
- if (i386_record_modrm (&ir))
+ if (ir.mod == 3)
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
+ else
+ {
+ if (ir.dflag == 2)
+ ir.ot = OT_QUAD;
+ else
+ ir.ot = OT_LONG;
+ if (i386_record_lea_modrm (&ir))
+ return -1;
+ }
+ break;
+
+ case 0x0f7f: /* movq */
+ if (i386_record_modrm (&ir))
return -1;
- if (ir.mod == 3)
- {
- if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.rm))
- goto no_support;
- record_full_arch_list_add_reg (ir.regcache,
+ if (ir.mod == 3)
+ {
+ if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.rm))
+ goto no_support;
+ record_full_arch_list_add_reg (ir.regcache,
I387_MM0_REGNUM (tdep) + ir.rm);
- }
- else
- {
- ir.ot = OT_QUAD;
- if (i386_record_lea_modrm (&ir))
- return -1;
- }
- break;
-
- case 0xf30fb8: /* popcnt */
- if (i386_record_modrm (&ir))
+ }
+ else
+ {
+ ir.ot = OT_QUAD;
+ if (i386_record_lea_modrm (&ir))
+ return -1;
+ }
+ break;
+
+ case 0xf30fb8: /* popcnt */
+ if (i386_record_modrm (&ir))
return -1;
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg);
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
- break;
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg);
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ break;
- case 0x660fd6: /* movq */
- if (i386_record_modrm (&ir))
+ case 0x660fd6: /* movq */
+ if (i386_record_modrm (&ir))
return -1;
- if (ir.mod == 3)
- {
- ir.rm |= ir.rex_b;
- if (!i386_xmm_regnum_p (gdbarch,
+ if (ir.mod == 3)
+ {
+ ir.rm |= ir.rex_b;
+ if (!i386_xmm_regnum_p (gdbarch,
I387_XMM0_REGNUM (tdep) + ir.rm))
- goto no_support;
- record_full_arch_list_add_reg (ir.regcache,
+ goto no_support;
+ record_full_arch_list_add_reg (ir.regcache,
I387_XMM0_REGNUM (tdep) + ir.rm);
- }
- else
- {
- ir.ot = OT_QUAD;
- if (i386_record_lea_modrm (&ir))
- return -1;
- }
- break;
-
- case 0x660f3817: /* ptest */
- case 0x0f2e: /* ucomiss */
- case 0x660f2e: /* ucomisd */
- case 0x0f2f: /* comiss */
- case 0x660f2f: /* comisd */
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
- break;
-
- case 0x0ff7: /* maskmovq */
- regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_REDI_REGNUM],
- &addr);
- if (record_full_arch_list_add_mem (addr, 64))
- return -1;
- break;
-
- case 0x660ff7: /* maskmovdqu */
- regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_REDI_REGNUM],
- &addr);
- if (record_full_arch_list_add_mem (addr, 128))
- return -1;
- break;
-
- default:
- goto no_support;
- break;
- }
+ }
+ else
+ {
+ ir.ot = OT_QUAD;
+ if (i386_record_lea_modrm (&ir))
+ return -1;
+ }
+ break;
+
+ case 0x660f3817: /* ptest */
+ case 0x0f2e: /* ucomiss */
+ case 0x660f2e: /* ucomisd */
+ case 0x0f2f: /* comiss */
+ case 0x660f2f: /* comisd */
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ break;
+
+ case 0x0ff7: /* maskmovq */
+ regcache_raw_read_unsigned (ir.regcache,
+ ir.regmap[X86_RECORD_REDI_REGNUM],
+ &addr);
+ if (record_full_arch_list_add_mem (addr, 64))
+ return -1;
+ break;
+
+ case 0x660ff7: /* maskmovdqu */
+ regcache_raw_read_unsigned (ir.regcache,
+ ir.regmap[X86_RECORD_REDI_REGNUM],
+ &addr);
+ if (record_full_arch_list_add_mem (addr, 128))
+ return -1;
+ break;
+
+ default:
+ goto no_support;
+ break;
+ }
break;
default:
no_support:
printf_unfiltered (_("Process record does not support instruction 0x%02x "
- "at address %s.\n"),
- (unsigned int) (opcode),
- paddress (gdbarch, ir.orig_addr));
+ "at address %s.\n"),
+ (unsigned int) (opcode),
+ paddress (gdbarch, ir.orig_addr));
return -1;
}
extern int i386_svr4_reg_to_regnum (struct gdbarch *gdbarch, int reg);
extern int i386_process_record (struct gdbarch *gdbarch,
- struct regcache *regcache, CORE_ADDR addr);
+ struct regcache *regcache, CORE_ADDR addr);
extern const struct target_desc *i386_target_description (uint64_t xcr0,
bool segments);
_initialize_i386_windows_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
- i386_windows_osabi_sniffer);
+ i386_windows_osabi_sniffer);
/* Cygwin uses elf core dumps. */
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
- i386_cygwin_core_osabi_sniffer);
+ i386_cygwin_core_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_WINDOWS,
- i386_windows_init_abi);
+ i386_windows_init_abi);
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_CYGWIN,
i386_cygwin_init_abi);
}
if (regnum == -1 || regnum == i)
{
/* Most of the FPU control registers occupy only 16 bits in
- the fsave area. Give those a special treatment. */
+ the fsave area. Give those a special treatment. */
if (i >= I387_FCTRL_REGNUM (tdep)
&& i != I387_FIOFF_REGNUM (tdep) && i != I387_FOOFF_REGNUM (tdep))
{
if (i == I387_FOP_REGNUM (tdep))
{
/* The opcode occupies only 11 bits. Make sure we
- don't touch the other bits. */
+ don't touch the other bits. */
buf[1] &= ((1 << 3) - 1);
buf[1] |= ((FSAVE_ADDR (tdep, regs, i))[1] & ~((1 << 3) - 1));
}
if (val[0] & (1 << fpreg))
{
int thisreg = (fpreg + 8 - top) % 8
- + I387_ST0_REGNUM (tdep);
+ + I387_ST0_REGNUM (tdep);
tag = i387_tag (FXSAVE_ADDR (tdep, regs, thisreg));
}
else
if (regnum == -1 || regnum == i)
{
/* Most of the FPU control registers occupy only 16 bits in
- the fxsave area. Give those a special treatment. */
+ the fxsave area. Give those a special treatment. */
if (i >= I387_FCTRL_REGNUM (tdep) && i < I387_XMM0_REGNUM (tdep)
&& i != I387_FIOFF_REGNUM (tdep) && i != I387_FOOFF_REGNUM (tdep))
{
if (i == I387_FOP_REGNUM (tdep))
{
/* The opcode occupies only 11 bits. Make sure we
- don't touch the other bits. */
+ don't touch the other bits. */
buf[1] &= ((1 << 3) - 1);
buf[1] |= ((FXSAVE_ADDR (tdep, regs, i))[1] & ~((1 << 3) - 1));
}
/* Set all bnd registers to the INIT state. INIT state means
all memory range can be accessed. */
extern void i387_reset_bnd_regs (struct gdbarch *gdbarch,
- struct regcache *regcache);
+ struct regcache *regcache);
#endif /* i387-tdep.h */
libunwind frame unwinding. */
int
libunwind_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame, void **this_cache)
+ struct frame_info *this_frame, void **this_cache)
{
unw_cursor_t cursor;
unw_accessors_t *acc;
void
libunwind_frame_this_id (struct frame_info *this_frame, void **this_cache,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
struct libunwind_frame_cache *cache =
libunwind_frame_cache (this_frame, this_cache);
struct value *
libunwind_frame_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+ void **this_cache, int regnum)
{
struct libunwind_frame_cache *cache =
libunwind_frame_cache (this_frame, this_cache);
case UNW_SLT_REG:
val = frame_unwind_got_register (this_frame, regnum,
- descr->uw2gdb (sl.u.regnum));
+ descr->uw2gdb (sl.u.regnum));
break;
case UNW_SLT_NONE:
{
- /* The register is not stored at a specific memory address nor
- inside another register. So use libunwind to fetch the register
- value for us, and create a constant value with the result. */
- if (descr->is_fpreg (uw_regnum))
- {
- ret = unw_get_fpreg_p (&cache->cursor, uw_regnum, &fpval);
- if (ret < 0)
- return frame_unwind_got_constant (this_frame, regnum, 0);
- val = frame_unwind_got_bytes (this_frame, regnum,
- (gdb_byte *) &fpval);
- }
- else
- {
- ret = unw_get_reg_p (&cache->cursor, uw_regnum, &intval);
- if (ret < 0)
- return frame_unwind_got_constant (this_frame, regnum, 0);
- val = frame_unwind_got_constant (this_frame, regnum, intval);
- }
- break;
+ /* The register is not stored at a specific memory address nor
+ inside another register. So use libunwind to fetch the register
+ value for us, and create a constant value with the result. */
+ if (descr->is_fpreg (uw_regnum))
+ {
+ ret = unw_get_fpreg_p (&cache->cursor, uw_regnum, &fpval);
+ if (ret < 0)
+ return frame_unwind_got_constant (this_frame, regnum, 0);
+ val = frame_unwind_got_bytes (this_frame, regnum,
+ (gdb_byte *) &fpval);
+ }
+ else
+ {
+ ret = unw_get_reg_p (&cache->cursor, uw_regnum, &intval);
+ if (ret < 0)
+ return frame_unwind_got_constant (this_frame, regnum, 0);
+ val = frame_unwind_got_constant (this_frame, regnum, intval);
+ }
+ break;
}
}
/* Verify if we are in a sigtramp frame and we can use libunwind to unwind. */
int
libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
+ struct frame_info *this_frame,
+ void **this_cache)
{
unw_cursor_t cursor;
unw_accessors_t *acc;
};
int libunwind_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache);
-
+ struct frame_info *this_frame,
+ void **this_cache);
+
int libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache);
+ struct frame_info *this_frame,
+ void **this_cache);
void libunwind_frame_set_descr (struct gdbarch *arch,
struct libunwind_descr *descr);
void libunwind_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id);
struct value *libunwind_frame_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum);
+ void **this_cache, int regnum);
void libunwind_frame_dealloc_cache (struct frame_info *self, void *cache);
int libunwind_is_initialized (void);
return regno < 0
|| regno >= gdbarch_num_regs (gdbarch)
|| u_offsets[regno] == -1
- || regno == IA64_BSPSTORE_REGNUM;
+ || regno == IA64_BSPSTORE_REGNUM;
}
void
if (!(psr & IA64_PSR_DB))
{
psr |= IA64_PSR_DB; /* Set the db bit - this enables hardware
- watchpoints and breakpoints. */
+ watchpoints and breakpoints. */
regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr);
}
}
regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);
psr |= IA64_PSR_DD; /* Set the dd bit - this will disable the watchpoint
- for the next instruction. */
+ for the next instruction. */
regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr);
*addr_p = (CORE_ADDR) siginfo.si_addr;
/* Probe for the table size once. */
if (gate_table_size == 0)
- gate_table_size = syscall (__NR_getunwind, NULL, 0);
+ gate_table_size = syscall (__NR_getunwind, NULL, 0);
if (gate_table_size < 0)
return TARGET_XFER_E_IO;
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
/* Core file support. */
set_gdbarch_iterate_over_regset_sections
#include "ia64-libunwind-tdep.h"
/* Note: KERNEL_START is supposed to be an address which is not going
- to ever contain any valid unwind info. For ia64 linux, the choice
- of 0xc000000000000000 is fairly safe since that's uncached space.
+ to ever contain any valid unwind info. For ia64 linux, the choice
+ of 0xc000000000000000 is fairly safe since that's uncached space.
- We use KERNEL_START as follows: after obtaining the kernel's
- unwind table via getunwind(), we project its unwind data into
- address-range KERNEL_START-(KERNEL_START+ktab_size) and then
- when ia64_access_mem() sees a memory access to this
- address-range, we redirect it to ktab instead.
+ We use KERNEL_START as follows: after obtaining the kernel's
+ unwind table via getunwind(), we project its unwind data into
+ address-range KERNEL_START-(KERNEL_START+ktab_size) and then
+ when ia64_access_mem() sees a memory access to this
+ address-range, we redirect it to ktab instead.
- None of this hackery is needed with a modern kernel/libcs
- which uses the kernel virtual DSO to provide access to the
- kernel's unwind info. In that case, ktab_size remains 0 and
- hence the value of KERNEL_START doesn't matter. */
+ None of this hackery is needed with a modern kernel/libcs
+ which uses the kernel virtual DSO to provide access to the
+ kernel's unwind info. In that case, ktab_size remains 0 and
+ hence the value of KERNEL_START doesn't matter. */
#define KERNEL_START 0xc000000000000000ULL
The current addressing used by the code below:
original PC placed_address placed_size required covered
- == bp_tgt->shadow_len reqd \subset covered
+ == bp_tgt->shadow_len reqd \subset covered
0xABCDE0 0xABCDE0 0x10 <0x0...0x5> <0x0..0xF>
0xABCDE1 0xABCDE1 0xF <0x5...0xA> <0x1..0xF>
0xABCDE2 0xABCDE2 0xE <0xA...0xF> <0x2..0xF>
static enum register_status
ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+ int regnum, gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum register_status status;
else if (regnum == VBOF_REGNUM)
{
/* A virtual register frame start is provided for user convenience.
- It can be calculated as the bsp - sof (sizeof frame). */
+ It can be calculated as the bsp - sof (sizeof frame). */
ULONGEST bsp, vbsp;
ULONGEST cfm;
/* Adjust the register number to account for register rotation. */
regnum = VP16_REGNUM
- + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
+ + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
}
prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0;
store_unsigned_integer (buf, register_size (gdbarch, regnum),
/* Adjust the register number to account for register rotation. */
regnum = VP16_REGNUM
- + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
+ + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
}
prN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order);
static void
ia64_value_to_register (struct frame_info *frame, int regnum,
- struct type *valtype, const gdb_byte *in)
+ struct type *valtype, const gdb_byte *in)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte out[IA64_FP_REGISTER_SIZE];
CORE_ADDR addr = prologue_sal.end;
/* Handle the case in which compiler's optimizer/scheduler
- has moved instructions into the prologue. We scan ahead
+ has moved instructions into the prologue. We scan ahead
in the function looking for address ranges whose corresponding
line number is less than or equal to the first one that we
found for the function. (It can be less than when the
scheduler puts a body instruction before the first prologue
instruction.) */
for (i = 2 * max_skip_non_prologue_insns;
- i > 0 && (lim_pc == 0 || addr < lim_pc);
+ i > 0 && (lim_pc == 0 || addr < lim_pc);
i--)
- {
+ {
struct symtab_and_line sal;
sal = find_pc_line (addr, 0);
static CORE_ADDR
examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
- struct frame_info *this_frame,
- struct ia64_frame_cache *cache)
+ struct frame_info *this_frame,
+ struct ia64_frame_cache *cache)
{
CORE_ADDR next_pc;
CORE_ADDR last_prologue_pc = pc;
/* Look for a leaf routine. */
if (pc < lim_pc && next_pc
&& (it == I || it == M)
- && ((instr & 0x1ee00000000LL) == 0x10800000000LL))
+ && ((instr & 0x1ee00000000LL) == 0x10800000000LL))
{
/* adds rN = imm14, rM (or mov rN, rM when imm14 is 0) */
int imm = (int) ((((instr & 0x01000000000LL) ? -1 : 0) << 13)
- | ((instr & 0x001f8000000LL) >> 20)
- | ((instr & 0x000000fe000LL) >> 13));
+ | ((instr & 0x001f8000000LL) >> 20)
+ | ((instr & 0x000000fe000LL) >> 13));
int rM = (int) ((instr & 0x00007f00000LL) >> 20);
int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
int qp = (int) (instr & 0x0000000003fLL);
break;
}
else if (it == I && ((instr & 0x1eff8000000LL) == 0x00188000000LL))
- {
+ {
/* Move from BR */
int b2 = (int) ((instr & 0x0000000e000LL) >> 13);
int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
}
}
else if ((it == I || it == M)
- && ((instr & 0x1ee00000000LL) == 0x10800000000LL))
+ && ((instr & 0x1ee00000000LL) == 0x10800000000LL))
{
/* adds rN = imm14, rM (or mov rN, rM when imm14 is 0) */
int imm = (int) ((((instr & 0x01000000000LL) ? -1 : 0) << 13)
- | ((instr & 0x001f8000000LL) >> 20)
- | ((instr & 0x000000fe000LL) >> 13));
+ | ((instr & 0x001f8000000LL) >> 20)
+ | ((instr & 0x000000fe000LL) >> 13));
int rM = (int) ((instr & 0x00007f00000LL) >> 20);
int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
int qp = (int) (instr & 0x0000000003fLL);
last_prologue_pc = next_pc;
}
else if (qp == 0 && rN == 2
- && ((rM == fp_reg && fp_reg != 0) || rM == 12))
+ && ((rM == fp_reg && fp_reg != 0) || rM == 12))
{
CORE_ADDR saved_sp = 0;
/* adds r2, spilloffset, rFramePointer
- or
+ or
adds r2, spilloffset, r12
- Get ready for stf.spill or st8.spill instructions.
+ Get ready for stf.spill or st8.spill instructions.
The address to start spilling at is loaded into r2.
FIXME: Why r2? That's what gcc currently uses; it
could well be different for other compilers. */
/* Hmm... whether or not this will work will depend on
- where the pc is. If it's still early in the prologue
+ where the pc is. If it's still early in the prologue
this'll be wrong. FIXME */
if (this_frame)
saved_sp = get_frame_register_unsigned (this_frame,
sp_regnum);
spill_addr = saved_sp
- + (rM == 12 ? 0 : mem_stack_frame_size)
+ + (rM == 12 ? 0 : mem_stack_frame_size)
+ imm;
spill_reg = rN;
last_prologue_pc = next_pc;
}
}
else if (it == M
- && ( ((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
- || ((instr & 0x1ffc8000000LL) == 0x0cec0000000LL) ))
+ && ( ((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
+ || ((instr & 0x1ffc8000000LL) == 0x0cec0000000LL) ))
{
/* stf.spill [rN] = fM, imm9
or
{
cache->saved_regs[IA64_FR0_REGNUM + fM] = spill_addr;
- if ((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
+ if ((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
spill_addr += imm;
else
spill_addr = 0; /* last one; must be done. */
}
}
else if ((it == M && ((instr & 0x1eff8000000LL) == 0x02110000000LL))
- || (it == I && ((instr & 0x1eff8000000LL) == 0x00050000000LL)) )
+ || (it == I && ((instr & 0x1eff8000000LL) == 0x00050000000LL)) )
{
/* mov.m rN = arM
or
}
}
else if (it == M
- && ( ((instr & 0x1ffc8000000LL) == 0x08cc0000000LL)
- || ((instr & 0x1efc0000000LL) == 0x0acc0000000LL)))
+ && ( ((instr & 0x1ffc8000000LL) == 0x08cc0000000LL)
+ || ((instr & 0x1efc0000000LL) == 0x0acc0000000LL)))
{
/* st8 [rN] = rM
or
&& (rM == unat_save_reg || rM == pr_save_reg))
{
/* We've found a spill of either the UNAT register or the PR
- register. (Well, not exactly; what we've actually found is
+ register. (Well, not exactly; what we've actually found is
a spill of the register that UNAT or PR was moved to).
Record that fact and move on... */
if (rM == unat_save_reg)
unat_save_reg = 0;
}
else
- {
+ {
/* Track PR register. */
cache->saved_regs[IA64_PR_REGNUM] = spill_addr;
pr_save_reg = 0;
}
}
else if (it == M && ((instr & 0x1ff88000000LL) == 0x0cc80000000LL))
- {
+ {
/* Either
stfs [rN] = fM
or
}
}
else if (it == M
- && ( ((instr & 0x1ffc8000000LL) == 0x08ec0000000LL)
- || ((instr & 0x1efc0000000LL) == 0x0aec0000000LL)))
+ && ( ((instr & 0x1ffc8000000LL) == 0x08ec0000000LL)
+ || ((instr & 0x1efc0000000LL) == 0x0aec0000000LL)))
{
/* st8.spill [rN] = rM
or
if (qp == 0 && rN == spill_reg && 4 <= rM && rM <= 7)
{
/* We've found a spill of one of the preserved general purpose
- regs. Record the spill address and advance the spill
+ regs. Record the spill address and advance the spill
register if appropriate. */
cache->saved_regs[IA64_GR0_REGNUM + rM] = spill_addr;
if ((instr & 0x1efc0000000LL) == 0x0aec0000000LL)
- /* st8.spill [rN] = rM, imm9 */
+ /* st8.spill [rN] = rM, imm9 */
spill_addr += imm9(instr);
else
spill_addr = 0; /* Done spilling. */
rrb_gr = (cfm >> 18) & 0x7f;
/* The previous bof only requires subtraction of the sol (size of
- locals) due to the overlap between output and input of
- subsequent frames. */
+ locals) due to the overlap between output and input of
+ subsequent frames. */
bof = rse_address_add (bof, -sol);
for (i = 0, addr = bof;
CORE_ADDR prev_cfm, bsp, prev_bsp;
/* We want to calculate the previous bsp as the end of the previous
- register stack frame. This corresponds to what the hardware bsp
- register will be if we pop the frame back which is why we might
- have been called. We know the beginning of the current frame is
- cache->bsp - cache->sof. This value in the previous frame points
- to the start of the output registers. We can calculate the end of
- that frame by adding the size of output:
- (sof (size of frame) - sol (size of locals)). */
+ register stack frame. This corresponds to what the hardware bsp
+ register will be if we pop the frame back which is why we might
+ have been called. We know the beginning of the current frame is
+ cache->bsp - cache->sof. This value in the previous frame points
+ to the start of the output registers. We can calculate the end of
+ that frame by adding the size of output:
+ (sof (size of frame) - sol (size of locals)). */
val = ia64_frame_prev_register (this_frame, this_cache, IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer (value_contents_all (val),
8, byte_order);
bsp = rse_address_add (cache->bsp, -(cache->sof));
prev_bsp =
- rse_address_add (bsp, (prev_cfm & 0x7f) - ((prev_cfm >> 7) & 0x7f));
+ rse_address_add (bsp, (prev_cfm & 0x7f) - ((prev_cfm >> 7) & 0x7f));
return frame_unwind_got_constant (this_frame, regnum, prev_bsp);
}
CORE_ADDR addr = cache->saved_regs[IA64_CFM_REGNUM];
if (addr != 0)
- return frame_unwind_got_memory (this_frame, regnum, addr);
+ return frame_unwind_got_memory (this_frame, regnum, addr);
if (cache->prev_cfm)
- return frame_unwind_got_constant (this_frame, regnum, cache->prev_cfm);
+ return frame_unwind_got_constant (this_frame, regnum, cache->prev_cfm);
if (cache->frameless)
- return frame_unwind_got_register (this_frame, IA64_PFS_REGNUM,
- IA64_PFS_REGNUM);
+ return frame_unwind_got_register (this_frame, IA64_PFS_REGNUM,
+ IA64_PFS_REGNUM);
return frame_unwind_got_register (this_frame, regnum, 0);
}
else if (regnum == IA64_VFP_REGNUM)
{
/* If the function in question uses an automatic register (r32-r127)
- for the frame pointer, it'll be found by ia64_find_saved_register()
+ for the frame pointer, it'll be found by ia64_find_saved_register()
above. If the function lacks one of these frame pointers, we can
still provide a value since we know the size of the frame. */
return frame_unwind_got_constant (this_frame, regnum, cache->base);
ULONGEST prN;
pr_val = ia64_frame_prev_register (this_frame, this_cache,
- IA64_PR_REGNUM);
+ IA64_PR_REGNUM);
if (VP16_REGNUM <= regnum && regnum <= VP63_REGNUM)
{
/* Fetch predicate register rename base from current frame
regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
}
prN = extract_bit_field (value_contents_all (pr_val),
- regnum - VP0_REGNUM, 1);
+ regnum - VP0_REGNUM, 1);
return frame_unwind_got_constant (this_frame, regnum, prN);
}
struct value *unat_val;
ULONGEST unatN;
unat_val = ia64_frame_prev_register (this_frame, this_cache,
- IA64_UNAT_REGNUM);
+ IA64_UNAT_REGNUM);
unatN = extract_bit_field (value_contents_all (unat_val),
- regnum - IA64_NAT0_REGNUM, 1);
+ regnum - IA64_NAT0_REGNUM, 1);
return frame_unwind_got_constant (this_frame, regnum, unatN);
}
{
int natval = 0;
/* Find address of general register corresponding to nat bit we're
- interested in. */
+ interested in. */
CORE_ADDR gr_addr;
gr_addr = cache->saved_regs[regnum - IA64_NAT0_REGNUM + IA64_GR0_REGNUM];
CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM];
if (addr != 0)
- {
- read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM));
- pc = extract_unsigned_integer (buf, 8, byte_order);
- }
+ {
+ read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM));
+ pc = extract_unsigned_integer (buf, 8, byte_order);
+ }
else if (cache->frameless)
{
get_frame_register (this_frame, IA64_BR0_REGNUM, buf);
else if (regnum == IA64_PSR_REGNUM)
{
/* We don't know how to get the complete previous PSR, but we need it
- for the slot information when we unwind the pc (pc is formed of IP
- register plus slot information from PSR). To get the previous
- slot information, we mask it off the return address. */
+ for the slot information when we unwind the pc (pc is formed of IP
+ register plus slot information from PSR). To get the previous
+ slot information, we mask it off the return address. */
ULONGEST slot_num = 0;
CORE_ADDR pc = 0;
CORE_ADDR psr = 0;
CORE_ADDR addr = cache->saved_regs[IA64_BR0_REGNUM];
if (addr != 0)
- return frame_unwind_got_memory (this_frame, regnum, addr);
+ return frame_unwind_got_memory (this_frame, regnum, addr);
return frame_unwind_got_constant (this_frame, regnum, 0);
}
else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM)
- || (regnum >= V32_REGNUM && regnum <= V127_REGNUM))
+ || (regnum >= V32_REGNUM && regnum <= V127_REGNUM))
{
CORE_ADDR addr = 0;
regnum = IA64_GR32_REGNUM + (regnum - V32_REGNUM);
addr = cache->saved_regs[regnum];
if (addr != 0)
- return frame_unwind_got_memory (this_frame, regnum, addr);
+ return frame_unwind_got_memory (this_frame, regnum, addr);
if (cache->frameless)
- {
- struct value *reg_val;
- CORE_ADDR prev_cfm, prev_bsp, prev_bof;
+ {
+ struct value *reg_val;
+ CORE_ADDR prev_cfm, prev_bsp, prev_bof;
- /* FIXME: brobecker/2008-05-01: Doesn't this seem redundant
- with the same code above? */
+ /* FIXME: brobecker/2008-05-01: Doesn't this seem redundant
+ with the same code above? */
if (regnum >= V32_REGNUM)
regnum = IA64_GR32_REGNUM + (regnum - V32_REGNUM);
- reg_val = ia64_frame_prev_register (this_frame, this_cache,
- IA64_CFM_REGNUM);
+ reg_val = ia64_frame_prev_register (this_frame, this_cache,
+ IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer (value_contents_all (reg_val),
- 8, byte_order);
+ 8, byte_order);
reg_val = ia64_frame_prev_register (this_frame, this_cache,
- IA64_BSP_REGNUM);
+ IA64_BSP_REGNUM);
prev_bsp = extract_unsigned_integer (value_contents_all (reg_val),
- 8, byte_order);
+ 8, byte_order);
prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f));
addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM));
- return frame_unwind_got_memory (this_frame, regnum, addr);
- }
+ return frame_unwind_got_memory (this_frame, regnum, addr);
+ }
return frame_unwind_got_constant (this_frame, regnum, 0);
}
/* Adjust the floating point register number to account for
register rotation. */
regnum = IA64_FR32_REGNUM
- + ((regnum - IA64_FR32_REGNUM) + rrb_fr) % 96;
+ + ((regnum - IA64_FR32_REGNUM) + rrb_fr) % 96;
}
/* If we have stored a memory address, access the register. */
addr = cache->saved_regs[regnum];
if (addr != 0)
- return frame_unwind_got_memory (this_frame, regnum, addr);
+ return frame_unwind_got_memory (this_frame, regnum, addr);
/* Otherwise, punt and get the current value of the register. */
else
- return frame_unwind_got_register (this_frame, regnum, regnum);
+ return frame_unwind_got_register (this_frame, regnum, regnum);
}
}
ia64_sigtramp_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build_special (cache->base,
- get_frame_pc (this_frame),
- cache->bsp);
+ get_frame_pc (this_frame),
+ cache->bsp);
if (gdbarch_debug >= 1)
fprintf_unfiltered (gdb_stdlog,
"sigtramp frame id: code %s, stack %s, "
}
else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM)
- || (regnum >= V32_REGNUM && regnum <= V127_REGNUM))
+ || (regnum >= V32_REGNUM && regnum <= V127_REGNUM))
{
CORE_ADDR addr = 0;
regnum = IA64_GR32_REGNUM + (regnum - V32_REGNUM);
addr = cache->saved_regs[regnum];
if (addr != 0)
- return frame_unwind_got_memory (this_frame, regnum, addr);
+ return frame_unwind_got_memory (this_frame, regnum, addr);
return frame_unwind_got_constant (this_frame, regnum, 0);
}
CORE_ADDR addr = cache->saved_regs[regnum];
if (addr != 0)
- return frame_unwind_got_memory (this_frame, regnum, addr);
+ return frame_unwind_got_memory (this_frame, regnum, addr);
return frame_unwind_got_constant (this_frame, regnum, 0);
}
static int
ia64_sigtramp_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
+ struct frame_info *this_frame,
+ void **this_cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
if (tdep->pc_in_sigtramp)
break;
default:
- /* For all other registers, just unwind the value directly. */
+ /* For all other registers, just unwind the value directly. */
regcache_cooked_read_unsigned (regcache, regnum, val);
break;
}
if (addr - KERNEL_START < ktab_size)
{
unw_word_t *laddr = (unw_word_t*) ((char *) ktab
- + (addr - KERNEL_START));
+ + (addr - KERNEL_START));
if (write)
- *laddr = *val;
+ *laddr = *val;
else
- *val = *laddr;
+ *val = *laddr;
return 0;
}
ktab_size = ktab_buf->size ();
for (etab = ktab; etab->start_offset; ++etab)
- etab->info_offset += KERNEL_START;
+ etab->info_offset += KERNEL_START;
}
if (ip < ktab[0].start_offset || ip >= etab[-1].end_offset)
{
int ok = 0;
for (i = 0; i < ehdr->e_phnum; ++i)
- {
- if (phdr[i].p_type == PT_LOAD
+ {
+ if (phdr[i].p_type == PT_LOAD
&& (p_unwind->p_vaddr - phdr[i].p_vaddr) < phdr[i].p_memsz)
{
- ok = 1;
+ ok = 1;
/* Get the segbase from the section containing the
libunwind table. */
segbase = phdr[i].p_vaddr + load_base;
}
}
if (!ok)
- return -UNW_ENOINFO;
+ return -UNW_ENOINFO;
}
dip->start_ip = p_text->p_vaddr + load_base;
ULONGEST unatN_val;
unatN_val = extract_bit_field (value_contents_all (val),
- regnum - IA64_NAT0_REGNUM, 1);
+ regnum - IA64_NAT0_REGNUM, 1);
return frame_unwind_got_constant (this_frame, regnum, unatN_val);
}
CORE_ADDR prev_bsp, prev_cfm;
/* We want to calculate the previous bsp as the end of the previous
- register stack frame. This corresponds to what the hardware bsp
- register will be if we pop the frame back which is why we might
- have been called. We know that libunwind will pass us back the
- beginning of the current frame so we should just add sof to it. */
+ register stack frame. This corresponds to what the hardware bsp
+ register will be if we pop the frame back which is why we might
+ have been called. We know that libunwind will pass us back the
+ beginning of the current frame so we should just add sof to it. */
prev_bsp = extract_unsigned_integer (value_contents_all (val),
8, byte_order);
cfm_val = libunwind_frame_prev_register (this_frame, this_cache,
- IA64_CFM_REGNUM);
+ IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer (value_contents_all (cfm_val),
8, byte_order);
prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f));
static int
ia64_libunwind_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
+ struct frame_info *this_frame,
+ void **this_cache)
{
if (libunwind_is_initialized ()
&& libunwind_frame_sniffer (self, this_frame, this_cache))
static void
ia64_libunwind_sigtramp_frame_this_id (struct frame_info *this_frame,
- void **this_cache,
+ void **this_cache,
struct frame_id *this_id)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
/* If the previous frame pc value is 0, then we want to use the SIGCONTEXT
method of getting previous registers. */
prev_ip_val = libunwind_frame_prev_register (this_frame, this_cache,
- IA64_IP_REGNUM);
+ IA64_IP_REGNUM);
prev_ip = extract_unsigned_integer (value_contents_all (prev_ip_val),
8, byte_order);
{
void *tmp_cache = NULL;
return ia64_sigtramp_frame_prev_register (this_frame, &tmp_cache,
- regnum);
+ regnum);
}
else
return ia64_libunwind_frame_prev_register (this_frame, this_cache, regnum);
static int
ia64_libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_cache)
+ struct frame_info *this_frame,
+ void **this_cache)
{
if (libunwind_is_initialized ())
{
if (libunwind_sigtramp_frame_sniffer (self, this_frame, this_cache))
- return 1;
+ return 1;
return 0;
}
else
ia64_struct_type_p (const struct type *type)
{
return (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION);
+ || type->code () == TYPE_CODE_UNION);
}
static void
else if (!ia64_struct_type_p (type) && TYPE_LENGTH (type) < 8)
{
/* This is an integral value, and its size is less than 8 bytes.
- These values are LSB-aligned, so extract the relevant bytes,
- and copy them into VALBUF. */
+ These values are LSB-aligned, so extract the relevant bytes,
+ and copy them into VALBUF. */
/* brobecker/2005-12-30: Actually, all integral values are LSB aligned,
so I suppose we should also add handling here for integral values
whose size is greater than 8. But I wasn't able to create such
if (m)
{
- regcache_cooked_read_unsigned (regcache, regnum, &val);
+ regcache_cooked_read_unsigned (regcache, regnum, &val);
memcpy ((char *)valbuf + offset, &val, m);
}
}
{
ULONGEST val;
memcpy (&val, (char *)valbuf + offset, m);
- regcache_cooked_write_unsigned (regcache, regnum, val);
+ regcache_cooked_write_unsigned (regcache, regnum, val);
}
}
}
struct obj_section *pc_section = find_pc_section (pc);
if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
- return pc;
+ return pc;
}
/* There are also descriptors embedded in vtables. */
/* Special handling for function parameters. */
if (len == 8
- && type->code () == TYPE_CODE_PTR
- && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC)
+ && type->code () == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC)
{
gdb_byte val_buf[8];
ULONGEST faddr = extract_unsigned_integer (value_contents (arg),
gdb_byte val_buf[8];
memset (val_buf, 0, 8);
- if (!ia64_struct_type_p (type) && len < 8)
- {
- /* Integral types are LSB-aligned, so we have to be careful
- to insert the argument on the correct side of the buffer.
- This is why we use store_unsigned_integer. */
- store_unsigned_integer
- (val_buf, 8, byte_order,
- extract_unsigned_integer (value_contents (arg), len,
+ if (!ia64_struct_type_p (type) && len < 8)
+ {
+ /* Integral types are LSB-aligned, so we have to be careful
+ to insert the argument on the correct side of the buffer.
+ This is why we use store_unsigned_integer. */
+ store_unsigned_integer
+ (val_buf, 8, byte_order,
+ extract_unsigned_integer (value_contents (arg), len,
byte_order));
- }
- else
- {
- /* This is either an 8bit integral type, or an aggregate.
- For 8bit integral type, there is no problem, we just
- copy the value over.
-
- For aggregates, the only potentially tricky portion
- is to write the last one if it is less than 8 bytes.
- In this case, the data is Byte0-aligned. Happy news,
- this means that we don't need to differentiate the
- handling of 8byte blocks and less-than-8bytes blocks. */
- memcpy (val_buf, value_contents (arg) + argoffset,
- (len > 8) ? 8 : len);
- }
+ }
+ else
+ {
+ /* This is either an 8bit integral type, or an aggregate.
+ For 8bit integral type, there is no problem, we just
+ copy the value over.
+
+ For aggregates, the only potentially tricky portion
+ is to write the last one if it is less than 8 bytes.
+ In this case, the data is Byte0-aligned. Happy news,
+ this means that we don't need to differentiate the
+ handling of 8byte blocks and less-than-8bytes blocks. */
+ memcpy (val_buf, value_contents (arg) + argoffset,
+ (len > 8) ? 8 : len);
+ }
if (slotnum < rseslots)
tdep->infcall_ops.store_argument_in_slot (regcache, bsp,
set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
#ifdef HAVE_LIBUNWIND_IA64_H
frame_unwind_append_unwinder (gdbarch,
- &ia64_libunwind_sigtramp_frame_unwind);
+ &ia64_libunwind_sigtramp_frame_unwind);
frame_unwind_append_unwinder (gdbarch, &ia64_libunwind_frame_unwind);
frame_unwind_append_unwinder (gdbarch, &ia64_sigtramp_frame_unwind);
libunwind_frame_set_descr (gdbarch, &ia64_libunwind_descr);
/* Store the argument stored in BUF into the appropriate location
given the BSP and the SLOTNUM. */
void (*store_argument_in_slot) (struct regcache *regcache, CORE_ADDR bsp,
- int slotnum, gdb_byte *buf);
+ int slotnum, gdb_byte *buf);
/* For targets where we cannot call the function directly, store
the address of the function we want to call at the location
static int
ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
- unw_proc_info_t *pi,
- int need_unwind_info, void *arg)
+ unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte buf[32];
unsigned int info_len;
res = target_read (current_top_target (), TARGET_OBJECT_OPENVMS_UIB,
- annex + 2, buf, 0, sizeof (buf));
+ annex + 2, buf, 0, sizeof (buf));
if (res != sizeof (buf))
return -UNW_ENOINFO;
pi->unwind_info = xmalloc (pi->unwind_info_size);
res = target_read_memory (table_addr + 8,
- (gdb_byte *) pi->unwind_info, pi->unwind_info_size);
+ (gdb_byte *) pi->unwind_info, pi->unwind_info_size);
if (res != 0)
{
xfree (pi->unwind_info);
static void
ia64_vms_put_unwind_info (unw_addr_space_t as,
- unw_proc_info_t *pip, void *arg)
+ unw_proc_info_t *pip, void *arg)
{
/* Nothing required for now. */
}
static int
ia64_vms_get_dyn_info_list (unw_addr_space_t as,
- unw_word_t *dilap, void *arg)
+ unw_word_t *dilap, void *arg)
{
return -UNW_ENOINFO;
}
we print this instead. */
#define RAW_FUNCTION_ADDRESS_FORMAT "at 0x%s"
#define RAW_FUNCTION_ADDRESS_SIZE (sizeof (RAW_FUNCTION_ADDRESS_FORMAT) \
- + 2 * sizeof (CORE_ADDR))
+ + 2 * sizeof (CORE_ADDR))
/* NOTE: cagney/2003-04-16: What's the future of this code?
type = builtin->builtin_int;
}
/* Currently all target ABIs require at least the width of an integer
- type for an argument. We may have to conditionalize the following
- type coercion for future targets. */
+ type for an argument. We may have to conditionalize the following
+ type coercion for future targets. */
if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin->builtin_int))
type = builtin->builtin_int;
break;
break;
case TYPE_CODE_ARRAY:
/* Arrays are coerced to pointers to their first element, unless
- they are vectors, in which case we want to leave them alone,
- because they are passed by value. */
+ they are vectors, in which case we want to leave them alone,
+ because they are passed by value. */
if (current_language->c_style_arrays_p ())
if (!type->is_vector ())
type = lookup_pointer_type (TYPE_TARGET_TYPE (type));
else if (ftype->code () == TYPE_CODE_INT)
{
/* Handle the case of functions lacking debugging info.
- Their values are characters since their addresses are char. */
+ Their values are characters since their addresses are char. */
if (TYPE_LENGTH (ftype) == 1)
funaddr = value_as_address (value_addr (function));
else
do is add FRAME_ALIGN() to the architecture vector. If that
fails, try dummy_id().
- If the ABI specifies a "Red Zone" (see the doco) the code
- below will quietly trash it. */
+ If the ABI specifies a "Red Zone" (see the doco) the code
+ below will quietly trash it. */
sp = old_sp;
/* Skip over the stack temporaries that might have been generated during
struct value *lastval;
lastval = get_last_thread_stack_temporary (call_thread.get ());
- if (lastval != NULL)
+ if (lastval != NULL)
{
CORE_ADDR lastval_addr = value_address (lastval);
if (e.reason < 0)
{
const char *name = get_function_name (funaddr,
- name_buf, sizeof (name_buf));
+ name_buf, sizeof (name_buf));
discard_infcall_control_state (inf_status.release ());
/* We could discard the dummy frame here if the program exited,
- but it will get garbage collected the next time the program is
- run anyway. */
+ but it will get garbage collected the next time the program is
+ run anyway. */
switch (e.reason)
{
discard_infcall_control_state (inf_status.release ());
/* We could discard the dummy frame here given that the program exited,
- but it will get garbage collected the next time the program is
- run anyway. */
+ but it will get garbage collected the next time the program is
+ run anyway. */
error (_("The program being debugged exited while in a function "
"called from GDB.\n"
if (current_inferior ()->argc != 0)
{
gdb::array_view<char * const> args (current_inferior ()->argv,
- current_inferior ()->argc);
+ current_inferior ()->argc);
std::string n = construct_inferior_arguments (args);
set_inferior_args (n.c_str ());
}
else if (stat != 0)
{
/* There may be several breakpoints in the same place, so this
- isn't as strange as it seems. */
+ isn't as strange as it seems. */
while (stat != 0)
{
if (stat < 0)
if (p != 0 && val != 0)
{
/* We have both a space and an equals. If the space is before the
- equals, walk forward over the spaces til we see a nonspace
- (possibly the equals). */
+ equals, walk forward over the spaces til we see a nonspace
+ (possibly the equals). */
if (p > val)
while (*val == ' ')
val++;
/* Now if the = is after the char following the spaces,
- take the char following the spaces. */
+ take the char following the spaces. */
if (p > val)
p = val - 1;
}
if (var == 0)
{
/* If there is no argument, delete all environment variables.
- Ask for confirmation if reading from the terminal. */
+ Ask for confirmation if reading from the terminal. */
if (!from_tty || query (_("Delete all environment variables? ")))
current_inferior ()->environment.clear ();
}
{
value_column_1 = 15,
/* Give enough room for "0x", 16 hex digits and two spaces in
- preceding column. */
+ preceding column. */
value_column_2 = value_column_1 + 2 + 16 + 2,
};
for (i = 0; i < numregs; i++)
{
/* Decide between printing all regs, non-float / vector regs, or
- specific reg. */
+ specific reg. */
if (regnum == -1)
{
if (print_all)
}
/* If the register name is empty, it is undefined for this
- processor, so don't display anything. */
+ processor, so don't display anything. */
if (gdbarch_register_name (gdbarch, i) == NULL
|| *(gdbarch_register_name (gdbarch, i)) == '\0')
continue;
addr_exp = skip_spaces (addr_exp);
/* Discard any leading ``$''. Check that there is something
- resembling a register following it. */
+ resembling a register following it. */
if (addr_exp[0] == '$')
addr_exp++;
if (isspace ((*addr_exp)) || (*addr_exp) == '\0')
&cmdlist);
add_setshow_boolean_cmd ("inferior-events", no_class,
- &print_inferior_events, _("\
+ &print_inferior_events, _("\
Set printing of inferior events (such as inferior start and exit)."), _("\
Show printing of inferior events (such as inferior start and exit)."), NULL,
- NULL,
- show_print_inferior_events,
- &setprintlist, &showprintlist);
+ NULL,
+ show_print_inferior_events,
+ &setprintlist, &showprintlist);
create_internalvar_type_lazy ("_inferior", &inferior_funcs, NULL);
}
{
/* Fix up the resulting state. */
gdbarch_displaced_step_fixup (displaced->step_gdbarch,
- displaced->step_closure.get (),
- displaced->step_original,
- displaced->step_copy,
- get_thread_regcache (displaced->step_thread));
+ displaced->step_closure.get (),
+ displaced->step_original,
+ displaced->step_copy,
+ get_thread_regcache (displaced->step_thread));
ret = 1;
}
else
{
/* Since the instruction didn't complete, all we can do is
- relocate the PC. */
+ relocate the PC. */
struct regcache *regcache = get_thread_regcache (event_thread);
CORE_ADDR pc = regcache_read_pc (regcache);
record that we tried to step a breakpoint instruction, so
that adjust_pc_after_break doesn't end up confused.
- - In non-stop if we insert a breakpoint (e.g., a step-resume)
+ - In non-stop if we insert a breakpoint (e.g., a step-resume)
in one thread after another thread that was stepping had been
momentarily paused for a step-over. When we re-resume the
stepping thread, it may be resumed from that address with a
}
infrun_debug_printf ("resuming %s",
- target_pid_to_str (tp->ptid).c_str ());
+ target_pid_to_str (tp->ptid).c_str ());
reset_ecs (ecs, tp);
switch_to_thread (tp);
if (!non_stop)
{
for (thread_info *thr : all_non_exited_threads ())
- {
+ {
if (thr->thread_fsm == NULL)
continue;
if (thr == ecs->event_thread)
}
/* Use debug_prefixed_printf directly to get a meaningful function
- name. */
+ name. */
if (debug_infrun)
debug_prefixed_printf ("infrun", "stop_all_threads", "done");
};
#0 - thread 1 is left stopped
#1 - thread 2 is resumed and hits breakpoint
- -> TARGET_WAITKIND_STOPPED
+ -> TARGET_WAITKIND_STOPPED
#2 - thread 3 is resumed and exits
- this is the last resumed thread, so
+ this is the last resumed thread, so
-> TARGET_WAITKIND_NO_RESUMED
#3 - gdb processes stop for thread 2 and decides to re-resume
- it.
+ it.
#4 - gdb processes the TARGET_WAITKIND_NO_RESUMED event.
- thread 2 is now resumed, so the event should be ignored.
+ thread 2 is now resumed, so the event should be ignored.
IOW, if the stop for thread 2 doesn't end a foreground command,
then we need to ignore the following TARGET_WAITKIND_NO_RESUMED
case TARGET_WAITKIND_LOADED:
context_switch (ecs);
/* Ignore gracefully during startup of the inferior, as it might
- be the shell which has just loaded some objects, otherwise
- add the symbols for the newly loaded objects. Also ignore at
- the beginning of an attach or remote session; we will query
- the full list of libraries once the connection is
- established. */
+ be the shell which has just loaded some objects, otherwise
+ add the symbols for the newly loaded objects. Also ignore at
+ the beginning of an attach or remote session; we will query
+ the full list of libraries once the connection is
+ established. */
stop_soon = get_inferior_stop_soon (ecs);
if (stop_soon == NO_STOP_QUIETLY)
handle_vfork_child_exec_or_exit (1);
/* This causes the eventpoints and symbol table to be reset.
- Must do this now, before trying to determine whether to
- stop. */
+ Must do this now, before trying to determine whether to
+ stop. */
follow_exec (inferior_ptid, ecs->ws.value.execd_pathname);
/* In follow_exec we may have deleted the original thread and
return;
/* Be careful not to try to gather much state about a thread
- that's in a syscall. It's frequently a losing proposition. */
+ that's in a syscall. It's frequently a losing proposition. */
case TARGET_WAITKIND_SYSCALL_ENTRY:
/* Getting the current syscall number. */
if (handle_syscall_event (ecs) == 0)
return;
/* Before examining the threads further, step this thread to
- get it entirely out of the syscall. (We get notice of the
- event when the thread is just on the verge of exiting a
- syscall. Stepping one instruction seems to get it back
- into user code.) */
+ get it entirely out of the syscall. (We get notice of the
+ event when the thread is just on the verge of exiting a
+ syscall. Stepping one instruction seems to get it back
+ into user code.) */
case TARGET_WAITKIND_SYSCALL_RETURN:
if (handle_syscall_event (ecs) == 0)
process_event_stop_test (ecs);
infrun_debug_printf ("saved stop_pc=%s for %s "
"(currently_stepping=%d)",
paddress (target_gdbarch (),
- tp->suspend.stop_pc),
+ tp->suspend.stop_pc),
target_pid_to_str (tp->ptid).c_str (),
currently_stepping (tp));
ecs->event_thread->suspend.stop_pc));
if (target_stopped_by_watchpoint ())
{
- CORE_ADDR addr;
+ CORE_ADDR addr;
infrun_debug_printf ("stopped by watchpoint");
if (target_stopped_data_address (current_top_target (), &addr))
infrun_debug_printf ("stopped data address=%s",
- paddress (reg_gdbarch, addr));
- else
+ paddress (reg_gdbarch, addr));
+ else
infrun_debug_printf ("(no data address available)");
}
}
|| gdbarch_have_nonsteppable_watchpoint (gdbarch)))
{
/* At this point, we are stopped at an instruction which has
- attempted to write to a piece of memory under control of
- a watchpoint. The instruction hasn't actually executed
- yet. If we were to evaluate the watchpoint expression
- now, we would get the old value, and therefore no change
- would seem to have occurred.
-
- In order to make watchpoints work `right', we really need
- to complete the memory write, and then evaluate the
- watchpoint expression. We do this by single-stepping the
+ attempted to write to a piece of memory under control of
+ a watchpoint. The instruction hasn't actually executed
+ yet. If we were to evaluate the watchpoint expression
+ now, we would get the old value, and therefore no change
+ would seem to have occurred.
+
+ In order to make watchpoints work `right', we really need
+ to complete the memory write, and then evaluate the
+ watchpoint expression. We do this by single-stepping the
target.
It may not be necessary to disable the watchpoint to step over
{
/* The user issued a continue when stopped at a breakpoint.
Set up for another trap and get out of here. */
- ecs->event_thread->stepping_over_breakpoint = 1;
- keep_going (ecs);
- return;
+ ecs->event_thread->stepping_over_breakpoint = 1;
+ keep_going (ecs);
+ return;
}
else if (step_through_delay)
{
infrun_debug_printf ("step-resume breakpoint is inserted");
/* Having a step-resume breakpoint overrides anything
- else having to do with stepping commands until
- that breakpoint is reached. */
+ else having to do with stepping commands until
+ that breakpoint is reached. */
keep_going (ecs);
return;
}
{
infrun_debug_printf ("stepped into signal trampoline");
/* The inferior, while doing a "step" or "next", has ended up in
- a signal trampoline (either by a signal being delivered or by
- the signal handler returning). Just single-step until the
- inferior leaves the trampoline (either by calling the handler
- or returning). */
+ a signal trampoline (either by a signal being delivered or by
+ the signal handler returning). Just single-step until the
+ inferior leaves the trampoline (either by calling the handler
+ or returning). */
keep_going (ecs);
return;
}
}
/* If we are in a function call trampoline (a stub between the
- calling routine and the real function), locate the real
- function. That's what tells us (a) whether we want to step
- into it at all, and (b) what prologue we want to run to the
- end of, if we do step into it. */
+ calling routine and the real function), locate the real
+ function. That's what tells us (a) whether we want to step
+ into it at all, and (b) what prologue we want to run to the
+ end of, if we do step into it. */
real_stop_pc = skip_language_trampoline (frame, stop_pc);
if (real_stop_pc == 0)
real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
thinking of stepping into and the function isn't on the skip
list, step into it.
- If there are several symtabs at that PC (e.g. with include
- files), just want to know whether *any* of them have line
- numbers. find_pc_line handles this. */
+ If there are several symtabs at that PC (e.g. with include
+ files), just want to know whether *any* of them have line
+ numbers. find_pc_line handles this. */
{
struct symtab_and_line tmp_sal;
}
/* If we have no line number and the step-stop-if-no-debug is
- set, we stop the step so that the user has a chance to switch
- in assembly mode. */
+ set, we stop the step so that the user has a chance to switch
+ in assembly mode. */
if (ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
&& step_stop_if_no_debug)
{
infrun_debug_printf ("stepped into undebuggable function");
/* The inferior just stepped into, or returned to, an
- undebuggable function (where there is no debugging information
- and no line number corresponding to the address where the
- inferior stopped). Since we want to skip this kind of code,
- we keep going until the inferior returns from this
- function - unless the user has asked us not to (via
- set step-mode) or we no longer know how to get back
- to the call site. */
+ undebuggable function (where there is no debugging information
+ and no line number corresponding to the address where the
+ inferior stopped). Since we want to skip this kind of code,
+ we keep going until the inferior returns from this
+ function - unless the user has asked us not to (via
+ set step-mode) or we no longer know how to get back
+ to the call site. */
if (step_stop_if_no_debug
|| !frame_id_p (frame_unwind_caller_id (frame)))
{
if (ecs->event_thread->control.step_range_end == 1)
{
/* It is stepi or nexti. We always want to stop stepping after
- one instruction. */
+ one instruction. */
infrun_debug_printf ("stepi/nexti");
end_stepping_range (ecs);
return;
if (stop_pc_sal.line == 0)
{
/* We have no line number information. That means to stop
- stepping (does this always happen right after one instruction,
- when we do "s" in a function with no line numbers,
- or can this happen as a result of a return or longjmp?). */
+ stepping (does this always happen right after one instruction,
+ when we do "s" in a function with no line numbers,
+ or can this happen as a result of a return or longjmp?). */
infrun_debug_printf ("line number info");
end_stepping_range (ecs);
return;
stepping_thread = NULL;
for (thread_info *tp : all_non_exited_threads ())
- {
+ {
switch_to_thread_no_regs (tp);
/* Ignore threads of processes the caller is not
sr_sal.pspace = get_frame_program_space (get_current_frame ());
/* Do not specify what the fp should be when we stop since on
- some machines the prologue is where the new fp value is
- established. */
+ some machines the prologue is where the new fp value is
+ established. */
insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal, null_frame_id);
/* And make sure stepping stops right away then. */
ecs->event_thread->control.step_range_end
- = ecs->event_thread->control.step_range_start;
+ = ecs->event_thread->control.step_range_start;
}
keep_going (ecs);
}
}
/* If any signal numbers or symbol names were found, set flags for
- which signals to apply actions to. */
+ which signals to apply actions to. */
for (int signum = sigfirst; signum >= 0 && signum <= siglast; signum++)
{
/* Capture state from GDBARCH, TP, and REGCACHE that must be restored
once the inferior function call has finished. */
infcall_suspend_state (struct gdbarch *gdbarch,
- const struct thread_info *tp,
- struct regcache *regcache)
+ const struct thread_info *tp,
+ struct regcache *regcache)
: m_thread_suspend (tp->suspend),
m_registers (new readonly_detached_regcache (*regcache))
{
if (gdbarch_get_siginfo_type_p (gdbarch))
{
- struct type *type = gdbarch_get_siginfo_type (gdbarch);
- size_t len = TYPE_LENGTH (type);
+ struct type *type = gdbarch_get_siginfo_type (gdbarch);
+ size_t len = TYPE_LENGTH (type);
- siginfo_data.reset ((gdb_byte *) xmalloc (len));
+ siginfo_data.reset ((gdb_byte *) xmalloc (len));
- if (target_read (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
- siginfo_data.get (), 0, len) != len)
- {
- /* Errors ignored. */
- siginfo_data.reset (nullptr);
- }
+ if (target_read (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
+ siginfo_data.get (), 0, len) != len)
+ {
+ /* Errors ignored. */
+ siginfo_data.reset (nullptr);
+ }
}
if (siginfo_data)
{
- m_siginfo_gdbarch = gdbarch;
- m_siginfo_data = std::move (siginfo_data);
+ m_siginfo_gdbarch = gdbarch;
+ m_siginfo_data = std::move (siginfo_data);
}
}
/* Restores the stored state into GDBARCH, TP, and REGCACHE. */
void restore (struct gdbarch *gdbarch,
- struct thread_info *tp,
- struct regcache *regcache) const
+ struct thread_info *tp,
+ struct regcache *regcache) const
{
tp->suspend = m_thread_suspend;
if (m_siginfo_gdbarch == gdbarch)
{
- struct type *type = gdbarch_get_siginfo_type (gdbarch);
+ struct type *type = gdbarch_get_siginfo_type (gdbarch);
- /* Errors ignored. */
- target_write (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
- m_siginfo_data.get (), 0, TYPE_LENGTH (type));
+ /* Errors ignored. */
+ target_write (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
+ m_siginfo_data.get (), 0, TYPE_LENGTH (type));
}
/* The inferior can be gone if the user types "print exit(0)"
Show mode for locking scheduler during execution."), _("\
off == no locking (threads may preempt at any time)\n\
on == full locking (no thread except the current thread may run)\n\
- This applies to both normal execution and replay mode.\n\
+ This applies to both normal execution and replay mode.\n\
step == scheduler locked during stepping commands (step, next, stepi, nexti).\n\
- In this mode, other threads may run during other commands.\n\
- This applies to both normal execution and replay mode.\n\
+ In this mode, other threads may run during other commands.\n\
+ This applies to both normal execution and replay mode.\n\
replay == scheduler locked in replay mode and unlocked during normal execution."),
set_schedlock_func, /* traps on target vector */
show_scheduler_mode,
{
LONGEST insn = read_memory_unsigned_integer (pc, 4, byte_order);
/* Skip any instructions writing to (sp) or decrementing the
- SP. */
+ SP. */
if ((insn & 0xffe00000) == 0xac200000)
{
/* sw using SP/%1 as base. */
}
/* Unknown instruction encountered in frame. Bail out?
- 1) If we have a subsequent line symbol, we can keep going.
- 2) If not, we need to bail out and quit scanning instructions. */
+ 1) If we have a subsequent line symbol, we can keep going.
+ 2) If not, we need to bail out and quit scanning instructions. */
if (fi && sal.end && (pc < sal.end)) /* Keep scanning. */
continue;
if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != -1)
return frame_unwind_got_memory (this_frame, regnum,
- cache->saved_regs[regnum]);
+ cache->saved_regs[regnum]);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
static CORE_ADDR
iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
type = value_type (args[i]);
typelen = TYPE_LENGTH (type);
if (typelen <= 4)
- {
- /* Scalars of up to 4 bytes,
- structs of up to 4 bytes, and
- pointers. */
- if (argreg <= E_LAST_ARGREG)
- argreg++;
- else
- stackspace += 4;
- }
+ {
+ /* Scalars of up to 4 bytes,
+ structs of up to 4 bytes, and
+ pointers. */
+ if (argreg <= E_LAST_ARGREG)
+ argreg++;
+ else
+ stackspace += 4;
+ }
else if (typelen == 8 && !iq2000_pass_8bytetype_by_address (type))
- {
- /* long long,
- double, and possibly
- structs with a single field of long long or double. */
- if (argreg <= E_LAST_ARGREG - 1)
- {
- /* 8-byte arg goes into a register pair
- (must start with an even-numbered reg). */
- if (((argreg - E_1ST_ARGREG) % 2) != 0)
- argreg ++;
- argreg += 2;
- }
- else
- {
- argreg = E_LAST_ARGREG + 1; /* no more argregs. */
- /* 8-byte arg goes on stack, must be 8-byte aligned. */
- stackspace = ((stackspace + 7) & ~7);
- stackspace += 8;
- }
- }
+ {
+ /* long long,
+ double, and possibly
+ structs with a single field of long long or double. */
+ if (argreg <= E_LAST_ARGREG - 1)
+ {
+ /* 8-byte arg goes into a register pair
+ (must start with an even-numbered reg). */
+ if (((argreg - E_1ST_ARGREG) % 2) != 0)
+ argreg ++;
+ argreg += 2;
+ }
+ else
+ {
+ argreg = E_LAST_ARGREG + 1; /* no more argregs. */
+ /* 8-byte arg goes on stack, must be 8-byte aligned. */
+ stackspace = ((stackspace + 7) & ~7);
+ stackspace += 8;
+ }
+ }
else
{
/* Structs are passed as pointer to a copy of the struct.
So we need room on the stack for a copy of the struct
plus for the argument pointer. */
- if (argreg <= E_LAST_ARGREG)
- argreg++;
- else
- stackspace += 4;
+ if (argreg <= E_LAST_ARGREG)
+ argreg++;
+ else
+ stackspace += 4;
/* Care for 8-byte alignment of structs saved on stack. */
stackspace += ((typelen + 7) & ~7);
}
typelen = TYPE_LENGTH (type);
val = value_contents (args[i]);
if (typelen <= 4)
- {
- /* Char, short, int, float, pointer, and structs <= four bytes. */
+ {
+ /* Char, short, int, float, pointer, and structs <= four bytes. */
slacklen = (4 - (typelen % 4)) % 4;
memset (buf, 0, sizeof (buf));
memcpy (buf + slacklen, val, typelen);
- if (argreg <= E_LAST_ARGREG)
- {
- /* Passed in a register. */
+ if (argreg <= E_LAST_ARGREG)
+ {
+ /* Passed in a register. */
regcache->raw_write (argreg++, buf);
- }
- else
- {
- /* Passed on the stack. */
- write_memory (sp + stackspace, buf, 4);
- stackspace += 4;
- }
- }
+ }
+ else
+ {
+ /* Passed on the stack. */
+ write_memory (sp + stackspace, buf, 4);
+ stackspace += 4;
+ }
+ }
else if (typelen == 8 && !iq2000_pass_8bytetype_by_address (type))
- {
- /* (long long), (double), or struct consisting of
- a single (long long) or (double). */
- if (argreg <= E_LAST_ARGREG - 1)
- {
- /* 8-byte arg goes into a register pair
- (must start with an even-numbered reg). */
- if (((argreg - E_1ST_ARGREG) % 2) != 0)
- argreg++;
+ {
+ /* (long long), (double), or struct consisting of
+ a single (long long) or (double). */
+ if (argreg <= E_LAST_ARGREG - 1)
+ {
+ /* 8-byte arg goes into a register pair
+ (must start with an even-numbered reg). */
+ if (((argreg - E_1ST_ARGREG) % 2) != 0)
+ argreg++;
regcache->raw_write (argreg++, val);
regcache->raw_write (argreg++, val + 4);
- }
- else
- {
- /* 8-byte arg goes on stack, must be 8-byte aligned. */
- argreg = E_LAST_ARGREG + 1; /* no more argregs. */
- stackspace = ((stackspace + 7) & ~7);
- write_memory (sp + stackspace, val, typelen);
- stackspace += 8;
- }
- }
+ }
+ else
+ {
+ /* 8-byte arg goes on stack, must be 8-byte aligned. */
+ argreg = E_LAST_ARGREG + 1; /* no more argregs. */
+ stackspace = ((stackspace + 7) & ~7);
+ write_memory (sp + stackspace, val, typelen);
+ stackspace += 8;
+ }
+ }
else
- {
+ {
/* Store struct beginning at the upper end of the previously
computed stack space. Then store the address of the struct
using the usual rules for a 4 byte value. */
write_memory (sp + stackspace, buf, 4);
stackspace += 4;
}
- }
+ }
}
/* Store return address. */
if (lang->la_language == language_auto)
{
/* Enter auto mode. Set to the current frame's language, if
- known, or fallback to the initial language. */
+ known, or fallback to the initial language. */
language_mode = language_mode_auto;
try
{
break;
case range_check_off:
/* FIXME: cagney/2002-01-30: Should this function print anything
- when range error is off? */
+ when range error is off? */
vfprintf_filtered (gdb_stderr, string, args);
fprintf_filtered (gdb_stderr, "\n");
break;
case '+': case '-':
case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- if (!linespec_lexer_lex_number (parser, &(parser->lexer.current)))
+ case '5': case '6': case '7': case '8': case '9':
+ if (!linespec_lexer_lex_number (parser, &(parser->lexer.current)))
parser->lexer.current = linespec_lexer_lex_string (parser);
- break;
+ break;
case ':':
/* If we have a scope operator, lex the input as a string.
t = check_typedef (t);
/* Loop over each method name. At this level, all overloads of a name
- are counted as a single name. There is an inner loop which loops over
- each overload. */
+ are counted as a single name. There is an inner loop which loops over
+ each overload. */
for (method_counter = TYPE_NFN_FIELDS (t) - 1;
method_counter >= 0;
{
if (function != NULL)
throw_error (NOT_FOUND_ERROR,
- _("No label \"%s\" defined in function \"%s\"."),
- label, function);
+ _("No label \"%s\" defined in function \"%s\"."),
+ label, function);
else
throw_error (NOT_FOUND_ERROR,
- _("No label \"%s\" defined in current function."),
- label);
+ _("No label \"%s\" defined in current function."),
+ label);
}
/* Throw a source file not found error. */
= new std::vector<block_symbol> (std::move (symbols));
PARSER_RESULT (parser)->minimal_symbols
= new std::vector<bound_minimal_symbol>
- (std::move (minimal_symbols));
+ (std::move (minimal_symbols));
PARSER_EXPLICIT (parser)->function_name = name.release ();
}
else
label_name_spec -> STRING
function_name_spec -> STRING
offset_spec -> NUMBER
- -> '+' NUMBER
+ -> '+' NUMBER
-> '-' NUMBER
This may all be followed by several keywords such as "if EXPR",
if (*default_symtab == 0)
{
/* Use whatever we have for the default source line. We don't use
- get_current_or_default_symtab_and_line as it can recurse and call
+ get_current_or_default_symtab_and_line as it can recurse and call
us back! */
struct symtab_and_line cursal =
get_current_source_symtab_and_line ();
if (search_pspace == NULL)
{
for (struct program_space *pspace : program_spaces)
- {
+ {
if (pspace->executing_startup)
continue;
|| (parent != NULL && parent->state == THREAD_STOPPED))
{
if (inferior_call_waitpid (pptid, ptid.pid ()))
- warning (_("Unable to wait pid %s"),
+ warning (_("Unable to wait pid %s"),
target_pid_to_str (ptid).c_str ());
}
}
{
int target_signo = gdb_signal_from_host (signo);
if (target_signo < pass_signals.size () && pass_signals[target_signo])
- sigaddset (&pass_mask, signo);
+ sigaddset (&pass_mask, signo);
}
}
ptrace stop. Make sure it is in a ptrace stop; from there we
can kill it, signal it, et cetera.
- First make sure there is a pending SIGSTOP. Since we are
+ First make sure there is a pending SIGSTOP. Since we are
already attached, the process can not transition from stopped
to running without a PTRACE_CONT; so we know this signal will
go into the queue. The SIGSTOP generated by PTRACE_ATTACH is
static enum target_xfer_status
linux_xfer_siginfo (enum target_object object,
- const char *annex, gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
ULONGEST *addr, ULONGEST *endaddr,
const char **permissions, size_t *permissions_len,
ULONGEST *offset,
- const char **device, size_t *device_len,
+ const char **device, size_t *device_len,
ULONGEST *inode,
const char **filename)
{
"Start Addr",
" End Addr",
" Size", " Offset", "objfile");
- }
+ }
else
- {
+ {
printf_filtered (" %18s %18s %10s %10s %s\n",
"Start Addr",
" End Addr",
&inode, &mapping_filename);
if (gdbarch_addr_bit (gdbarch) == 32)
- {
- printf_filtered ("\t%10s %10s %10s %10s %s\n",
+ {
+ printf_filtered ("\t%10s %10s %10s %10s %s\n",
paddress (gdbarch, addr),
paddress (gdbarch, endaddr),
hex_string (endaddr - addr),
*mapping_filename ? mapping_filename : "");
}
else
- {
- printf_filtered (" %18s %18s %10s %10s %s\n",
+ {
+ printf_filtered (" %18s %18s %10s %10s %s\n",
paddress (gdbarch, addr),
paddress (gdbarch, endaddr),
hex_string (endaddr - addr),
hex_string (offset),
*mapping_filename ? mapping_filename : "");
- }
+ }
}
}
else
linux_read_core_file_mappings (struct gdbarch *gdbarch,
struct bfd *cbfd,
gdb::function_view<void (ULONGEST count)>
- pre_loop_cb,
+ pre_loop_cb,
gdb::function_view<void (int num,
- ULONGEST start,
+ ULONGEST start,
ULONGEST end,
ULONGEST file_ofs,
const char *filename,
for (int i = 0; i < count; i++)
{
if (f >= descend)
- {
+ {
warning (_("malformed note - filename area is too small"));
return;
}
ULONGEST end = bfd_get (addr_size_bits, core_bfd, descdata);
descdata += addr_size;
ULONGEST file_ofs
- = bfd_get (addr_size_bits, core_bfd, descdata) * page_size;
+ = bfd_get (addr_size_bits, core_bfd, descdata) * page_size;
descdata += addr_size;
char * filename = filenames;
filenames += strlen ((char *) filenames) + 1;
}
},
[=] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
- const char *filename, const void *other)
+ const char *filename, const void *other)
{
if (gdbarch_addr_bit (gdbarch) == 32)
printf_filtered ("\t%10s %10s %10s %10s %s\n",
if (has_anonymous)
should_dump_p = should_dump_mapping_p (filterflags, &v, priv,
- mapping_anon_p,
+ mapping_anon_p,
mapping_file_p,
- filename, addr, offset);
+ filename, addr, offset);
else
{
/* Older Linux kernels did not support the "Anonymous:" counter.
fprintf_unfiltered (gdb_stdlog, _("td_ta_new failed: %s\n"),
thread_db_err_str (err));
else
- switch (err)
- {
- case TD_NOLIBTHREAD:
+ switch (err)
+ {
+ case TD_NOLIBTHREAD:
#ifdef THREAD_DB_HAS_TD_VERSION
- case TD_VERSION:
+ case TD_VERSION:
#endif
- /* The errors above are not unexpected and silently ignored:
- they just mean we haven't found correct version of
- libthread_db yet. */
- break;
- default:
- warning (_("td_ta_new failed: %s"), thread_db_err_str (err));
- }
+ /* The errors above are not unexpected and silently ignored:
+ they just mean we haven't found correct version of
+ libthread_db yet. */
+ break;
+ default:
+ warning (_("td_ta_new failed: %s"), thread_db_err_str (err));
+ }
return false;
}
else if (thread_db_find_new_threads_silently (inferior_thread ()) != 0)
{
/* Even if libthread_db initializes, if the thread list is
- corrupted, we'd not manage to list any threads. Better reject this
- thread_db, and fall back to at least listing LWPs. */
+ corrupted, we'd not manage to list any threads. Better reject this
+ thread_db, and fall back to at least listing LWPs. */
return false;
}
td_init = dlsym (handle, "td_init");
if (td_init != NULL)
- {
- const char *const libpath = dladdr_to_soname (td_init);
+ {
+ const char *const libpath = dladdr_to_soname (td_init);
- if (libpath != NULL)
- fprintf_unfiltered (gdb_stdlog, _("Host %s resolved to: %s.\n"),
- library, libpath);
- }
+ if (libpath != NULL)
+ fprintf_unfiltered (gdb_stdlog, _("Host %s resolved to: %s.\n"),
+ library, libpath);
+ }
}
info = add_thread_db_info (handle);
thread_db_thread_info *priv = get_thread_db_thread_info (tp);
if (priv != NULL && handle_tid == priv->tid)
- return tp;
+ return tp;
}
return NULL;
/* Now, if libthread_db provided the initialization image's
address, we *could* try to build a non-lvalue value from
the initialization image. */
- throw_error (TLS_NOT_ALLOCATED_YET_ERROR,
- _("TLS not allocated yet"));
+ throw_error (TLS_NOT_ALLOCATED_YET_ERROR,
+ _("TLS not allocated yet"));
#endif
/* Something else went wrong. */
if (err != TD_OK)
- throw_error (TLS_GENERIC_ERROR,
- (("%s")), thread_db_err_str (err));
+ throw_error (TLS_GENERIC_ERROR,
+ (("%s")), thread_db_err_str (err));
/* Cast assuming host == target. Joy. */
/* Do proper sign extension for the target. */
byte_order);
/* First num_arg_regs parameters are passed by registers,
- and the rest are passed on the stack. */
+ and the rest are passed on the stack. */
if (i < num_arg_regs)
regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val);
else
else
{
/* Aggregate types greater than a single register are returned
- in memory. FIXME: Unless they are only 2 regs?. */
+ in memory. FIXME: Unless they are only 2 regs?. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
return_buffer = l;
read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
/* Expressions */
exp : exp '^' %prec UNARY
- { write_exp_elt_opcode (pstate, UNOP_IND); }
+ { write_exp_elt_opcode (pstate, UNOP_IND); }
;
exp : '-'
/* Modula-2 array subscript notation [a,b,c...]. */
exp : exp '['
- /* This function just saves the number of arguments
+ /* This function just saves the number of arguments
that follow in the list. It is *not* specific to
function types */
- { pstate->start_arglist(); }
- non_empty_arglist ']' %prec DOT
+ { pstate->start_arglist(); }
+ non_empty_arglist ']' %prec DOT
{
gdb_assert (pstate->arglist_len > 0);
write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT);
;
non_empty_arglist
- : exp
- { pstate->arglist_len = 1; }
+ : exp
+ { pstate->arglist_len = 1; }
;
non_empty_arglist
- : non_empty_arglist ',' exp %prec ABOVE_COMMA
+ : non_empty_arglist ',' exp %prec ABOVE_COMMA
{ pstate->arglist_len++; }
;
;
exp : type '(' exp ')' %prec UNARY
- { write_exp_elt_opcode (pstate, UNOP_CAST);
+ { write_exp_elt_opcode (pstate, UNOP_CAST);
write_exp_elt_type (pstate, $1);
write_exp_elt_opcode (pstate, UNOP_CAST); }
;
;
exp : exp DIV exp
- { write_exp_elt_opcode (pstate, BINOP_INTDIV); }
- ;
+ { write_exp_elt_opcode (pstate, BINOP_INTDIV); }
+ ;
exp : exp MOD exp
{ write_exp_elt_opcode (pstate, BINOP_REM); }
exp : exp NOTEQUAL exp
{ write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
- | exp '#' exp
- { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
+ | exp '#' exp
+ { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
;
exp : exp LEQ exp
break;
}
toktype = parse_number (p - tokstart);
- if (toktype == ERROR)
+ if (toktype == ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
if (noside == EVAL_SKIP)
goto nosideret;
/* If the user attempts to subscript something that is not an
- array or pointer type (like a plain int variable for example),
- then report this as an error. */
+ array or pointer type (like a plain int variable for example),
+ then report this as an error. */
arg1 = coerce_ref (arg1);
type = check_typedef (value_type (arg1));
}
/* m2_get_discrete_bounds - a wrapper for get_discrete_bounds which
- understands that CHARs might be signed.
- This should be integrated into gdbtypes.c
- inside get_discrete_bounds. */
+ understands that CHARs might be signed.
+ This should be integrated into gdbtypes.c
+ inside get_discrete_bounds. */
static int
m2_get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
}
/* m2_is_long_set_of_type - returns TRUE if the long set was declared as
- SET OF <oftype> of_type is assigned to the
- subtype. */
+ SET OF <oftype> of_type is assigned to the
+ subtype. */
int
m2_is_long_set_of_type (struct type *type, struct type **of_type)
}
/* m2_is_unbounded_array - returns TRUE if, type, should be regarded
- as a Modula-2 unbounded ARRAY type. */
+ as a Modula-2 unbounded ARRAY type. */
int
m2_is_unbounded_array (struct type *type)
}
/* m2_unbounded_array - if the struct type matches a Modula-2 unbounded
- parameter type then display the type as an
- ARRAY OF type. Returns TRUE if an unbounded
- array type was detected. */
+ parameter type then display the type as an
+ ARRAY OF type. Returns TRUE if an unbounded
+ array type was detected. */
static int
m2_unbounded_array (struct type *type, struct ui_file *stream, int show,
/* get_long_set_bounds - assigns the bounds of the long set to low and
- high. */
+ high. */
int
get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
/* m2_print_array_contents - prints out the contents of an
- array up to a max_print values.
- It prints arrays of char as a string
- and all other data types as comma
- separated values. */
+ array up to a max_print values.
+ It prints arrays of char as a string
+ and all other data types as comma
+ separated values. */
static void
m2_print_array_contents (struct value *val,
&& (options->format == 0 || options->format == 's'))
{
/* If requested, look for the first null char and only print
- elements up to it. */
+ elements up to it. */
if (options->stop_print_at_null)
{
unsigned int temp_len;
#define CB(name, raw_pair) \
(add_reg (arch, #name, (raw_pair)->type, 0, \
m32c_banked_read, m32c_banked_write, \
- (raw_pair), (raw_pair + 1), FLAGBIT_B))
+ (raw_pair), (raw_pair + 1), FLAGBIT_B))
/* A pair of registers named NAMEH and NAMEL, of type TYPE, that
access the top and bottom halves of the register pointed to by
{
struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch);
return (value.kind == pvk_register
- && (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c
+ && (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c
? (value.reg == tdep->r1->num)
: (value.reg == tdep->r0->num))
- && value.k == 0);
+ && value.k == 0);
}
/* Return non-zero if VALUE is an incoming argument register. */
{
struct gdbarch_tdep *tdep = gdbarch_tdep (state->arch);
return (value.kind == pvk_register
- && (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c
+ && (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c
? (value.reg == tdep->r1->num || value.reg == tdep->r2->num)
: (value.reg == tdep->r0->num))
- && value.k == 0);
+ && value.k == 0);
}
/* Return non-zero if a store of VALUE to LOC is probably spilling an
return (m32c_is_arg_reg (st, value)
&& loc.kind == srcdest_mem
- && pv_is_register (loc.addr, tdep->sp->num)
- && ! st->stack->find_reg (st->arch, value.reg, 0));
+ && pv_is_register (loc.addr, tdep->sp->num)
+ && ! st->stack->find_reg (st->arch, value.reg, 0));
}
/* Return non-zero if a store of VALUE to LOC is probably
}
/* If this instruction changed the FB or decreased the SP (i.e.,
- allocated more stack space), then this may be a good place to
- declare the prologue finished. However, there are some
- exceptions:
+ allocated more stack space), then this may be a good place to
+ declare the prologue finished. However, there are some
+ exceptions:
- - If the instruction just changed the FB back to its original
- value, then that's probably a restore instruction. The
- prologue should definitely end before that.
+ - If the instruction just changed the FB back to its original
+ value, then that's probably a restore instruction. The
+ prologue should definitely end before that.
- - If the instruction increased the value of the SP (that is,
- shrunk the frame), then it's probably part of a frame
- teardown sequence, and the prologue should end before
- that. */
+ - If the instruction increased the value of the SP (that is,
+ shrunk the frame), then it's probably part of a frame
+ teardown sequence, and the prologue should end before
+ that. */
if (! pv_is_identical (st.fb, pre_insn_fb))
- {
- if (! pv_is_register_k (st.fb, tdep->fb->num, 0))
- after_last_frame_related_insn = st.next_addr;
- }
+ {
+ if (! pv_is_register_k (st.fb, tdep->fb->num, 0))
+ after_last_frame_related_insn = st.next_addr;
+ }
else if (! pv_is_identical (st.sp, pre_insn_sp))
- {
- /* The comparison of the constants looks odd, there, because
- .k is unsigned. All it really means is that the SP is
- lower than it was before the instruction. */
- if ( pv_is_register (pre_insn_sp, tdep->sp->num)
- && pv_is_register (st.sp, tdep->sp->num)
- && ((pre_insn_sp.k - st.sp.k) < (st.sp.k - pre_insn_sp.k)))
- after_last_frame_related_insn = st.next_addr;
- }
+ {
+ /* The comparison of the constants looks odd, there, because
+ .k is unsigned. All it really means is that the SP is
+ lower than it was before the instruction. */
+ if ( pv_is_register (pre_insn_sp, tdep->sp->num)
+ && pv_is_register (st.sp, tdep->sp->num)
+ && ((pre_insn_sp.k - st.sp.k) < (st.sp.k - pre_insn_sp.k)))
+ after_last_frame_related_insn = st.next_addr;
+ }
st.scan_pc = st.next_addr;
}
CORE_ADDR stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
- just initialize the prologue cache, but don't do anything. */
+ just initialize the prologue cache, but don't do anything. */
if (! func_start)
- stop_addr = func_start;
+ stop_addr = func_start;
*this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct m32c_prologue);
m32c_analyze_prologue (get_frame_arch (this_frame),
static CORE_ADDR
m32c_frame_base (struct frame_info *this_frame,
- void **this_prologue_cache)
+ void **this_prologue_cache)
{
struct m32c_prologue *p
= m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
return a description of the stack slot holding it. */
if (p->reg_offset[regnum] != 1)
return frame_unwind_got_memory (this_frame, regnum,
- frame_base + p->reg_offset[regnum]);
+ frame_base + p->reg_offset[regnum]);
/* Otherwise, presume we haven't changed the value of this
register, and get it from the next frame. */
m32c_jsri16:
- # Save return address.
+ # Save return address.
pop.w m32c_jsri_ret
pop.b m32c_jsri_ret+2
- # Store target function address.
+ # Store target function address.
pop.w m32c_jsri_addr
# Re-push return address.
= lookup_minimal_symbol_by_pc (addr);
if (! func_msym.minsym)
- error (_("Cannot convert code address %s to function pointer:\n"
- "couldn't find a symbol at that address, to find trampoline."),
- paddress (gdbarch, addr));
+ error (_("Cannot convert code address %s to function pointer:\n"
+ "couldn't find a symbol at that address, to find trampoline."),
+ paddress (gdbarch, addr));
func_name = func_msym.minsym->linkage_name ();
tramp_name = (char *) xmalloc (strlen (func_name) + 5);
tramp_msym = lookup_minimal_symbol (tramp_name, NULL, NULL);
/* We've either got another copy of the name now, or don't need
- the name any more. */
+ the name any more. */
xfree (tramp_name);
if (! tramp_msym.minsym)
if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD)
{
/* See if there is a minimal symbol at that address whose name is
- "NAME.plt". */
+ "NAME.plt". */
struct bound_minimal_symbol ptr_msym = lookup_minimal_symbol_by_pc (ptr);
if (ptr_msym.minsym)
- {
- const char *ptr_msym_name = ptr_msym.minsym->linkage_name ();
- int len = strlen (ptr_msym_name);
+ {
+ const char *ptr_msym_name = ptr_msym.minsym->linkage_name ();
+ int len = strlen (ptr_msym_name);
- if (len > 4
- && strcmp (ptr_msym_name + len - 4, ".plt") == 0)
- {
+ if (len > 4
+ && strcmp (ptr_msym_name + len - 4, ".plt") == 0)
+ {
struct bound_minimal_symbol func_msym;
- /* We have a .plt symbol; try to find the symbol for the
- corresponding function.
-
- Since the trampoline contains a jump instruction, we
- could also just extract the jump's target address. I
- don't see much advantage one way or the other. */
- char *func_name = (char *) xmalloc (len - 4 + 1);
- memcpy (func_name, ptr_msym_name, len - 4);
- func_name[len - 4] = '\0';
- func_msym
- = lookup_minimal_symbol (func_name, NULL, NULL);
-
- /* If we do have such a symbol, return its value as the
- function's true address. */
- if (func_msym.minsym)
- ptr = BMSYMBOL_VALUE_ADDRESS (func_msym);
- }
- }
+ /* We have a .plt symbol; try to find the symbol for the
+ corresponding function.
+
+ Since the trampoline contains a jump instruction, we
+ could also just extract the jump's target address. I
+ don't see much advantage one way or the other. */
+ char *func_name = (char *) xmalloc (len - 4 + 1);
+ memcpy (func_name, ptr_msym_name, len - 4);
+ func_name[len - 4] = '\0';
+ func_msym
+ = lookup_minimal_symbol (func_name, NULL, NULL);
+
+ /* If we do have such a symbol, return its value as the
+ function's true address. */
+ if (func_msym.minsym)
+ ptr = BMSYMBOL_VALUE_ADDRESS (func_msym);
+ }
+ }
else
{
int aspace;
if (addr == 0)
{
/* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
- accordingly. */
+ accordingly. */
addr = m32r_linux_rt_sigtramp_start (cache->pc, this_frame);
if (addr)
sigcontext_addr += 128;
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
}
void _initialize_m32r_linux_tdep ();
break;
/* If this is a 32 bit instruction, we dont want to examine its
- immediate data as though it were an instruction. */
+ immediate data as though it were an instruction. */
if (current_pc & 0x02)
{
/* Decode this instruction further. */
framesize -= stack_adjust;
after_prologue = 0;
/* A frameless function may have no "mv fp, sp".
- In that case, this is the end of the prologue. */
+ In that case, this is the end of the prologue. */
after_stack_adjust = current_pc + 2;
}
continue;
if (info->uses_frame)
{
/* The SP was moved to the FP. This indicates that a new frame
- was created. Get THIS frame's FP value by unwinding it from
- the next frame. */
+ was created. Get THIS frame's FP value by unwinding it from
+ the next frame. */
this_base = get_frame_register_unsigned (this_frame, M32R_FP_REGNUM);
/* The FP points at the last saved register. Adjust the FP back
- to before the first saved register giving the SP. */
+ to before the first saved register giving the SP. */
prev_sp = this_base + info->size;
}
else
{
/* Assume that the FP is this frame's SP but with that pushed
- stack space added back. */
+ stack space added back. */
this_base = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
prev_sp = this_base + info->size;
}
MSYMBOL_IS_RTI Tests the "RTC" bit in a minimal symbol. */
#define MSYMBOL_SET_RTC(msym) \
- MSYMBOL_TARGET_FLAG_1 (msym) = 1
+ MSYMBOL_TARGET_FLAG_1 (msym) = 1
#define MSYMBOL_SET_RTI(msym) \
- MSYMBOL_TARGET_FLAG_2 (msym) = 1
+ MSYMBOL_TARGET_FLAG_2 (msym) = 1
#define MSYMBOL_IS_RTC(msym) \
MSYMBOL_TARGET_FLAG_1 (msym)
/* Keep track of the address range for soft registers. */
if (reg->addr < (CORE_ADDR) soft_min_addr)
- soft_min_addr = reg->addr;
+ soft_min_addr = reg->addr;
if (reg->addr > (CORE_ADDR) soft_max_addr)
- soft_max_addr = reg->addr;
+ soft_max_addr = reg->addr;
}
else
{
for (i = SOFT_FP_REGNUM; i < M68HC11_ALL_REGS; i++)
{
if (soft_regs[i].name && soft_regs[i].addr == addr)
- return i;
+ return i;
}
return -1;
}
if (status != REG_VALID)
return status;
if (pc >= 0x8000 && pc < 0xc000)
- {
- ULONGEST page;
+ {
+ ULONGEST page;
regcache->cooked_read (HARD_PAGE_REGNUM, &page);
- pc -= 0x8000;
- pc += (page << 14);
- pc += 0x1000000;
- }
+ pc -= 0x8000;
+ pc += (page << 14);
+ pc += 0x1000000;
+ }
store_unsigned_integer (buf, regsize, byte_order, pc);
return REG_VALID;
}
memcpy (tmp, buf, regsize);
pc = extract_unsigned_integer (tmp, regsize, byte_order);
if (pc >= 0x1000000)
- {
- pc -= 0x1000000;
- regcache_cooked_write_unsigned (regcache, HARD_PAGE_REGNUM,
- (pc >> 14) & 0x0ff);
- pc &= 0x03fff;
- regcache_cooked_write_unsigned (regcache, HARD_PC_REGNUM,
- pc + 0x8000);
- }
+ {
+ pc -= 0x1000000;
+ regcache_cooked_write_unsigned (regcache, HARD_PAGE_REGNUM,
+ (pc >> 14) & 0x0ff);
+ pc &= 0x03fff;
+ regcache_cooked_write_unsigned (regcache, HARD_PC_REGNUM,
+ pc + 0x8000);
+ }
else
- regcache_cooked_write_unsigned (regcache, HARD_PC_REGNUM, pc);
+ regcache_cooked_write_unsigned (regcache, HARD_PC_REGNUM, pc);
return;
}
static struct insn_sequence m6811_prologue[] = {
/* Sequences to save a soft-register. */
{ P_SAVE_REG, 3, { M6811_OP_LDX, OP_DIRECT,
- M6811_OP_PSHX } },
+ M6811_OP_PSHX } },
{ P_SAVE_REG, 5, { M6811_OP_PAGE2, M6811_OP_LDX, OP_DIRECT,
- M6811_OP_PAGE2, M6811_OP_PSHX } },
+ M6811_OP_PAGE2, M6811_OP_PSHX } },
{ P_SAVE_REG, 4, { M6811_OP_LDX_EXT, OP_IMM_HIGH, OP_IMM_LOW,
- M6811_OP_PSHX } },
+ M6811_OP_PSHX } },
{ P_SAVE_REG, 6, { M6811_OP_PAGE2, M6811_OP_LDX_EXT, OP_IMM_HIGH, OP_IMM_LOW,
- M6811_OP_PAGE2, M6811_OP_PSHX } },
+ M6811_OP_PAGE2, M6811_OP_PSHX } },
/* Sequences to allocate local variables. */
{ P_LOCAL_N, 7, { M6811_OP_TSX,
- M6811_OP_XGDX,
- M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
- M6811_OP_XGDX,
- M6811_OP_TXS } },
+ M6811_OP_XGDX,
+ M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
+ M6811_OP_XGDX,
+ M6811_OP_TXS } },
{ P_LOCAL_N, 11, { M6811_OP_PAGE2, M6811_OP_TSX,
- M6811_OP_PAGE2, M6811_OP_XGDX,
- M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
- M6811_OP_PAGE2, M6811_OP_XGDX,
- M6811_OP_PAGE2, M6811_OP_TXS } },
+ M6811_OP_PAGE2, M6811_OP_XGDX,
+ M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
+ M6811_OP_PAGE2, M6811_OP_XGDX,
+ M6811_OP_PAGE2, M6811_OP_TXS } },
{ P_LOCAL_1, 1, { M6811_OP_DES } },
{ P_LOCAL_2, 1, { M6811_OP_PSHX } },
{ P_LOCAL_2, 2, { M6811_OP_PAGE2, M6811_OP_PSHX } },
/* Sequence of instructions in the 68HC12 function prologue. */
static struct insn_sequence m6812_prologue[] = {
{ P_SAVE_REG, 5, { M6812_OP_PAGE2, M6812_OP_MOVW, M6812_PB_PSHW,
- OP_IMM_HIGH, OP_IMM_LOW } },
+ OP_IMM_HIGH, OP_IMM_LOW } },
{ P_SET_FRAME, 2, { M6812_OP_STS, OP_DIRECT } },
{ P_SET_FRAME, 3, { M6812_OP_STS_EXT, OP_IMM_HIGH, OP_IMM_LOW } },
{ P_LOCAL_N, 2, { M6812_OP_LEAS, OP_PBYTE } },
static struct insn_sequence *
m68hc11_analyze_instruction (struct gdbarch *gdbarch,
struct insn_sequence *seq, CORE_ADDR pc,
- CORE_ADDR *val)
+ CORE_ADDR *val)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned char buffer[MAX_CODES];
{
cur_val = 0;
for (j = 0; j < seq->length; j++)
- {
- if (bufsize < j + 1)
- {
- buffer[bufsize] = read_memory_unsigned_integer (pc + bufsize,
- 1, byte_order);
- bufsize++;
- }
- /* Continue while we match the opcode. */
- if (seq->code[j] == buffer[j])
- continue;
-
- if ((seq->code[j] & 0xf00) == 0)
- break;
-
- /* Extract a sequence parameter (address or constant). */
- switch (seq->code[j])
- {
- case OP_DIRECT:
- cur_val = (CORE_ADDR) buffer[j];
- break;
-
- case OP_IMM_HIGH:
- cur_val = cur_val & 0x0ff;
- cur_val |= (buffer[j] << 8);
- break;
-
- case OP_IMM_LOW:
- cur_val &= 0x0ff00;
- cur_val |= buffer[j];
- break;
-
- case OP_PBYTE:
- if ((buffer[j] & 0xE0) == 0x80)
- {
- v = buffer[j] & 0x1f;
- if (v & 0x10)
- v |= 0xfff0;
- }
- else if ((buffer[j] & 0xfe) == 0xf0)
- {
- v = read_memory_unsigned_integer (pc + j + 1, 1, byte_order);
- if (buffer[j] & 1)
- v |= 0xff00;
- }
- else if (buffer[j] == 0xf2)
- {
- v = read_memory_unsigned_integer (pc + j + 1, 2, byte_order);
- }
- cur_val = v;
- break;
- }
- }
+ {
+ if (bufsize < j + 1)
+ {
+ buffer[bufsize] = read_memory_unsigned_integer (pc + bufsize,
+ 1, byte_order);
+ bufsize++;
+ }
+ /* Continue while we match the opcode. */
+ if (seq->code[j] == buffer[j])
+ continue;
+
+ if ((seq->code[j] & 0xf00) == 0)
+ break;
+
+ /* Extract a sequence parameter (address or constant). */
+ switch (seq->code[j])
+ {
+ case OP_DIRECT:
+ cur_val = (CORE_ADDR) buffer[j];
+ break;
+
+ case OP_IMM_HIGH:
+ cur_val = cur_val & 0x0ff;
+ cur_val |= (buffer[j] << 8);
+ break;
+
+ case OP_IMM_LOW:
+ cur_val &= 0x0ff00;
+ cur_val |= buffer[j];
+ break;
+
+ case OP_PBYTE:
+ if ((buffer[j] & 0xE0) == 0x80)
+ {
+ v = buffer[j] & 0x1f;
+ if (v & 0x10)
+ v |= 0xfff0;
+ }
+ else if ((buffer[j] & 0xfe) == 0xf0)
+ {
+ v = read_memory_unsigned_integer (pc + j + 1, 1, byte_order);
+ if (buffer[j] & 1)
+ v |= 0xff00;
+ }
+ else if (buffer[j] == 0xf2)
+ {
+ v = read_memory_unsigned_integer (pc + j + 1, 2, byte_order);
+ }
+ cur_val = v;
+ break;
+ }
+ }
/* We have a full match. */
if (j == seq->length)
- {
- *val = cur_val;
- return seq;
- }
+ {
+ *val = cur_val;
+ return seq;
+ }
}
return 0;
}
seq = m68hc11_analyze_instruction (gdbarch, seq_table, pc, &val);
if (seq == 0)
- break;
+ break;
/* If we are within the instruction group, we can't advance the
- pc nor the stack offset. Otherwise the caller's stack computed
- from the current stack can be wrong. */
+ pc nor the stack offset. Otherwise the caller's stack computed
+ from the current stack can be wrong. */
if (pc + seq->length > current_pc)
- break;
+ break;
pc = pc + seq->length;
if (seq->type == P_SAVE_REG)
- {
- if (found_frame_point)
- {
- saved_reg = m68hc11_which_soft_register (val);
- if (saved_reg < 0)
- break;
-
- save_addr -= 2;
- if (info->saved_regs)
- info->saved_regs[saved_reg].addr = save_addr;
- }
- else
- {
- size += 2;
- }
- }
+ {
+ if (found_frame_point)
+ {
+ saved_reg = m68hc11_which_soft_register (val);
+ if (saved_reg < 0)
+ break;
+
+ save_addr -= 2;
+ if (info->saved_regs)
+ info->saved_regs[saved_reg].addr = save_addr;
+ }
+ else
+ {
+ size += 2;
+ }
+ }
else if (seq->type == P_SET_FRAME)
- {
- found_frame_point = 1;
- info->size = size;
- }
+ {
+ found_frame_point = 1;
+ info->size = size;
+ }
else if (seq->type == P_LOCAL_1)
- {
- size += 1;
- }
+ {
+ size += 1;
+ }
else if (seq->type == P_LOCAL_2)
- {
- size += 2;
- }
+ {
+ size += 2;
+ }
else if (seq->type == P_LOCAL_N)
- {
- /* Stack pointer is decremented for the allocation. */
- if (val & 0x8000)
- size -= (int) (val) | 0xffff0000;
- else
- size -= val;
- }
+ {
+ /* Stack pointer is decremented for the allocation. */
+ if (val & 0x8000)
+ size -= (int) (val) | 0xffff0000;
+ else
+ size -= val;
+ }
}
if (found_frame_point == 0)
info->sp_offset = size;
static struct m68hc11_unwind_cache *
m68hc11_frame_unwind_cache (struct frame_info *this_frame,
- void **this_prologue_cache)
+ void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
ULONGEST prev_sp;
else
{
/* The FP points at the last saved register. Adjust the FP back
- to before the first saved register giving the SP. */
+ to before the first saved register giving the SP. */
prev_sp = this_base + info->size + 2;
this_base += STACK_CORRECTION (gdbarch);
if (soft_regs[SOFT_FP_REGNUM].name)
- info->saved_regs[SOFT_FP_REGNUM].addr = info->size - 2;
+ info->saved_regs[SOFT_FP_REGNUM].addr = info->size - 2;
}
if (info->return_kind == RETURN_RTC)
for (i = 0; i < gdbarch_num_cooked_regs (gdbarch); i++)
if (trad_frame_addr_p (info->saved_regs, i))
{
- info->saved_regs[i].addr += this_base;
+ info->saved_regs[i].addr += this_base;
}
/* The previous frame's SP needed to be computed. Save the computed
static void
m68hc11_frame_this_id (struct frame_info *this_frame,
- void **this_prologue_cache,
- struct frame_id *this_id)
+ void **this_prologue_cache,
+ struct frame_id *this_id)
{
struct m68hc11_unwind_cache *info
= m68hc11_frame_unwind_cache (this_frame, this_prologue_cache);
static struct value *
m68hc11_frame_prev_register (struct frame_info *this_frame,
- void **this_prologue_cache, int regnum)
+ void **this_prologue_cache, int regnum)
{
struct value *value;
struct m68hc11_unwind_cache *info
{
CORE_ADDR pc = value_as_long (value);
if (pc >= 0x08000 && pc < 0x0c000)
- {
- CORE_ADDR page;
+ {
+ CORE_ADDR page;
release_value (value);
page = value_as_long (value);
release_value (value);
- pc -= 0x08000;
- pc += ((page & 0x0ff) << 14);
- pc += 0x1000000;
+ pc -= 0x08000;
+ pc += ((page & 0x0ff) << 14);
+ pc += 0x1000000;
return frame_unwind_got_constant (this_frame, regnum, pc);
- }
+ }
}
return value;
/* Get and print the register from the given frame. */
static void
m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file,
- struct frame_info *frame, int regno)
+ struct frame_info *frame, int regno)
{
LONGEST rval;
{
fprintf_filtered (file, "0x%02x ", (unsigned char) rval);
if (regno != HARD_CCR_REGNUM)
- print_longest (file, 'd', 1, rval);
+ print_longest (file, 'd', 1, rval);
}
else
{
if (regno == HARD_PC_REGNUM && gdbarch_tdep (gdbarch)->use_page_register)
- {
- ULONGEST page;
+ {
+ ULONGEST page;
- page = get_frame_register_unsigned (frame, HARD_PAGE_REGNUM);
- fprintf_filtered (file, "0x%02x:%04x ", (unsigned) page,
- (unsigned) rval);
- }
+ page = get_frame_register_unsigned (frame, HARD_PAGE_REGNUM);
+ fprintf_filtered (file, "0x%02x:%04x ", (unsigned) page,
+ (unsigned) rval);
+ }
else
- {
- fprintf_filtered (file, "0x%04x ", (unsigned) rval);
- if (regno != HARD_PC_REGNUM && regno != HARD_SP_REGNUM
- && regno != SOFT_FP_REGNUM && regno != M68HC12_HARD_PC_REGNUM)
- print_longest (file, 'd', 1, rval);
- }
+ {
+ fprintf_filtered (file, "0x%04x ", (unsigned) rval);
+ if (regno != HARD_PC_REGNUM && regno != HARD_SP_REGNUM
+ && regno != SOFT_FP_REGNUM && regno != M68HC12_HARD_PC_REGNUM)
+ print_longest (file, 'd', 1, rval);
+ }
}
if (regno == HARD_CCR_REGNUM)
unsigned char l = rval & 0xff;
fprintf_filtered (file, "%c%c%c%c%c%c%c%c ",
- l & M6811_S_BIT ? 'S' : '-',
- l & M6811_X_BIT ? 'X' : '-',
- l & M6811_H_BIT ? 'H' : '-',
- l & M6811_I_BIT ? 'I' : '-',
- l & M6811_N_BIT ? 'N' : '-',
- l & M6811_Z_BIT ? 'Z' : '-',
- l & M6811_V_BIT ? 'V' : '-',
- l & M6811_C_BIT ? 'C' : '-');
+ l & M6811_S_BIT ? 'S' : '-',
+ l & M6811_X_BIT ? 'X' : '-',
+ l & M6811_H_BIT ? 'H' : '-',
+ l & M6811_I_BIT ? 'I' : '-',
+ l & M6811_N_BIT ? 'N' : '-',
+ l & M6811_Z_BIT ? 'Z' : '-',
+ l & M6811_V_BIT ? 'V' : '-',
+ l & M6811_C_BIT ? 'C' : '-');
N = (l & M6811_N_BIT) != 0;
Z = (l & M6811_Z_BIT) != 0;
V = (l & M6811_V_BIT) != 0;
/* Same as 'info reg' but prints the registers in a different way. */
static void
m68hc11_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
- struct frame_info *frame, int regno, int cpregs)
+ struct frame_info *frame, int regno, int cpregs)
{
if (regno >= 0)
{
const char *name = gdbarch_register_name (gdbarch, regno);
if (!name || !*name)
- return;
+ return;
fprintf_filtered (file, "%-10s ", name);
m68hc11_print_register (gdbarch, file, frame, regno);
m68hc11_print_register (gdbarch, file, frame, HARD_Y_REGNUM);
if (gdbarch_tdep (gdbarch)->use_page_register)
- {
- fprintf_filtered (file, "\nPage=");
- m68hc11_print_register (gdbarch, file, frame, HARD_PAGE_REGNUM);
- }
+ {
+ fprintf_filtered (file, "\nPage=");
+ m68hc11_print_register (gdbarch, file, frame, HARD_PAGE_REGNUM);
+ }
fprintf_filtered (file, "\n");
nr = 0;
for (i = SOFT_D1_REGNUM; i < M68HC11_ALL_REGS; i++)
- {
- /* Skip registers which are not defined in the symbol table. */
- if (soft_regs[i].name == 0)
- continue;
-
- fprintf_filtered (file, "D%d=", i - SOFT_D1_REGNUM + 1);
- m68hc11_print_register (gdbarch, file, frame, i);
- nr++;
- if ((nr % 8) == 7)
- fprintf_filtered (file, "\n");
- else
- fprintf_filtered (file, " ");
- }
+ {
+ /* Skip registers which are not defined in the symbol table. */
+ if (soft_regs[i].name == 0)
+ continue;
+
+ fprintf_filtered (file, "D%d=", i - SOFT_D1_REGNUM + 1);
+ m68hc11_print_register (gdbarch, file, frame, i);
+ nr++;
+ if ((nr % 8) == 7)
+ fprintf_filtered (file, "\n");
+ else
+ fprintf_filtered (file, " ");
+ }
if (nr && (nr % 8) != 7)
- fprintf_filtered (file, "\n");
+ fprintf_filtered (file, "\n");
}
}
static CORE_ADDR
m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
/* First argument is passed in D and X registers. */
if (TYPE_LENGTH (type) <= 4)
- {
- ULONGEST v;
+ {
+ ULONGEST v;
- v = extract_unsigned_integer (value_contents (args[0]),
+ v = extract_unsigned_integer (value_contents (args[0]),
TYPE_LENGTH (type), byte_order);
- first_stack_argnum = 1;
-
- regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v);
- if (TYPE_LENGTH (type) > 2)
- {
- v >>= 16;
- regcache_cooked_write_unsigned (regcache, HARD_X_REGNUM, v);
- }
- }
+ first_stack_argnum = 1;
+
+ regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v);
+ if (TYPE_LENGTH (type) > 2)
+ {
+ v >>= 16;
+ regcache_cooked_write_unsigned (regcache, HARD_X_REGNUM, v);
+ }
+ }
}
for (argnum = nargs - 1; argnum >= first_stack_argnum; argnum--)
type = value_type (args[argnum]);
if (TYPE_LENGTH (type) & 1)
- {
- static gdb_byte zero = 0;
+ {
+ static gdb_byte zero = 0;
- sp--;
- write_memory (sp, &zero, 1);
- }
+ sp--;
+ write_memory (sp, &zero, 1);
+ }
val = value_contents (args[argnum]);
sp -= TYPE_LENGTH (type);
write_memory (sp, val, TYPE_LENGTH (type));
static void
m68hc11_store_return_value (struct type *type, struct regcache *regcache,
- const gdb_byte *valbuf)
+ const gdb_byte *valbuf)
{
int len;
static void
m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
- void *valbuf)
+ void *valbuf)
{
gdb_byte buf[M68HC11_REG_SIZE];
static int
m68hc11_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
- struct reggroup *group)
+ struct reggroup *group)
{
/* We must save the real hard register as well as gcc
soft registers including the frame pointer. */
if (group == save_reggroup || group == restore_reggroup)
{
return (regnum <= gdbarch_num_regs (gdbarch)
- || ((regnum == SOFT_FP_REGNUM
- || regnum == SOFT_TMP_REGNUM
- || regnum == SOFT_ZS_REGNUM
- || regnum == SOFT_XY_REGNUM)
- && m68hc11_register_name (gdbarch, regnum)));
+ || ((regnum == SOFT_FP_REGNUM
+ || regnum == SOFT_TMP_REGNUM
+ || regnum == SOFT_ZS_REGNUM
+ || regnum == SOFT_XY_REGNUM)
+ && m68hc11_register_name (gdbarch, regnum)));
}
/* Group to identify gcc soft registers (d1..dN). */
if (group == m68hc11_hard_reggroup)
{
return regnum == HARD_PC_REGNUM || regnum == HARD_SP_REGNUM
- || regnum == HARD_X_REGNUM || regnum == HARD_D_REGNUM
- || regnum == HARD_Y_REGNUM || regnum == HARD_CCR_REGNUM;
+ || regnum == HARD_X_REGNUM || regnum == HARD_D_REGNUM
+ || regnum == HARD_Y_REGNUM || regnum == HARD_CCR_REGNUM;
}
return default_register_reggroup_p (gdbarch, regnum, group);
}
static struct gdbarch *
m68hc11_gdbarch_init (struct gdbarch_info info,
- struct gdbarch_list *arches)
+ struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
tdep->prologue = m6812_prologue;
set_gdbarch_addr_bit (gdbarch, elf_flags & E_M68HC12_BANKS ? 32 : 16);
set_gdbarch_num_pseudo_regs (gdbarch,
- elf_flags & E_M68HC12_BANKS
- ? M68HC12_NUM_PSEUDO_REGS
- : M68HC11_NUM_PSEUDO_REGS);
+ elf_flags & E_M68HC12_BANKS
+ ? M68HC12_NUM_PSEUDO_REGS
+ : M68HC11_NUM_PSEUDO_REGS);
set_gdbarch_pc_regnum (gdbarch, elf_flags & E_M68HC12_BANKS
- ? M68HC12_HARD_PC_REGNUM : HARD_PC_REGNUM);
+ ? M68HC12_HARD_PC_REGNUM : HARD_PC_REGNUM);
set_gdbarch_num_regs (gdbarch, elf_flags & E_M68HC12_BANKS
- ? M68HC12_NUM_REGS : M68HC11_NUM_REGS);
+ ? M68HC12_NUM_REGS : M68HC11_NUM_REGS);
break;
default:
/* Minsymbol frobbing. */
set_gdbarch_elf_make_msymbol_special (gdbarch,
- m68hc11_elf_make_msymbol_special);
+ m68hc11_elf_make_msymbol_special);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_("Couldn't get registers"));
m68kbsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_("Couldn't write registers"));
}
if (regnum == -1 || m68kbsd_fpregset_supplies_p (regnum))
if (errno == EIO)
{
/* The kernel we're running on doesn't support the GETREGS
- request. Reset `have_ptrace_getregs'. */
+ request. Reset `have_ptrace_getregs'. */
have_ptrace_getregs = 0;
return;
}
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
}
void _initialize_m68k_linux_tdep ();
|| (code == TYPE_CODE_FLT && TYPE_LENGTH (type) == 12))
{
/* The default on m68k is to return structures in static memory.
- Consequently a function must return the address where we can
- find the return value. */
+ Consequently a function must return the address where we can
+ find the return value. */
if (readbuf)
{
if (sym->name == NULL || *sym->name == '\0')
{
/* Skip names that don't exist (shouldn't happen), or names
- that are null strings (may happen). */
+ that are null strings (may happen). */
return;
}
symaddr = sym->value + sym->section->vma;
if (sym->section == bfd_abs_section_ptr)
- ms_type = mst_abs;
+ ms_type = mst_abs;
else if (sym->section->flags & SEC_CODE)
- {
- if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
- ms_type = mst_text;
- else
- ms_type = mst_file_text;
- }
+ {
+ if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
+ ms_type = mst_text;
+ else
+ ms_type = mst_file_text;
+ }
else if (sym->section->flags & SEC_ALLOC)
- {
- if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
- {
- if (sym->section->flags & SEC_LOAD)
- ms_type = mst_data;
- else
- ms_type = mst_bss;
- }
- else if (sym->flags & BSF_LOCAL)
- {
- /* Not a special stabs-in-elf symbol, do regular
- symbol processing. */
- if (sym->section->flags & SEC_LOAD)
- ms_type = mst_file_data;
- else
- ms_type = mst_file_bss;
- }
- else
- ms_type = mst_unknown;
- }
+ {
+ if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
+ {
+ if (sym->section->flags & SEC_LOAD)
+ ms_type = mst_data;
+ else
+ ms_type = mst_bss;
+ }
+ else if (sym->flags & BSF_LOCAL)
+ {
+ /* Not a special stabs-in-elf symbol, do regular
+ symbol processing. */
+ if (sym->section->flags & SEC_LOAD)
+ ms_type = mst_file_data;
+ else
+ ms_type = mst_file_bss;
+ }
+ else
+ ms_type = mst_unknown;
+ }
else
- return; /* Skip this symbol. */
+ return; /* Skip this symbol. */
reader.record_with_info (sym->name, symaddr, ms_type,
gdb_bfd_section_index (objfile->obfd,
bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *)sym;
switch (state)
- {
- case S_NO_SO:
+ {
+ case S_NO_SO:
if (mach_o_sym->n_type == N_SO)
- {
- /* Start of object stab. */
+ {
+ /* Start of object stab. */
if (sym->name == NULL || sym->name[0] == 0)
- {
- /* Unexpected empty N_SO. */
- complaint (_("Unexpected empty N_SO stab"));
- }
- else
- {
- file_so = sym;
- state = S_FIRST_SO;
- }
- }
- else if (sym->flags & BSF_DEBUGGING)
- {
- if (mach_o_sym->n_type == N_OPT)
- {
- /* No complaint for OPT. */
- break;
- }
-
- /* Debugging symbols are not expected here. */
- complaint (_("%s: Unexpected debug stab outside SO markers"),
- objfile_name (objfile));
- }
- else
- {
- /* Non-debugging symbols go to the minimal symbol table. */
- macho_symtab_add_minsym (reader, objfile, sym);
- }
- break;
-
- case S_FIRST_SO:
- case S_SECOND_SO:
+ {
+ /* Unexpected empty N_SO. */
+ complaint (_("Unexpected empty N_SO stab"));
+ }
+ else
+ {
+ file_so = sym;
+ state = S_FIRST_SO;
+ }
+ }
+ else if (sym->flags & BSF_DEBUGGING)
+ {
+ if (mach_o_sym->n_type == N_OPT)
+ {
+ /* No complaint for OPT. */
+ break;
+ }
+
+ /* Debugging symbols are not expected here. */
+ complaint (_("%s: Unexpected debug stab outside SO markers"),
+ objfile_name (objfile));
+ }
+ else
+ {
+ /* Non-debugging symbols go to the minimal symbol table. */
+ macho_symtab_add_minsym (reader, objfile, sym);
+ }
+ break;
+
+ case S_FIRST_SO:
+ case S_SECOND_SO:
if (mach_o_sym->n_type == N_SO)
- {
+ {
if (sym->name == NULL || sym->name[0] == 0)
- {
- /* Unexpected empty N_SO. */
- complaint (_("Empty SO section"));
- state = S_NO_SO;
- }
- else if (state == S_FIRST_SO)
- {
- /* Second SO stab for the file name. */
- file_so = sym;
- state = S_SECOND_SO;
- }
- else
- complaint (_("Three SO in a raw"));
- }
- else if (mach_o_sym->n_type == N_OSO)
- {
+ {
+ /* Unexpected empty N_SO. */
+ complaint (_("Empty SO section"));
+ state = S_NO_SO;
+ }
+ else if (state == S_FIRST_SO)
+ {
+ /* Second SO stab for the file name. */
+ file_so = sym;
+ state = S_SECOND_SO;
+ }
+ else
+ complaint (_("Three SO in a raw"));
+ }
+ else if (mach_o_sym->n_type == N_OSO)
+ {
if (sym->name == NULL || sym->name[0] == 0)
- {
- /* Empty OSO. Means that this file was compiled with
- stabs. */
- state = S_STAB_FILE;
- warning (_("stabs debugging not supported for %s"),
- file_so->name);
- }
- else
- {
- /* Non-empty OSO for a Dwarf file. */
- oso_file = symbol_table + i;
- nbr_syms = 0;
- state = S_DWARF_FILE;
- }
- }
- else
- complaint (_("Unexpected stab after SO"));
- break;
-
- case S_STAB_FILE:
- case S_DWARF_FILE:
+ {
+ /* Empty OSO. Means that this file was compiled with
+ stabs. */
+ state = S_STAB_FILE;
+ warning (_("stabs debugging not supported for %s"),
+ file_so->name);
+ }
+ else
+ {
+ /* Non-empty OSO for a Dwarf file. */
+ oso_file = symbol_table + i;
+ nbr_syms = 0;
+ state = S_DWARF_FILE;
+ }
+ }
+ else
+ complaint (_("Unexpected stab after SO"));
+ break;
+
+ case S_STAB_FILE:
+ case S_DWARF_FILE:
if (mach_o_sym->n_type == N_SO)
- {
+ {
if (sym->name == NULL || sym->name[0] == 0)
- {
- /* End of file. */
- if (state == S_DWARF_FILE)
+ {
+ /* End of file. */
+ if (state == S_DWARF_FILE)
oso_vector_ptr->emplace_back (oso_file, symbol_table + i,
nbr_syms);
- state = S_NO_SO;
- }
- else
- {
- complaint (_("Missing nul SO"));
- file_so = sym;
- state = S_FIRST_SO;
- }
- }
- else if (sym->flags & BSF_DEBUGGING)
- {
- if (state == S_STAB_FILE)
- {
- /* FIXME: to be implemented. */
- }
- else
- {
- switch (mach_o_sym->n_type)
- {
- case N_FUN:
- if (sym->name == NULL || sym->name[0] == 0)
- break;
- /* Fall through. */
- case N_STSYM:
- /* Interesting symbol. */
- nbr_syms++;
- break;
- case N_ENSYM:
- case N_BNSYM:
- case N_GSYM:
- break;
- default:
- complaint (_("unhandled stab for dwarf OSO file"));
- break;
- }
- }
- }
- else
- complaint (_("non-debugging symbol within SO"));
- break;
- }
+ state = S_NO_SO;
+ }
+ else
+ {
+ complaint (_("Missing nul SO"));
+ file_so = sym;
+ state = S_FIRST_SO;
+ }
+ }
+ else if (sym->flags & BSF_DEBUGGING)
+ {
+ if (state == S_STAB_FILE)
+ {
+ /* FIXME: to be implemented. */
+ }
+ else
+ {
+ switch (mach_o_sym->n_type)
+ {
+ case N_FUN:
+ if (sym->name == NULL || sym->name[0] == 0)
+ break;
+ /* Fall through. */
+ case N_STSYM:
+ /* Interesting symbol. */
+ nbr_syms++;
+ break;
+ case N_ENSYM:
+ case N_BNSYM:
+ case N_GSYM:
+ break;
+ default:
+ complaint (_("unhandled stab for dwarf OSO file"));
+ break;
+ }
+ }
+ }
+ else
+ complaint (_("non-debugging symbol within SO"));
+ break;
+ }
}
if (state != S_NO_SO)
static struct bfd_hash_entry *
macho_sym_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
+ struct bfd_hash_table *table,
+ const char *string)
{
struct macho_sym_hash_entry *ret = (struct macho_sym_hash_entry *) entry;
subclass. */
if (ret == NULL)
ret = (struct macho_sym_hash_entry *) bfd_hash_allocate (table,
- sizeof (* ret));
+ sizeof (* ret));
if (ret == NULL)
return NULL;
static void
macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
const char *name,
- struct objfile *main_objfile,
+ struct objfile *main_objfile,
symfile_add_flags symfile_flags)
{
int storage;
if (!bfd_check_format (abfd.get (), bfd_object))
{
warning (_("`%s': can't read symbols: %s."), oso->name,
- bfd_errmsg (bfd_get_error ()));
+ bfd_errmsg (bfd_get_error ()));
return;
}
}
if (!bfd_hash_table_init_n (&table, macho_sym_hash_newfunc,
- sizeof (struct macho_sym_hash_entry),
- oso->nbr_syms))
+ sizeof (struct macho_sym_hash_entry),
+ oso->nbr_syms))
{
warning (_("`%s': can't create hash table"), oso->name);
return;
bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *)sym;
switch (mach_o_sym->n_type)
- {
- case N_ENSYM:
- case N_BNSYM:
- case N_GSYM:
- sym = NULL;
- break;
- case N_FUN:
- if (sym->name == NULL || sym->name[0] == 0)
- sym = NULL;
- break;
- case N_STSYM:
- break;
- default:
- sym = NULL;
- break;
- }
+ {
+ case N_ENSYM:
+ case N_BNSYM:
+ case N_GSYM:
+ sym = NULL;
+ break;
+ case N_FUN:
+ if (sym->name == NULL || sym->name[0] == 0)
+ sym = NULL;
+ break;
+ case N_STSYM:
+ break;
+ default:
+ sym = NULL;
+ break;
+ }
if (sym != NULL)
- {
- struct macho_sym_hash_entry *ent;
-
- ent = (struct macho_sym_hash_entry *)
- bfd_hash_lookup (&table, sym->name, TRUE, FALSE);
- if (ent->sym != NULL)
- complaint (_("Duplicated symbol %s in symbol table"), sym->name);
- else
- {
- if (mach_o_debug_level > 4)
- {
- struct gdbarch *arch = main_objfile->arch ();
- printf_unfiltered
- (_("Adding symbol %s (addr: %s)\n"),
- sym->name, paddress (arch, sym->value));
- }
- ent->sym = sym;
- }
- }
+ {
+ struct macho_sym_hash_entry *ent;
+
+ ent = (struct macho_sym_hash_entry *)
+ bfd_hash_lookup (&table, sym->name, TRUE, FALSE);
+ if (ent->sym != NULL)
+ complaint (_("Duplicated symbol %s in symbol table"), sym->name);
+ else
+ {
+ if (mach_o_debug_level > 4)
+ {
+ struct gdbarch *arch = main_objfile->arch ();
+ printf_unfiltered
+ (_("Adding symbol %s (addr: %s)\n"),
+ sym->name, paddress (arch, sym->value));
+ }
+ ent->sym = sym;
+ }
+ }
}
/* Relocate symbols of the OSO. */
bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *)sym;
if (mach_o_sym->n_type & BFD_MACH_O_N_STAB)
- continue;
+ continue;
if ((mach_o_sym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_UNDF
- && sym->value != 0)
- {
- /* For common symbol use the min symtab and modify the OSO
- symbol table. */
- CORE_ADDR res;
-
- res = macho_resolve_oso_sym_with_minsym (main_objfile, sym);
- if (res != 0)
- {
- sym->section = bfd_com_section_ptr;
- sym->value = res;
- }
- }
+ && sym->value != 0)
+ {
+ /* For common symbol use the min symtab and modify the OSO
+ symbol table. */
+ CORE_ADDR res;
+
+ res = macho_resolve_oso_sym_with_minsym (main_objfile, sym);
+ if (res != 0)
+ {
+ sym->section = bfd_com_section_ptr;
+ sym->value = res;
+ }
+ }
else if ((mach_o_sym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_SECT)
- {
- /* Normal symbol. */
- asection *sec = sym->section;
- bfd_mach_o_section *msec;
- unsigned int sec_type;
-
- /* Skip buggy ones. */
- if (sec == NULL || sections_rebased[sec->index] != 0)
- continue;
-
- /* Only consider regular, non-debugging sections. */
- msec = bfd_mach_o_get_mach_o_section (sec);
- sec_type = msec->flags & BFD_MACH_O_SECTION_TYPE_MASK;
- if ((sec_type == BFD_MACH_O_S_REGULAR
- || sec_type == BFD_MACH_O_S_ZEROFILL)
- && (msec->flags & BFD_MACH_O_S_ATTR_DEBUG) == 0)
- {
- CORE_ADDR addr = 0;
-
- if ((mach_o_sym->n_type & BFD_MACH_O_N_EXT) != 0)
- {
- /* Use the min symtab for global symbols. */
- addr = macho_resolve_oso_sym_with_minsym (main_objfile, sym);
- }
- else
- {
- struct macho_sym_hash_entry *ent;
-
- ent = (struct macho_sym_hash_entry *)
- bfd_hash_lookup (&table, sym->name, FALSE, FALSE);
- if (ent != NULL)
- addr = bfd_asymbol_value (ent->sym);
- }
-
- /* Adjust the section. */
- if (addr != 0)
- {
- CORE_ADDR res = addr - sym->value;
-
- if (mach_o_debug_level > 3)
- {
- struct gdbarch *arch = main_objfile->arch ();
- printf_unfiltered
- (_("resolve sect %s with %s (set to %s)\n"),
- sec->name, sym->name,
- paddress (arch, res));
- }
- bfd_set_section_vma (sec, res);
- sections_rebased[sec->index] = 1;
- }
- }
- else
- {
- /* Mark the section as never rebased. */
- sections_rebased[sec->index] = 2;
- }
- }
+ {
+ /* Normal symbol. */
+ asection *sec = sym->section;
+ bfd_mach_o_section *msec;
+ unsigned int sec_type;
+
+ /* Skip buggy ones. */
+ if (sec == NULL || sections_rebased[sec->index] != 0)
+ continue;
+
+ /* Only consider regular, non-debugging sections. */
+ msec = bfd_mach_o_get_mach_o_section (sec);
+ sec_type = msec->flags & BFD_MACH_O_SECTION_TYPE_MASK;
+ if ((sec_type == BFD_MACH_O_S_REGULAR
+ || sec_type == BFD_MACH_O_S_ZEROFILL)
+ && (msec->flags & BFD_MACH_O_S_ATTR_DEBUG) == 0)
+ {
+ CORE_ADDR addr = 0;
+
+ if ((mach_o_sym->n_type & BFD_MACH_O_N_EXT) != 0)
+ {
+ /* Use the min symtab for global symbols. */
+ addr = macho_resolve_oso_sym_with_minsym (main_objfile, sym);
+ }
+ else
+ {
+ struct macho_sym_hash_entry *ent;
+
+ ent = (struct macho_sym_hash_entry *)
+ bfd_hash_lookup (&table, sym->name, FALSE, FALSE);
+ if (ent != NULL)
+ addr = bfd_asymbol_value (ent->sym);
+ }
+
+ /* Adjust the section. */
+ if (addr != 0)
+ {
+ CORE_ADDR res = addr - sym->value;
+
+ if (mach_o_debug_level > 3)
+ {
+ struct gdbarch *arch = main_objfile->arch ();
+ printf_unfiltered
+ (_("resolve sect %s with %s (set to %s)\n"),
+ sec->name, sym->name,
+ paddress (arch, res));
+ }
+ bfd_set_section_vma (sec, res);
+ sections_rebased[sec->index] = 1;
+ }
+ }
+ else
+ {
+ /* Mark the section as never rebased. */
+ sections_rebased[sec->index] = 2;
+ }
+ }
}
bfd_hash_table_free (&table);
pfx_len = get_archive_prefix_len (oso->name);
if (pfx_len > 0)
{
- int last_ix;
- oso_el *oso2;
- int ix2;
+ int last_ix;
+ oso_el *oso2;
+ int ix2;
std::string archive_name (oso->name, pfx_len);
- /* Compute number of oso for this archive. */
- for (last_ix = ix; last_ix < oso_vector_ptr->size (); last_ix++)
- {
+ /* Compute number of oso for this archive. */
+ for (last_ix = ix; last_ix < oso_vector_ptr->size (); last_ix++)
+ {
oso2 = &(*oso_vector_ptr)[last_ix];
- if (strncmp (oso2->name, archive_name.c_str (), pfx_len) != 0)
- break;
- }
+ if (strncmp (oso2->name, archive_name.c_str (), pfx_len) != 0)
+ break;
+ }
/* Open the archive and check the format. */
gdb_bfd_ref_ptr archive_bfd (gdb_bfd_open (archive_name.c_str (),
{
warning (_("Could not open OSO archive file \"%s\""),
archive_name.c_str ());
- ix = last_ix;
+ ix = last_ix;
continue;
}
if (!bfd_check_format (archive_bfd.get (), bfd_archive))
{
warning (_("OSO archive file \"%s\" not an archive."),
archive_name.c_str ());
- ix = last_ix;
+ ix = last_ix;
continue;
}
{
warning (_("Could not read archive members out of "
"OSO archive \"%s\""), archive_name.c_str ());
- ix = last_ix;
+ ix = last_ix;
continue;
}
- /* Load all oso in this library. */
+ /* Load all oso in this library. */
while (member_bfd != NULL)
{
const char *member_name = bfd_get_filename (member_bfd.get ());
- int member_len = strlen (member_name);
-
- /* If this member is referenced, add it as a symfile. */
- for (ix2 = ix; ix2 < last_ix; ix2++)
- {
- oso2 = &(*oso_vector_ptr)[ix2];
-
- if (oso2->name
- && strlen (oso2->name) == pfx_len + member_len + 2
- && !memcmp (member_name, oso2->name + pfx_len + 1,
- member_len))
- {
- macho_add_oso_symfile (oso2, member_bfd,
+ int member_len = strlen (member_name);
+
+ /* If this member is referenced, add it as a symfile. */
+ for (ix2 = ix; ix2 < last_ix; ix2++)
+ {
+ oso2 = &(*oso_vector_ptr)[ix2];
+
+ if (oso2->name
+ && strlen (oso2->name) == pfx_len + member_len + 2
+ && !memcmp (member_name, oso2->name + pfx_len + 1,
+ member_len))
+ {
+ macho_add_oso_symfile (oso2, member_bfd,
bfd_get_filename (member_bfd.get ()),
- main_objfile, symfile_flags);
- oso2->name = NULL;
- break;
- }
- }
+ main_objfile, symfile_flags);
+ oso2->name = NULL;
+ break;
+ }
+ }
member_bfd = gdb_bfd_openr_next_archived_file (archive_bfd.get (),
member_bfd.get ());
}
- for (ix2 = ix; ix2 < last_ix; ix2++)
- {
- oso2 = &(*oso_vector_ptr)[ix2];
-
- if (oso2->name != NULL)
- warning (_("Could not find specified archive member "
- "for OSO name \"%s\""), oso->name);
- }
- ix = last_ix;
+ for (ix2 = ix; ix2 < last_ix; ix2++)
+ {
+ oso2 = &(*oso_vector_ptr)[ix2];
+
+ if (oso2->name != NULL)
+ warning (_("Could not find specified archive member "
+ "for OSO name \"%s\""), oso->name);
+ }
+ ix = last_ix;
}
else
{
gdb_bfd_ref_ptr abfd (gdb_bfd_open (oso->name, gnutarget));
if (abfd == NULL)
- warning (_("`%s': can't open to read symbols: %s."), oso->name,
- bfd_errmsg (bfd_get_error ()));
- else
- macho_add_oso_symfile (oso, abfd, oso->name, main_objfile,
+ warning (_("`%s': can't open to read symbols: %s."), oso->name,
+ bfd_errmsg (bfd_get_error ()));
+ else
+ macho_add_oso_symfile (oso, abfd, oso->name, main_objfile,
symfile_flags);
- ix++;
- }
+ ix++;
+ }
}
}
return NULL;
if (bfd_mach_o_lookup_command (objfile->obfd,
- BFD_MACH_O_LC_UUID, &main_uuid) == 0)
+ BFD_MACH_O_LC_UUID, &main_uuid) == 0)
{
warning (_("can't find UUID in %s"), objfile_name (objfile));
return NULL;
}
if (bfd_mach_o_lookup_command (dsym_bfd.get (),
- BFD_MACH_O_LC_UUID, &dsym_uuid) == 0)
+ BFD_MACH_O_LC_UUID, &dsym_uuid) == 0)
{
warning (_("can't find UUID in %s"), dsym_filename);
return NULL;
}
if (memcmp (dsym_uuid->command.uuid.uuid, main_uuid->command.uuid.uuid,
- sizeof (main_uuid->command.uuid.uuid)))
+ sizeof (main_uuid->command.uuid.uuid)))
{
warning (_("dsym file UUID doesn't match the one in %s"),
objfile_name (objfile));
symbol_table.resize (storage_needed / sizeof (asymbol *));
- minimal_symbol_reader reader (objfile);
+ minimal_symbol_reader reader (objfile);
symcount = bfd_canonicalize_symtab (objfile->obfd,
symbol_table.data ());
macho_symtab_read (reader, objfile, symcount, symbol_table.data (),
&oso_vector);
- reader.install ();
+ reader.install ();
}
/* Try to read .eh_frame / .debug_frame. */
gdb_bfd_ref_ptr dsym_bfd (macho_check_dsym (objfile, &dsym_filename));
if (dsym_bfd != NULL)
{
- struct bfd_section *asect, *dsect;
+ struct bfd_section *asect, *dsect;
if (mach_o_debug_level > 0)
printf_unfiltered (_("dsym file found\n"));
- /* Set dsym section size. */
- for (asect = objfile->obfd->sections, dsect = dsym_bfd->sections;
- asect && dsect;
- asect = asect->next, dsect = dsect->next)
- {
- if (strcmp (asect->name, dsect->name) != 0)
- break;
- bfd_set_section_size (dsect, bfd_section_size (asect));
- }
+ /* Set dsym section size. */
+ for (asect = objfile->obfd->sections, dsect = dsym_bfd->sections;
+ asect && dsect;
+ asect = asect->next, dsect = dsect->next)
+ {
+ if (strcmp (asect->name, dsect->name) != 0)
+ break;
+ bfd_set_section_size (dsect, bfd_section_size (asect));
+ }
/* Add the dsym file as a separate file. */
- symbol_file_add_separate (dsym_bfd.get (), dsym_filename.c_str (),
+ symbol_file_add_separate (dsym_bfd.get (), dsym_filename.c_str (),
symfile_flags, objfile);
/* Don't try to read dwarf2 from main file or shared libraries. */
- return;
+ return;
}
}
static bfd_byte *
macho_symfile_relocate (struct objfile *objfile, asection *sectp,
- bfd_byte *buf)
+ bfd_byte *buf)
{
bfd *abfd = objfile->obfd;
if (mach_o_debug_level > 0)
printf_unfiltered (_("Relocate section '%s' of %s\n"),
- sectp->name, objfile_name (objfile));
+ sectp->name, objfile_name (objfile));
return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL);
}
static void
macho_symfile_offsets (struct objfile *objfile,
- const section_addr_info &addrs)
+ const section_addr_info &addrs)
{
unsigned int i;
struct obj_section *osect;
evaluated, just its value. */
if (! exp || ! *exp)
error (_("You must follow the `macro expand' command with the"
- " expression you\n"
- "want to expand."));
+ " expression you\n"
+ "want to expand."));
gdb::unique_xmalloc_ptr<macro_scope> ms = default_macro_scope ();
see the expression expanded one level at a time. */
if (! exp || ! *exp)
error (_("You must follow the `macro expand-once' command with"
- " the expression\n"
- "you want to expand."));
+ " the expression\n"
+ "you want to expand."));
gdb::unique_xmalloc_ptr<macro_scope> ms = default_macro_scope ();
the splay tree so that it can be safely used while iterating. */
static void
show_pp_source_pos (struct ui_file *stream,
- struct macro_source_file *file,
- int line)
+ struct macro_source_file *file,
+ int line)
{
std::string fullname = macro_source_fullname (file);
fprintf_filtered (stream, "%ps:%d\n",
|| strncmp (arg_start, "-all", p - arg_start) == 0)
show_all_macros_named = 1;
else if (strncmp (arg_start, "--", p - arg_start) == 0)
- /* Our macro support seems rather C specific but this would
- seem necessary for languages allowing - in macro names.
+ /* Our macro support seems rather C specific but this would
+ seem necessary for languages allowing - in macro names.
e.g. Scheme's (defmacro ->foo () "bar\n") */
processing_args = 0;
else
print_macro_definition (name, d, file, line);
}
else
- {
- fprintf_filtered (gdb_stdout,
- "The symbol `%s' has no definition as a C/C++"
- " preprocessor macro\n"
- "at ", name);
- show_pp_source_pos (gdb_stdout, ms->file, ms->line);
+ {
+ fprintf_filtered (gdb_stdout,
+ "The symbol `%s' has no definition as a C/C++"
+ " preprocessor macro\n"
+ "at ", name);
+ show_pp_source_pos (gdb_stdout, ms->file, ms->line);
}
}
}
macro_is_whitespace (int c)
{
return (c == ' '
- || c == '\t'
- || c == '\n'
- || c == '\v'
- || c == '\f');
+ || c == '\t'
+ || c == '\n'
+ || c == '\v'
+ || c == '\f');
}
macro_is_identifier_nondigit (int c)
{
return (c == '_'
- || ('a' <= c && c <= 'z')
- || ('A' <= c && c <= 'Z'));
+ || ('a' <= c && c <= 'z')
+ || ('A' <= c && c <= 'Z'));
}
if (p + 2 > end)
return 0;
else if (p[0] == '/'
- && p[1] == '*')
+ && p[1] == '*')
{
char *tok_start = p;
p += 2;
for (; p < end; p++)
- if (p + 2 <= end
- && p[0] == '*'
- && p[1] == '/')
- {
- p += 2;
- set_token (tok, tok_start, p);
- return 1;
- }
+ if (p + 2 <= end
+ && p[0] == '*'
+ && p[1] == '/')
+ {
+ p += 2;
+ set_token (tok, tok_start, p);
+ return 1;
+ }
error (_("Unterminated comment in macro expansion."));
}
else if (p[0] == '/'
- && p[1] == '/')
+ && p[1] == '/')
{
char *tok_start = p;
p += 2;
for (; p < end; p++)
- if (*p == '\n')
- break;
+ if (*p == '\n')
+ break;
set_token (tok, tok_start, p);
return 1;
char *tok_start = p;
while (p < end
- && (macro_is_identifier_nondigit (*p)
- || macro_is_digit (*p)))
- p++;
+ && (macro_is_identifier_nondigit (*p)
+ || macro_is_digit (*p)))
+ p++;
set_token (tok, tok_start, p);
tok->is_identifier = 1;
{
if (p < end
&& (macro_is_digit (*p)
- || (*p == '.'
+ || (*p == '.'
&& p + 2 <= end
&& macro_is_digit (p[1]))))
{
char *tok_start = p;
while (p < end)
- {
+ {
if (p + 2 <= end
&& strchr ("eEpP", *p)
&& (p[1] == '+' || p[1] == '-'))
- p += 2;
- else if (macro_is_digit (*p)
+ p += 2;
+ else if (macro_is_digit (*p)
|| macro_is_identifier_nondigit (*p)
|| *p == '.')
- p++;
- else
- break;
- }
+ p++;
+ else
+ break;
+ }
set_token (tok, tok_start, p);
return 1;
int char_count = 0;
if (*p == '\'')
- p++;
+ p++;
else if (*p == 'L' || *p == 'u' || *p == 'U')
- p += 2;
+ p += 2;
else
- gdb_assert_not_reached ("unexpected character constant");
+ gdb_assert_not_reached ("unexpected character constant");
for (;;)
- {
- if (p >= end)
- error (_("Unmatched single quote."));
- else if (*p == '\'')
- {
- if (!char_count)
- error (_("A character constant must contain at least one "
- "character."));
- p++;
- break;
- }
- else if (*p == '\\')
- {
+ {
+ if (p >= end)
+ error (_("Unmatched single quote."));
+ else if (*p == '\'')
+ {
+ if (!char_count)
+ error (_("A character constant must contain at least one "
+ "character."));
+ p++;
+ break;
+ }
+ else if (*p == '\\')
+ {
const char *s, *o;
s = o = ++p;
char_count += c_parse_escape (&s, NULL);
p += s - o;
- }
- else
+ }
+ else
{
p++;
char_count++;
}
- }
+ }
set_token (tok, tok_start, p);
return 1;
if ((p + 1 <= end
&& *p == '"')
|| (p + 2 <= end
- && (p[0] == 'L' || p[0] == 'u' || p[0] == 'U')
- && p[1] == '"'))
+ && (p[0] == 'L' || p[0] == 'u' || p[0] == 'U')
+ && p[1] == '"'))
{
char *tok_start = p;
if (*p == '"')
- p++;
+ p++;
else if (*p == 'L' || *p == 'u' || *p == 'U')
- p += 2;
+ p += 2;
else
- gdb_assert_not_reached ("unexpected string literal");
+ gdb_assert_not_reached ("unexpected string literal");
for (;;)
- {
- if (p >= end)
- error (_("Unterminated string in expression."));
- else if (*p == '"')
- {
- p++;
- break;
- }
- else if (*p == '\n')
- error (_("Newline characters may not appear in string "
- "constants."));
- else if (*p == '\\')
- {
+ {
+ if (p >= end)
+ error (_("Unterminated string in expression."));
+ else if (*p == '"')
+ {
+ p++;
+ break;
+ }
+ else if (*p == '\n')
+ error (_("Newline characters may not appear in string "
+ "constants."));
+ else if (*p == '\\')
+ {
const char *s, *o;
s = o = ++p;
c_parse_escape (&s, NULL);
p += s - o;
- }
- else
- p++;
- }
+ }
+ else
+ p++;
+ }
set_token (tok, tok_start, p);
return 1;
if (p + 1 <= end)
{
for (i = 0; punctuators[i]; i++)
- {
- const char *punctuator = punctuators[i];
-
- if (p[0] == punctuator[0])
- {
- int len = strlen (punctuator);
-
- if (p + len <= end
- && ! memcmp (p, punctuator, len))
- {
- set_token (tok, p, p + len);
- return 1;
- }
- }
- }
+ {
+ const char *punctuator = punctuators[i];
+
+ if (p[0] == punctuator[0])
+ {
+ int len = strlen (punctuator);
+
+ if (p + len <= end
+ && ! memcmp (p, punctuator, len))
+ {
+ set_token (tok, p, p + len);
+ return 1;
+ }
+ }
+ }
}
return 0;
succeed, or 0 if we didn't find any more tokens in SRC. */
static int
get_token (struct macro_buffer *tok,
- struct macro_buffer *src)
+ struct macro_buffer *src)
{
char *p = src->text;
char *end = p + src->len;
/* From the ISO C standard, ISO/IEC 9899:1999 (E), section 6.4:
preprocessing-token:
- header-name
- identifier
- pp-number
- character-constant
- string-literal
- punctuator
- each non-white-space character that cannot be one of the above
+ header-name
+ identifier
+ pp-number
+ character-constant
+ string-literal
+ punctuator
+ each non-white-space character that cannot be one of the above
We don't have to deal with header-name tokens, since those can
only occur after a #include, which we will never see. */
else if (get_comment (tok, p, end))
p += tok->len;
else if (get_pp_number (tok, p, end)
- || get_character_constant (tok, p, end)
- || get_string_literal (tok, p, end)
- /* Note: the grammar in the standard seems to be
- ambiguous: L'x' can be either a wide character
- constant, or an identifier followed by a normal
- character constant. By trying `get_identifier' after
- we try get_character_constant and get_string_literal,
- we give the wide character syntax precedence. Now,
- since GDB doesn't handle wide character constants
- anyway, is this the right thing to do? */
- || get_identifier (tok, p, end)
- || get_punctuator (tok, p, end))
+ || get_character_constant (tok, p, end)
+ || get_string_literal (tok, p, end)
+ /* Note: the grammar in the standard seems to be
+ ambiguous: L'x' can be either a wide character
+ constant, or an identifier followed by a normal
+ character constant. By trying `get_identifier' after
+ we try get_character_constant and get_string_literal,
+ we give the wide character syntax precedence. Now,
+ since GDB doesn't handle wide character constants
+ anyway, is this the right thing to do? */
+ || get_identifier (tok, p, end)
+ || get_punctuator (tok, p, end))
{
- /* How many characters did we consume, including whitespace? */
- int consumed = p - src->text + tok->len;
+ /* How many characters did we consume, including whitespace? */
+ int consumed = p - src->text + tok->len;
- src->text += consumed;
- src->len -= consumed;
- return 1;
+ src->text += consumed;
+ src->len -= consumed;
+ return 1;
}
else
{
- /* We have found a "non-whitespace character that cannot be
- one of the above." Make a token out of it. */
- int consumed;
-
- set_token (tok, p, p + 1);
- consumed = p - src->text + tok->len;
- src->text += consumed;
- src->len -= consumed;
- return 1;
+ /* We have found a "non-whitespace character that cannot be
+ one of the above." Make a token out of it. */
+ int consumed;
+
+ set_token (tok, p, p + 1);
+ consumed = p - src->text + tok->len;
+ src->text += consumed;
+ src->len -= consumed;
+ return 1;
}
return 0;
yield "< <", not "<<", etc. */
static void
append_tokens_without_splicing (struct macro_buffer *dest,
- struct macro_buffer *src)
+ struct macro_buffer *src)
{
int original_dest_len = dest->len;
struct macro_buffer dest_tail, new_token;
the first time. This is not a bug fix.) */
if (get_token (&new_token, &dest_tail)
&& (new_token.text + new_token.len
- == dest->text + original_dest_len))
+ == dest->text + original_dest_len))
{
/* No splice, so we're done. */
dest->last_token = original_dest_len + src->last_token;
/* Try to re-parse DEST's last token, as above. */
if (get_token (&new_token, &dest_tail)
&& (new_token.text + new_token.len
- == dest->text + original_dest_len))
+ == dest->text + original_dest_len))
{
/* No splice, so we're done. */
dest->last_token = original_dest_len + 1 + src->last_token;
/* As far as I know, there's no case where inserting a space isn't
enough to prevent a splice. */
internal_error (__FILE__, __LINE__,
- _("unable to avoid splicing tokens during macro expansion"));
+ _("unable to avoid splicing tokens during macro expansion"));
}
/* Stringify an argument, and insert it into DEST. ARG is the text to
struct macro_buffer temp (src->text, src->len);
if (! get_token (&tok, &temp)
- || tok.len != 1
- || tok.text[0] != '(')
+ || tok.len != 1
+ || tok.text[0] != '(')
return false;
}
/* Gather the argument's tokens. */
depth = 0;
for (;;)
- {
- if (! get_token (&tok, src))
- error (_("Malformed argument list for macro `%s'."), name);
-
- /* Is tok an opening paren? */
- if (tok.len == 1 && tok.text[0] == '(')
- depth++;
-
- /* Is tok is a closing paren? */
- else if (tok.len == 1 && tok.text[0] == ')')
- {
- /* If it's a closing paren at the top level, then that's
- the end of the argument list. */
- if (depth == 0)
- {
+ {
+ if (! get_token (&tok, src))
+ error (_("Malformed argument list for macro `%s'."), name);
+
+ /* Is tok an opening paren? */
+ if (tok.len == 1 && tok.text[0] == '(')
+ depth++;
+
+ /* Is tok is a closing paren? */
+ else if (tok.len == 1 && tok.text[0] == ')')
+ {
+ /* If it's a closing paren at the top level, then that's
+ the end of the argument list. */
+ if (depth == 0)
+ {
/* In the varargs case, the last argument may be
missing. Add an empty argument in this case. */
if (nargs != -1 && args.size () == nargs - 1)
*args_ptr = std::move (args);
return true;
- }
+ }
- depth--;
- }
+ depth--;
+ }
- /* If tok is a comma at top level, then that's the end of
- the current argument. However, if we are handling a
- variadic macro and we are computing the last argument, we
- want to include the comma and remaining tokens. */
- else if (tok.len == 1 && tok.text[0] == ',' && depth == 0
+ /* If tok is a comma at top level, then that's the end of
+ the current argument. However, if we are handling a
+ variadic macro and we are computing the last argument, we
+ want to include the comma and remaining tokens. */
+ else if (tok.len == 1 && tok.text[0] == ',' && depth == 0
&& (nargs == -1 || args.size () < nargs))
- break;
-
- /* Extend the current argument to enclose this token. If
- this is the current argument's first token, leave out any
- leading whitespace, just for aesthetics. */
- if (arg->len == 0)
- {
- arg->text = tok.text;
- arg->len = tok.len;
- arg->last_token = 0;
- }
- else
- {
- arg->len = (tok.text + tok.len) - arg->text;
- arg->last_token = tok.text - arg->text;
- }
- }
+ break;
+
+ /* Extend the current argument to enclose this token. If
+ this is the current argument's first token, leave out any
+ leading whitespace, just for aesthetics. */
+ if (arg->len == 0)
+ {
+ arg->text = tok.text;
+ arg->len = tok.len;
+ arg->last_token = 0;
+ }
+ else
+ {
+ arg->len = (tok.text + tok.len) - arg->text;
+ arg->last_token = tok.text - arg->text;
+ }
+ }
}
}
/* The `expand' and `substitute_args' functions both invoke `scan'
recursively, so we need a forward declaration somewhere. */
static void scan (struct macro_buffer *dest,
- struct macro_buffer *src,
- struct macro_name_list *no_loop,
+ struct macro_buffer *src,
+ struct macro_name_list *no_loop,
const macro_scope &scope);
/* A helper function for substitute_args.
static void
substitute_args (struct macro_buffer *dest,
- struct macro_definition *def,
+ struct macro_definition *def,
int is_varargs, const struct macro_buffer *va_arg_name,
const std::vector<struct macro_buffer> &argv,
- struct macro_name_list *no_loop,
+ struct macro_name_list *no_loop,
const macro_scope &scope)
{
/* The token we are currently considering. */
}
/* Just for aesthetics. If we skipped some whitespace, copy
- that to DEST. */
+ that to DEST. */
if (tok.text > original_rl_start)
- {
- dest->appendmem (original_rl_start, tok.text - original_rl_start);
- dest->last_token = dest->len;
- }
+ {
+ dest->appendmem (original_rl_start, tok.text - original_rl_start);
+ dest->last_token = dest->len;
+ }
/* Is this token the stringification operator? */
if (tok.len == 1
- && tok.text[0] == '#')
+ && tok.text[0] == '#')
{
int arg;
dest->appendmem (",", 1);
}
- dest->last_token = dest->len;
+ dest->last_token = dest->len;
if (finished)
lookahead_valid = 0;
else
we don't expand it.) If we return zero, leave SRC unchanged. */
static int
expand (const char *id,
- struct macro_definition *def,
- struct macro_buffer *dest,
- struct macro_buffer *src,
- struct macro_name_list *no_loop,
+ struct macro_definition *def,
+ struct macro_buffer *dest,
+ struct macro_buffer *src,
+ struct macro_name_list *no_loop,
const macro_scope &scope)
{
struct macro_name_list new_no_loop;
std::vector<struct macro_buffer> argv;
/* If we couldn't find any argument list, then we don't expand
- this macro. */
+ this macro. */
if (!gather_arguments (id, src, is_varargs ? def->argc : -1,
&argv))
return 0;
/* Check that we're passing an acceptable number of arguments for
- this macro. */
+ this macro. */
if (argv.size () != def->argc)
- {
+ {
if (is_varargs && argv.size () >= def->argc - 1)
{
/* Ok. */
}
- /* Remember that a sequence of tokens like "foo()" is a
- valid invocation of a macro expecting either zero or one
- arguments. */
- else if (! (argv.size () == 1
+ /* Remember that a sequence of tokens like "foo()" is a
+ valid invocation of a macro expecting either zero or one
+ arguments. */
+ else if (! (argv.size () == 1
&& argv[0].len == 0
&& def->argc == 0))
- error (_("Wrong number of arguments to macro `%s' "
- "(expected %d, got %d)."),
- id, def->argc, int (argv.size ()));
- }
+ error (_("Wrong number of arguments to macro `%s' "
+ "(expected %d, got %d)."),
+ id, def->argc, int (argv.size ()));
+ }
/* Note that we don't expand macro invocations in the arguments
- yet --- we let subst_args take care of that. Parameters that
- appear as operands of the stringifying operator "#" or the
- splicing operator "##" don't get macro references expanded,
- so we can't really tell whether it's appropriate to macro-
- expand an argument until we see how it's being used. */
+ yet --- we let subst_args take care of that. Parameters that
+ appear as operands of the stringifying operator "#" or the
+ splicing operator "##" don't get macro references expanded,
+ so we can't really tell whether it's appropriate to macro-
+ expand an argument until we see how it's being used. */
struct macro_buffer substituted (0);
substitute_args (&substituted, def, is_varargs, &va_arg_name,
argv, no_loop, scope);
/* Now `substituted' is the macro's replacement list, with all
- argument values substituted into it properly. Re-scan it for
- macro references, but don't expand invocations of this macro.
-
- We create a new buffer, `substituted_src', which points into
- `substituted', and scan that. We can't scan `substituted'
- itself, since the tokenization process moves the buffer's
- text pointer around, and we still need to be able to find
- `substituted's original text buffer after scanning it so we
- can free it. */
+ argument values substituted into it properly. Re-scan it for
+ macro references, but don't expand invocations of this macro.
+
+ We create a new buffer, `substituted_src', which points into
+ `substituted', and scan that. We can't scan `substituted'
+ itself, since the tokenization process moves the buffer's
+ text pointer around, and we still need to be able to find
+ `substituted's original text buffer after scanning it so we
+ can free it. */
struct macro_buffer substituted_src (substituted.text, substituted.len);
scan (dest, &substituted_src, &new_no_loop, scope);
SRC_FIRST must be a string built by get_token. */
static int
maybe_expand (struct macro_buffer *dest,
- struct macro_buffer *src_first,
- struct macro_buffer *src_rest,
- struct macro_name_list *no_loop,
+ struct macro_buffer *src_first,
+ struct macro_buffer *src_rest,
+ struct macro_name_list *no_loop,
const macro_scope &scope)
{
gdb_assert (src_first->shared);
if (src_first->is_identifier)
{
/* Make a null-terminated copy of it, since that's what our
- lookup function expects. */
+ lookup function expects. */
std::string id (src_first->text, src_first->len);
/* If we're currently re-scanning the result of expanding
- this macro, don't expand it again. */
+ this macro, don't expand it again. */
if (! currently_rescanning (no_loop, id.c_str ()))
- {
- /* Does this identifier have a macro definition in scope? */
- macro_definition *def = standard_macro_lookup (id.c_str (), scope);
+ {
+ /* Does this identifier have a macro definition in scope? */
+ macro_definition *def = standard_macro_lookup (id.c_str (), scope);
- if (def && expand (id.c_str (), def, dest, src_rest, no_loop, scope))
+ if (def && expand (id.c_str (), def, dest, src_rest, no_loop, scope))
return 1;
- }
+ }
}
return 0;
/* Find the next token in SRC. */
if (! get_token (&tok, src))
- break;
+ break;
/* Just for aesthetics. If we skipped some whitespace, copy
- that to DEST. */
+ that to DEST. */
if (tok.text > original_src_start)
- {
- dest->appendmem (original_src_start, tok.text - original_src_start);
- dest->last_token = dest->len;
- }
+ {
+ dest->appendmem (original_src_start, tok.text - original_src_start);
+ dest->last_token = dest->len;
+ }
if (! maybe_expand (dest, &tok, src, no_loop, scope))
- /* We didn't end up expanding tok as a macro reference, so
- simply append it to dest. */
- append_tokens_without_splicing (dest, &tok);
+ /* We didn't end up expanding tok as a macro reference, so
+ simply append it to dest. */
+ append_tokens_without_splicing (dest, &tok);
}
/* Just for aesthetics. If there was any trailing whitespace in
if (maybe_expand (&dest, &tok, &src, 0, scope))
{
/* It was a macro invocation! Package up the expansion as a
- null-terminated string and return it. Set *lexptr to the
- start of the next token in the input. */
+ null-terminated string and return it. Set *lexptr to the
+ start of the next token in the input. */
dest.appendc ('\0');
*lexptr = src.text;
return dest.release ();
else
{
/* There are, unfortunately, cases where a compilation unit can
- have a symtab for a source file that doesn't appear in the
- macro table. For example, at the moment, Dwarf doesn't have
- any way in the .debug_macinfo section to describe the effect
- of #line directives, so if you debug a YACC parser you'll get
- a macro table which only mentions the .c files generated by
- YACC, but symtabs that mention the .y files consumed by YACC.
-
- In the long run, we should extend the Dwarf macro info
- representation to handle #line directives, and get GCC to
- emit it.
-
- For the time being, though, we'll just treat these as
- occurring at the end of the main source file. */
+ have a symtab for a source file that doesn't appear in the
+ macro table. For example, at the moment, Dwarf doesn't have
+ any way in the .debug_macinfo section to describe the effect
+ of #line directives, so if you debug a YACC parser you'll get
+ a macro table which only mentions the .c files generated by
+ YACC, but symtabs that mention the .y files consumed by YACC.
+
+ In the long run, we should extend the Dwarf macro info
+ representation to handle #line directives, and get GCC to
+ emit it.
+
+ For the time being, though, we'll just treat these as
+ occurring at the end of the main source file. */
ms->file = main_file;
ms->line = -1;
complaint (_("symtab found for `%s', but that file\n"
- "is not covered in the compilation unit's macro information"),
- symtab_to_filename_for_display (sal.symtab));
+ "is not covered in the compilation unit's macro information"),
+ symtab_to_filename_for_display (sal.symtab));
}
return ms;
else
{
/* Don't call select_source_symtab here. That can raise an
- error if symbols aren't loaded, but GDB calls the expression
- evaluator in all sorts of contexts.
-
- For example, commands like `set width' call the expression
- evaluator to evaluate their numeric arguments. If the
- current language is C, then that may call this function to
- choose a scope for macro expansion. If you don't have any
- symbol files loaded, then get_current_or_default would raise an
- error. But `set width' shouldn't raise an error just because
- it can't decide which scope to macro-expand its argument in. */
+ error if symbols aren't loaded, but GDB calls the expression
+ evaluator in all sorts of contexts.
+
+ For example, commands like `set width' call the expression
+ evaluator to evaluate their numeric arguments. If the
+ current language is C, then that may call this function to
+ choose a scope for macro expansion. If you don't have any
+ symbol files loaded, then get_current_or_default would raise an
+ error. But `set width' shouldn't raise an error just because
+ it can't decide which scope to macro-expand its argument in. */
struct symtab_and_line cursal =
get_current_source_symtab_and_line ();
their places. */
static int
compare_locations (struct macro_source_file *file1, int line1,
- struct macro_source_file *file2, int line2)
+ struct macro_source_file *file2, int line2)
{
/* We want to treat positions in an #included file as coming *after*
the line containing the #include, but *before* the line after the
if (! file1)
{
if (! file2)
- return 0;
+ return 0;
else
- return 1;
+ return 1;
}
else if (! file2)
return -1;
if (file1 != file2)
{
/* If one file is deeper than the other, walk up the #inclusion
- chain until the two files are at least at the same *depth*.
- Then, walk up both files in synchrony until they're the same
- file. That file is the common ancestor. */
+ chain until the two files are at least at the same *depth*.
+ Then, walk up both files in synchrony until they're the same
+ file. That file is the common ancestor. */
int depth1 = inclusion_depth (file1);
int depth2 = inclusion_depth (file2);
/* Only one of these while loops will ever execute in any given
- case. */
+ case. */
while (depth1 > depth2)
- {
- line1 = file1->included_at_line;
- file1 = file1->included_by;
- included1 = 1;
- depth1--;
- }
+ {
+ line1 = file1->included_at_line;
+ file1 = file1->included_by;
+ included1 = 1;
+ depth1--;
+ }
while (depth2 > depth1)
- {
- line2 = file2->included_at_line;
- file2 = file2->included_by;
- included2 = 1;
- depth2--;
- }
+ {
+ line2 = file2->included_at_line;
+ file2 = file2->included_by;
+ included2 = 1;
+ depth2--;
+ }
/* Now both file1 and file2 are at the same depth. Walk toward
- the root of the tree until we find where the branches meet. */
+ the root of the tree until we find where the branches meet. */
while (file1 != file2)
- {
- line1 = file1->included_at_line;
- file1 = file1->included_by;
- /* At this point, we know that the case the includedX flags
- are trying to deal with won't come up, but we'll just
- maintain them anyway. */
- included1 = 1;
-
- line2 = file2->included_at_line;
- file2 = file2->included_by;
- included2 = 1;
-
- /* Sanity check. If file1 and file2 are really from the
- same compilation unit, then they should both be part of
- the same tree, and this shouldn't happen. */
- gdb_assert (file1 && file2);
- }
+ {
+ line1 = file1->included_at_line;
+ file1 = file1->included_by;
+ /* At this point, we know that the case the includedX flags
+ are trying to deal with won't come up, but we'll just
+ maintain them anyway. */
+ included1 = 1;
+
+ line2 = file2->included_at_line;
+ file2 = file2->included_by;
+ included2 = 1;
+
+ /* Sanity check. If file1 and file2 are really from the
+ same compilation unit, then they should both be part of
+ the same tree, and this shouldn't happen. */
+ gdb_assert (file1 && file2);
+ }
}
/* Now we've got two line numbers in the same file. */
if (line1 == line2)
{
/* They can't both be from #included files. Then we shouldn't
- have walked up this far. */
+ have walked up this far. */
gdb_assert (! included1 || ! included2);
/* Any #included position comes after a non-#included position
- with the same line number in the #including file. */
+ with the same line number in the #including file. */
if (included1)
- return 1;
+ return 1;
else if (included2)
- return -1;
+ return -1;
else
- return 0;
+ return 0;
}
else
return line1 - line2;
after NAME, FILE, and LINE. */
static int
key_compare (struct macro_key *key,
- const char *name, struct macro_source_file *file, int line)
+ const char *name, struct macro_source_file *file, int line)
{
int names = strcmp (key->name, name);
return names;
return compare_locations (key->start_file, key->start_line,
- file, line);
+ file, line);
}
library's happiness. */
static int
macro_tree_compare (splay_tree_key untyped_key1,
- splay_tree_key untyped_key2)
+ splay_tree_key untyped_key2)
{
struct macro_key *key1 = (struct macro_key *) untyped_key1;
struct macro_key *key2 = (struct macro_key *) untyped_key2;
the bcache. */
static struct macro_key *
new_macro_key (struct macro_table *t,
- const char *name,
- struct macro_source_file *file,
- int line)
+ const char *name,
+ struct macro_source_file *file,
+ int line)
{
struct macro_key *k = (struct macro_key *) macro_alloc (sizeof (*k), t);
/* Allocate and initialize a new source file structure. */
static struct macro_source_file *
new_source_file (struct macro_table *t,
- const char *filename)
+ const char *filename)
{
/* Get space for the source file structure itself. */
struct macro_source_file *f
struct macro_source_file *
macro_set_main (struct macro_table *t,
- const char *filename)
+ const char *filename)
{
/* You can't change a table's main source file. What would that do
to the tree? */
struct macro_source_file *
macro_include (struct macro_source_file *source,
- int line,
- const char *included)
+ int line,
+ const char *included)
{
struct macro_source_file *newobj;
struct macro_source_file **link;
if (*link && line == (*link)->included_at_line)
{
/* This means the compiler is emitting bogus debug info. (GCC
- circa March 2002 did this.) It also means that the splay
- tree ordering function, macro_tree_compare, will abort,
- because it can't tell which #inclusion came first. But GDB
- should tolerate bad debug info. So:
+ circa March 2002 did this.) It also means that the splay
+ tree ordering function, macro_tree_compare, will abort,
+ because it can't tell which #inclusion came first. But GDB
+ should tolerate bad debug info. So:
- First, squawk. */
+ First, squawk. */
std::string link_fullname = macro_source_fullname (*link);
std::string source_fullname = macro_source_fullname (source);
line);
/* Now, choose a new, unoccupied line number for this
- #inclusion, after the alleged #inclusion line. */
+ #inclusion, after the alleged #inclusion line. */
while (*link && line == (*link)->included_at_line)
- {
- /* This line number is taken, so try the next line. */
- line++;
- link = &(*link)->next_included;
- }
+ {
+ /* This line number is taken, so try the next line. */
+ line++;
+ link = &(*link)->next_included;
+ }
}
/* At this point, we know that LINE is an unused line number, and
for (child = source->includes; child; child = child->next_included)
{
- struct macro_source_file *result
- = macro_lookup_inclusion (child, name);
-
- if (result)
- {
- int result_depth = inclusion_depth (result);
-
- if (! best || result_depth < best_depth)
- {
- best = result;
- best_depth = result_depth;
- }
- }
+ struct macro_source_file *result
+ = macro_lookup_inclusion (child, name);
+
+ if (result)
+ {
+ int result_depth = inclusion_depth (result);
+
+ if (! best || result_depth < best_depth)
+ {
+ best = result;
+ best_depth = result_depth;
+ }
+ }
}
return best;
and the macro_definition structure itself, in T's bcache. */
static struct macro_definition *
new_macro_definition (struct macro_table *t,
- enum macro_kind kind,
- int argc, const char **argv,
- const char *replacement)
+ enum macro_kind kind,
+ int argc, const char **argv,
+ const char *replacement)
{
struct macro_definition *d
= (struct macro_definition *) macro_alloc (sizeof (*d), t);
/* Bcache all the arguments. */
cached_argv = (const char **) alloca (cached_argv_size);
for (i = 0; i < argc; i++)
- cached_argv[i] = macro_bcache_str (t, argv[i]);
+ cached_argv[i] = macro_bcache_str (t, argv[i]);
/* Now bcache the array of argument pointers itself. */
d->argv = ((const char * const *)
int i;
for (i = 0; i < d->argc; i++)
- macro_bcache_free (t, (char *) d->argv[i]);
+ macro_bcache_free (t, (char *) d->argv[i]);
macro_bcache_free (t, (char **) d->argv);
}
SOURCE, or zero if there is none. */
static splay_tree_node
find_definition (const char *name,
- struct macro_source_file *file,
- int line)
+ struct macro_source_file *file,
+ int line)
{
struct macro_table *t = file->table;
splay_tree_node n;
if (! n)
{
/* It's okay for us to do two queries like this: the real work
- of the searching is done when we splay, and splaying the tree
- a second time at the same key is a constant time operation.
- If this still bugs you, you could always just extend the
- splay tree library with a predecessor-or-equal operation, and
- use that. */
+ of the searching is done when we splay, and splaying the tree
+ a second time at the same key is a constant time operation.
+ If this still bugs you, you could always just extend the
+ splay tree library with a predecessor-or-equal operation, and
+ use that. */
splay_tree_node pred = splay_tree_predecessor (t->definitions,
- (splay_tree_key) &query);
+ (splay_tree_key) &query);
if (pred)
- {
- /* Make sure this predecessor actually has the right name.
- We just want to search within a given name's definitions. */
- struct macro_key *found = (struct macro_key *) pred->key;
-
- if (strcmp (found->name, name) == 0)
- n = pred;
- }
+ {
+ /* Make sure this predecessor actually has the right name.
+ We just want to search within a given name's definitions. */
+ struct macro_key *found = (struct macro_key *) pred->key;
+
+ if (strcmp (found->name, name) == 0)
+ n = pred;
+ }
}
if (n)
struct macro_key *found = (struct macro_key *) n->key;
/* Okay, so this definition has the right name, and its scope
- begins before the given source location. But does its scope
- end after the given source location? */
+ begins before the given source location. But does its scope
+ end after the given source location? */
if (compare_locations (file, line, found->end_file, found->end_line) < 0)
- return n;
+ return n;
else
- return 0;
+ return 0;
}
else
return 0;
is `macro_function_like'.) */
static struct macro_key *
check_for_redefinition (struct macro_source_file *source, int line,
- const char *name, enum macro_kind kind,
- int argc, const char **argv,
- const char *replacement)
+ const char *name, enum macro_kind kind,
+ int argc, const char **argv,
+ const char *replacement)
{
splay_tree_node n = find_definition (name, source, line);
{
struct macro_key *found_key = (struct macro_key *) n->key;
struct macro_definition *found_def
- = (struct macro_definition *) n->value;
+ = (struct macro_definition *) n->value;
int same = 1;
/* Is this definition the same as the existing one?
- According to the standard, this comparison needs to be done
- on lists of tokens, not byte-by-byte, as we do here. But
- that's too hard for us at the moment, and comparing
- byte-by-byte will only yield false negatives (i.e., extra
- warning messages), not false positives (i.e., unnoticed
- definition changes). */
+ According to the standard, this comparison needs to be done
+ on lists of tokens, not byte-by-byte, as we do here. But
+ that's too hard for us at the moment, and comparing
+ byte-by-byte will only yield false negatives (i.e., extra
+ warning messages), not false positives (i.e., unnoticed
+ definition changes). */
if (kind != found_def->kind)
- same = 0;
+ same = 0;
else if (strcmp (replacement, found_def->replacement))
- same = 0;
+ same = 0;
else if (kind == macro_function_like)
- {
- if (argc != found_def->argc)
- same = 0;
- else
- {
- int i;
-
- for (i = 0; i < argc; i++)
- if (strcmp (argv[i], found_def->argv[i]))
- same = 0;
- }
- }
+ {
+ if (argc != found_def->argc)
+ same = 0;
+ else
+ {
+ int i;
+
+ for (i = 0; i < argc; i++)
+ if (strcmp (argv[i], found_def->argv[i]))
+ same = 0;
+ }
+ }
if (! same)
- {
+ {
std::string source_fullname = macro_source_fullname (source);
std::string found_key_fullname
= macro_source_fullname (found_key->start_file);
name, source_fullname.c_str (), line,
found_key_fullname.c_str (),
found_key->start_line);
- }
+ }
return found_key;
}
static void
macro_define_internal (struct macro_source_file *source, int line,
- const char *name, enum macro_kind kind,
+ const char *name, enum macro_kind kind,
int argc, const char **argv,
- const char *replacement)
+ const char *replacement)
{
struct macro_table *t = source->table;
struct macro_key *k = NULL;
void
macro_define_function (struct macro_source_file *source, int line,
- const char *name, int argc, const char **argv,
- const char *replacement)
+ const char *name, int argc, const char **argv,
+ const char *replacement)
{
macro_define_internal (source, line,
name, macro_function_like,
void
macro_undef (struct macro_source_file *source, int line,
- const char *name)
+ const char *name)
{
splay_tree_node n = find_definition (name, source, line);
struct macro_key *key = (struct macro_key *) n->key;
/* If we're removing a definition at exactly the same point that
- we defined it, then just delete the entry altogether. GCC
- 4.1.2 will generate DWARF that says to do this if you pass it
- arguments like '-DFOO -UFOO -DFOO=2'. */
+ we defined it, then just delete the entry altogether. GCC
+ 4.1.2 will generate DWARF that says to do this if you pass it
+ arguments like '-DFOO -UFOO -DFOO=2'. */
if (source == key->start_file
- && line == key->start_line)
- splay_tree_remove (source->table->definitions, n->key);
+ && line == key->start_line)
+ splay_tree_remove (source->table->definitions, n->key);
else
- {
- /* This function is the only place a macro's end-of-scope
- location gets set to anything other than "end of the
- compilation unit" (i.e., end_file is zero). So if this
- macro already has its end-of-scope set, then we're
- probably seeing a second #undefinition for the same
- #definition. */
- if (key->end_file)
- {
+ {
+ /* This function is the only place a macro's end-of-scope
+ location gets set to anything other than "end of the
+ compilation unit" (i.e., end_file is zero). So if this
+ macro already has its end-of-scope set, then we're
+ probably seeing a second #undefinition for the same
+ #definition. */
+ if (key->end_file)
+ {
std::string source_fullname = macro_source_fullname (source);
std::string key_fullname = macro_source_fullname (key->end_file);
- complaint (_("macro '%s' is #undefined twice,"
- " at %s:%d and %s:%d"),
+ complaint (_("macro '%s' is #undefined twice,"
+ " at %s:%d and %s:%d"),
name, source_fullname.c_str (), line,
key_fullname.c_str (),
key->end_line);
- }
+ }
- /* Whether or not we've seen a prior #undefinition, wipe out
- the old ending point, and make this the ending point. */
- key->end_file = source;
- key->end_line = line;
- }
+ /* Whether or not we've seen a prior #undefinition, wipe out
+ the old ending point, and make this the ending point. */
+ key->end_file = source;
+ key->end_line = line;
+ }
}
else
{
/* According to the ISO C standard, an #undef for a symbol that
- has no macro definition in scope is ignored. So we should
- ignore it too. */
+ has no macro definition in scope is ignored. So we should
+ ignore it too. */
#if 0
complaint (_("no definition for macro `%s' in scope to #undef at %s:%d"),
name, source->filename, line);
struct macro_definition *
macro_lookup_definition (struct macro_source_file *source,
- int line, const char *name)
+ int line, const char *name)
{
splay_tree_node n = find_definition (name, source, line);
struct macro_source_file *
macro_definition_location (struct macro_source_file *source,
- int line,
- const char *name,
- int *definition_line)
+ int line,
+ const char *name,
+ int *definition_line)
{
splay_tree_node n = find_definition (name, source, line);
t->compunit_symtab = cust;
t->redef_ok = 0;
t->definitions = (splay_tree_new_with_allocator
- (macro_tree_compare,
- ((splay_tree_delete_key_fn) macro_tree_delete_key),
- ((splay_tree_delete_value_fn) macro_tree_delete_value),
- ((splay_tree_allocate_fn) macro_alloc),
- ((splay_tree_deallocate_fn) macro_free),
- t));
+ (macro_tree_compare,
+ ((splay_tree_delete_key_fn) macro_tree_delete_key),
+ ((splay_tree_delete_value_fn) macro_tree_delete_value),
+ ((splay_tree_allocate_fn) macro_alloc),
+ ((splay_tree_deallocate_fn) macro_free),
+ t));
return t;
}
number." This is analogous to the way GCC reports errors in
#include files:
- $ gcc -c base.c
- In file included from header2.h:8,
- from header1.h:3,
- from base.c:5:
- header3.h:1: parse error before ')' token
- $
+ $ gcc -c base.c
+ In file included from header2.h:8,
+ from header1.h:3,
+ from base.c:5:
+ header3.h:1: parse error before ')' token
+ $
GCC tells you exactly what path of #inclusions led you to the
problem. It gives you complete information, in a way that the
following would not:
- $ gcc -c base.c
- header3.h:1: parse error before ')' token
- $
+ $ gcc -c base.c
+ header3.h:1: parse error before ')' token
+ $
Converting all of GDB to use this is a big task, and I'm not really
suggesting it should be a priority. But this module's whole
the same source location (although 'gcc -DFOO -UFOO -DFOO=2' does
do that in GCC 4.1.2.). */
struct macro_table *new_macro_table (struct obstack *obstack,
- gdb::bcache *bcache,
+ gdb::bcache *bcache,
struct compunit_symtab *cust);
The macro table makes its own copy of FILENAME; the caller is
responsible for freeing FILENAME when it is no longer needed. */
struct macro_source_file *macro_set_main (struct macro_table *table,
- const char *filename);
+ const char *filename);
/* Return the main source file of the macro table TABLE. */
The macro table makes its own copy of INCLUDED; the caller is
responsible for freeing INCLUDED when it is no longer needed. */
struct macro_source_file *macro_include (struct macro_source_file *source,
- int line,
- const char *included);
+ int line,
+ const char *included);
/* Define any special macros, like __FILE__ or __LINE__. This should
be called once, on the main source file. */
appears more than once in the inclusion tree, return the
least-nested inclusion --- the one closest to the main source file. */
struct macro_source_file *macro_lookup_inclusion
- (struct macro_source_file *source,
- const char *name);
+ (struct macro_source_file *source,
+ const char *name);
/* Record an object-like #definition (i.e., one with no parameter list).
string is REPLACEMENT. This function makes copies of NAME and
REPLACEMENT; the caller is responsible for freeing them. */
void macro_define_object (struct macro_source_file *source, int line,
- const char *name, const char *replacement);
+ const char *name, const char *replacement);
/* Record an function-like #definition (i.e., one with a parameter list).
NAME, ARGV, and REPLACEMENT; the caller is responsible for freeing
them. */
void macro_define_function (struct macro_source_file *source, int line,
- const char *name, int argc, const char **argv,
- const char *replacement);
+ const char *name, int argc, const char **argv,
+ const char *replacement);
/* Record an #undefinition.
Record in SOURCE's macro table that, at line number LINE in SOURCE,
we removed the definition for the preprocessor symbol named NAME. */
void macro_undef (struct macro_source_file *source, int line,
- const char *name);
+ const char *name);
/* Different kinds of macro definitions. */
enum macro_kind
the caller need not free it. Return zero if NAME is not #defined
at that point. */
struct macro_definition *macro_lookup_definition
- (struct macro_source_file *source,
- int line, const char *name);
+ (struct macro_source_file *source,
+ int line, const char *name);
/* Return the source location of the definition for NAME in scope at
the file. Return zero if NAME has no definition in scope at that
point, and leave *DEFINITION_LINE unchanged. */
struct macro_source_file *macro_definition_location
- (struct macro_source_file *source,
- int line,
- const char *name,
- int *definition_line);
+ (struct macro_source_file *source,
+ int line,
+ const char *name,
+ int *definition_line);
/* Prototype for a callback callable when walking a macro table. NAME
is the name of the macro, and DEFINITION is the definition. SOURCE
if (!IS_ABSOLUTE_PATH (gdb_datadir.c_str ()))
{
gdb::unique_xmalloc_ptr<char> abs_datadir
- = gdb_abspath (gdb_datadir.c_str ());
+ = gdb_abspath (gdb_datadir.c_str ());
gdb_datadir = abs_datadir.get ();
}
break;
case OPT_WINDOWS:
/* FIXME: cagney/2003-03-01: Not sure if this option is
- actually useful, and if it is, what it should do. */
+ actually useful, and if it is, what it should do. */
#ifdef GDBTK
/* --windows is equivalent to -i=insight. */
xfree (interpreter_p);
else
baud_rate = rate;
}
- break;
+ break;
case 'l':
{
int timeout;
if (!quiet && strcmp (interpreter_p, INTERP_MI1) == 0)
{
/* Print all the junk at the top, with trailing "..." if we are
- about to read a symbol file (possibly slowly). */
+ about to read a symbol file (possibly slowly). */
print_gdb_version (gdb_stdout, true);
if (symarg)
printf_filtered ("..");
if (!quiet && !current_interp_named_p (INTERP_MI1))
{
/* Print all the junk at the top, with trailing "..." if we are
- about to read a symbol file (possibly slowly). */
+ about to read a symbol file (possibly slowly). */
print_gdb_version (gdb_stdout, true);
if (symarg)
printf_filtered ("..");
&& strcmp (execarg, symarg) == 0)
{
/* The exec file and the symbol-file are the same. If we can't
- open it, better only print one error message.
- catch_command_errors returns non-zero on success! */
+ open it, better only print one error message.
+ catch_command_errors returns non-zero on success! */
ret = catch_command_errors (exec_file_attach, execarg,
!batch_flag);
if (ret != 0)
Initial commands and command files:\n\n\
--command=FILE, -x Execute GDB commands from FILE.\n\
--init-command=FILE, -ix\n\
- Like -x but execute commands before loading inferior.\n\
+ Like -x but execute commands before loading inferior.\n\
--eval-command=COMMAND, -ex\n\
- Execute a single GDB command.\n\
- May be used multiple times and in conjunction\n\
- with --command.\n\
+ Execute a single GDB command.\n\
+ May be used multiple times and in conjunction\n\
+ with --command.\n\
--init-eval-command=COMMAND, -iex\n\
- Like -ex but before loading inferior.\n\
+ Like -ex but before loading inferior.\n\
--nh Do not read ~/.gdbinit.\n\
--nx Do not read any .gdbinit files in any directory.\n\n\
"), stream);
Output and user interface control:\n\n\
--fullname Output information used by emacs-GDB interface.\n\
--interpreter=INTERP\n\
- Select a specific interpreter / user interface\n\
+ Select a specific interpreter / user interface\n\
--tty=TTY Use TTY for input/output by the program being debugged.\n\
-w Use the GUI interface.\n\
--nw Do not use the GUI interface.\n\
fputs_unfiltered (_("\
--dbx DBX compatibility mode.\n\
-q, --quiet, --silent\n\
- Do not print version number on startup.\n\n\
+ Do not print version number on startup.\n\n\
"), stream);
fputs_unfiltered (_("\
Operating modes:\n\n\
--batch Exit after processing options.\n\
--batch-silent Like --batch, but suppress all gdb stdout output.\n\
--return-child-result\n\
- GDB exit code will be the child's exit code.\n\
+ GDB exit code will be the child's exit code.\n\
--configuration Print details about GDB configuration and then exit.\n\
--help Print this message and then exit.\n\
--version Print version information and then exit.\n\n\
Other options:\n\n\
--cd=DIR Change current directory to DIR.\n\
--data-directory=DIR, -D\n\
- Set GDB's data-directory to DIR.\n\
+ Set GDB's data-directory to DIR.\n\
"), stream);
fputs_unfiltered (_("\n\
At startup, GDB reads the following init files and executes their commands:\n\
{
std::string output;
for (size_t idx = 0; idx < system_gdbinit.size (); ++idx)
- {
+ {
output += system_gdbinit[idx];
if (idx < system_gdbinit.size () - 1)
output += ", ";
#define SC_IS_TEXT(sc) ((sc) == scText \
|| (sc) == scRConst \
- || (sc) == scInit \
- || (sc) == scFini)
+ || (sc) == scInit \
+ || (sc) == scFini)
#define SC_IS_DATA(sc) ((sc) == scData \
|| (sc) == scSData \
|| (sc) == scRData \
stabsread_new_init ();
free_header_files ();
init_header_files ();
-
+
/* Make sure all the FDR information is swapped in. */
if (info->fdr == NULL)
{
reg_value_complaint (int regnum, int num_regs, const char *sym)
{
complaint (_("bad register number %d (max %d) in symbol %s"),
- regnum, num_regs - 1, sym);
+ regnum, num_regs - 1, sym);
}
/* Parse a single symbol. Mostly just make up a GDB symbol for it.
case scText:
case scRConst:
/* Do not relocate relative values.
- The value of a stEnd symbol is the displacement from the
- corresponding start symbol value.
- The value of a stBlock symbol is the displacement from the
- procedure address. */
+ The value of a stEnd symbol is the displacement from the
+ corresponding start symbol value.
+ The value of a stBlock symbol is the displacement from the
+ procedure address. */
if (sh->st != stEnd && sh->st != stBlock)
sh->value += section_offsets[SECT_OFF_TEXT (objfile)];
break;
case stProc: /* Procedure, usually goes into global block. */
case stStaticProc: /* Static procedure, goes into current block. */
/* For stProc symbol records, we need to check the storage class
- as well, as only (stProc, scText) entries represent "real"
- procedures - See the Compaq document titled "Object File /
- Symbol Table Format Specification" for more information.
- If the storage class is not scText, we discard the whole block
- of symbol records for this stProc. */
+ as well, as only (stProc, scText) entries represent "real"
+ procedures - See the Compaq document titled "Object File /
+ Symbol Table Format Specification" for more information.
+ If the storage class is not scText, we discard the whole block
+ of symbol records for this stProc. */
if (sh->st == stProc && sh->sc != scText)
- {
- char *ext_tsym = ext_sh;
- int keep_counting = 1;
- SYMR tsym;
-
- while (keep_counting)
- {
- ext_tsym += external_sym_size;
- (*swap_sym_in) (cur_bfd, ext_tsym, &tsym);
- count++;
- switch (tsym.st)
- {
- case stParam:
- break;
- case stEnd:
- keep_counting = 0;
- break;
- default:
- complaint (_("unknown symbol type 0x%x"), sh->st);
- break;
- }
- }
- break;
- }
+ {
+ char *ext_tsym = ext_sh;
+ int keep_counting = 1;
+ SYMR tsym;
+
+ while (keep_counting)
+ {
+ ext_tsym += external_sym_size;
+ (*swap_sym_in) (cur_bfd, ext_tsym, &tsym);
+ count++;
+ switch (tsym.st)
+ {
+ case stParam:
+ break;
+ case stEnd:
+ keep_counting = 0;
+ break;
+ default:
+ complaint (_("unknown symbol type 0x%x"), sh->st);
+ break;
+ }
+ }
+ break;
+ }
s = new_symbol (name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (s) = LOC_BLOCK;
&& t->code () == TYPE_CODE_VOID)
{
/* I don't know why, but, at least under Alpha GNU/Linux,
- when linking against a malloc without debugging
- symbols, its read as a function returning void---this
- is bad because it means we cannot call functions with
- string arguments interactively; i.e., "call
- printf("howdy\n")" would fail with the error message
- "program has no memory available". To avoid this, we
- patch up the type and make it void*
- instead. (davidm@azstarnet.com). */
+ when linking against a malloc without debugging
+ symbols, its read as a function returning void---this
+ is bad because it means we cannot call functions with
+ string arguments interactively; i.e., "call
+ printf("howdy\n")" would fail with the error message
+ "program has no memory available". To avoid this, we
+ patch up the type and make it void*
+ instead. (davidm@azstarnet.com). */
t = make_pointer_type (t, NULL);
}
}
SYMBOL_TYPE (s) = lookup_function_type (t);
/* All functions in C++ have prototypes. For C we don't have enough
- information in the debug info. */
+ information in the debug info. */
if (s->language () == language_cplus)
SYMBOL_TYPE (s)->set_is_prototyped (true);
break;
/* Beginning of code for structure, union, and enum definitions.
- They all share a common set of local variables, defined here. */
+ They all share a common set of local variables, defined here. */
{
enum type_code type_code;
char *ext_tsym;
switch (tsym.st)
{
case stEnd:
- /* C++ encodes class types as structures where there the
- methods are encoded as stProc. The scope of stProc
- symbols also ends with stEnd, thus creating a risk of
- taking the wrong stEnd symbol record as the end of
- the current struct, which would cause GDB to undercount
- the real number of fields in this struct. To make sure
- we really reached the right stEnd symbol record, we
- check the associated name, and match it against the
- struct name. Since method names are mangled while
- the class name is not, there is no risk of having a
- method whose name is identical to the class name
- (in particular constructor method names are different
- from the class name). There is therefore no risk that
- this check stops the count on the StEnd of a method.
+ /* C++ encodes class types as structures where there the
+ methods are encoded as stProc. The scope of stProc
+ symbols also ends with stEnd, thus creating a risk of
+ taking the wrong stEnd symbol record as the end of
+ the current struct, which would cause GDB to undercount
+ the real number of fields in this struct. To make sure
+ we really reached the right stEnd symbol record, we
+ check the associated name, and match it against the
+ struct name. Since method names are mangled while
+ the class name is not, there is no risk of having a
+ method whose name is identical to the class name
+ (in particular constructor method names are different
+ from the class name). There is therefore no risk that
+ this check stops the count on the StEnd of a method.
Also, assume that we're really at the end when tsym.iss
is 0 (issNull). */
- if (tsym.iss == issNull
+ if (tsym.iss == issNull
|| strcmp (debug_info->ss + cur_fdr->issBase + tsym.iss,
- name) == 0)
- goto end_of_fields;
- break;
+ name) == 0)
+ goto end_of_fields;
+ break;
case stMember:
if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
if (tsym.index != 0)
{
/* This is something like a struct within a
- struct. Skip over the fields of the inner
- struct. The -1 is because the for loop will
- increment ext_tsym. */
+ struct. Skip over the fields of the inner
+ struct. The -1 is because the for loop will
+ increment ext_tsym. */
ext_tsym = ((char *) debug_info->external_sym
+ ((cur_fdr->isymBase + tsym.index - 1)
* external_sym_size));
case_stBlock_code:
found_ecoff_debugging_info = 1;
/* Beginnning of (code) block. Value of symbol
- is the displacement from procedure start. */
+ is the displacement from procedure start. */
push_parse_stack ();
/* Do not start a new block if this is the outermost block of a
- procedure. This allows the LOC_BLOCK symbol to point to the
- block with the local variables, so funcname::var works. */
+ procedure. This allows the LOC_BLOCK symbol to point to the
+ block with the local variables, so funcname::var works. */
if (top_stack->blocktype == stProc
|| top_stack->blocktype == stStaticProc)
{
if (ftype->num_fields () <= 0)
{
/* No parameter type information is recorded with the function's
- type. Set that from the type of the parameter symbols. */
+ type. Set that from the type of the parameter symbols. */
int nparams = top_stack->numargs;
int iparams;
struct symbol *sym;
case stIndirect: /* forward declaration on Irix5 */
/* Forward declarations from Irix5 cc are handled by cross_ref,
- skip them. */
+ skip them. */
break;
case stTypedef: /* type definition */
found_ecoff_debugging_info = 1;
/* Typedefs for forward declarations and opaque structs from alpha cc
- are handled by cross_ref, skip them. */
+ are handled by cross_ref, skip them. */
if (sh->iss == 0)
break;
t = pend->t;
/* Mips cc puts out a typedef with the name of the struct for forward
- declarations. These should not go into the symbol table and
- TYPE_NAME should not be set for them.
- They can't be distinguished from an intentional typedef to
- the same name however:
- x.h:
- struct x { int ix; int jx; };
- struct xx;
- x.c:
- typedef struct x x;
- struct xx {int ixx; int jxx; };
- generates a cross referencing stTypedef for x and xx.
- The user visible effect of this is that the type of a pointer
- to struct foo sometimes is given as `foo *' instead of `struct foo *'.
- The problem is fixed with alpha cc and Irix5 cc. */
+ declarations. These should not go into the symbol table and
+ TYPE_NAME should not be set for them.
+ They can't be distinguished from an intentional typedef to
+ the same name however:
+ x.h:
+ struct x { int ix; int jx; };
+ struct xx;
+ x.c:
+ typedef struct x x;
+ struct xx {int ixx; int jxx; };
+ generates a cross referencing stTypedef for x and xx.
+ The user visible effect of this is that the type of a pointer
+ to struct foo sometimes is given as `foo *' instead of `struct foo *'.
+ The problem is fixed with alpha cc and Irix5 cc. */
/* However if the typedef cross references to an opaque aggregate, it
- is safe to omit it from the symbol table. */
+ is safe to omit it from the symbol table. */
if (has_opaque_xref (cur_fdr, sh))
break;
|| SYMBOL_TYPE (s)->code () == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as "pointer to
- foo" or "function returning foo", we better not set
- the TYPE_NAME. If the program contains "typedef char
- *caddr_t;", we don't want all variables of type char
- * to print as caddr_t. This is not just a
- consequence of GDB's type management; CC and GCC (at
- least through version 2.4) both output variables of
- either type char * or caddr_t with the type
- refering to the stTypedef symbol for caddr_t. If a future
- compiler cleans this up it GDB is not ready for it
- yet, but if it becomes ready we somehow need to
- disable this check (without breaking the PCC/GCC2.4
- case).
-
- Sigh.
-
- Fortunately, this check seems not to be necessary
- for anything except pointers or functions. */
+ foo" or "function returning foo", we better not set
+ the TYPE_NAME. If the program contains "typedef char
+ *caddr_t;", we don't want all variables of type char
+ * to print as caddr_t. This is not just a
+ consequence of GDB's type management; CC and GCC (at
+ least through version 2.4) both output variables of
+ either type char * or caddr_t with the type
+ refering to the stTypedef symbol for caddr_t. If a future
+ compiler cleans this up it GDB is not ready for it
+ yet, but if it becomes ready we somehow need to
+ disable this check (without breaking the PCC/GCC2.4
+ case).
+
+ Sigh.
+
+ Fortunately, this check seems not to be necessary
+ for anything except pointers or functions. */
}
else
SYMBOL_TYPE (s)->set_name (s->linkage_name ());
tp = init_type (mdebugread_objfile, type_code, 0, NULL);
/* DEC c89 produces cross references to qualified aggregate types,
- dereference them. */
+ dereference them. */
while (tp->code () == TYPE_CODE_PTR
|| tp->code () == TYPE_CODE_ARRAY)
tp = TYPE_TARGET_TYPE (tp);
/* Make sure that TYPE_CODE(tp) has an expected type code.
- Any type may be returned from cross_ref if file indirect entries
- are corrupted. */
+ Any type may be returned from cross_ref if file indirect entries
+ are corrupted. */
if (tp->code () != TYPE_CODE_STRUCT
&& tp->code () != TYPE_CODE_UNION
&& tp->code () != TYPE_CODE_ENUM)
tp = init_type (mdebugread_objfile, type_code, 0, NULL);
/* Make sure that TYPE_CODE(tp) has an expected type code.
- Any type may be returned from cross_ref if file indirect entries
- are corrupted. */
+ Any type may be returned from cross_ref if file indirect entries
+ are corrupted. */
if (tp->code () != TYPE_CODE_RANGE)
{
unexpected_type_code_complaint (sym_name);
id, NULL, bigend, sym_name);
/* The bounds type should be an integer type, but might be anything
- else due to corrupt aux entries. */
+ else due to corrupt aux entries. */
if (indx->code () != TYPE_CODE_INT)
{
complaint (_("illegal array index type for %s, assuming int"),
t = create_array_type (NULL, *tpp, range);
/* We used to fill in the supplied array element bitsize
- here if the TYPE_LENGTH of the target type was zero.
- This happens for a `pointer to an array of anonymous structs',
- but in this case the array element bitsize is also zero,
- so nothing is gained.
- And we used to check the TYPE_LENGTH of the target type against
- the supplied array element bitsize.
- gcc causes a mismatch for `pointer to array of object',
- since the sdb directives it uses do not have a way of
- specifying the bitsize, but it does no harm (the
- TYPE_LENGTH should be correct) and we should be able to
- ignore the erroneous bitsize from the auxiliary entry safely.
- dbx seems to ignore it too. */
+ here if the TYPE_LENGTH of the target type was zero.
+ This happens for a `pointer to an array of anonymous structs',
+ but in this case the array element bitsize is also zero,
+ so nothing is gained.
+ And we used to check the TYPE_LENGTH of the target type against
+ the supplied array element bitsize.
+ gcc causes a mismatch for `pointer to array of object',
+ since the sdb directives it uses do not have a way of
+ specifying the bitsize, but it does no harm (the
+ TYPE_LENGTH should be correct) and we should be able to
+ ignore the erroneous bitsize from the auxiliary entry safely.
+ dbx seems to ignore it too. */
/* TYPE_TARGET_STUB now takes care of the zero TYPE_LENGTH problem. */
if (TYPE_LENGTH (*tpp) == 0)
{
#if 0
/* This loses both in the case mentioned (want a static, find a global),
- but also if we are looking up a non-mangled name which happens to
- match the name of a mangled function. */
+ but also if we are looking up a non-mangled name which happens to
+ match the name of a mangled function. */
/* We have to save the cur_fdr across the call to lookup_symbol.
- If the pdr is for a static function and if a global function with
- the same name exists, lookup_symbol will eventually read in the symtab
- for the global function and clobber cur_fdr. */
+ If the pdr is for a static function and if a global function with
+ the same name exists, lookup_symbol will eventually read in the symtab
+ for the global function and clobber cur_fdr. */
FDR *save_cur_fdr = cur_fdr;
s = lookup_symbol (sh_name, NULL, VAR_DOMAIN, 0);
BLOCK_FUNCTION (b) = s;
BLOCK_START (b) = pr->adr;
/* BOUND used to be the end of procedure's text, but the
- argument is no longer passed in. */
+ argument is no longer passed in. */
BLOCK_END (b) = bound;
BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
add_block (b, top_stack->cur_st);
e->pdr = *pr;
/* GDB expects the absolute function start address for the
- procedure descriptor in e->pdr.adr.
- As the address in the procedure descriptor is usually relative,
- we would have to relocate e->pdr.adr with cur_fdr->adr.
- Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
- in shared libraries on some systems, and on other systems
- e->pdr.adr is sometimes offset by a bogus value.
- To work around these problems, we replace e->pdr.adr with
- the start address of the function. */
+ procedure descriptor in e->pdr.adr.
+ As the address in the procedure descriptor is usually relative,
+ we would have to relocate e->pdr.adr with cur_fdr->adr.
+ Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
+ in shared libraries on some systems, and on other systems
+ e->pdr.adr is sometimes offset by a bogus value.
+ To work around these problems, we replace e->pdr.adr with
+ the start address of the function. */
e->pdr.adr = BLOCK_START (b);
}
case stProc:
case stStaticProc:
/* There is no need to parse the external procedure symbols.
- If they are from objects compiled without -g, their index will
- be indexNil, and the symbol definition from the minimal symbol
- is preferrable (yielding a function returning int instead of int).
- If the index points to a local procedure symbol, the local
- symbol already provides the correct type.
- Note that the index of the external procedure symbol points
- to the local procedure symbol in the local symbol table, and
- _not_ to the auxiliary symbol info. */
+ If they are from objects compiled without -g, their index will
+ be indexNil, and the symbol definition from the minimal symbol
+ is preferrable (yielding a function returning int instead of int).
+ If the index points to a local procedure symbol, the local
+ symbol already provides the correct type.
+ Note that the index of the external procedure symbol points
+ to the local procedure symbol in the local symbol table, and
+ _not_ to the auxiliary symbol info. */
break;
case stGlobal:
case stLabel:
/* Global common symbols are resolved by the runtime loader,
- ignore them. */
+ ignore them. */
if (SC_IS_COMMON (es->asym.sc))
break;
/* Note that the case of a symbol with indexNil must be handled
- anyways by parse_symbol(). */
+ anyways by parse_symbol(). */
parse_symbol (&es->asym, ax, NULL,
bigend, section_offsets, objfile);
break;
continue;
/* Determine start and end address of compressed line bytes for
- this procedure. */
+ this procedure. */
base = debug_info->line + fh->cbLineOffset;
if (j != (fh->cpd - 1))
halt = base + pr[1].cbLineOffset;
static void
record_minimal_symbol (minimal_symbol_reader &reader,
const char *name, const CORE_ADDR address,
- enum minimal_symbol_type ms_type, int storage_class,
- struct objfile *objfile)
+ enum minimal_symbol_type ms_type, int storage_class,
+ struct objfile *objfile)
{
int section;
switch (storage_class)
{
case scText:
- section = SECT_OFF_TEXT (objfile);
- break;
+ section = SECT_OFF_TEXT (objfile);
+ break;
case scData:
- section = SECT_OFF_DATA (objfile);
- break;
+ section = SECT_OFF_DATA (objfile);
+ break;
case scBss:
- section = SECT_OFF_BSS (objfile);
- break;
+ section = SECT_OFF_BSS (objfile);
+ break;
case scSData:
- section = get_section_index (objfile, ".sdata");
- break;
+ section = get_section_index (objfile, ".sdata");
+ break;
case scSBss:
- section = get_section_index (objfile, ".sbss");
- break;
+ section = get_section_index (objfile, ".sbss");
+ break;
case scRData:
- section = get_section_index (objfile, ".rdata");
- break;
+ section = get_section_index (objfile, ".rdata");
+ break;
case scInit:
- section = get_section_index (objfile, ".init");
- break;
+ section = get_section_index (objfile, ".init");
+ break;
case scXData:
- section = get_section_index (objfile, ".xdata");
- break;
+ section = get_section_index (objfile, ".xdata");
+ break;
case scPData:
- section = get_section_index (objfile, ".pdata");
- break;
+ section = get_section_index (objfile, ".pdata");
+ break;
case scFini:
- section = get_section_index (objfile, ".fini");
- break;
+ section = get_section_index (objfile, ".fini");
+ break;
case scRConst:
- section = get_section_index (objfile, ".rconst");
- break;
+ section = get_section_index (objfile, ".rconst");
+ break;
#ifdef scTlsData
case scTlsData:
- section = get_section_index (objfile, ".tlsdata");
- break;
+ section = get_section_index (objfile, ".tlsdata");
+ break;
#endif
#ifdef scTlsBss
case scTlsBss:
- section = get_section_index (objfile, ".tlsbss");
- break;
+ section = get_section_index (objfile, ".tlsbss");
+ break;
#endif
default:
- /* This kind of symbol is not associated to a section. */
- section = -1;
+ /* This kind of symbol is not associated to a section. */
+ section = -1;
}
reader.record_with_info (name, address, ms_type, section);
CORE_ADDR svalue = ext_in->asym.value;
/* The Irix 5 native tools seem to sometimes generate bogus
- external symbols. */
+ external symbols. */
if (ext_in->ifd < -1 || ext_in->ifd >= hdr->ifdMax)
{
complaint (_("bad ifd for external symbol: %d (max %ld)"),
if (SC_IS_COMMON (ext_in->asym.sc))
{
/* The value of a common symbol is its size, not its address.
- Ignore it. */
+ Ignore it. */
continue;
}
else if (SC_IS_DATA (ext_in->asym.sc))
{
ms_type = mst_bss;
}
- else if (SC_IS_SBSS (ext_in->asym.sc))
- {
- ms_type = mst_bss;
- }
+ else if (SC_IS_SBSS (ext_in->asym.sc))
+ {
+ ms_type = mst_bss;
+ }
else
ms_type = mst_abs;
break;
case stLabel:
/* Label */
- /* On certain platforms, some extra label symbols can be
- generated by the linker. One possible usage for this kind
- of symbols is to represent the address of the begining of a
- given section. For instance, on Tru64 5.1, the address of
- the _ftext label is the start address of the .text section.
-
- The storage class of these symbols is usually directly
- related to the section to which the symbol refers. For
- instance, on Tru64 5.1, the storage class for the _fdata
- label is scData, refering to the .data section.
-
- It is actually possible that the section associated to the
- storage class of the label does not exist. On True64 5.1
- for instance, the libm.so shared library does not contain
- any .data section, although it contains a _fpdata label
- which storage class is scData... Since these symbols are
- usually useless for the debugger user anyway, we just
- discard these symbols. */
-
+ /* On certain platforms, some extra label symbols can be
+ generated by the linker. One possible usage for this kind
+ of symbols is to represent the address of the begining of a
+ given section. For instance, on Tru64 5.1, the address of
+ the _ftext label is the start address of the .text section.
+
+ The storage class of these symbols is usually directly
+ related to the section to which the symbol refers. For
+ instance, on Tru64 5.1, the storage class for the _fdata
+ label is scData, refering to the .data section.
+
+ It is actually possible that the section associated to the
+ storage class of the label does not exist. On True64 5.1
+ for instance, the libm.so shared library does not contain
+ any .data section, although it contains a _fpdata label
+ which storage class is scData... Since these symbols are
+ usually useless for the debugger user anyway, we just
+ discard these symbols. */
+
if (SC_IS_TEXT (ext_in->asym.sc))
{
- if (objfile->sect_index_text == -1)
- continue;
-
+ if (objfile->sect_index_text == -1)
+ continue;
+
ms_type = mst_file_text;
}
else if (SC_IS_DATA (ext_in->asym.sc))
{
- if (objfile->sect_index_data == -1)
- continue;
+ if (objfile->sect_index_data == -1)
+ continue;
ms_type = mst_file_data;
}
else if (SC_IS_BSS (ext_in->asym.sc))
{
- if (objfile->sect_index_bss == -1)
- continue;
+ if (objfile->sect_index_bss == -1)
+ continue;
ms_type = mst_file_bss;
}
- else if (SC_IS_SBSS (ext_in->asym.sc))
- {
- const int sbss_sect_index = get_section_index (objfile, ".sbss");
+ else if (SC_IS_SBSS (ext_in->asym.sc))
+ {
+ const int sbss_sect_index = get_section_index (objfile, ".sbss");
- if (sbss_sect_index == -1)
- continue;
+ if (sbss_sect_index == -1)
+ continue;
- ms_type = mst_file_bss;
- }
+ ms_type = mst_file_bss;
+ }
else
ms_type = mst_abs;
break;
unknown_ext_complaint (name);
}
if (!ECOFF_IN_ELF (cur_bfd))
- record_minimal_symbol (reader, name, svalue, ms_type, ext_in->asym.sc,
- objfile);
+ record_minimal_symbol (reader, name, svalue, ms_type, ext_in->asym.sc,
+ objfile);
}
/* Pass 3 over files, over local syms: fill in static symbols. */
}
/* Determine the start address for this object file from the
- file header and relocate it, except for Irix 5.2 zero fh->adr. */
+ file header and relocate it, except for Irix 5.2 zero fh->adr. */
if (fh->cpd)
textlow = fh->adr;
else
pst->legacy_expand_psymtab = mdebug_expand_psymtab;
/* Set up language for the pst.
- The language from the FDR is used if it is unambigious (e.g. cfront
- with native cc and g++ will set the language to C).
- Otherwise we have to deduce the language from the filename.
- Native ecoff has every header file in a separate FDR, so
- deduce_language_from_filename will return language_unknown for
- a header file, which is not what we want.
- But the FDRs for the header files are after the FDR for the source
- file, so we can assign the language of the source file to the
- following header files. Then we save the language in the private
- pst data so that we can reuse it when building symtabs. */
+ The language from the FDR is used if it is unambigious (e.g. cfront
+ with native cc and g++ will set the language to C).
+ Otherwise we have to deduce the language from the filename.
+ Native ecoff has every header file in a separate FDR, so
+ deduce_language_from_filename will return language_unknown for
+ a header file, which is not what we want.
+ But the FDRs for the header files are after the FDR for the source
+ file, so we can assign the language of the source file to the
+ following header files. Then we save the language in the private
+ pst data so that we can reuse it when building symtabs. */
prev_language = psymtab_language;
switch (fh->lang)
pst->set_text_high (pst->raw_text_low ());
/* For stabs-in-ecoff files, the second symbol must be @stab.
- This symbol is emitted by mips-tfile to signal that the
- current object file uses encapsulated stabs instead of mips
- ecoff for local symbols. (It is the second symbol because
- the first symbol is the stFile used to signal the start of a
- file). */
+ This symbol is emitted by mips-tfile to signal that the
+ current object file uses encapsulated stabs instead of mips
+ ecoff for local symbols. (It is the second symbol because
+ the first symbol is the stFile used to signal the start of a
+ file). */
processing_gcc_compilation = 0;
if (fh->csym >= 2)
{
if (sh.st == stStaticProc)
{
namestring = debug_info->ss + fh->issBase + sh.iss;
- record_minimal_symbol (reader, namestring, sh.value,
- mst_file_text, sh.sc,
- objfile);
+ record_minimal_symbol (reader, namestring, sh.value,
+ mst_file_text, sh.sc,
+ objfile);
}
procaddr = sh.value;
case scPData:
case scXData:
namestring = debug_info->ss + fh->issBase + sh.iss;
- record_minimal_symbol (reader, namestring, sh.value,
- mst_file_data, sh.sc,
- objfile);
+ record_minimal_symbol (reader, namestring, sh.value,
+ mst_file_data, sh.sc,
+ objfile);
break;
default:
/* FIXME! Shouldn't this use cases for bss,
then have the default be abs? */
namestring = debug_info->ss + fh->issBase + sh.iss;
- record_minimal_symbol (reader, namestring, sh.value,
- mst_file_bss, sh.sc,
- objfile);
+ record_minimal_symbol (reader, namestring, sh.value,
+ mst_file_bss, sh.sc,
+ objfile);
break;
}
}
if (sh.index >= hdr->iauxMax)
{
/* Should not happen, but does when cross-compiling
- with the MIPS compiler. FIXME -- pull later. */
+ with the MIPS compiler. FIXME -- pull later. */
index_complaint (sym_name);
new_sdx = cur_sdx + 1; /* Don't skip at all. */
}
new_sdx = cur_sdx + 1; /* Don't skip backward. */
}
- /* For stProc symbol records, we need to check the
- storage class as well, as only (stProc, scText)
- entries represent "real" procedures - See the
- Compaq document titled "Object File / Symbol Table
- Format Specification" for more information. If the
- storage class is not scText, we discard the whole
- block of symbol records for this stProc. */
- if (sh.st == stProc && sh.sc != scText)
- goto skip;
+ /* For stProc symbol records, we need to check the
+ storage class as well, as only (stProc, scText)
+ entries represent "real" procedures - See the
+ Compaq document titled "Object File / Symbol Table
+ Format Specification" for more information. If the
+ storage class is not scText, we discard the whole
+ block of symbol records for this stProc. */
+ if (sh.st == stProc && sh.sc != scText)
+ goto skip;
/* Usually there is a local and a global stProc symbol
for a function. This means that the function name
}
/* Link pst to FDR. dbx_end_psymtab returns NULL if the psymtab was
- empty and put on the free list. */
+ empty and put on the free list. */
fdr_to_pst[f_idx].pst
= dbx_end_psymtab (objfile, save_pst,
psymtab_include_list, includes_used,
dependencies_used = 0;
/* The objfile has its functions reordered if this partial symbol
- table overlaps any other partial symbol table.
- We cannot assume a reordered objfile if a partial symbol table
- is contained within another partial symbol table, as partial symbol
- tables for include files with executable code are contained
- within the partial symbol table for the including source file,
- and we do not want to flag the objfile reordered for these cases.
-
- This strategy works well for Irix-5.2 shared libraries, but we
- might have to use a more elaborate (and slower) algorithm for
- other cases. */
+ table overlaps any other partial symbol table.
+ We cannot assume a reordered objfile if a partial symbol table
+ is contained within another partial symbol table, as partial symbol
+ tables for include files with executable code are contained
+ within the partial symbol table for the including source file,
+ and we do not want to flag the objfile reordered for these cases.
+
+ This strategy works well for Irix-5.2 shared libraries, but we
+ might have to use a more elaborate (and slower) algorithm for
+ other cases. */
save_pst = fdr_to_pst[f_idx].pst;
if (save_pst != NULL
&& save_pst->text_low_valid
continue;
/* Skip the first file indirect entry as it is a self dependency for
- source files or a reverse .h -> .c dependency for header files. */
+ source files or a reverse .h -> .c dependency for header files. */
pst->number_of_dependencies = 0;
pst->dependencies
= objfile->partial_symtabs->allocate_dependencies (fh->crfd - 1);
case stBlock:
/* It is an enumerated type if the next symbol entry is a stMember
- and its auxiliary index is indexNil or its auxiliary entry
- is a plain btNil or btVoid.
- Alpha cc -migrate enums are recognized by a zero index and
- a zero symbol value.
- DU 4.0 cc enums are recognized by a member type of btEnum without
- qualifiers and a zero symbol value. */
+ and its auxiliary index is indexNil or its auxiliary entry
+ is a plain btNil or btVoid.
+ Alpha cc -migrate enums are recognized by a zero index and
+ a zero symbol value.
+ DU 4.0 cc enums are recognized by a member type of btEnum without
+ qualifiers and a zero symbol value. */
(*swap_sym_in) (cur_bfd, ext_sym, &sh);
if (sh.st != stMember)
return;
name = debug_info->ss + cur_fdr->issBase + sh.iss;
/* Note that the value doesn't matter for enum constants
- in psymtabs, just in symtabs. */
+ in psymtabs, just in symtabs. */
pst->add_psymbol (name, true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC, 0,
enum language language = PST_PRIVATE (pst)->pst_language;
/* We should never get non N_STAB symbols here, but they
- should be harmless, so keep process_one_symbol from
- complaining about them. */
+ should be harmless, so keep process_one_symbol from
+ complaining about them. */
if (type_code & N_STAB)
{
/* If we found a trailing N_SO with no name, process
- it here instead of in process_one_symbol, so we
- can keep a handle to its symtab. The symtab
- would otherwise be ended twice, once in
- process_one_symbol, and once after this loop. */
+ it here instead of in process_one_symbol, so we
+ can keep a handle to its symtab. The symtab
+ would otherwise be ended twice, once in
+ process_one_symbol, and once after this loop. */
if (type_code == N_SO
&& get_last_source_file ()
&& previous_stab_code != (unsigned char) N_SO
}
/* There used to be a call to sort_blocks here, but this should not
- be necessary for stabs symtabs. And as sort_blocks modifies the
- start address of the GLOBAL_BLOCK to the FIRST_LOCAL_BLOCK,
- it did the wrong thing if the first procedure in a file was
- generated via asm statements. */
+ be necessary for stabs symtabs. And as sort_blocks modifies the
+ start address of the GLOBAL_BLOCK to the FIRST_LOCAL_BLOCK,
+ it did the wrong thing if the first procedure in a file was
+ generated via asm statements. */
/* Fill in procedure info next. */
if (fh->cpd > 0)
(*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
/* Determine lowest PDR address, the PDRs are not always
- sorted. */
+ sorted. */
if (pdr_in == pr_block.data ())
lowest_pdr_addr = pdr_in->adr;
else if (pdr_in->adr < lowest_pdr_addr)
xfree (lines);
/* .. and our share of externals.
- XXX use the global list to speed up things here. How?
- FIXME, Maybe quit once we have found the right number of ext's? */
+ XXX use the global list to speed up things here. How?
+ FIXME, Maybe quit once we have found the right number of ext's? */
top_stack->cur_st = COMPUNIT_FILETABS (cust);
top_stack->cur_block
= BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
section_offsets, objfile);
/* If there are undefined symbols, tell the user.
- The alpha has an undefined symbol for every symbol that is
- from a shared library, so tell the user only if verbose is on. */
+ The alpha has an undefined symbol for every symbol that is
+ from a shared library, so tell the user only if verbose is on. */
if (info_verbose && n_undef_symbols)
{
printf_filtered (_("File %s contains %d unresolved references:"),
case btTypedef:
/* Follow a forward typedef. This might recursively
- call cross_ref till we get a non typedef'ed type.
- FIXME: This is not correct behaviour, but gdb currently
- cannot handle typedefs without type copying. Type
- copying is impossible as we might have mutual forward
- references between two files and the copied type would not
- get filled in when we later parse its definition. */
+ call cross_ref till we get a non typedef'ed type.
+ FIXME: This is not correct behaviour, but gdb currently
+ cannot handle typedefs without type copying. Type
+ copying is impossible as we might have mutual forward
+ references between two files and the copied type would not
+ get filled in when we later parse its definition. */
*tpp = parse_type (xref_fd,
debug_info->external_aux + fh->iauxBase,
sh.index,
return zero. */
static const CGEN_HW_ENTRY *
find_hw_entry_by_prefix_and_isa (CGEN_CPU_DESC desc,
- const char *prefix,
- CGEN_BITSET *copro_isa_mask,
- CGEN_BITSET *generic_isa_mask)
+ const char *prefix,
+ CGEN_BITSET *copro_isa_mask,
+ CGEN_BITSET *generic_isa_mask)
{
int prefix_len = strlen (prefix);
int i;
{
const CGEN_HW_ENTRY *hw = desc->hw_table.entries[i];
if (strncmp (prefix, hw->name, prefix_len) == 0)
- {
- CGEN_BITSET *hw_isa_mask
- = ((CGEN_BITSET *)
- &CGEN_ATTR_CGEN_HW_ISA_VALUE (CGEN_HW_ATTRS (hw)));
-
- if (cgen_bitset_intersect_p (hw_isa_mask, copro_isa_mask)
- && ! cgen_bitset_intersect_p (hw_isa_mask, generic_isa_mask))
- return hw;
- }
+ {
+ CGEN_BITSET *hw_isa_mask
+ = ((CGEN_BITSET *)
+ &CGEN_ATTR_CGEN_HW_ISA_VALUE (CGEN_HW_ATTRS (hw)));
+
+ if (cgen_bitset_intersect_p (hw_isa_mask, copro_isa_mask)
+ && ! cgen_bitset_intersect_p (hw_isa_mask, generic_isa_mask))
+ return hw;
+ }
}
return 0;
const CGEN_HW_ENTRY *hw = desc->hw_table.entries[i];
if (hw->type == type)
- return hw;
+ return hw;
}
return 0;
whose hardware type is GENERIC_TYPE. */
static const CGEN_HW_ENTRY *
me_module_register_set (CONFIG_ATTR me_module,
- const char *prefix,
- CGEN_HW_TYPE generic_type)
+ const char *prefix,
+ CGEN_HW_TYPE generic_type)
{
/* This is kind of tricky, because the hardware table is constructed
in a way that isn't very helpful. Perhaps we can fix that, but
char *name = entry->name;
/* The CGEN keyword entries for register names include the
- leading $, which appears in MeP assembly as well as in GDB.
- But we don't want to return that; GDB core code adds that
- itself. */
+ leading $, which appears in MeP assembly as well as in GDB.
+ But we don't want to return that; GDB core code adds that
+ itself. */
if (name[0] == '$')
- name++;
+ name++;
return name;
}
#define IS_CR64_REGNUM(n) (IN_SET (CR64, (n)))
#define IS_FP_CR64_REGNUM(n) (IN_SET (FP_CR64, (n)))
#define IS_CR_REGNUM(n) (IS_CR32_REGNUM (n) || IS_FP_CR32_REGNUM (n) \
- || IS_CR64_REGNUM (n) || IS_FP_CR64_REGNUM (n))
+ || IS_CR64_REGNUM (n) || IS_FP_CR64_REGNUM (n))
#define IS_CCR_REGNUM(n) (IN_SET (CCR, (n)))
#define IS_RAW_REGNUM(n) (IN_SET (RAW, (n)))
int pseudofp64 = MEP_FIRST_FP_CR64_REGNUM + i;
/* Truly, the raw->pseudo mapping depends on the current module.
- But we use the raw->pseudo mapping when we read the debugging
- info; at that point, we don't know what module we'll actually
- be running yet. So, we always supply the 64-bit register
- numbers; GDB knows how to pick a smaller value out of a
- larger register properly. */
+ But we use the raw->pseudo mapping when we read the debugging
+ info; at that point, we don't know what module we'll actually
+ be running yet. So, we always supply the 64-bit register
+ numbers; GDB knows how to pick a smaller value out of a
+ larger register properly. */
mep_raw_to_pseudo[raw] = pseudo64;
mep_pseudo_to_raw[pseudo32] = raw;
mep_pseudo_to_raw[pseudofp32] = raw;
|| IS_FP_CR32_REGNUM (pseudo))
return 32;
else if (IS_CR64_REGNUM (pseudo)
- || IS_FP_CR64_REGNUM (pseudo))
+ || IS_FP_CR64_REGNUM (pseudo))
return 64;
else
gdb_assert_not_reached ("unexpected coprocessor pseudo register");
mep_pseudo_cr_is_float (int pseudo)
{
return (IS_FP_CR32_REGNUM (pseudo)
- || IS_FP_CR64_REGNUM (pseudo));
+ || IS_FP_CR64_REGNUM (pseudo));
}
else if (IS_CSR_REGNUM (regnr))
{
/* The 'hi' and 'lo' registers are only present on processors
- that have the 'MUL' or 'DIV' instructions enabled. */
+ that have the 'MUL' or 'DIV' instructions enabled. */
if ((regnr == MEP_HI_REGNUM || regnr == MEP_LO_REGNUM)
- && (! (current_options () & (MEP_OPT_MUL | MEP_OPT_DIV))))
- return "";
+ && (! (current_options () & (MEP_OPT_MUL | MEP_OPT_DIV))))
+ return "";
return csr_names[regnr - MEP_FIRST_CSR_REGNUM];
}
/* Does this module have a coprocessor at all? */
if (! (current_options () & MEP_OPT_COP))
- return "";
+ return "";
names = current_cr_names ();
if (! names)
- /* This module's coprocessor has no general-purpose registers. */
- return "";
+ /* This module's coprocessor has no general-purpose registers. */
+ return "";
cr_size = current_cop_data_bus_width ();
if (cr_size != mep_pseudo_cr_size (regnr))
- /* This module's coprocessor's GPR's are of a different size. */
- return "";
+ /* This module's coprocessor's GPR's are of a different size. */
+ return "";
cr_is_float = current_cr_is_float ();
/* The extra ! operators ensure we get boolean equality, not
- numeric equality. */
+ numeric equality. */
if (! cr_is_float != ! mep_pseudo_cr_is_float (regnr))
- /* This module's coprocessor's GPR's are of a different type. */
- return "";
+ /* This module's coprocessor's GPR's are of a different type. */
+ return "";
return register_name_from_keyword (names, mep_pseudo_cr_index (regnr));
}
{
/* Does this module have a coprocessor at all? */
if (! (current_options () & MEP_OPT_COP))
- return "";
+ return "";
{
- CGEN_KEYWORD *names = current_ccr_names ();
+ CGEN_KEYWORD *names = current_ccr_names ();
- if (! names)
- /* This me_module's coprocessor has no control registers. */
- return "";
+ if (! names)
+ /* This me_module's coprocessor has no control registers. */
+ return "";
- return register_name_from_keyword (names, regnr-MEP_FIRST_CCR_REGNUM);
+ return register_name_from_keyword (names, regnr-MEP_FIRST_CCR_REGNUM);
}
}
static int
mep_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
- struct reggroup *group)
+ struct reggroup *group)
{
/* Filter reserved or unused register numbers. */
{
the existing behavior, so we'd want to run that by them. */
if (group == general_reggroup)
return (IS_GPR_REGNUM (regnum)
- || IS_CSR_REGNUM (regnum));
+ || IS_CSR_REGNUM (regnum));
/* Everything is in the 'all' reggroup, except for the raw CSR's. */
else if (group == all_reggroup)
return (IS_GPR_REGNUM (regnum)
- || IS_CSR_REGNUM (regnum)
- || IS_CR_REGNUM (regnum)
- || IS_CCR_REGNUM (regnum));
+ || IS_CSR_REGNUM (regnum)
+ || IS_CR_REGNUM (regnum)
+ || IS_CCR_REGNUM (regnum));
/* All registers should be saved and restored, except for the raw
CSR's.
hardware engine, perhaps. */
else if (group == save_reggroup || group == restore_reggroup)
return (IS_GPR_REGNUM (regnum)
- || IS_CSR_REGNUM (regnum)
- || IS_CR_REGNUM (regnum)
- || IS_CCR_REGNUM (regnum));
+ || IS_CSR_REGNUM (regnum)
+ || IS_CR_REGNUM (regnum)
+ || IS_CCR_REGNUM (regnum));
else if (group == mep_csr_reggroup)
return IS_CSR_REGNUM (regnum);
{
int size = mep_pseudo_cr_size (reg_nr);
if (size == 32)
- {
- if (mep_pseudo_cr_is_float (reg_nr))
- return builtin_type (gdbarch)->builtin_float;
- else
- return builtin_type (gdbarch)->builtin_uint32;
- }
+ {
+ if (mep_pseudo_cr_is_float (reg_nr))
+ return builtin_type (gdbarch)->builtin_float;
+ else
+ return builtin_type (gdbarch)->builtin_uint32;
+ }
else if (size == 64)
- {
- if (mep_pseudo_cr_is_float (reg_nr))
- return builtin_type (gdbarch)->builtin_double;
- else
- return builtin_type (gdbarch)->builtin_uint64;
- }
+ {
+ if (mep_pseudo_cr_is_float (reg_nr))
+ return builtin_type (gdbarch)->builtin_double;
+ else
+ return builtin_type (gdbarch)->builtin_uint64;
+ }
else
- gdb_assert_not_reached ("unexpected cr size");
+ gdb_assert_not_reached ("unexpected cr size");
}
/* All other registers are 32 bits long. */
static enum register_status
mep_pseudo_cr32_read (struct gdbarch *gdbarch,
readable_regcache *regcache,
- int cookednum,
- gdb_byte *buf)
+ int cookednum,
+ gdb_byte *buf)
{
enum register_status status;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
static enum register_status
mep_pseudo_cr64_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int cookednum,
- gdb_byte *buf)
+ readable_regcache *regcache,
+ int cookednum,
+ gdb_byte *buf)
{
return regcache->raw_read (mep_pseudo_to_raw[cookednum], buf);
}
static enum register_status
mep_pseudo_register_read (struct gdbarch *gdbarch,
readable_regcache *regcache,
- int cookednum,
- gdb_byte *buf)
+ int cookednum,
+ gdb_byte *buf)
{
if (IS_CSR_REGNUM (cookednum)
|| IS_CCR_REGNUM (cookednum))
return regcache->raw_read (mep_pseudo_to_raw[cookednum], buf);
else if (IS_CR32_REGNUM (cookednum)
- || IS_FP_CR32_REGNUM (cookednum))
+ || IS_FP_CR32_REGNUM (cookednum))
return mep_pseudo_cr32_read (gdbarch, regcache, cookednum, buf);
else if (IS_CR64_REGNUM (cookednum)
- || IS_FP_CR64_REGNUM (cookednum))
+ || IS_FP_CR64_REGNUM (cookednum))
return mep_pseudo_cr64_read (gdbarch, regcache, cookednum, buf);
else
gdb_assert_not_reached ("unexpected pseudo register");
static void
mep_pseudo_csr_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int cookednum,
- const gdb_byte *buf)
+ struct regcache *regcache,
+ int cookednum,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, cookednum);
ULONGEST old_bits;
ULONGEST new_bits;
ULONGEST mixed_bits;
-
+
regcache_raw_read_unsigned (regcache, r->raw, &old_bits);
new_bits = extract_unsigned_integer (buf, size, byte_order);
mixed_bits = ((r->writeable_bits & new_bits)
- | (~r->writeable_bits & old_bits));
+ | (~r->writeable_bits & old_bits));
regcache_raw_write_unsigned (regcache, r->raw, mixed_bits);
}
}
-
+
static void
mep_pseudo_cr32_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int cookednum,
- const gdb_byte *buf)
+ struct regcache *regcache,
+ int cookednum,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Expand the 32-bit value into a 64-bit value, and write that to
static void
mep_pseudo_cr64_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int cookednum,
- const gdb_byte *buf)
+ struct regcache *regcache,
+ int cookednum,
+ const gdb_byte *buf)
{
regcache->raw_write (mep_pseudo_to_raw[cookednum], buf);
}
static void
mep_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int cookednum,
- const gdb_byte *buf)
+ struct regcache *regcache,
+ int cookednum,
+ const gdb_byte *buf)
{
if (IS_CSR_REGNUM (cookednum))
mep_pseudo_csr_write (gdbarch, regcache, cookednum, buf);
else if (IS_CR32_REGNUM (cookednum)
- || IS_FP_CR32_REGNUM (cookednum))
+ || IS_FP_CR32_REGNUM (cookednum))
mep_pseudo_cr32_write (gdbarch, regcache, cookednum, buf);
else if (IS_CR64_REGNUM (cookednum)
- || IS_FP_CR64_REGNUM (cookednum))
+ || IS_FP_CR64_REGNUM (cookednum))
mep_pseudo_cr64_write (gdbarch, regcache, cookednum, buf);
else if (IS_CCR_REGNUM (cookednum))
regcache->raw_write (mep_pseudo_to_raw[cookednum], buf);
if (s)
{
/* The libopcodes disassembly code uses the section to find the
- BFD, the BFD to find the ELF header, the ELF header to find
- the me_module index, and the me_module index to select the
- right instructions to print. */
+ BFD, the BFD to find the ELF header, the ELF header to find
+ the me_module index, and the me_module index to select the
+ right instructions to print. */
info->section = s->the_bfd_section;
}
void
foo (void)
{
- asm ("movu $1, 0x123456");
- asm ("sb $1,0x5678($2)");
- asm ("clip $1, 19");
+ asm ("movu $1, 0x123456");
+ asm ("sb $1,0x5678($2)");
+ asm ("clip $1, 19");
}
compiles to this big-endian code:
vliw_mode = current_options () & (MEP_OPT_VL32 | MEP_OPT_VL64);
/* If PC is in a VLIW section, but the current core doesn't say
- that it supports either VLIW mode, then we don't have enough
- information to parse the instruction stream it contains.
- Since the "undifferentiated" standard core doesn't have
- either VLIW mode bit set, this could happen.
+ that it supports either VLIW mode, then we don't have enough
+ information to parse the instruction stream it contains.
+ Since the "undifferentiated" standard core doesn't have
+ either VLIW mode bit set, this could happen.
- But it shouldn't be an error to (say) set a breakpoint in a
- VLIW section, if you know you'll never reach it. (Perhaps
- you have a script that sets a bunch of standard breakpoints.)
+ But it shouldn't be an error to (say) set a breakpoint in a
+ VLIW section, if you know you'll never reach it. (Perhaps
+ you have a script that sets a bunch of standard breakpoints.)
- So we'll just return zero here, and hope for the best. */
+ So we'll just return zero here, and hope for the best. */
if (! (vliw_mode & (MEP_OPT_VL32 | MEP_OPT_VL64)))
- return 0;
+ return 0;
/* If both VL32 and VL64 are set, that's bogus, too. */
if (vliw_mode == (MEP_OPT_VL32 | MEP_OPT_VL64))
- return 0;
+ return 0;
}
else
vliw_mode = 0;
if (vliw_mode)
{
/* In 32-bit VLIW code, all bundles are 32 bits long. We ignore the
- coprocessor half of a core / copro bundle. */
+ coprocessor half of a core / copro bundle. */
if (vliw_mode == MEP_OPT_VL32)
- insn_len = 4;
+ insn_len = 4;
/* In 64-bit VLIW code, all bundles are 64 bits long. We ignore the
- coprocessor half of a core / copro bundle. */
+ coprocessor half of a core / copro bundle. */
else if (vliw_mode == MEP_OPT_VL64)
- insn_len = 8;
+ insn_len = 8;
/* We'd better be in either core, 32-bit VLIW, or 64-bit VLIW mode. */
else
- gdb_assert_not_reached ("unexpected vliw mode");
+ gdb_assert_not_reached ("unexpected vliw mode");
}
/* Otherwise, the top two bits of the major opcode are (again) what
#define ADD_OFFSET(i) (SFIELD (i, 18, 6))
/* LDC Rn,imm5 0111_nnnn_iiii_101I xxxx_xxxx_xxxx_xxxx
- imm5 = I||i[7:4] */
+ imm5 = I||i[7:4] */
#define IS_LDC(i) (((i) & 0xf00e0000) == 0x700a0000)
#define LDC_IMM(i) ((FIELD (i, 16, 1) << 4) | FIELD (i, 20, 4))
#define LDC_TARGET(i) (FIELD (i, 24, 4))
is_arg_reg (pv_t value)
{
return (value.kind == pvk_register
- && MEP_R1_REGNUM <= value.reg && value.reg <= MEP_R4_REGNUM
- && value.k == 0);
+ && MEP_R1_REGNUM <= value.reg && value.reg <= MEP_R4_REGNUM
+ && value.k == 0);
}
/* Return non-zero if a store of REG's current value VALUE to ADDR is
struct pv_area *stack)
{
return (is_arg_reg (value)
- && pv_is_register (addr, MEP_SP_REGNUM)
- && ! stack->find_reg (gdbarch, value.reg, 0));
+ && pv_is_register (addr, MEP_SP_REGNUM)
+ && ! stack->find_reg (gdbarch, value.reg, 0));
}
static void
mep_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct mep_prologue *result)
+ struct mep_prologue *result)
{
CORE_ADDR pc;
unsigned long insn;
next_pc = mep_get_insn (gdbarch, pc, &insn);
/* A zero return from mep_get_insn means that either we weren't
- able to read the instruction from memory, or that we don't
- have enough information to be able to reliably decode it. So
- we'll store here and hope for the best. */
+ able to read the instruction from memory, or that we don't
+ have enough information to be able to reliably decode it. So
+ we'll store here and hope for the best. */
if (! next_pc)
- break;
+ break;
/* Note the current values of the SP and FP, so we can tell if
- this instruction changed them, below. */
+ this instruction changed them, below. */
pre_insn_fp = reg[MEP_FP_REGNUM];
pre_insn_sp = reg[MEP_SP_REGNUM];
if (IS_ADD (insn))
- {
- int rn = ADD_TARGET (insn);
- CORE_ADDR imm6 = ADD_OFFSET (insn);
+ {
+ int rn = ADD_TARGET (insn);
+ CORE_ADDR imm6 = ADD_OFFSET (insn);
- reg[rn] = pv_add_constant (reg[rn], imm6);
- }
+ reg[rn] = pv_add_constant (reg[rn], imm6);
+ }
else if (IS_ADD3_16 (insn))
{
- int rn = ADD3_16_TARGET (insn);
- int imm7 = ADD3_16_OFFSET (insn);
+ int rn = ADD3_16_TARGET (insn);
+ int imm7 = ADD3_16_OFFSET (insn);
- reg[rn] = pv_add_constant (reg[MEP_SP_REGNUM], imm7);
- }
+ reg[rn] = pv_add_constant (reg[MEP_SP_REGNUM], imm7);
+ }
else if (IS_ADD3_32 (insn))
{
- int rn = ADD3_32_TARGET (insn);
- int rm = ADD3_32_SOURCE (insn);
- int imm16 = ADD3_32_OFFSET (insn);
+ int rn = ADD3_32_TARGET (insn);
+ int rm = ADD3_32_SOURCE (insn);
+ int imm16 = ADD3_32_OFFSET (insn);
- reg[rn] = pv_add_constant (reg[rm], imm16);
+ reg[rn] = pv_add_constant (reg[rm], imm16);
}
else if (IS_SW_REG (insn))
- {
- int rn = SW_REG_SOURCE (insn);
- int rm = SW_REG_BASE (insn);
-
- /* If simulating this store would require us to forget
- everything we know about the stack frame in the name of
- accuracy, it would be better to just quit now. */
- if (stack.store_would_trash (reg[rm]))
- break;
-
- if (is_arg_spill (gdbarch, reg[rn], reg[rm], &stack))
- after_last_frame_setup_insn = next_pc;
-
- stack.store (reg[rm], 4, reg[rn]);
- }
+ {
+ int rn = SW_REG_SOURCE (insn);
+ int rm = SW_REG_BASE (insn);
+
+ /* If simulating this store would require us to forget
+ everything we know about the stack frame in the name of
+ accuracy, it would be better to just quit now. */
+ if (stack.store_would_trash (reg[rm]))
+ break;
+
+ if (is_arg_spill (gdbarch, reg[rn], reg[rm], &stack))
+ after_last_frame_setup_insn = next_pc;
+
+ stack.store (reg[rm], 4, reg[rn]);
+ }
else if (IS_SW_IMMD (insn))
- {
- int rn = SW_IMMD_SOURCE (insn);
- int offset = SW_IMMD_OFFSET (insn);
- pv_t addr = pv_add_constant (reg[MEP_SP_REGNUM], offset);
-
- /* If simulating this store would require us to forget
- everything we know about the stack frame in the name of
- accuracy, it would be better to just quit now. */
- if (stack.store_would_trash (addr))
- break;
-
- if (is_arg_spill (gdbarch, reg[rn], addr, &stack))
- after_last_frame_setup_insn = next_pc;
-
- stack.store (addr, 4, reg[rn]);
- }
+ {
+ int rn = SW_IMMD_SOURCE (insn);
+ int offset = SW_IMMD_OFFSET (insn);
+ pv_t addr = pv_add_constant (reg[MEP_SP_REGNUM], offset);
+
+ /* If simulating this store would require us to forget
+ everything we know about the stack frame in the name of
+ accuracy, it would be better to just quit now. */
+ if (stack.store_would_trash (addr))
+ break;
+
+ if (is_arg_spill (gdbarch, reg[rn], addr, &stack))
+ after_last_frame_setup_insn = next_pc;
+
+ stack.store (addr, 4, reg[rn]);
+ }
else if (IS_MOV (insn))
{
- int rn = MOV_TARGET (insn);
- int rm = MOV_SOURCE (insn);
+ int rn = MOV_TARGET (insn);
+ int rm = MOV_SOURCE (insn);
- reg[rn] = reg[rm];
+ reg[rn] = reg[rm];
if (pv_is_register (reg[rm], rm) && is_arg_reg (reg[rm]))
after_last_frame_setup_insn = next_pc;
}
else if (IS_SB (insn) || IS_SH (insn) || IS_SW (insn))
{
- int rn = SWBH_32_SOURCE (insn);
- int rm = SWBH_32_BASE (insn);
- int disp = SWBH_32_OFFSET (insn);
- int size = (IS_SB (insn) ? 1
- : IS_SH (insn) ? 2
- : (gdb_assert (IS_SW (insn)), 4));
- pv_t addr = pv_add_constant (reg[rm], disp);
-
- if (stack.store_would_trash (addr))
- break;
-
- if (is_arg_spill (gdbarch, reg[rn], addr, &stack))
- after_last_frame_setup_insn = next_pc;
+ int rn = SWBH_32_SOURCE (insn);
+ int rm = SWBH_32_BASE (insn);
+ int disp = SWBH_32_OFFSET (insn);
+ int size = (IS_SB (insn) ? 1
+ : IS_SH (insn) ? 2
+ : (gdb_assert (IS_SW (insn)), 4));
+ pv_t addr = pv_add_constant (reg[rm], disp);
+
+ if (stack.store_would_trash (addr))
+ break;
+
+ if (is_arg_spill (gdbarch, reg[rn], addr, &stack))
+ after_last_frame_setup_insn = next_pc;
- stack.store (addr, size, reg[rn]);
+ stack.store (addr, size, reg[rn]);
}
else if (IS_LDC (insn))
{
- int rn = LDC_TARGET (insn);
- int cr = LDC_IMM (insn) + MEP_FIRST_CSR_REGNUM;
+ int rn = LDC_TARGET (insn);
+ int cr = LDC_IMM (insn) + MEP_FIRST_CSR_REGNUM;
- reg[rn] = reg[cr];
+ reg[rn] = reg[cr];
}
else if (IS_LW (insn))
- {
- int rn = LW_TARGET (insn);
- int rm = LW_BASE (insn);
- int offset = LW_OFFSET (insn);
- pv_t addr = pv_add_constant (reg[rm], offset);
-
- reg[rn] = stack.fetch (addr, 4);
- }
+ {
+ int rn = LW_TARGET (insn);
+ int rm = LW_BASE (insn);
+ int offset = LW_OFFSET (insn);
+ pv_t addr = pv_add_constant (reg[rm], offset);
+
+ reg[rn] = stack.fetch (addr, 4);
+ }
else if (IS_BRA (insn) && BRA_DISP (insn) > 0)
{
/* When a loop appears as the first statement of a function
break;
}
else
- /* We've hit some instruction we don't know how to simulate.
- Strictly speaking, we should set every value we're
- tracking to "unknown". But we'll be optimistic, assume
- that we have enough information already, and stop
- analysis here. */
- break;
+ /* We've hit some instruction we don't know how to simulate.
+ Strictly speaking, we should set every value we're
+ tracking to "unknown". But we'll be optimistic, assume
+ that we have enough information already, and stop
+ analysis here. */
+ break;
/* If this instruction changed the FP or decreased the SP (i.e.,
- allocated more stack space), then this may be a good place to
- declare the prologue finished. However, there are some
- exceptions:
+ allocated more stack space), then this may be a good place to
+ declare the prologue finished. However, there are some
+ exceptions:
- - If the instruction just changed the FP back to its original
- value, then that's probably a restore instruction. The
- prologue should definitely end before that.
+ - If the instruction just changed the FP back to its original
+ value, then that's probably a restore instruction. The
+ prologue should definitely end before that.
- - If the instruction increased the value of the SP (that is,
- shrunk the frame), then it's probably part of a frame
- teardown sequence, and the prologue should end before that. */
+ - If the instruction increased the value of the SP (that is,
+ shrunk the frame), then it's probably part of a frame
+ teardown sequence, and the prologue should end before that. */
if (! pv_is_identical (reg[MEP_FP_REGNUM], pre_insn_fp))
- {
- if (! pv_is_register_k (reg[MEP_FP_REGNUM], MEP_FP_REGNUM, 0))
- after_last_frame_setup_insn = next_pc;
- }
+ {
+ if (! pv_is_register_k (reg[MEP_FP_REGNUM], MEP_FP_REGNUM, 0))
+ after_last_frame_setup_insn = next_pc;
+ }
else if (! pv_is_identical (reg[MEP_SP_REGNUM], pre_insn_sp))
- {
- /* The comparison of constants looks odd, there, because .k
- is unsigned. All it really means is that the new value
- is lower than it was before the instruction. */
- if (pv_is_register (pre_insn_sp, MEP_SP_REGNUM)
- && pv_is_register (reg[MEP_SP_REGNUM], MEP_SP_REGNUM)
- && ((pre_insn_sp.k - reg[MEP_SP_REGNUM].k)
- < (reg[MEP_SP_REGNUM].k - pre_insn_sp.k)))
- after_last_frame_setup_insn = next_pc;
- }
+ {
+ /* The comparison of constants looks odd, there, because .k
+ is unsigned. All it really means is that the new value
+ is lower than it was before the instruction. */
+ if (pv_is_register (pre_insn_sp, MEP_SP_REGNUM)
+ && pv_is_register (reg[MEP_SP_REGNUM], MEP_SP_REGNUM)
+ && ((pre_insn_sp.k - reg[MEP_SP_REGNUM].k)
+ < (reg[MEP_SP_REGNUM].k - pre_insn_sp.k)))
+ after_last_frame_setup_insn = next_pc;
+ }
pc = next_pc;
}
static struct mep_prologue *
mep_analyze_frame_prologue (struct frame_info *this_frame,
- void **this_prologue_cache)
+ void **this_prologue_cache)
{
if (! *this_prologue_cache)
{
CORE_ADDR func_start, stop_addr;
*this_prologue_cache
- = FRAME_OBSTACK_ZALLOC (struct mep_prologue);
+ = FRAME_OBSTACK_ZALLOC (struct mep_prologue);
func_start = get_frame_func (this_frame);
stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
- just initialize the prologue cache, but don't do anything. */
+ just initialize the prologue cache, but don't do anything. */
if (! func_start)
- stop_addr = func_start;
+ stop_addr = func_start;
mep_analyze_prologue (get_frame_arch (this_frame),
func_start, stop_addr,
base. */
static CORE_ADDR
mep_frame_base (struct frame_info *this_frame,
- void **this_prologue_cache)
+ void **this_prologue_cache)
{
struct mep_prologue *p
= mep_analyze_frame_prologue (this_frame, this_prologue_cache);
if (p->has_frame_ptr)
{
CORE_ADDR fp
- = get_frame_register_unsigned (this_frame, MEP_FP_REGNUM);
+ = get_frame_register_unsigned (this_frame, MEP_FP_REGNUM);
return fp - p->frame_ptr_offset;
}
else
{
CORE_ADDR sp
- = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
+ = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
return sp - p->frame_size;
}
}
static void
mep_frame_this_id (struct frame_info *this_frame,
- void **this_prologue_cache,
- struct frame_id *this_id)
+ void **this_prologue_cache,
+ struct frame_id *this_id)
{
*this_id = frame_id_build (mep_frame_base (this_frame, this_prologue_cache),
- get_frame_func (this_frame));
+ get_frame_func (this_frame));
}
static struct value *
mep_frame_prev_register (struct frame_info *this_frame,
- void **this_prologue_cache, int regnum)
+ void **this_prologue_cache, int regnum)
{
struct mep_prologue *p
= mep_analyze_frame_prologue (this_frame, this_prologue_cache);
return frame_unwind_got_constant (this_frame, regnum, frame_base);
/* If prologue analysis says we saved this register somewhere,
- return a description of the stack slot holding it. */
+ return a description of the stack slot holding it. */
if (p->reg_offset[regnum] != 1)
value = frame_unwind_got_memory (this_frame, regnum,
frame_base + p->reg_offset[regnum]);
/* Otherwise, presume we haven't changed the value of this
- register, and get it from the next frame. */
+ register, and get it from the next frame. */
else
value = frame_unwind_got_register (this_frame, regnum, regnum);
/* If we need to toggle the operating mode, do so. */
if (regnum == MEP_PSW_REGNUM)
- {
+ {
CORE_ADDR psw, lp;
psw = value_as_long (value);
release_value (value);
- /* Get the LP's value, too. */
+ /* Get the LP's value, too. */
value = get_frame_register_value (this_frame, MEP_LP_REGNUM);
lp = value_as_long (value);
release_value (value);
- /* If LP.LTOM is set, then toggle PSW.OM. */
+ /* If LP.LTOM is set, then toggle PSW.OM. */
if (lp & 0x1)
psw ^= 0x1000;
return frame_unwind_got_constant (this_frame, regnum, psw);
- }
+ }
return value;
}
static void
mep_extract_return_value (struct gdbarch *arch,
- struct type *type,
- struct regcache *regcache,
- gdb_byte *valbuf)
+ struct type *type,
+ struct regcache *regcache,
+ gdb_byte *valbuf)
{
int byte_order = gdbarch_byte_order (arch);
static void
mep_store_return_value (struct gdbarch *arch,
- struct type *type,
- struct regcache *regcache,
- const gdb_byte *valbuf)
+ struct type *type,
+ struct regcache *regcache,
+ const gdb_byte *valbuf)
{
int byte_order = gdbarch_byte_order (arch);
if (TYPE_LENGTH (type) <= MEP_GPR_SIZE)
{
/* Values that don't occupy a full register appear at the least
- significant end of the value. This is the offset to where the
- value starts. */
+ significant end of the value. This is the offset to where the
+ value starts. */
int offset;
if (byte_order == BFD_ENDIAN_BIG)
- offset = MEP_GPR_SIZE - TYPE_LENGTH (type);
+ offset = MEP_GPR_SIZE - TYPE_LENGTH (type);
else
- offset = 0;
+ offset = 0;
regcache->cooked_write_part (MEP_R0_REGNUM, offset, TYPE_LENGTH (type),
valbuf);
new stack pointer. */
static CORE_ADDR
push_large_arguments (CORE_ADDR sp, int argc, struct value **argv,
- CORE_ADDR copy[])
+ CORE_ADDR copy[])
{
int i;
unsigned arg_len = TYPE_LENGTH (value_type (argv[i]));
if (arg_len > MEP_GPR_SIZE)
- {
- /* Reserve space for the copy, and then round the SP down, to
- make sure it's all aligned properly. */
- sp = (sp - arg_len) & -4;
- write_memory (sp, value_contents (argv[i]), arg_len);
- copy[i] = sp;
- }
+ {
+ /* Reserve space for the copy, and then round the SP down, to
+ make sure it's all aligned properly. */
+ sp = (sp - arg_len) & -4;
+ write_memory (sp, value_contents (argv[i]), arg_len);
+ copy[i] = sp;
+ }
}
return sp;
static CORE_ADDR
mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int argc, struct value **argv, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int argc, struct value **argv, CORE_ADDR sp,
function_call_return_method return_method,
- CORE_ADDR struct_addr)
+ CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR *copy = (CORE_ADDR *) alloca (argc * sizeof (copy[0]));
/* Arguments that fit in a GPR get expanded to fill the GPR. */
if (TYPE_LENGTH (value_type (argv[i])) <= MEP_GPR_SIZE)
- value = extract_unsigned_integer (value_contents (argv[i]),
- TYPE_LENGTH (value_type (argv[i])),
+ value = extract_unsigned_integer (value_contents (argv[i]),
+ TYPE_LENGTH (value_type (argv[i])),
byte_order);
/* Arguments too large to fit in a GPR get copied to the stack,
- and we pass a pointer to the copy. */
+ and we pass a pointer to the copy. */
else
- value = copy[i];
+ value = copy[i];
/* We use $1 -- $4 for passing arguments, then use the stack. */
if (arg_reg <= MEP_R4_REGNUM)
- {
- regcache_cooked_write_unsigned (regcache, arg_reg, value);
- arg_reg++;
- }
+ {
+ regcache_cooked_write_unsigned (regcache, arg_reg, value);
+ arg_reg++;
+ }
else
- {
- gdb_byte buf[MEP_GPR_SIZE];
- store_unsigned_integer (buf, MEP_GPR_SIZE, byte_order, value);
- write_memory (arg_stack, buf, MEP_GPR_SIZE);
- arg_stack += MEP_GPR_SIZE;
- }
+ {
+ gdb_byte buf[MEP_GPR_SIZE];
+ store_unsigned_integer (buf, MEP_GPR_SIZE, byte_order, value);
+ write_memory (arg_stack, buf, MEP_GPR_SIZE);
+ arg_stack += MEP_GPR_SIZE;
+ }
}
gdb_assert (arg_stack <= arg_stack_end);
if (info.abfd)
{
/* The way to get the me_module code depends on the object file
- format. At the moment, we only know how to handle ELF. */
+ format. At the moment, we only know how to handle ELF. */
if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
{
int flag = elf_elfheader (info.abfd)->e_flags & EF_MEP_INDEX_MASK;
me_module = (CONFIG_ATTR) flag;
}
else
- me_module = CONFIG_NONE;
+ me_module = CONFIG_NONE;
}
else
me_module = CONFIG_NONE;
if (info.abfd)
{
/* The negations on either side make the comparison treat all
- non-zero (true) values as equal. */
+ non-zero (true) values as equal. */
if (! bfd_big_endian (info.abfd) != ! me_module_big_endian (me_module))
- {
- const char *module_name = me_module_name (me_module);
- const char *module_endianness
- = me_module_big_endian (me_module) ? "big" : "little";
- const char *file_name = bfd_get_filename (info.abfd);
- const char *file_endianness
- = bfd_big_endian (info.abfd) ? "big" : "little";
-
- fputc_unfiltered ('\n', gdb_stderr);
- if (module_name)
- warning (_("the MeP module '%s' is %s-endian, but the executable\n"
+ {
+ const char *module_name = me_module_name (me_module);
+ const char *module_endianness
+ = me_module_big_endian (me_module) ? "big" : "little";
+ const char *file_name = bfd_get_filename (info.abfd);
+ const char *file_endianness
+ = bfd_big_endian (info.abfd) ? "big" : "little";
+
+ fputc_unfiltered ('\n', gdb_stderr);
+ if (module_name)
+ warning (_("the MeP module '%s' is %s-endian, but the executable\n"
"%s is %s-endian."),
- module_name, module_endianness,
- file_name, file_endianness);
- else
- warning (_("the selected MeP module is %s-endian, but the "
+ module_name, module_endianness,
+ file_name, file_endianness);
+ else
+ warning (_("the selected MeP module is %s-endian, but the "
"executable\n"
"%s is %s-endian."),
- module_endianness, file_name, file_endianness);
- }
+ module_endianness, file_name, file_endianness);
+ }
}
/* Find a candidate among the list of architectures we've created
{
const char *mach_name = info.bfd_arch_info->printable_name;
enum cgen_endian endian = (info.byte_order == BFD_ENDIAN_BIG
- ? CGEN_ENDIAN_BIG
- : CGEN_ENDIAN_LITTLE);
+ ? CGEN_ENDIAN_BIG
+ : CGEN_ENDIAN_LITTLE);
tdep->cpu_desc = mep_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
- CGEN_CPU_OPEN_ENDIAN, endian,
- CGEN_CPU_OPEN_END);
+ CGEN_CPU_OPEN_ENDIAN, endian,
+ CGEN_CPU_OPEN_END);
}
tdep->me_module = me_module;
&oind, &oarg);
if (opt < 0)
- break;
+ break;
switch ((enum opt) opt)
- {
+ {
case OPT_CONDITION:
condition.assign (oarg);
break;
case OPT_TEMP:
temp = 1;
break;
- }
+ }
}
/* This command does not accept any argument. Make sure the user
&oind, &oarg);
if (opt < 0)
- break;
+ break;
switch ((enum opt) opt)
- {
+ {
case OPT_CONDITION:
condition.assign (oarg);
break;
case OPT_UNHANDLED:
ex_kind = ada_catch_exception_unhandled;
break;
- }
+ }
}
/* This command does not accept any argument. Make sure the user
&oind, &oarg);
if (opt < 0)
- break;
+ break;
switch ((enum opt) opt)
- {
+ {
case OPT_CONDITION:
condition.assign (oarg);
break;
case OPT_TEMP:
temp = 1;
break;
- }
+ }
}
/* This command does not accept any argument. Make sure the user
for (;;)
{
int opt = mi_getopt (actual_cmd, argc, argv, opts,
- &oind, &oarg);
+ &oind, &oarg);
if (opt < 0)
- break;
+ break;
switch ((enum opt) opt)
- {
- case OPT_TEMP:
- temp = 1;
- break;
- case OPT_DISABLED:
- enabled = 0;
- break;
- }
+ {
+ case OPT_TEMP:
+ temp = 1;
+ break;
+ case OPT_DISABLED:
+ enabled = 0;
+ break;
+ }
}
if (oind >= argc)
for (;;)
{
int opt = mi_getopt (cmd, argc, argv, opts,
- &oind, &oarg);
+ &oind, &oarg);
if (opt < 0)
- break;
+ break;
switch ((enum opt) opt)
- {
- case OPT_TEMP:
- temp = true;
- break;
- case OPT_REGEX:
+ {
+ case OPT_TEMP:
+ temp = true;
+ break;
+ case OPT_REGEX:
regex = oarg;
- break;
- }
+ break;
+ }
}
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
always required:
MODE: 0 -- disassembly.
- 1 -- disassembly and source (with deprecated source-centric view).
- 2 -- disassembly and opcodes.
- 3 -- disassembly, source-centric and opcodes.
- 4 -- disassembly, and source (with pc-centric view).
- 5 -- disassembly, source (pc-centric) and opcodes. */
+ 1 -- disassembly and source (with deprecated source-centric view).
+ 2 -- disassembly and opcodes.
+ 3 -- disassembly, source-centric and opcodes.
+ 4 -- disassembly, and source (with pc-centric view).
+ 5 -- disassembly, source (pc-centric) and opcodes. */
void
mi_cmd_disassemble (const char *command, char **argv, int argc)
required) OR start_addr + end_addr OR addr. */
if (!(
- ( line_seen && file_seen && !start_seen && !end_seen
+ ( line_seen && file_seen && !start_seen && !end_seen
&& !addr_seen)
|| (!line_seen && !file_seen && !num_seen && start_seen && end_seen
else if (addr_seen)
{
if (find_pc_partial_function (addr, NULL, &low, &high) == 0)
- error (_("-data-disassemble: "
- "No function contains specified address"));
+ error (_("-data-disassemble: "
+ "No function contains specified address"));
}
gdb_disassembly (gdbarch, uiout,
if (argc > 0)
error (_("-environment-pwd: No arguments allowed"));
-
+
if (mi_version (uiout) < 2)
{
env_execute_cli_command ("pwd", NULL);
gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0));
if (cwd == NULL)
error (_("-environment-pwd: error finding name of working directory: %s"),
- safe_strerror (errno));
+ safe_strerror (errno));
uiout->field_string ("cwd", cwd.get ());
}
{
if (argc == 0 || argc > 1)
error (_("-environment-cd: Usage DIRECTORY"));
-
+
env_execute_cli_command ("cd", argv[0]);
}
while (1)
{
int opt = mi_getopt ("-environment-path", argc, argv, opts,
- &oind, &oarg);
+ &oind, &oarg);
if (opt < 0)
- break;
+ break;
switch ((enum opt) opt)
- {
- case RESET_OPT:
- reset = 1;
- break;
- }
+ {
+ case RESET_OPT:
+ reset = 1;
+ break;
+ }
}
argv += oind;
argc -= oind;
/* Can be null if path is not set. */
if (!env)
- env = "";
+ env = "";
exec_path = xstrdup (env);
}
while (1)
{
int opt = mi_getopt ("-environment-directory", argc, argv, opts,
- &oind, &oarg);
+ &oind, &oarg);
if (opt < 0)
- break;
+ break;
switch ((enum opt) opt)
- {
- case RESET_OPT:
- reset = 1;
- break;
- }
+ {
+ case RESET_OPT:
+ reset = 1;
+ break;
+ }
}
argv += oind;
argc -= oind;
else
{
/* Called with no arguments, it means we want the whole
- backtrace. */
+ backtrace. */
frame_low = -1;
frame_high = -1;
}
else
{
/* Called with no arguments, it means we want args for the whole
- backtrace. */
+ backtrace. */
frame_low = -1;
frame_high = -1;
}
&& (arg->val != NULL || arg->error != NULL)));
gdb_assert (arg->entry_kind == print_entry_values_no
|| (arg->entry_kind == print_entry_values_only
- && (arg->val || arg->error)));
+ && (arg->val || arg->error)));
if (skip_unavailable && arg->val != NULL
&& (value_entirely_unavailable (arg->val)
{
ALL_BLOCK_SYMBOLS (block, iter, sym)
{
- int print_me = 0;
+ int print_me = 0;
switch (SYMBOL_CLASS (sym))
{
}
uiout->field_string ("in_scope", "true");
break;
- case VAROBJ_NOT_IN_SCOPE:
- uiout->field_string ("in_scope", "false");
+ case VAROBJ_NOT_IN_SCOPE:
+ uiout->field_string ("in_scope", "false");
break;
- case VAROBJ_INVALID:
- uiout->field_string ("in_scope", "invalid");
+ case VAROBJ_INVALID:
+ uiout->field_string ("in_scope", "invalid");
break;
}
DEF_MI_CMD_MI_1 ("break-watch", mi_cmd_break_watch,
&mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI_1 ("catch-assert", mi_cmd_catch_assert,
- &mi_suppress_notification.breakpoint),
+ &mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI_1 ("catch-exception", mi_cmd_catch_exception,
- &mi_suppress_notification.breakpoint),
+ &mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI_1 ("catch-handlers", mi_cmd_catch_handlers,
- &mi_suppress_notification.breakpoint),
+ &mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI_1 ("catch-load", mi_cmd_catch_load,
- &mi_suppress_notification.breakpoint),
+ &mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI_1 ("catch-unload", mi_cmd_catch_unload,
- &mi_suppress_notification.breakpoint),
+ &mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI_1 ("catch-throw", mi_cmd_catch_throw,
- &mi_suppress_notification.breakpoint),
+ &mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI_1 ("catch-rethrow", mi_cmd_catch_rethrow,
- &mi_suppress_notification.breakpoint),
+ &mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI_1 ("catch-catch", mi_cmd_catch_catch,
- &mi_suppress_notification.breakpoint),
+ &mi_suppress_notification.breakpoint),
DEF_MI_CMD_MI ("complete", mi_cmd_complete),
DEF_MI_CMD_MI ("data-disassemble", mi_cmd_disassemble),
DEF_MI_CMD_MI ("data-evaluate-expression", mi_cmd_data_evaluate_expression),
/* Write given values into registers. The registers and values are
given as pairs. The corresponding MI command is
-data-write-register-values <format>
- [<regnum1> <value1>...<regnumN> <valueN>] */
+ [<regnum1> <value1>...<regnumN> <valueN>] */
void
mi_cmd_data_write_register_values (const char *command, char **argv, int argc)
{
{
int x;
if (sscanf (cdata + i * 2, "%02x", &x) != 1)
- error (_("Invalid argument"));
+ error (_("Invalid argument"));
databuf[i] = (gdb_byte) x;
}
if (len_units < count_units)
{
/* Pattern is made of less units than count:
- repeat pattern to fill memory. */
+ repeat pattern to fill memory. */
data = gdb::byte_vector (count_units * unit_size);
/* Number of times the pattern is entirely repeated. */
/* Number of remaining addressable memory units. */
remaining_units = count_units % len_units;
for (i = 0; i < steps; i++)
- memcpy (&data[i * len_bytes], &databuf[0], len_bytes);
+ memcpy (&data[i * len_bytes], &databuf[0], len_bytes);
if (remaining_units > 0)
- memcpy (&data[steps * len_bytes], &databuf[0],
+ memcpy (&data[steps * len_bytes], &databuf[0],
remaining_units * unit_size);
}
else
{
/* Pattern is longer than or equal to count:
- just copy count addressable memory units. */
+ just copy count addressable memory units. */
data = std::move (databuf);
}
if (result.number_matches > 0)
uiout->field_fmt ("completion", "%s%s",
- arg_prefix.c_str (),result.match_list[0]);
+ arg_prefix.c_str (),result.match_list[0]);
{
ui_out_emit_list completions_emitter (uiout, "matches");
if (result.number_matches == 1)
uiout->field_fmt (NULL, "%s%s",
- arg_prefix.c_str (), result.match_list[0]);
+ arg_prefix.c_str (), result.match_list[0]);
else
{
- result.sort_match_list ();
- for (size_t i = 0; i < result.number_matches; i++)
- {
- uiout->field_fmt (NULL, "%s%s",
- arg_prefix.c_str (), result.match_list[i + 1]);
- }
+ result.sort_match_list ();
+ for (size_t i = 0; i < result.number_matches; i++)
+ {
+ uiout->field_fmt (NULL, "%s%s",
+ arg_prefix.c_str (), result.match_list[i + 1]);
+ }
}
}
uiout->field_string ("max_completions_reached",
- result.number_matches == max_completions ? "1" : "0");
+ result.number_matches == max_completions ? "1" : "0");
}
/* See if --all is the last token in the input. */
if (strcmp (chp, "--all") == 0)
{
- parse->all = 1;
- chp += strlen (chp);
- }
+ parse->all = 1;
+ chp += strlen (chp);
+ }
if (strncmp (chp, "--thread-group ", tgs) == 0)
{
char *endp;
else if (IS_SETUP_FP(op, ra, rb))
{
/* We have a frame pointer. Note the register which is
- acting as the frame pointer. */
+ acting as the frame pointer. */
flags |= MICROBLAZE_MY_FRAME_IN_FP;
flags &= ~MICROBLAZE_MY_FRAME_IN_SP;
cache->fp_regnum = rd;
if (cache->frameless_p)
{
if (regnum == MICROBLAZE_PC_REGNUM)
- regnum = 15;
+ regnum = 15;
if (regnum == MICROBLAZE_SP_REGNUM)
- regnum = 1;
+ regnum = 1;
return trad_frame_get_prev_register (this_frame,
cache->saved_regs, regnum);
}
microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
{
register_remote_g_packet_guess (gdbarch,
- 4 * MICROBLAZE_NUM_CORE_REGS,
- tdesc_microblaze);
+ 4 * MICROBLAZE_NUM_CORE_REGS,
+ tdesc_microblaze);
register_remote_g_packet_guess (gdbarch,
- 4 * MICROBLAZE_NUM_REGS,
- tdesc_microblaze_with_stack_protect);
+ 4 * MICROBLAZE_NUM_REGS,
+ tdesc_microblaze_with_stack_protect);
}
static struct gdbarch *
int i;
feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.microblaze.core");
+ "org.gnu.gdb.microblaze.core");
if (feature == NULL)
- return NULL;
+ return NULL;
tdesc_data = tdesc_data_alloc ();
valid_p = 1;
for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
- microblaze_register_names[i]);
+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
+ microblaze_register_names[i]);
feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.microblaze.stack-protect");
+ "org.gnu.gdb.microblaze.stack-protect");
if (feature != NULL)
- {
- valid_p = 1;
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- MICROBLAZE_SLR_REGNUM,
- "rslr");
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- MICROBLAZE_SHR_REGNUM,
- "rshr");
- }
+ {
+ valid_p = 1;
+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
+ MICROBLAZE_SLR_REGNUM,
+ "rslr");
+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
+ MICROBLAZE_SHR_REGNUM,
+ "rshr");
+ }
if (!valid_p)
return NULL;
if (size < LZMA_STREAM_HEADER_SIZE
|| bfd_seek (section->owner, offset, SEEK_SET) != 0
|| bfd_bread (footer, LZMA_STREAM_HEADER_SIZE, section->owner)
- != LZMA_STREAM_HEADER_SIZE
+ != LZMA_STREAM_HEADER_SIZE
|| lzma_stream_footer_decode (&options, footer) != LZMA_OK
|| offset < options.backward_size)
{
pos = 0;
if (bfd_seek (section->owner, offset, SEEK_SET) != 0
|| bfd_bread (indexdata, options.backward_size, section->owner)
- != options.backward_size
+ != options.backward_size
|| lzma_index_buffer_decode (&index, &memlimit, &gdb_lzma_allocator,
indexdata, &pos, options.backward_size)
- != LZMA_OK
+ != LZMA_OK
|| lzma_index_size (index) != options.backward_size)
{
xfree (indexdata);
CORE_ADDR pc = pc_in;
/* If this objfile has a minimal symbol table, go search it
- using a binary search. */
+ using a binary search. */
if (objfile->per_bfd->minimal_symbol_count > 0)
{
int best_zero_sized = -1;
- msymbol = objfile->per_bfd->msymbols.get ();
+ msymbol = objfile->per_bfd->msymbols.get ();
lo = 0;
hi = objfile->per_bfd->minimal_symbol_count - 1;
}
/* If we have multiple symbols at the same address, we want
- hi to point to the last one. That way we can find the
- right symbol if it has an index greater than hi. */
+ hi to point to the last one. That way we can find the
+ right symbol if it has an index greater than hi. */
while (hi < objfile->per_bfd->minimal_symbol_count - 1
&& (MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi])
== MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi + 1])))
}
/* The minimal symbol indexed by hi now is the best one in this
- objfile's minimal symbol table. See if it is the best one
- overall. */
+ objfile's minimal symbol table. See if it is the best one
+ overall. */
if (hi >= 0
&& ((best_symbol == NULL) ||
if (symtab_create_debug >= 2)
printf_unfiltered ("Recording minsym: %-21s %18s %4d %.*s\n",
- mst_str (ms_type), hex_string (address), section,
+ mst_str (ms_type), hex_string (address), section,
(int) name.size (), name.data ());
if (m_msym_bunch_index == BUNCH_SIZE)
}
/* Allocate enough space, into which we will gather the bunches
- of new and existing minimal symbols, sort them, and then
- compact out the duplicate entries. Once we have a final
- table, we will give back the excess space. */
+ of new and existing minimal symbols, sort them, and then
+ compact out the duplicate entries. Once we have a final
+ table, we will give back the excess space. */
alloc_count = m_msym_count + m_objfile->per_bfd->minimal_symbol_count;
gdb::unique_xmalloc_ptr<minimal_symbol>
* sizeof (struct minimal_symbol));
/* Walk through the list of minimal symbol bunches, adding each symbol
- to the new contiguous array of symbols. Note that we start with the
- current, possibly partially filled bunch (thus we use the current
- msym_bunch_index for the first bunch we copy over), and thereafter
- each bunch is full. */
+ to the new contiguous array of symbols. Note that we start with the
+ current, possibly partially filled bunch (thus we use the current
+ msym_bunch_index for the first bunch we copy over), and thereafter
+ each bunch is full. */
mcount = m_objfile->per_bfd->minimal_symbol_count;
std::sort (msymbols, msymbols + mcount, minimal_symbol_is_less_than);
/* Compact out any duplicates, and free up whatever space we are
- no longer using. */
+ no longer using. */
mcount = compact_minimal_symbols (msymbols, mcount, m_objfile);
msym_holder.reset (XRESIZEVEC (struct minimal_symbol,
mcount));
/* Attach the minimal symbol table to the specified objfile.
- The strings themselves are also located in the storage_obstack
- of this objfile. */
+ The strings themselves are also located in the storage_obstack
+ of this objfile. */
if (m_objfile->per_bfd->minimal_symbol_count != 0)
clear_minimal_symbol_hash_tables (m_objfile);
}
{
/* To limit how long we hold the lock, we only acquire it here
- and not while we demangle the names above. */
+ and not while we demangle the names above. */
#if CXX_STD_THREAD
std::lock_guard<std::mutex> guard (demangled_mutex);
#endif
ps_err_e
ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ lwpid_t lwpid, int idx, void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
Pre-2.6.12 sigcontext:
struct sigcontext {
- unsigned int sc_regmask; [Unused]
- unsigned int sc_status;
- unsigned long long sc_pc;
- unsigned long long sc_regs[32];
- unsigned long long sc_fpregs[32];
- unsigned int sc_ownedfp;
- unsigned int sc_fpc_csr;
- unsigned int sc_fpc_eir; [Unused]
- unsigned int sc_used_math;
- unsigned int sc_ssflags; [Unused]
+ unsigned int sc_regmask; [Unused]
+ unsigned int sc_status;
+ unsigned long long sc_pc;
+ unsigned long long sc_regs[32];
+ unsigned long long sc_fpregs[32];
+ unsigned int sc_ownedfp;
+ unsigned int sc_fpc_csr;
+ unsigned int sc_fpc_eir; [Unused]
+ unsigned int sc_used_math;
+ unsigned int sc_ssflags; [Unused]
[Alignment hole of four bytes]
- unsigned long long sc_mdhi;
- unsigned long long sc_mdlo;
+ unsigned long long sc_mdhi;
+ unsigned long long sc_mdlo;
- unsigned int sc_cause; [Unused]
- unsigned int sc_badvaddr; [Unused]
+ unsigned int sc_cause; [Unused]
+ unsigned int sc_badvaddr; [Unused]
- unsigned long sc_sigset[4]; [kernel's sigset_t]
+ unsigned long sc_sigset[4]; [kernel's sigset_t]
};
Post-2.6.12 sigcontext (SmartMIPS/DSP support added):
struct sigcontext {
- unsigned int sc_regmask; [Unused]
- unsigned int sc_status; [Unused]
- unsigned long long sc_pc;
- unsigned long long sc_regs[32];
- unsigned long long sc_fpregs[32];
- unsigned int sc_acx;
- unsigned int sc_fpc_csr;
- unsigned int sc_fpc_eir; [Unused]
- unsigned int sc_used_math;
- unsigned int sc_dsp;
+ unsigned int sc_regmask; [Unused]
+ unsigned int sc_status; [Unused]
+ unsigned long long sc_pc;
+ unsigned long long sc_regs[32];
+ unsigned long long sc_fpregs[32];
+ unsigned int sc_acx;
+ unsigned int sc_fpc_csr;
+ unsigned int sc_fpc_eir; [Unused]
+ unsigned int sc_used_math;
+ unsigned int sc_dsp;
[Alignment hole of four bytes]
- unsigned long long sc_mdhi;
- unsigned long long sc_mdlo;
- unsigned long sc_hi1;
- unsigned long sc_lo1;
- unsigned long sc_hi2;
- unsigned long sc_lo2;
- unsigned long sc_hi3;
- unsigned long sc_lo3;
+ unsigned long long sc_mdhi;
+ unsigned long long sc_mdlo;
+ unsigned long sc_hi1;
+ unsigned long sc_lo1;
+ unsigned long sc_hi2;
+ unsigned long sc_lo2;
+ unsigned long sc_hi3;
+ unsigned long sc_lo3;
};
The RT signal frames look like this:
if (signal >= MIPS_LINUX_SIGRTMIN && signal <= MIPS_LINUX_SIGRTMAX)
{
/* GDB_SIGNAL_REALTIME values are not contiguous, map parts of
- the MIPS block to the respective GDB_SIGNAL_REALTIME blocks. */
+ the MIPS block to the respective GDB_SIGNAL_REALTIME blocks. */
int offset = signal - MIPS_LINUX_SIGRTMIN;
if (offset == 0)
if (gdbarch_cannot_fetch_register (gdbarch, i))
regcache->raw_supply (i, NULL);
else
- regcache->raw_supply
+ regcache->raw_supply
(i, regs + (i * mips_isa_regsize (gdbarch)));
- }
+ }
}
}
if (gdbarch_cannot_fetch_register (gdbarch, i))
regcache->raw_supply (i, NULL);
else
- regcache->raw_supply (i,
+ regcache->raw_supply (i,
fpregs
+ ((i - gdbarch_fp0_regnum (gdbarch))
* mips_isa_regsize (gdbarch)));
static void
mipsnbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+ struct gdbarch *gdbarch)
{
nbsd_init_abi (info, gdbarch);
ax_reg (ax, rawnum);
if (register_size (gdbarch, rawnum) > register_size (gdbarch, reg))
- {
+ {
if (!gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p
|| gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG)
{
int num_regs = gdbarch_num_regs (gdbarch);
return (register_size (gdbarch, regnum) == 8
- && regnum % num_regs > 0 && regnum % num_regs < 32
- && TYPE_LENGTH (type) < 8);
+ && regnum % num_regs > 0 && regnum % num_regs < 32
+ && TYPE_LENGTH (type) < 8);
}
static int
else
{
internal_error (__FILE__, __LINE__,
- _("mips_register_to_value: unrecognized case"));
+ _("mips_register_to_value: unrecognized case"));
}
}
int len = TYPE_LENGTH (type);
/* Sign extend values, irrespective of type, that are stored to
- a 64-bit general purpose register. (32-bit unsigned values
+ a 64-bit general purpose register. (32-bit unsigned values
are stored as signed quantities within a 64-bit register.
When performing an operation, in compiled code, that combines
a 32-bit unsigned value with a signed 64-bit value, a type
else
{
internal_error (__FILE__, __LINE__,
- _("mips_value_to_register: unrecognized case"));
+ _("mips_value_to_register: unrecognized case"));
}
}
if (mips_float_register_p (gdbarch, regnum))
{
/* The floating-point registers raw, or cooked, always match
- mips_isa_regsize(), and also map 1:1, byte for byte. */
+ mips_isa_regsize(), and also map 1:1, byte for byte. */
if (mips_isa_regsize (gdbarch) == 4)
return builtin_type (gdbarch)->builtin_float;
else
case ISA_MICROMIPS:
if ((micromips_op (insn) & 0x4) == 0x4
|| (micromips_op (insn) & 0x7) == 0x0)
- return 2 * MIPS_INSN16_SIZE;
+ return 2 * MIPS_INSN16_SIZE;
else
- return MIPS_INSN16_SIZE;
+ return MIPS_INSN16_SIZE;
case ISA_MIPS16:
if ((insn & 0xf800) == 0xf000)
return 2 * MIPS_INSN16_SIZE;
const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch);
return (info->mach == bfd_mach_mips_octeon
- || info->mach == bfd_mach_mips_octeonp
- || info->mach == bfd_mach_mips_octeon2);
+ || info->mach == bfd_mach_mips_octeonp
+ || info->mach == bfd_mach_mips_octeon2);
}
/* Return true if the OP represents the Octeon's BBIT instruction. */
if (((regcache_raw_get_signed (regcache,
itype_rs (inst)) >> bit) & 1)
- == branch_if)
+ == branch_if)
pc += mips32_relative_offset (inst) + 4;
- else
+ else
pc += 8; /* After the delay slot. */
}
}
case 30:
/* This is an instruction extension. Fetch the real instruction
- (which follows the extension) and decode things based on
- that. */
+ (which follows the extension) and decode things based on
+ that. */
{
pc += 2;
pc = extended_mips16_next_pc (regcache, pc, insn,
&& this_cache->saved_regs[regnum].addr == -1)
{
this_cache->saved_regs[regnum + 0 * gdbarch_num_regs (gdbarch)].addr
- = offset;
+ = offset;
this_cache->saved_regs[regnum + 1 * gdbarch_num_regs (gdbarch)].addr
- = offset;
+ = offset;
}
}
static CORE_ADDR
mips16_scan_prologue (struct gdbarch *gdbarch,
CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct frame_info *this_frame,
- struct mips_frame_cache *this_cache)
+ struct frame_info *this_frame,
+ struct mips_frame_cache *this_cache)
{
int prev_non_prologue_insn = 0;
int this_non_prologue_insn;
in_delay_slot = 0;
/* Save the previous instruction. If it's an EXTEND, we'll extract
- the immediate offset extension from it in mips16_get_imm. */
+ the immediate offset extension from it in mips16_get_imm. */
prev_inst = inst;
/* Fetch and decode the instruction. */
cur_pc, NULL);
/* Normally we ignore extend instructions. However, if it is
- not followed by a valid prologue instruction, then this
- instruction is not part of the prologue either. We must
- remember in this case to adjust the end_prologue_addr back
- over the extend. */
+ not followed by a valid prologue instruction, then this
+ instruction is not part of the prologue either. We must
+ remember in this case to adjust the end_prologue_addr back
+ over the extend. */
if ((inst & 0xf800) == 0xf000) /* extend */
- {
- extend_bytes = MIPS_INSN16_SIZE;
- continue;
- }
+ {
+ extend_bytes = MIPS_INSN16_SIZE;
+ continue;
+ }
prev_extend_bytes = extend_bytes;
extend_bytes = 0;
set_reg_offset (gdbarch, this_cache, reg, frame_addr + offset);
}
else if ((inst & 0xf81f) == 0xe809
- && (inst & 0x700) != 0x700) /* entry */
+ && (inst & 0x700) != 0x700) /* entry */
entry_inst = inst; /* Save for later processing. */
else if ((inst & 0xff80) == 0x6480) /* save */
{
save_inst |= prev_inst << 16;
}
else if ((inst & 0xff1c) == 0x6704) /* move reg,$a0-$a3 */
- {
- /* This instruction is part of the prologue, but we don't
- need to do anything special to handle it. */
- }
+ {
+ /* This instruction is part of the prologue, but we don't
+ need to do anything special to handle it. */
+ }
else if (mips16_instruction_has_delay_slot (inst, 0))
/* JAL/JALR/JALX/JR */
{
}
}
else
- {
+ {
this_non_prologue_insn = 1;
- }
+ }
non_prologue_insns += this_non_prologue_insn;
/* A jump or branch, or enough non-prologue insns seen? If so,
- then we must have reached the end of the prologue by now. */
+ then we must have reached the end of the prologue by now. */
if (prev_delay_slot || non_prologue_insns > 1
|| mips16_instruction_is_compact_branch (inst))
break;
frame_offset += 32;
/* Now we can calculate what the SP must have been at the
- start of the function prologue. */
+ start of the function prologue. */
sp += frame_offset;
/* Check if a0-a3 were saved in the caller's argument save area. */
frame_offset += frame_size;
/* Now we can calculate what the SP must have been at the
- start of the function prologue. */
+ start of the function prologue. */
sp += frame_offset;
/* Check if A0-A3 were saved in the caller's argument save area. */
if (this_cache != NULL)
{
this_cache->base =
- (get_frame_register_signed (this_frame,
+ (get_frame_register_signed (this_frame,
gdbarch_num_regs (gdbarch) + frame_reg)
- + frame_offset - frame_adjust);
+ + frame_offset - frame_adjust);
/* FIXME: brobecker/2004-10-10: Just as in the mips32 case, we should
- be able to get rid of the assignment below, evetually. But it's
- still needed for now. */
+ be able to get rid of the assignment below, evetually. But it's
+ still needed for now. */
this_cache->saved_regs[gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->pc]
- = this_cache->saved_regs[gdbarch_num_regs (gdbarch) + MIPS_RA_REGNUM];
+ = this_cache->saved_regs[gdbarch_num_regs (gdbarch) + MIPS_RA_REGNUM];
}
/* Set end_prologue_addr to the address of the instruction immediately
default:
/* The instruction in the delay slot can be a part
- of the prologue, so move forward once more. */
+ of the prologue, so move forward once more. */
if (micromips_instruction_has_delay_slot (insn, 0))
in_delay_slot = 1;
else
default:
/* The instruction in the delay slot can be a part
- of the prologue, so move forward once more. */
+ of the prologue, so move forward once more. */
if (micromips_instruction_has_delay_slot (insn << 16, 0))
in_delay_slot = 1;
else
non_prologue_insns += this_non_prologue_insn;
/* A jump or branch, enough non-prologue insns seen or positive
- stack adjustment? If so, then we must have reached the end
- of the prologue by now. */
+ stack adjustment? If so, then we must have reached the end
+ of the prologue by now. */
if (prev_delay_slot || non_prologue_insns > 1 || sp_adj > 0
|| micromips_instruction_is_compact_branch (insn))
break;
for (i = 0; i < num_regs; i++)
{
- this_cache->saved_regs[i].addr = -1;
+ this_cache->saved_regs[i].addr = -1;
}
}
}
static CORE_ADDR
mips32_scan_prologue (struct gdbarch *gdbarch,
CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct frame_info *this_frame,
- struct mips_frame_cache *this_cache)
+ struct frame_info *this_frame,
+ struct mips_frame_cache *this_cache)
{
int prev_non_prologue_insn;
int this_non_prologue_insn;
|| high_word == 0x67bd) /* daddiu $sp,$sp,-i */
{
if (offset < 0) /* Negative stack adjustment? */
- frame_offset -= offset;
+ frame_offset -= offset;
else
/* Exit loop if a positive stack adjustment is found, which
usually means that the stack cleanup code in the function
epilogue is reached. */
break;
- seen_sp_adjust = 1;
+ seen_sp_adjust = 1;
}
else if (((high_word & 0xFFE0) == 0xafa0) /* sw reg,offset($sp) */
- && !regsize_is_64_bits)
+ && !regsize_is_64_bits)
{
set_reg_offset (gdbarch, this_cache, reg, sp + offset);
}
else if (((high_word & 0xFFE0) == 0xffa0) /* sd reg,offset($sp) */
- && regsize_is_64_bits)
+ && regsize_is_64_bits)
{
/* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra. */
set_reg_offset (gdbarch, this_cache, reg, sp + offset);
alloca_adjust = (unsigned) (frame_addr - (sp + offset));
if (alloca_adjust > 0)
{
- /* FP > SP + frame_size. This may be because of
- an alloca or somethings similar. Fix sp to
- "pre-alloca" value, and try again. */
+ /* FP > SP + frame_size. This may be because of
+ an alloca or somethings similar. Fix sp to
+ "pre-alloca" value, and try again. */
sp += alloca_adjust;
- /* Need to reset the status of all registers. Otherwise,
- we will hit a guard that prevents the new address
- for each register to be recomputed during the second
- pass. */
- reset_saved_regs (gdbarch, this_cache);
+ /* Need to reset the status of all registers. Otherwise,
+ we will hit a guard that prevents the new address
+ for each register to be recomputed during the second
+ pass. */
+ reset_saved_regs (gdbarch, this_cache);
goto restart;
}
}
}
/* move $30,$sp. With different versions of gas this will be either
- `addu $30,$sp,$zero' or `or $30,$sp,$zero' or `daddu 30,sp,$0'.
- Accept any one of these. */
+ `addu $30,$sp,$zero' or `or $30,$sp,$zero' or `daddu 30,sp,$0'.
+ Accept any one of these. */
else if (inst == 0x03A0F021 || inst == 0x03a0f025 || inst == 0x03a0f02d)
{
/* New gcc frame, virtual frame pointer is at r30 + frame_size. */
alloca_adjust = (unsigned) (frame_addr - sp);
if (alloca_adjust > 0)
- {
- /* FP > SP + frame_size. This may be because of
- an alloca or somethings similar. Fix sp to
- "pre-alloca" value, and try again. */
- sp = frame_addr;
- /* Need to reset the status of all registers. Otherwise,
- we will hit a guard that prevents the new address
- for each register to be recomputed during the second
- pass. */
- reset_saved_regs (gdbarch, this_cache);
- goto restart;
- }
+ {
+ /* FP > SP + frame_size. This may be because of
+ an alloca or somethings similar. Fix sp to
+ "pre-alloca" value, and try again. */
+ sp = frame_addr;
+ /* Need to reset the status of all registers. Otherwise,
+ we will hit a guard that prevents the new address
+ for each register to be recomputed during the second
+ pass. */
+ reset_saved_regs (gdbarch, this_cache);
+ goto restart;
+ }
}
}
else if ((high_word & 0xFFE0) == 0xafc0 /* sw reg,offset($30) */
- && !regsize_is_64_bits)
+ && !regsize_is_64_bits)
{
set_reg_offset (gdbarch, this_cache, reg, frame_addr + offset);
}
else if ((high_word & 0xFFE0) == 0xE7A0 /* swc1 freg,n($sp) */
- || (high_word & 0xF3E0) == 0xA3C0 /* sx reg,n($s8) */
- || (inst & 0xFF9F07FF) == 0x00800021 /* move reg,$a0-$a3 */
- || high_word == 0x3c1c /* lui $gp,n */
- || high_word == 0x279c /* addiu $gp,$gp,n */
- || inst == 0x0399e021 /* addu $gp,$gp,$t9 */
- || inst == 0x033ce021 /* addu $gp,$t9,$gp */
- )
+ || (high_word & 0xF3E0) == 0xA3C0 /* sx reg,n($s8) */
+ || (inst & 0xFF9F07FF) == 0x00800021 /* move reg,$a0-$a3 */
+ || high_word == 0x3c1c /* lui $gp,n */
+ || high_word == 0x279c /* addiu $gp,$gp,n */
+ || inst == 0x0399e021 /* addu $gp,$gp,$t9 */
+ || inst == 0x033ce021 /* addu $gp,$t9,$gp */
+ )
{
/* These instructions are part of the prologue, but we don't
need to do anything special to handle them. */
}
/* The instructions below load $at or $t0 with an immediate
- value in preparation for a stack adjustment via
- subu $sp,$sp,[$at,$t0]. These instructions could also
- initialize a local variable, so we accept them only before
- a stack adjustment instruction was seen. */
+ value in preparation for a stack adjustment via
+ subu $sp,$sp,[$at,$t0]. These instructions could also
+ initialize a local variable, so we accept them only before
+ a stack adjustment instruction was seen. */
else if (!seen_sp_adjust
&& !prev_delay_slot
&& (high_word == 0x3c01 /* lui $at,n */
load_immediate_bytes += MIPS_INSN32_SIZE; /* FIXME! */
}
/* Check for branches and jumps. The instruction in the delay
- slot can be a part of the prologue, so move forward once more. */
+ slot can be a part of the prologue, so move forward once more. */
else if (mips32_instruction_has_delay_slot (gdbarch, inst))
{
in_delay_slot = 1;
}
/* This instruction is not an instruction typically found
- in a prologue, so we must have reached the end of the
- prologue. */
+ in a prologue, so we must have reached the end of the
+ prologue. */
else
{
this_non_prologue_insn = 1;
non_prologue_insns += this_non_prologue_insn;
/* A jump or branch, or enough non-prologue insns seen? If so,
- then we must have reached the end of the prologue by now. */
+ then we must have reached the end of the prologue by now. */
if (prev_delay_slot || non_prologue_insns > 1)
break;
if (this_cache != NULL)
{
this_cache->base =
- (get_frame_register_signed (this_frame,
+ (get_frame_register_signed (this_frame,
gdbarch_num_regs (gdbarch) + frame_reg)
- + frame_offset);
+ + frame_offset);
/* FIXME: brobecker/2004-09-15: We should be able to get rid of
- this assignment below, eventually. But it's still needed
- for now. */
+ this assignment below, eventually. But it's still needed
+ for now. */
this_cache->saved_regs[gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->pc]
- = this_cache->saved_regs[gdbarch_num_regs (gdbarch)
+ = this_cache->saved_regs[gdbarch_num_regs (gdbarch)
+ MIPS_RA_REGNUM];
}
loc += MIPS_INSN16_SIZE;
/* Assume that there is at most one conditional branch in the
- atomic sequence. If a branch is found, put a breakpoint in
- its destination address. */
+ atomic sequence. If a branch is found, put a breakpoint in
+ its destination address. */
switch (mips_insn_size (ISA_MICROMIPS, insn))
{
/* 32-bit instructions. */
case 0x11: /* POOL16C: bits 010001 */
if ((b5s5_op (insn) & 0x1c) != 0xc
/* JR16, JRC, JALR16, JALRS16: 010001 011xx */
- && b5s5_op (insn) != 0x18)
+ && b5s5_op (insn) != 0x18)
/* JRADDIUSP: bits 010001 11000 */
- break;
+ break;
return {}; /* Fall back to the standard single-step code. */
case 0x33: /* B16: bits 110011 */
argnum + 1, len, (int) typecode);
/* The EABI passes structures that do not fit in a register by
- reference. */
+ reference. */
if (len > abi_regsize
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
{
val = value_contents (arg);
/* 32-bit ABIs always start floating point arguments in an
- even-numbered floating point register. Round the FP register
- up before the check to see if there are any FP registers
- left. Non MIPS_EABI targets also pass the FP in the integer
- registers so also round up normal registers. */
+ even-numbered floating point register. Round the FP register
+ up before the check to see if there are any FP registers
+ left. Non MIPS_EABI targets also pass the FP in the integer
+ registers so also round up normal registers. */
if (abi_regsize < 8 && fp_register_arg_p (gdbarch, typecode, arg_type))
{
if ((float_argreg & 1))
}
/* Floating point arguments passed in registers have to be
- treated specially. On 32-bit architectures, doubles
- are passed in register pairs; the even register gets
- the low word, and the odd register gets the high word.
- On non-EABI processors, the first two floating point arguments are
- also copied to general registers, because MIPS16 functions
- don't use float registers for arguments. This duplication of
- arguments in general registers can't hurt non-MIPS16 functions
- because those registers are normally skipped. */
+ treated specially. On 32-bit architectures, doubles
+ are passed in register pairs; the even register gets
+ the low word, and the odd register gets the high word.
+ On non-EABI processors, the first two floating point arguments are
+ also copied to general registers, because MIPS16 functions
+ don't use float registers for arguments. This duplication of
+ arguments in general registers can't hurt non-MIPS16 functions
+ because those registers are normally skipped. */
/* MIPS_EABI squeezes a struct that contains a single floating
- point value into an FP register instead of pushing it onto the
- stack. */
+ point value into an FP register instead of pushing it onto the
+ stack. */
if (fp_register_arg_p (gdbarch, typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
{
else
{
/* This is a floating point value that fits entirely
- in a single register. */
+ in a single register. */
/* On 32 bit ABI's the float_argreg is further adjusted
- above to ensure that it is even register aligned. */
+ above to ensure that it is even register aligned. */
LONGEST regval = extract_signed_integer (val, len, byte_order);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
}
/* Note!!! This is NOT an else clause. Odd sized
- structs may go thru BOTH paths. Floating point
- arguments will not. */
+ structs may go thru BOTH paths. Floating point
+ arguments will not. */
/* Write this portion of the argument to a general
- purpose register. */
+ purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch)
&& !fp_register_arg_p (gdbarch, typecode, arg_type))
{
val += partial_len;
/* Compute the offset into the stack at which we will
- copy the next parameter.
+ copy the next parameter.
- In the new EABI (and the NABI32), the stack_offset
- only needs to be adjusted when it has been used. */
+ In the new EABI (and the NABI32), the stack_offset
+ only needs to be adjusted when it has been used. */
if (stack_used_p)
stack_offset += align_up (partial_len, abi_regsize);
}
/* Note!!! This is NOT an else clause. Odd sized
- structs may go thru BOTH paths. */
+ structs may go thru BOTH paths. */
/* Write this portion of the argument to a general
- purpose register. */
+ purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
{
LONGEST regval;
val += partial_len;
/* Compute the offset into the stack at which we will
- copy the next parameter.
+ copy the next parameter.
- In N32 (N64?), the stack_offset only needs to be
- adjusted when it has been used. */
+ In N32 (N64?), the stack_offset only needs to be
+ adjusted when it has been used. */
if (stack_used_p)
stack_offset += align_up (partial_len, MIPS64_REGSIZE);
== TYPE_CODE_FLT))))
{
/* A struct that contains one or two floats. Each value is part
- in the least significant part of their floating point
- register (or GPR, for soft float). */
+ in the least significant part of their floating point
+ register (or GPR, for soft float). */
int regnum;
int field;
for (field = 0, regnum = (tdep->mips_fpu_type != MIPS_FPU_NONE
|| type->code () == TYPE_CODE_ARRAY)
{
/* A composite type. Extract the left justified value,
- regardless of the byte order. I.e. DO NOT USE
- mips_xfer_lower. */
+ regardless of the byte order. I.e. DO NOT USE
+ mips_xfer_lower. */
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
else
{
/* A scalar extract each part but least-significant-byte
- justified. */
+ justified. */
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
val = value_contents (arg);
/* 32-bit ABIs always start floating point arguments in an
- even-numbered floating point register. Round the FP register
- up before the check to see if there are any FP registers
- left. O32 targets also pass the FP in the integer registers
- so also round up normal registers. */
+ even-numbered floating point register. Round the FP register
+ up before the check to see if there are any FP registers
+ left. O32 targets also pass the FP in the integer registers
+ so also round up normal registers. */
if (fp_register_arg_p (gdbarch, typecode, arg_type))
{
if ((float_argreg & 1))
}
/* Floating point arguments passed in registers have to be
- treated specially. On 32-bit architectures, doubles are
- passed in register pairs; the even FP register gets the
- low word, and the odd FP register gets the high word.
- On O32, the first two floating point arguments are also
- copied to general registers, following their memory order,
- because MIPS16 functions don't use float registers for
- arguments. This duplication of arguments in general
- registers can't hurt non-MIPS16 functions, because those
- registers are normally skipped. */
+ treated specially. On 32-bit architectures, doubles are
+ passed in register pairs; the even FP register gets the
+ low word, and the odd FP register gets the high word.
+ On O32, the first two floating point arguments are also
+ copied to general registers, following their memory order,
+ because MIPS16 functions don't use float registers for
+ arguments. This duplication of arguments in general
+ registers can't hurt non-MIPS16 functions, because those
+ registers are normally skipped. */
if (fp_register_arg_p (gdbarch, typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
else
{
/* This is a floating point value that fits entirely
- in a single register. */
+ in a single register. */
/* On 32 bit ABI's the float_argreg is further adjusted
- above to ensure that it is even register aligned. */
+ above to ensure that it is even register aligned. */
LONGEST regval = extract_unsigned_integer (val, len, byte_order);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
}
/* Note!!! This is NOT an else clause. Odd sized
- structs may go thru BOTH paths. */
+ structs may go thru BOTH paths. */
/* Write this portion of the argument to a general
- purpose register. */
+ purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
{
LONGEST regval = extract_signed_integer (val, partial_len,
val += partial_len;
/* Compute the offset into the stack at which we will
- copy the next parameter.
+ copy the next parameter.
- In older ABIs, the caller reserved space for
- registers that contained arguments. This was loosely
- refered to as their "home". Consequently, space is
- always allocated. */
+ In older ABIs, the caller reserved space for
+ registers that contained arguments. This was loosely
+ refered to as their "home". Consequently, space is
+ always allocated. */
stack_offset += align_up (partial_len, MIPS32_REGSIZE);
}
&& TYPE_LENGTH (type) == 4 && tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A single-precision floating-point value. If reading in or copying,
- then we get it from/put it to FP0 for standard MIPS code or GPR2
- for MIPS16 code. If writing out only, then we put it to both FP0
- and GPR2. We do not support reading in with no function known, if
- this safety check ever triggers, then we'll have to try harder. */
+ then we get it from/put it to FP0 for standard MIPS code or GPR2
+ for MIPS16 code. If writing out only, then we put it to both FP0
+ and GPR2. We do not support reading in with no function known, if
+ this safety check ever triggers, then we'll have to try harder. */
gdb_assert (function || !readbuf);
if (mips_debug)
switch (fval_reg)
&& TYPE_LENGTH (type) == 8 && tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A double-precision floating-point value. If reading in or copying,
- then we get it from/put it to FP1 and FP0 for standard MIPS code or
- GPR2 and GPR3 for MIPS16 code. If writing out only, then we put it
- to both FP1/FP0 and GPR2/GPR3. We do not support reading in with
- no function known, if this safety check ever triggers, then we'll
- have to try harder. */
+ then we get it from/put it to FP1 and FP0 for standard MIPS code or
+ GPR2 and GPR3 for MIPS16 code. If writing out only, then we put it
+ to both FP1/FP0 and GPR2/GPR3. We do not support reading in with
+ no function known, if this safety check ever triggers, then we'll
+ have to try harder. */
gdb_assert (function || !readbuf);
if (mips_debug)
switch (fval_reg)
&& tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A struct that contains one or two floats. Each value is part
- in the least significant part of their floating point
- register.. */
+ in the least significant part of their floating point
+ register.. */
int regnum;
int field;
for (field = 0, regnum = mips_regnum (gdbarch)->fp0;
|| type->code () == TYPE_CODE_UNION)
{
/* A structure or union. Extract the left justified value,
- regardless of the byte order. I.e. DO NOT USE
- mips_xfer_lower. */
+ regardless of the byte order. I.e. DO NOT USE
+ mips_xfer_lower. */
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
else
{
/* A scalar extract each part but least-significant-byte
- justified. o32 thinks registers are 4 byte, regardless of
- the ISA. */
+ justified. o32 thinks registers are 4 byte, regardless of
+ the ISA. */
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
val = value_contents (arg);
/* Floating point arguments passed in registers have to be
- treated specially. On 32-bit architectures, doubles are
- passed in register pairs; the even FP register gets the
- low word, and the odd FP register gets the high word.
- On O64, the first two floating point arguments are also
- copied to general registers, because MIPS16 functions
- don't use float registers for arguments. This duplication
- of arguments in general registers can't hurt non-MIPS16
- functions because those registers are normally skipped. */
+ treated specially. On 32-bit architectures, doubles are
+ passed in register pairs; the even FP register gets the
+ low word, and the odd FP register gets the high word.
+ On O64, the first two floating point arguments are also
+ copied to general registers, because MIPS16 functions
+ don't use float registers for arguments. This duplication
+ of arguments in general registers can't hurt non-MIPS16
+ functions because those registers are normally skipped. */
if (fp_register_arg_p (gdbarch, typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
}
/* Note!!! This is NOT an else clause. Odd sized
- structs may go thru BOTH paths. */
+ structs may go thru BOTH paths. */
/* Write this portion of the argument to a general
- purpose register. */
+ purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
{
LONGEST regval = extract_signed_integer (val, partial_len,
val += partial_len;
/* Compute the offset into the stack at which we will
- copy the next parameter.
+ copy the next parameter.
- In older ABIs, the caller reserved space for
- registers that contained arguments. This was loosely
- refered to as their "home". Consequently, space is
- always allocated. */
+ In older ABIs, the caller reserved space for
+ registers that contained arguments. This was loosely
+ refered to as their "home". Consequently, space is
+ always allocated. */
stack_offset += align_up (partial_len, MIPS64_REGSIZE);
}
else if (fp_register_arg_p (gdbarch, type->code (), type))
{
/* A floating-point value. If reading in or copying, then we get it
- from/put it to FP0 for standard MIPS code or GPR2 for MIPS16 code.
- If writing out only, then we put it to both FP0 and GPR2. We do
- not support reading in with no function known, if this safety
- check ever triggers, then we'll have to try harder. */
+ from/put it to FP0 for standard MIPS code or GPR2 for MIPS16 code.
+ If writing out only, then we put it to both FP0 and GPR2. We do
+ not support reading in with no function known, if this safety
+ check ever triggers, then we'll have to try harder. */
gdb_assert (function || !readbuf);
if (mips_debug)
switch (fval_reg)
else
{
/* A scalar extract each part but least-significant-byte
- justified. */
+ justified. */
int offset;
int regnum;
for (offset = 0, regnum = MIPS_V0_REGNUM;
if (raw_size == 8)
{
/* We have a 64-bit value for this register. Find the low-order
- 32 bits. */
+ 32 bits. */
int offset;
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
if (raw_size == 8 && !mips2_fp_compat (frame))
{
/* We have a 64-bit value for this register, and we should use
- all 64 bits. */
+ all 64 bits. */
if (!deprecated_frame_register_read (frame, regno, rare_buffer))
error (_("can't read register %d (%s)"),
regno, gdbarch_register_name (gdbarch, regno));
"odd-numbered FP register"));
/* mips_read_fp_register_single will find the correct 32 bits from
- each register. */
+ each register. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
mips_read_fp_register_single (frame, regno, rare_buffer + 4);
struct value_print_options opts;
/* 4-byte registers: Print hex and floating. Also print even
- numbered registers as doubles. */
+ numbered registers as doubles. */
mips_read_fp_register_single (frame, regnum, raw_buffer);
flt_str = target_float_to_string (raw_buffer, flt_type, "%-17.9g");
CORE_ADDR addr = func_end - 12;
if (addr < func_addr + 4)
- addr = func_addr + 4;
+ addr = func_addr + 4;
if (pc < addr)
- return 0;
+ return 0;
for (; pc < func_end; pc += MIPS_INSN32_SIZE)
{
CORE_ADDR addr = func_end - 12;
if (addr < func_addr + 4)
- addr = func_addr + 4;
+ addr = func_addr + 4;
if (pc < addr)
- return 0;
+ return 0;
for (; pc < func_end; pc += MIPS_INSN16_SIZE)
{
return bpaddr;
/* If the previous instruction has a branch delay slot, we have
- to move the breakpoint to the branch instruction. */
+ to move the breakpoint to the branch instruction. */
prev_addr = bpaddr - 4;
if (mips32_insn_at_pc_has_delay_slot (gdbarch, prev_addr))
bpaddr = prev_addr;
boundary = unmake_compact_addr (boundary);
/* The only MIPS16 instructions with delay slots are JAL, JALX,
- JALR and JR. An absolute JAL/JALX is always 4 bytes long,
- so try for that first, then try the 2 byte JALR/JR.
- The microMIPS ASE has a whole range of jumps and branches
- with delay slots, some of which take 4 bytes and some take
- 2 bytes, so the idea is the same.
- FIXME: We have to assume that bpaddr is not the second half
- of an extended instruction. */
+ JALR and JR. An absolute JAL/JALX is always 4 bytes long,
+ so try for that first, then try the 2 byte JALR/JR.
+ The microMIPS ASE has a whole range of jumps and branches
+ with delay slots, some of which take 4 bytes and some take
+ 2 bytes, so the idea is the same.
+ FIXME: We have to assume that bpaddr is not the second half
+ of an extended instruction. */
insn_at_pc_has_delay_slot = (mips_pc_is_micromips (gdbarch, bpaddr)
? micromips_insn_at_pc_has_delay_slot
: mips16_insn_at_pc_has_delay_slot);
else
{
/* Not a jump instruction: if we're at [target-1] this
- could be the second word of a JAL/JALX, so continue;
- otherwise we're done. */
+ could be the second word of a JAL/JALX, so continue;
+ otherwise we're done. */
if (i > 1)
break;
}
if (strncmp (name, mips_str_mips16_call_stub, prefixlen) == 0)
{
/* If the PC is in __mips16_call_stub_{1..10}, this is a call stub
- and the target PC is in $2. */
+ and the target PC is in $2. */
if (mips_is_stub_suffix (name + prefixlen, 0))
return get_frame_register_signed
(frame, gdbarch_num_regs (gdbarch) + MIPS_V0_REGNUM);
/* If the PC at the start of __mips16_call_stub_{s,d}{f,c}_{0..10},
- i.e. before the JALR instruction, this is effectively a call stub
- and the target PC is in $2. Otherwise this is effectively
- a return stub and the target PC is in $18. */
+ i.e. before the JALR instruction, this is effectively a call stub
+ and the target PC is in $2. Otherwise this is effectively
+ a return stub and the target PC is in $18. */
else if (mips_is_stub_mode (name + prefixlen)
&& name[prefixlen + 2] == '_'
&& mips_is_stub_suffix (name + prefixlen + 3, 0))
if (gdbarch_register_name (gdbarch,
gdbarch_num_regs (gdbarch) + regnum) != NULL
&& gdbarch_register_name (gdbarch,
- gdbarch_num_regs (gdbarch)
+ gdbarch_num_regs (gdbarch)
+ regnum)[0] != '\0')
return regnum;
else
mips_regnum.dspctl = dspctl = -1;
num_regs = MIPS_LAST_EMBED_REGNUM + 1;
if (info.bfd_arch_info != NULL
- && info.bfd_arch_info->mach == bfd_mach_mips3900)
- reg_names = mips_tx39_reg_names;
+ && info.bfd_arch_info->mach == bfd_mach_mips3900)
+ reg_names = mips_tx39_reg_names;
else
- reg_names = mips_generic_reg_names;
+ reg_names = mips_generic_reg_names;
}
/* Check any target description for validity. */
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
/* MIPS needs to be pedantic about which ABI and the compressed
- ISA variation the object is using. */
+ ISA variation the object is using. */
if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
continue;
if (gdbarch_tdep (arches->gdbarch)->mips_abi != mips_abi)
if (gdbarch_tdep (arches->gdbarch)->mips_isa != mips_isa)
continue;
/* Need to be pedantic about which register virtual size is
- used. */
+ used. */
if (gdbarch_tdep (arches->gdbarch)->mips64_transfers_32bit_regs_p
!= mips64_transfers_32bit_regs_p)
continue;
for (i = 0; i < MN10300_ELF_NFPREG; i++)
am33_supply_fpregset_method (regset, regcache,
- E_FS0_REGNUM + i, fpregs, len);
+ E_FS0_REGNUM + i, fpregs, len);
am33_supply_fpregset_method (regset, regcache,
E_FPCR_REGNUM, fpregs, len);
}
int i;
for (i = 0; i < MN10300_ELF_NFPREG; i++)
am33_collect_fpregset_method (regset, regcache, E_FS0_REGNUM + i,
- fpregs, len);
+ fpregs, len);
am33_collect_fpregset_method (regset, regcache,
E_FPCR_REGNUM, fpregs, len);
}
else if (regnum == E_FPCR_REGNUM)
regcache->raw_collect (E_FPCR_REGNUM, &fpregset->fpcr);
else if (E_FS0_REGNUM <= regnum
- && regnum < E_FS0_REGNUM + MN10300_ELF_NFPREG)
+ && regnum < E_FS0_REGNUM + MN10300_ELF_NFPREG)
regcache->raw_collect (regnum, &fpregset->fpregs[regnum - E_FS0_REGNUM]);
return;
\f
static void
am33_linux_sigframe_cache_init (const struct tramp_frame *self,
- struct frame_info *this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func);
+ struct frame_info *this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func);
static const struct tramp_frame am33_linux_sigframe = {
SIGTRAMP_FRAME,
static void
am33_linux_sigframe_cache_init (const struct tramp_frame *self,
- struct frame_info *this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct frame_info *this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func)
{
CORE_ADDR sc_base, fpubase;
int i;
}
trad_frame_set_reg_addr (this_cache, E_D0_REGNUM,
- sc_base + AM33_SIGCONTEXT_D0);
+ sc_base + AM33_SIGCONTEXT_D0);
trad_frame_set_reg_addr (this_cache, E_D1_REGNUM,
- sc_base + AM33_SIGCONTEXT_D1);
+ sc_base + AM33_SIGCONTEXT_D1);
trad_frame_set_reg_addr (this_cache, E_D2_REGNUM,
- sc_base + AM33_SIGCONTEXT_D2);
+ sc_base + AM33_SIGCONTEXT_D2);
trad_frame_set_reg_addr (this_cache, E_D3_REGNUM,
- sc_base + AM33_SIGCONTEXT_D3);
+ sc_base + AM33_SIGCONTEXT_D3);
trad_frame_set_reg_addr (this_cache, E_A0_REGNUM,
- sc_base + AM33_SIGCONTEXT_A0);
+ sc_base + AM33_SIGCONTEXT_A0);
trad_frame_set_reg_addr (this_cache, E_A1_REGNUM,
- sc_base + AM33_SIGCONTEXT_A1);
+ sc_base + AM33_SIGCONTEXT_A1);
trad_frame_set_reg_addr (this_cache, E_A2_REGNUM,
- sc_base + AM33_SIGCONTEXT_A2);
+ sc_base + AM33_SIGCONTEXT_A2);
trad_frame_set_reg_addr (this_cache, E_A3_REGNUM,
- sc_base + AM33_SIGCONTEXT_A3);
+ sc_base + AM33_SIGCONTEXT_A3);
trad_frame_set_reg_addr (this_cache, E_E0_REGNUM,
- sc_base + AM33_SIGCONTEXT_E0);
+ sc_base + AM33_SIGCONTEXT_E0);
trad_frame_set_reg_addr (this_cache, E_E1_REGNUM,
- sc_base + AM33_SIGCONTEXT_E1);
+ sc_base + AM33_SIGCONTEXT_E1);
trad_frame_set_reg_addr (this_cache, E_E2_REGNUM,
- sc_base + AM33_SIGCONTEXT_E2);
+ sc_base + AM33_SIGCONTEXT_E2);
trad_frame_set_reg_addr (this_cache, E_E3_REGNUM,
- sc_base + AM33_SIGCONTEXT_E3);
+ sc_base + AM33_SIGCONTEXT_E3);
trad_frame_set_reg_addr (this_cache, E_E4_REGNUM,
- sc_base + AM33_SIGCONTEXT_E4);
+ sc_base + AM33_SIGCONTEXT_E4);
trad_frame_set_reg_addr (this_cache, E_E5_REGNUM,
- sc_base + AM33_SIGCONTEXT_E5);
+ sc_base + AM33_SIGCONTEXT_E5);
trad_frame_set_reg_addr (this_cache, E_E6_REGNUM,
- sc_base + AM33_SIGCONTEXT_E6);
+ sc_base + AM33_SIGCONTEXT_E6);
trad_frame_set_reg_addr (this_cache, E_E7_REGNUM,
- sc_base + AM33_SIGCONTEXT_E7);
+ sc_base + AM33_SIGCONTEXT_E7);
trad_frame_set_reg_addr (this_cache, E_LAR_REGNUM,
- sc_base + AM33_SIGCONTEXT_LAR);
+ sc_base + AM33_SIGCONTEXT_LAR);
trad_frame_set_reg_addr (this_cache, E_LIR_REGNUM,
- sc_base + AM33_SIGCONTEXT_LIR);
+ sc_base + AM33_SIGCONTEXT_LIR);
trad_frame_set_reg_addr (this_cache, E_MDR_REGNUM,
- sc_base + AM33_SIGCONTEXT_MDR);
+ sc_base + AM33_SIGCONTEXT_MDR);
trad_frame_set_reg_addr (this_cache, E_MCVF_REGNUM,
- sc_base + AM33_SIGCONTEXT_MCVF);
+ sc_base + AM33_SIGCONTEXT_MCVF);
trad_frame_set_reg_addr (this_cache, E_MCRL_REGNUM,
- sc_base + AM33_SIGCONTEXT_MCRL);
+ sc_base + AM33_SIGCONTEXT_MCRL);
trad_frame_set_reg_addr (this_cache, E_MDRQ_REGNUM,
- sc_base + AM33_SIGCONTEXT_MDRQ);
+ sc_base + AM33_SIGCONTEXT_MDRQ);
trad_frame_set_reg_addr (this_cache, E_SP_REGNUM,
- sc_base + AM33_SIGCONTEXT_SP);
+ sc_base + AM33_SIGCONTEXT_SP);
trad_frame_set_reg_addr (this_cache, E_PSW_REGNUM,
- sc_base + AM33_SIGCONTEXT_EPSW);
+ sc_base + AM33_SIGCONTEXT_EPSW);
trad_frame_set_reg_addr (this_cache, E_PC_REGNUM,
- sc_base + AM33_SIGCONTEXT_PC);
+ sc_base + AM33_SIGCONTEXT_PC);
fpubase = get_frame_memory_unsigned (this_frame,
- sc_base + AM33_SIGCONTEXT_FPUCONTEXT,
+ sc_base + AM33_SIGCONTEXT_FPUCONTEXT,
4);
if (fpubase)
{
for (i = 0; i < 32; i++)
{
trad_frame_set_reg_addr (this_cache, E_FS0_REGNUM + i,
- fpubase + 4 * i);
+ fpubase + 4 * i);
}
trad_frame_set_reg_addr (this_cache, E_FPCR_REGNUM, fpubase + 4 * 32);
}
information. */
static void
mn10300_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct mn10300_prologue *result)
+ CORE_ADDR start_pc, CORE_ADDR limit_pc,
+ struct mn10300_prologue *result)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc;
gdb_byte instr[2];
/* Instructions can be as small as one byte; however, we usually
- need at least two bytes to do the decoding, so fetch that many
+ need at least two bytes to do the decoding, so fetch that many
to begin with. */
status = target_read_memory (pc, instr, 2);
if (status != 0)
}
/* mov aM, aN */
else if ((instr[0] & 0xf0) == 0x90
- && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
+ && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
{
int aN = instr[0] & 0x03;
int aM = (instr[0] & 0x0c) >> 2;
}
/* mov dM, dN */
else if ((instr[0] & 0xf0) == 0x80
- && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
+ && (instr[0] & 0x03) != ((instr[0] & 0x0c) >> 2))
{
int dN = instr[0] & 0x03;
int dM = (instr[0] & 0x0c) >> 2;
imm8 = extract_signed_integer (&instr[1], 1, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm8);
+ imm8);
pc += 2;
}
imm16 = extract_signed_integer (buf, 2, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm16);
+ imm16);
pc += 4;
}
imm32 = extract_signed_integer (buf, 2, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm32);
+ imm32);
pc += 6;
}
/* fmov fsM, (rN) */
}
/* mov imm8, aN */
else if ((instr[0] & 0xf0) == 0x90)
- {
+ {
int aN = instr[0] & 0x03;
LONGEST imm8;
}
/* mov imm16, aN */
else if ((instr[0] & 0xfc) == 0x24)
- {
+ {
int aN = instr[0] & 0x03;
gdb_byte buf[2];
LONGEST imm16;
}
/* mov imm32, aN */
else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xdc))
- {
+ {
int aN = instr[1] & 0x03;
gdb_byte buf[4];
LONGEST imm32;
}
/* mov imm8, dN */
else if ((instr[0] & 0xf0) == 0x80)
- {
+ {
int dN = instr[0] & 0x03;
LONGEST imm8;
}
/* mov imm16, dN */
else if ((instr[0] & 0xfc) == 0x2c)
- {
+ {
int dN = instr[0] & 0x03;
gdb_byte buf[2];
LONGEST imm16;
}
/* mov imm32, dN */
else if (instr[0] == 0xfc && ((instr[1] & 0xfc) == 0xcc))
- {
+ {
int dN = instr[1] & 0x03;
gdb_byte buf[4];
LONGEST imm32;
stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
- just initialize the prologue cache, but don't do anything. */
+ just initialize the prologue cache, but don't do anything. */
if (!func_start)
- stop_addr = func_start;
+ stop_addr = func_start;
mn10300_analyze_prologue (get_frame_arch (this_frame),
func_start, stop_addr,
static struct value *
mn10300_frame_prev_register (struct frame_info *this_frame,
- void **this_prologue_cache, int regnum)
+ void **this_prologue_cache, int regnum)
{
struct mn10300_prologue *p
= mn10300_analyze_frame_prologue (this_frame, this_prologue_cache);
return a description of the stack slot holding it. */
if (p->reg_offset[regnum] != 1)
return frame_unwind_got_memory (this_frame, regnum,
- frame_base + p->reg_offset[regnum]);
+ frame_base + p->reg_offset[regnum]);
/* Otherwise, presume we haven't changed the value of this
register, and get it from the next frame. */
= gdbarch_unwind_sp (gdbarch, create_new_frame (sp, func_addr));
if (sp != unwound_sp)
regcache_cooked_write_unsigned (regcache, E_SP_REGNUM,
- sp - (unwound_sp - sp));
+ sp - (unwound_sp - sp));
}
return sp;
if (record_debug > 1)
fprintf_unfiltered (gdb_stdlog, "Process record: moxie_process_record "
- "addr = 0x%s\n",
+ "addr = 0x%s\n",
paddress (target_gdbarch (), addr));
inst = (uint16_t) moxie_process_readu (addr, buf, 2, byte_order);
stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
- just initialize the prologue cache, but don't do anything. */
+ just initialize the prologue cache, but don't do anything. */
if (!func_start)
stop_addr = func_start;
else
{
/* Scalars bigger than 8 bytes such as complex doubles are passed
- on the stack. */
+ on the stack. */
if (arg_size > 8)
current_arg_on_stack = 1;
}
for (offset = 0; offset < arg_size; offset += 2)
{
/* The condition below prevents 8 byte scalars from being split
- between registers and memory (stack). It also prevents other
- splits once the stack has been written to. */
+ between registers and memory (stack). It also prevents other
+ splits once the stack has been written to. */
if (!current_arg_on_stack
&& (arg_reg
+ ((arg_size == 8 || args_on_stack)
if (code_model == MSP_LARGE_CODE_MODEL
&& (arg_type->code () == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (arg_type)
+ || TYPE_IS_REFERENCE (arg_type)
|| arg_type->code () == TYPE_CODE_STRUCT
|| arg_type->code () == TYPE_CODE_UNION))
{
const char *declaration,
const std::vector<const char *> &excludes,
int copy_names,
- struct obstack *obstack);
+ struct obstack *obstack);
#endif /* NAMESPACE_H */
gdb::function_view<void (int)> init_trace_fun,
void (*pre_trace_fun) (),
const char *shell_file_arg,
- void (*exec_fun)(const char *file, char * const *argv,
- char * const *env))
+ void (*exec_fun)(const char *file, char * const *argv,
+ char * const *env))
{
pid_t pid;
/* Set debug_fork then attach to the child while it sleeps, to debug. */
postfork_child_hook ();
/* Changing the signal handlers for the inferior after
- a vfork can also change them for the superior, so we don't mess
- with signals here. See comments in
- initialize_signals for how we get the right signal handlers
- for the inferior. */
+ a vfork can also change them for the superior, so we don't mess
+ with signals here. See comments in
+ initialize_signals for how we get the right signal handlers
+ for the inferior. */
/* "Trace me, Dr. Memory!" */
(*traceme_fun) ();
/* The call above set this process (the "child") as debuggable
- by the original gdb process (the "parent"). Since processes
- (unlike people) can have only one parent, if you are debugging
- gdb itself (and your debugger is thus _already_ the
- controller/parent for this child), code from here on out is
- undebuggable. Indeed, you probably got an error message
- saying "not parent". Sorry; you'll have to use print
- statements! */
+ by the original gdb process (the "parent"). Since processes
+ (unlike people) can have only one parent, if you are debugging
+ gdb itself (and your debugger is thus _already_ the
+ controller/parent for this child), code from here on out is
+ undebuggable. Indeed, you probably got an error message
+ saying "not parent". Sorry; you'll have to use print
+ statements! */
restore_original_signals_state ();
/* There is no execlpe call, so we have to set the environment
- for our child in the global variable. If we've vforked, this
- clobbers the parent, but environ is restored a few lines down
- in the parent. By the way, yes we do need to look down the
- path to find $SHELL. Rich Pixley says so, and I agree. */
+ for our child in the global variable. If we've vforked, this
+ clobbers the parent, but environ is restored a few lines down
+ in the parent. By the way, yes we do need to look down the
+ path to find $SHELL. Rich Pixley says so, and I agree. */
environ = env;
char **argv = child_argv.argv ();
if (exec_fun != NULL)
- (*exec_fun) (argv[0], &argv[0], env);
+ (*exec_fun) (argv[0], &argv[0], env);
else
- execvp (argv[0], &argv[0]);
+ execvp (argv[0], &argv[0]);
/* If we get here, it's an error. */
save_errno = errno;
if (!terminal_initted)
{
/* Now that the child has exec'd we know it has already
- set its process group. On POSIX systems, tcsetpgrp
- will fail with EPERM if we try it before the child's
- setpgid. */
+ set its process group. On POSIX systems, tcsetpgrp
+ will fail with EPERM if we try it before the child's
+ setpgid. */
/* Set up the "saved terminal modes" of the inferior
- based on what modes we are starting it with. */
+ based on what modes we are starting it with. */
target_terminal::init ();
/* Install inferior's terminal modes. */
#ifdef PTRACE_TYPE_ARG5
# ifdef HAVE_PTRACE64
# define ptrace(request, pid, addr, data) \
- ptrace64 (request, pid, addr, data, 0)
+ ptrace64 (request, pid, addr, data, 0)
# undef PTRACE_TYPE_ARG3
# define PTRACE_TYPE_ARG3 long long
# else
# define ptrace(request, pid, addr, data) \
- ptrace (request, pid, addr, data, 0)
+ ptrace (request, pid, addr, data, 0)
# endif
#else
/* Wrapper that avoids adding a pointless cast to all callers. */
# define ptrace(request, pid, addr, data) \
- ptrace ((PTRACE_TYPE_ARG1) request, pid, addr, data)
+ ptrace ((PTRACE_TYPE_ARG1) request, pid, addr, data)
#endif
#endif /* NAT_GDB_PTRACE_H */
- TYPE (enum mnsh_msg_type, always sent) - the message type.
- INT1 and
- INT2 (int, always sent, though not always used) - two
- values whose meaning is message-type-dependent.
+ values whose meaning is message-type-dependent.
See enum mnsh_msg_type documentation below.
- FD (int, optional, sent using SCM_RIGHTS) - an open file
- descriptor.
+ descriptor.
- BUF (unstructured data, optional) - some data with message-
- type-dependent meaning.
+ type-dependent meaning.
Note that the helper process is the child of a call to fork,
so all code in the helper must be async-signal-safe. */
time_t t = (time_t) seconds;
/* Per the ctime_r manpage, this buffer needs to be at least 26
- characters long. */
+ characters long. */
char buf[30];
const char *time_str = ctime_r (&t, buf);
strncpy (time, time_str, maxlen);
auto fn
= [=] (const struct kinfo_lwp *kl)
{
- return kl->l_lid == lwp;
+ return kl->l_lid == lwp;
};
return netbsd_thread_lister (pid, fn);
case 4:
return (DR_LEN_4 | rw);
case 8:
- if (TARGET_HAS_DR_LEN_8)
+ if (TARGET_HAS_DR_LEN_8)
return (DR_LEN_8 | rw);
/* FALL THROUGH */
default:
{
pid = inferior_ptid.pid ();
if (pid == 0)
- error (_("No current process: you must name one."));
+ error (_("No current process: you must name one."));
}
else if (built_argv.count () == 1 && isdigit (built_argv[0][0]))
pid = strtol (built_argv[0], NULL, 10);
inferior *inf = find_inferior_ptid (target, ptid);
for (thread_info *tp : inf->non_exited_threads ())
- {
- if (tp->ptid.lwp () == ptid.lwp ())
- request = PT_RESUME;
- else
- request = PT_SUSPEND;
-
- if (ptrace (request, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
- perror_with_name (("ptrace"));
- }
+ {
+ if (tp->ptid.lwp () == ptid.lwp ())
+ request = PT_RESUME;
+ else
+ request = PT_SUSPEND;
+
+ if (ptrace (request, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
+ perror_with_name (("ptrace"));
+ }
}
else
{
/* If ptid is a wildcard, resume all matching threads (they won't run
- until the process is continued however). */
+ until the process is continued however). */
for (thread_info *tp : all_non_exited_threads (target, ptid))
- if (ptrace (PT_RESUME, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
- perror_with_name (("ptrace"));
+ if (ptrace (PT_RESUME, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
+ perror_with_name (("ptrace"));
}
if (step)
int
nbsd_nat_target::set_syscall_catchpoint (int pid, bool needed,
- int any_count,
- gdb::array_view<const int> syscall_counts)
+ int any_count,
+ gdb::array_view<const int> syscall_counts)
{
/* Ignore the arguments. inf-ptrace.c will use PT_SYSCALL which
will catch all system call entries and exits. The system calls
static int
nbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
- enum gdb_signal signal)
+ enum gdb_signal signal)
{
switch (signal)
{
svr4_ilp32_fetch_link_map_offsets);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
/* Core file support. */
set_gdbarch_iterate_over_regset_sections
(gdbarch, nios2_iterate_over_regset_sections);
mov ra, r8
2) A stack adjustment and save of R4-R7 for varargs functions.
- For R2 CDX this is typically handled with a STWM, otherwise
+ For R2 CDX this is typically handled with a STWM, otherwise
this is typically merged with item 3.
3) A stack adjustment and save of the callee-saved registers.
- For R2 CDX these are typically handled with a PUSH.N or STWM,
+ For R2 CDX these are typically handled with a PUSH.N or STWM,
otherwise as an explicit SP decrement and individual register
saves.
- There may also be a stack switch here in an exception handler
+ There may also be a stack switch here in an exception handler
in place of a stack adjustment. It looks like:
movhi rx, %hiadj(newstack)
addhi rx, rx, %lo(newstack)
4) A frame pointer save, which can be either a MOV or ADDI.
5) A further stack pointer adjustment. This is normally included
- adjustment in step 3 unless the total adjustment is too large
+ adjustment in step 3 unless the total adjustment is too large
to be done in one step.
7) A stack overflow check, which can take either of these forms:
}
else if (nios2_match_stw (insn, op, mach, &ra, &rb, &imm))
- {
+ {
/* STW rb, imm(ra) */
/* Are we storing the original value of a register to the stack?
else
/* Non-stack memory writes cannot appear in the prologue. */
break;
- }
+ }
else if (nios2_match_stwm (insn, op, mach,
®list, &ra, &imm, &wb, &id))
value[rc].reg = NIOS2_STATUS_REGNUM + ra;
value[rc].offset = 0;
}
- }
+ }
else if (nios2_match_calli (insn, op, mach, &uimm))
{
if (find_pc_partial_function (start_pc, NULL, &func_addr, NULL))
{
CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
+ = skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return std::max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
/* Prologue analysis does the rest.... */
static CORE_ADDR
nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
val = value_contents (arg);
/* Copy the argument to general registers or the stack in
- register-sized pieces. Large arguments are split between
- registers and stack. */
+ register-sized pieces. Large arguments are split between
+ registers and stack. */
while (len > 0)
- {
+ {
int partial_len = (len < 4 ? len : 4);
if (argreg <= NIOS2_LAST_ARGREG)
/* The return address is in the link register. */
trad_frame_set_reg_realreg (this_trad_cache,
- gdbarch_pc_regnum (gdbarch),
- NIOS2_RA_REGNUM);
+ gdbarch_pc_regnum (gdbarch),
+ NIOS2_RA_REGNUM);
/* Frame ID, since it's a frameless / stackless function, no stack
space is allocated and SP on entry is the current SP. */
static void
nios2_stub_frame_this_id (struct frame_info *this_frame, void **this_cache,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
struct trad_frame_cache *this_trad_cache
= nios2_stub_frame_cache (this_frame, this_cache);
static struct value *
nios2_stub_frame_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+ void **this_cache, int regnum)
{
struct trad_frame_cache *this_trad_cache
= nios2_stub_frame_cache (this_frame, this_cache);
return TARGET_XFER_E_IO;
err = devctl (ctl_fd, DCMD_PROC_INFO, &procinfo,
- sizeof procinfo, 0);
+ sizeof procinfo, 0);
if (err != EOK)
return TARGET_XFER_E_IO;
{
/* FIXME: expected warning? */
/* warning( "Failed to set Kill-on-Last-Close flag: errno = %d(%s)\n",
- errn, safe_strerror(errn) ); */
+ errn, safe_strerror(errn) ); */
}
if (!target_is_pushed (ops))
push_target (ops);
{
int target_signo = gdb_signal_from_host (signo);
if (target_signo < pass_signals.size () && pass_signals[target_signo])
- sigdelset (&run.trace, signo);
+ sigdelset (&run.trace, signo);
}
}
if (sectsize >= namelen + sizeof_Elf_Nhdr
&& namelen == sizeof (QNX_NOTE_NAME)
&& 0 == strcmp (name, QNX_NOTE_NAME))
- *(enum gdb_osabi *) obj = GDB_OSABI_QNXNTO;
+ *(enum gdb_osabi *) obj = GDB_OSABI_QNXNTO;
XDELETEVEC (note);
}
/* Read AUXV from initial_stack. */
LONGEST
nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack, gdb_byte *readbuf,
- LONGEST len, size_t sizeof_auxv_t)
+ LONGEST len, size_t sizeof_auxv_t)
{
gdb_byte targ32[4]; /* For 32 bit target values. */
gdb_byte targ64[8]; /* For 64 bit target values. */
/* Size of pointer is assumed to be 4 bytes (32 bit arch.) */
data_ofs += (anint + 2) * ptr_size; /* + 2 comes from argc itself and
- NULL terminating pointer in
- argv. */
+ NULL terminating pointer in
+ argv. */
/* Now loop over env table: */
anint = 0;
while (target_read_memory (initial_stack + data_ofs, targ64, ptr_size)
- == 0)
+ == 0)
{
if (extract_unsigned_integer (targ64, ptr_size, byte_order) == 0)
anint = 1; /* Keep looping until non-null entry is found. */
{
if (target_read_memory (initial_stack + len_read, buff, sizeof_auxv_t)
== 0)
- {
+ {
/* Both 32 and 64 bit structures have int as the first field. */
- const ULONGEST a_type
+ const ULONGEST a_type
= extract_unsigned_integer (buff, sizeof (targ32), byte_order);
- if (a_type == AT_NULL)
+ if (a_type == AT_NULL)
break;
buff += sizeof_auxv_t;
len_read += sizeof_auxv_t;
- }
+ }
else
- break;
+ break;
}
return len_read;
}
child = separate_debug_objfile_backlink->separate_debug_objfile;
if (child == this)
- {
- /* THIS is the first child. */
- separate_debug_objfile_backlink->separate_debug_objfile =
- separate_debug_objfile_link;
- }
+ {
+ /* THIS is the first child. */
+ separate_debug_objfile_backlink->separate_debug_objfile =
+ separate_debug_objfile_link;
+ }
else
- {
- /* Find THIS in the list. */
- while (1)
- {
- if (child->separate_debug_objfile_link == this)
- {
- child->separate_debug_objfile_link =
- separate_debug_objfile_link;
- break;
- }
- child = child->separate_debug_objfile_link;
- gdb_assert (child);
- }
- }
+ {
+ /* Find THIS in the list. */
+ while (1)
+ {
+ if (child->separate_debug_objfile_link == this)
+ {
+ child->separate_debug_objfile_link =
+ separate_debug_objfile_link;
+ break;
+ }
+ child = child->separate_debug_objfile_link;
+ gdb_assert (child);
+ }
+ }
}
/* Remove any references to this objfile in the global value
&pspace_info->num_sections);
/* Don't need updates to section map until objfiles are added,
- removed or relocated. */
+ removed or relocated. */
pspace_info->new_objfiles_available = 0;
pspace_info->section_map_dirty = 0;
}
OBJF_SHARED objfile of PSPACE and false otherwise. */
extern bool shared_objfile_contains_address_p (struct program_space *pspace,
- CORE_ADDR address);
+ CORE_ADDR address);
/* This operation deletes all objfile entries that represent solibs that
weren't explicitly loaded by the user, via e.g., the add-symbol-file
for (i = 0; i < n; i++)
{
for (j = i + 1; j < n; j++)
- {
- if (arr[i] == arr[j])
- return 1;
- }
+ {
+ if (arr[i] == arr[j])
+ return 1;
+ }
}
return 0;
if (n == 1)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- ret = value_zero (elm_type, not_lval);
+ ret = value_zero (elm_type, not_lval);
else
- ret = value_subscript (val, indices[0]);
+ ret = value_subscript (val, indices[0]);
}
else
{
dst_len = (src_len == 3) ? 2 : src_len / 2;
for (i = 0; i < dst_len; i++)
- indices[i] = i*2+1;
+ indices[i] = i*2+1;
}
else if (strncasecmp (comps, "s", 1) == 0)
{
#define HEXCHAR_TO_INT(C) ((C >= '0' && C <= '9') ? \
- C-'0' : ((C >= 'A' && C <= 'F') ? \
- C-'A'+10 : ((C >= 'a' && C <= 'f') ? \
- C-'a'+10 : -1)))
+ C-'0' : ((C >= 'A' && C <= 'F') ? \
+ C-'A'+10 : ((C >= 'a' && C <= 'f') ? \
+ C-'a'+10 : -1)))
dst_len = strlen (comps);
/* Skip the s/S-prefix. */
int len = TYPE_LENGTH (arg_type);
enum type_code typecode = arg_type->code ();
/* The EABI passes structures that do not fit in a register by
- reference. In all other cases, pass the structure by value. */
+ reference. In all other cases, pass the structure by value. */
if ((TYPE_CODE_STRUCT == typecode) || (TYPE_CODE_UNION == typecode)
|| (len > bpw * 2))
{
else
{
/* We are past this point, so the stack pointer of the prev
- frame is frame_size greater than the stack pointer of this
- frame. */
+ frame is frame_size greater than the stack pointer of this
+ frame. */
trad_frame_set_reg_value (info, OR1K_SP_REGNUM,
this_sp + frame_size);
}
inst = or1k_fetch_instruction (gdbarch, addr);
/* If we have got this far, the stack pointer of the previous
- frame is the frame pointer of this frame. */
+ frame is the frame pointer of this frame. */
trad_frame_set_reg_realreg (info, OR1K_SP_REGNUM,
OR1K_FP_REGNUM);
}
inst = or1k_fetch_instruction (gdbarch, addr);
/* The register in the previous frame can be found at this
- location in this frame. */
+ location in this frame. */
trad_frame_set_reg_addr (info, rb, this_sp + simm);
}
else
feature = tdesc_find_feature (tdesc, "org.gnu.gdb.or1k.group0");
if (feature == NULL)
- return NULL;
+ return NULL;
tdesc_data = tdesc_data_alloc ();
valid_p = 1;
for (i = 0; i < OR1K_NUM_REGS; i++)
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
- or1k_reg_names[i]);
+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
+ or1k_reg_names[i]);
if (!valid_p)
return NULL;
int i;
for (i = 1; i < GDB_OSABI_INVALID; i++)
- {
+ {
enum gdb_osabi osabi = (enum gdb_osabi) i;
if (strcmp (set_osabi_string, gdbarch_osabi_name (osabi)) == 0)
ABI for each architecture and machine type combination. */
void gdbarch_register_osabi (enum bfd_architecture, unsigned long,
enum gdb_osabi,
- void (*)(struct gdbarch_info,
+ void (*)(struct gdbarch_info,
struct gdbarch *));
/* Lookup the OS ABI corresponding to the specified BFD. */
{
have_warned = 1;
warning (_("Can not parse XML OS data; XML support was disabled "
- "at compile time"));
+ "at compile time"));
}
return NULL;
static void
osdata_start_osdata (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element,
+ void *user_data,
std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
static void
osdata_start_item (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element,
+ void *user_data,
std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
static void
osdata_start_column (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element,
+ void *user_data,
std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
static void
osdata_end_column (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
+ const struct gdb_xml_element *element,
+ void *user_data, const char *body_text)
{
osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
struct osdata *osdata = data->osdata.get ();
snprintf (col_name, 32, "col%d", ix);
uiout->table_header (10, ui_left,
col_name, last->columns[ix].name.c_str ());
- }
+ }
}
uiout->table_body ();
}
}
- uiout->text ("\n");
+ uiout->text ("\n");
}
}
}
_initialize_osdata ()
{
add_info ("os", info_osdata_command,
- _("Show OS data ARG."));
+ _("Show OS data ARG."));
}
;
arglist :
- | exp
+ | exp
{ pstate->arglist_len = 1; }
| arglist ',' exp %prec ABOVE_COMMA
{ pstate->arglist_len++; }
struct value * this_val;
struct type * this_type;
/* Object pascal: it hangs off of `this'. Must
- not inadvertently convert from a method call
+ not inadvertently convert from a method call
to data ref. */
pstate->block_tracker->update (sym);
write_exp_elt_opcode (pstate, OP_THIS);
if (parsed_float)
{
/* Handle suffixes: 'f' for float, 'l' for long double.
- FIXME: This appears to be an extension -- do we want this? */
+ FIXME: This appears to be an extension -- do we want this? */
if (len >= 1 && tolower (p[len - 1]) == 'f')
{
putithere->typed_val_float.type
for (i = 0;i <= namelen;i++)
{
if ((tokstart[i]>='a' && tokstart[i]<='z'))
- uptokstart[i] = tokstart[i]-('a'-'A');
+ uptokstart[i] = tokstart[i]-('a'-'A');
else
- uptokstart[i] = tokstart[i];
+ uptokstart[i] = tokstart[i];
}
uptokstart[namelen]='\0';
return uptokstart;
if (explen > 2)
for (int i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
if (strncasecmp (tokstart, tokentab3[i].oper, 3) == 0
- && (!isalpha (tokentab3[i].oper[0]) || explen == 3
- || (!isalpha (tokstart[3])
+ && (!isalpha (tokentab3[i].oper[0]) || explen == 3
+ || (!isalpha (tokstart[3])
&& !isdigit (tokstart[3]) && tokstart[3] != '_')))
- {
- pstate->lexptr += 3;
- yylval.opcode = tokentab3[i].opcode;
- return tokentab3[i].token;
- }
+ {
+ pstate->lexptr += 3;
+ yylval.opcode = tokentab3[i].opcode;
+ return tokentab3[i].token;
+ }
/* See if it is a special token of length 2. */
if (explen > 1)
for (int i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
if (strncasecmp (tokstart, tokentab2[i].oper, 2) == 0
- && (!isalpha (tokentab2[i].oper[0]) || explen == 2
- || (!isalpha (tokstart[2])
+ && (!isalpha (tokentab2[i].oper[0]) || explen == 2
+ || (!isalpha (tokstart[2])
&& !isdigit (tokstart[2]) && tokstart[2] != '_')))
- {
- pstate->lexptr += 2;
- yylval.opcode = tokentab2[i].opcode;
- return tokentab2[i].token;
- }
+ {
+ pstate->lexptr += 2;
+ yylval.opcode = tokentab2[i].opcode;
+ return tokentab2[i].token;
+ }
switch (c = *tokstart)
{
if (pstate->lexptr[-1] != '\'')
error (_("Unmatched single quote."));
namelen -= 2;
- tokstart++;
- uptokstart = uptok(tokstart,namelen);
+ tokstart++;
+ uptokstart = uptok(tokstart,namelen);
goto tryname;
}
error (_("Invalid character constant."));
}
toktype = parse_number (pstate, tokstart,
p - tokstart, got_dot | got_e, &yylval);
- if (toktype == ERROR)
+ if (toktype == ERROR)
{
char *err_copy = (char *) alloca (p - tokstart + 1);
}
if (strcmp (uptokstart, "FALSE") == 0)
{
- yylval.lval = 0;
+ yylval.lval = 0;
free (uptokstart);
- return FALSEKEYWORD;
- }
+ return FALSEKEYWORD;
+ }
break;
case 4:
if (strcmp (uptokstart, "TRUE") == 0)
{
- yylval.lval = 1;
+ yylval.lval = 1;
free (uptokstart);
return TRUEKEYWORD;
- }
+ }
if (strcmp (uptokstart, "SELF") == 0)
- {
- /* Here we search for 'this' like
- inserted in FPC stabs debug info. */
+ {
+ /* Here we search for 'this' like
+ inserted in FPC stabs debug info. */
static const char this_name[] = "this";
if (lookup_symbol (this_name, pstate->expression_context_block,
char *tmp;
/* $ is the normal prefix for pascal hexadecimal values
- but this conflicts with the GDB use for debugger variables
- so in expression to enter hexadecimal values
- we still need to use C syntax with 0xff */
+ but this conflicts with the GDB use for debugger variables
+ so in expression to enter hexadecimal values
+ we still need to use C syntax with 0xff */
write_dollar_variable (pstate, yylval.sval);
tmp = (char *) alloca (namelen + 1);
memcpy (tmp, tokstart, namelen);
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
{
for (int i = 0; i <= namelen; i++)
- {
- if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
- tmp[i] -= ('a'-'A');
- }
+ {
+ if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
+ tmp[i] -= ('a'-'A');
+ }
if (search_field && current_type)
is_a_field = (lookup_struct_elt_type (current_type,
tmp.c_str (), 1) != NULL);
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
{
for (int i = 0; i <= namelen; i++)
- {
- if (i == 0)
- {
- if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
- tmp[i] -= ('a'-'A');
- }
- else
- if ((tmp[i] >= 'A' && tmp[i] <= 'Z'))
- tmp[i] -= ('A'-'a');
- }
+ {
+ if (i == 0)
+ {
+ if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
+ tmp[i] -= ('a'-'A');
+ }
+ else
+ if ((tmp[i] >= 'A' && tmp[i] <= 'Z'))
+ tmp[i] -= ('A'-'a');
+ }
if (search_field && current_type)
is_a_field = (lookup_struct_elt_type (current_type,
tmp.c_str (), 1) != NULL);
yylval.ssym.sym.symbol = NULL;
yylval.ssym.sym.block = NULL;
free (uptokstart);
- yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
+ yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
if (is_a_field)
return FIELDNAME;
else
no psymtabs (coff, xcoff, or some future change to blow away the
psymtabs once once symbols are read). */
if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
- || lookup_symtab (tmp.c_str ()))
+ || lookup_symtab (tmp.c_str ()))
{
yylval.ssym.sym.symbol = sym;
yylval.ssym.sym.block = NULL;
return BLOCKNAME;
}
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
- {
+ {
#if 1
/* Despite the following flaw, we need to keep this code enabled.
Because we can get called from check_stub_method, if we don't
#endif /* not 0 */
free (uptokstart);
return TYPENAME;
- }
+ }
yylval.tsym.type
= language_lookup_primitive_type (pstate->language (),
pstate->gdbarch (), tmp.c_str ());
when the input radix permits them, can be names or numbers
depending on the parse. Note we support radixes > 16 here. */
if (!sym
- && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
- || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
+ && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
+ || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
{
YYSTYPE newlval; /* Its value is ignored. */
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
but this does not happen for Free Pascal nor for GPC. */
int
is_pascal_string_type (struct type *type,int *length_pos,
- int *length_size, int *string_pos,
+ int *length_size, int *string_pos,
struct type **char_type,
const char **arrayname)
{
&& strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0
&& TYPE_FIELD_NAME (type, 1)
&& strcmp (TYPE_FIELD_NAME (type, 1), "st") == 0)
- {
- if (length_pos)
+ {
+ if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 0) / TARGET_CHAR_BIT;
- if (length_size)
+ if (length_size)
*length_size = TYPE_LENGTH (type->field (0).type ());
- if (string_pos)
+ if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
- if (char_type)
+ if (char_type)
*char_type = TYPE_TARGET_TYPE (type->field (1).type ());
if (arrayname)
*arrayname = TYPE_FIELD_NAME (type, 1);
- return 2;
- };
+ return 2;
+ };
/* GNU pascal strings. */
/* Three fields: Capacity, length and schema$ or _p_schema. */
if (type->num_fields () == 3
&& strcmp (TYPE_FIELD_NAME (type, 0), "Capacity") == 0
&& TYPE_FIELD_NAME (type, 1)
&& strcmp (TYPE_FIELD_NAME (type, 1), "length") == 0)
- {
+ {
if (length_pos)
*length_pos = TYPE_FIELD_BITPOS (type, 1) / TARGET_CHAR_BIT;
if (length_size)
*length_size = TYPE_LENGTH (type->field (1).type ());
if (string_pos)
*string_pos = TYPE_FIELD_BITPOS (type, 2) / TARGET_CHAR_BIT;
- /* FIXME: how can I detect wide chars in GPC ?? */
- if (char_type)
+ /* FIXME: how can I detect wide chars in GPC ?? */
+ if (char_type)
{
*char_type = TYPE_TARGET_TYPE (type->field (2).type ());
}
if (arrayname)
*arrayname = TYPE_FIELD_NAME (type, 2);
- return 3;
- };
+ return 3;
+ };
}
return 0;
}
lai->string_char_type = builtin->builtin_char;
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_pascal_primitive_types + 1,
- struct type *);
+ struct type *);
lai->primitive_type_vector [pascal_primitive_type_int]
= builtin->builtin_int;
lai->primitive_type_vector [pascal_primitive_type_long]
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types need no prefix. They are listed here so that
- gcc -Wall will reveal any types that haven't been handled. */
+ gcc -Wall will reveal any types that haven't been handled. */
break;
default:
error (_("type not handled in pascal_type_print_varspec_prefix()"));
wrap_here (" ");
}
/* Can we find if it is a var parameter ??
- if ( TYPE_FIELD(type, i) == )
- {
- fprintf_filtered (stream, "var ");
- } */
+ if ( TYPE_FIELD(type, i) == )
+ {
+ fprintf_filtered (stream, "var ");
+ } */
pascal_print_type (type->field (i).type (), "" /* TYPE_FIELD_NAME
seems invalid! */
,stream, -1, 0, flags);
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types do not need a suffix. They are listed so that
- gcc -Wall will report types that may not have been considered. */
+ gcc -Wall will report types that may not have been considered. */
break;
default:
error (_("type not handled in pascal_type_print_varspec_suffix()"));
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
/* case TYPE_CODE_FUNC:
- case TYPE_CODE_METHOD: */
+ case TYPE_CODE_METHOD: */
pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level,
flags);
break;
case TYPE_CODE_ARRAY:
/* pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, 0, 0);
- pascal_type_print_base (TYPE_TARGET_TYPE (type),
- stream, show, level);
- pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type),
- stream, 0, 0, 0); */
+ stream, 0, 0);
+ pascal_type_print_base (TYPE_TARGET_TYPE (type),
+ stream, show, level);
+ pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type),
+ stream, 0, 0, 0); */
pascal_print_type (TYPE_TARGET_TYPE (type), NULL, stream, 0, 0, flags);
break;
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
/*
- pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
- only after args !! */
+ pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ only after args !! */
break;
case TYPE_CODE_STRUCT:
if (type->name () != NULL)
continue;
/* If this is a pascal object or class we can print the
- various section labels. */
+ various section labels. */
if (HAVE_CPLUS_STRUCT (type))
{
const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
/* this is GNU C++ specific
- how can we know constructor/destructor?
- It might work for GNU pascal. */
+ how can we know constructor/destructor?
+ It might work for GNU pascal. */
for (j = 0; j < len2; j++)
{
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
fputs_filtered (" ", stream);
}
/* enum is just defined by
- type enume_name = (enum_member1,enum_member2,...) */
+ type enume_name = (enum_member1,enum_member2,...) */
fprintf_filtered (stream, " = ");
wrap_here (" ");
if (show < 0)
default:
/* Handle types not explicitly handled by the other cases,
- such as fundamental types. For these, just print whatever
- the type name is, as recorded in the type itself. If there
- is no type name, then complain. */
+ such as fundamental types. For these, just print whatever
+ the type name is, as recorded in the type itself. If there
+ is no type name, then complain. */
if (type->name () != NULL)
{
fputs_filtered (type->name (), stream);
pointed to, unless pointer is null. */
if (((TYPE_LENGTH (elttype) == 1
&& (elttype->code () == TYPE_CODE_INT
- || elttype->code () == TYPE_CODE_CHAR))
- || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
- && elttype->code () == TYPE_CODE_CHAR))
+ || elttype->code () == TYPE_CODE_CHAR))
+ || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
+ && elttype->code () == TYPE_CODE_CHAR))
&& (options->format == 0 || options->format == 's')
&& addr != 0)
{
}
else
{
- if (is_pascal_string_type (type, &length_pos, &length_size,
- &string_pos, &char_type, NULL))
+ if (is_pascal_string_type (type, &length_pos, &length_size,
+ &string_pos, &char_type, NULL))
{
len = extract_unsigned_integer (valaddr + length_pos,
length_size, byte_order);
|| type->code () == TYPE_CODE_REF)
{
/* Hack: remove (char *) for char strings. Their
- type is indicated by the quoted string anyway. */
+ type is indicated by the quoted string anyway. */
if (type->code () == TYPE_CODE_PTR
&& type->name () == NULL
&& TYPE_TARGET_TYPE (type)->name () != NULL
|| type->code () == TYPE_CODE_PTR) /* If using thunks. */
{
/* Virtual functions tables are full of pointers
- to virtual functions. */
+ to virtual functions. */
return pascal_object_is_vtbl_ptr_type (type);
}
}
struct value *v;
/* Bitfields require special handling, especially due to byte
- order problems. */
+ order problems. */
if (TYPE_FIELD_IGNORE (type, i))
{
fputs_styled ("<optimized out or zero length>",
if (dont_print_vb == 0)
{
/* If we're at top level, carve out a completely fresh
- chunk of the obstack and use that until this particular
- invocation returns. */
+ chunk of the obstack and use that until this particular
+ invocation returns. */
/* Bump up the high-water mark. Now alpha is omega. */
obstack_finish (&dont_print_vb_obstack);
}
}
fputs_filtered ("<", stream);
/* Not sure what the best notation is in the case where there is no
- baseclass name. */
+ baseclass name. */
fputs_filtered (basename ? basename : "", stream);
fputs_filtered ("> = ", stream);
if (dont_print_vb == 0)
{
/* Free the space used to deal with the printing
- of this type from top level. */
+ of this type from top level. */
obstack_free (&dont_print_vb_obstack, last_dont_print);
/* Reset watermark so that we can continue protecting
- ourselves from whatever we were protecting ourselves. */
+ ourselves from whatever we were protecting ourselves. */
dont_print_vb_obstack = tmp_obstack;
}
}
if (language_mode == language_mode_auto && block != NULL)
{
/* Find the language associated to the given context block.
- Default to the current language if it can not be determined.
-
- Note that using the language corresponding to the current frame
- can sometimes give unexpected results. For instance, this
- routine is often called several times during the inferior
- startup phase to re-parse breakpoint expressions after
- a new shared library has been loaded. The language associated
- to the current frame at this moment is not relevant for
- the breakpoint. Using it would therefore be silly, so it seems
- better to rely on the current language rather than relying on
- the current frame language to parse the expression. That's why
- we do the following language detection only if the context block
- has been specifically provided. */
+ Default to the current language if it can not be determined.
+
+ Note that using the language corresponding to the current frame
+ can sometimes give unexpected results. For instance, this
+ routine is often called several times during the inferior
+ startup phase to re-parse breakpoint expressions after
+ a new shared library has been loaded. The language associated
+ to the current frame at this moment is not relevant for
+ the breakpoint. Using it would therefore be silly, so it seems
+ better to rely on the current language rather than relying on
+ the current frame language to parse the expression. That's why
+ we do the following language detection only if the context block
+ has been specifically provided. */
struct symbol *func = block_linkage_function (block);
if (func != NULL)
- lang = language_def (func->language ());
+ lang = language_def (func->language ());
if (lang == NULL || lang->la_language == language_unknown)
- lang = current_language;
+ lang = current_language;
}
else
lang = current_language;
struct ppc_debug_info
{
- uint32_t version; /* Only version 1 exists to date. */
- uint32_t num_instruction_bps;
- uint32_t num_data_bps;
- uint32_t num_condition_regs;
- uint32_t data_bp_alignment;
- uint32_t sizeof_condition; /* size of the DVC register. */
- uint64_t features;
+ uint32_t version; /* Only version 1 exists to date. */
+ uint32_t num_instruction_bps;
+ uint32_t num_data_bps;
+ uint32_t num_condition_regs;
+ uint32_t data_bp_alignment;
+ uint32_t sizeof_condition; /* size of the DVC register. */
+ uint64_t features;
};
/* Features will have bits indicating whether there is support for: */
struct ppc_hw_breakpoint
{
- uint32_t version; /* currently, version must be 1 */
- uint32_t trigger_type; /* only some combinations allowed */
- uint32_t addr_mode; /* address match mode */
- uint32_t condition_mode; /* break/watchpoint condition flags */
- uint64_t addr; /* break/watchpoint address */
- uint64_t addr2; /* range end or mask */
- uint64_t condition_value; /* contents of the DVC register */
+ uint32_t version; /* currently, version must be 1 */
+ uint32_t trigger_type; /* only some combinations allowed */
+ uint32_t addr_mode; /* address match mode */
+ uint32_t condition_mode; /* break/watchpoint condition flags */
+ uint64_t addr; /* break/watchpoint address */
+ uint64_t addr2; /* range end or mask */
+ uint64_t condition_value; /* contents of the DVC register */
};
/* Trigger type. */
#define PPC_BREAKPOINT_CONDITION_BE_ALL 0x00ff0000
#define PPC_BREAKPOINT_CONDITION_BE_SHIFT 16
#define PPC_BREAKPOINT_CONDITION_BE(n) \
- (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT))
+ (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT))
#endif /* PPC_PTRACE_GETHWDBGINFO */
/* Feature defined on Linux kernel v3.9: DAWR interface, that enables wider
/* This is the layout of the POWER7 VSX registers and the way they overlap
with the existing FPR and VMX registers.
- VSR doubleword 0 VSR doubleword 1
- ----------------------------------------------------------------
+ VSR doubleword 0 VSR doubleword 1
+ ----------------------------------------------------------------
VSR[0] | FPR[0] | |
- ----------------------------------------------------------------
+ ----------------------------------------------------------------
VSR[1] | FPR[1] | |
- ----------------------------------------------------------------
- | ... | |
- | ... | |
- ----------------------------------------------------------------
+ ----------------------------------------------------------------
+ | ... | |
+ | ... | |
+ ----------------------------------------------------------------
VSR[30] | FPR[30] | |
- ----------------------------------------------------------------
+ ----------------------------------------------------------------
VSR[31] | FPR[31] | |
- ----------------------------------------------------------------
+ ----------------------------------------------------------------
VSR[32] | VR[0] |
- ----------------------------------------------------------------
+ ----------------------------------------------------------------
VSR[33] | VR[1] |
- ----------------------------------------------------------------
- | ... |
- | ... |
- ----------------------------------------------------------------
+ ----------------------------------------------------------------
+ | ... |
+ | ... |
+ ----------------------------------------------------------------
VSR[62] | VR[30] |
- ----------------------------------------------------------------
+ ----------------------------------------------------------------
VSR[63] | VR[31] |
- ----------------------------------------------------------------
+ ----------------------------------------------------------------
VSX has 64 128bit registers. The first 32 registers overlap with
the FP registers (doubleword 0) and hence extend them with additional
if (ret < 0)
{
if (errno == EIO)
- {
- have_ptrace_getvrregs = 0;
- return;
- }
+ {
+ have_ptrace_getvrregs = 0;
+ return;
+ }
perror_with_name (_("Unable to fetch AltiVec registers"));
}
if (have_ptrace_getsetevrregs)
{
if (ptrace (PTRACE_GETEVRREGS, tid, 0, evrregset) >= 0)
- return;
+ return;
else
- {
- /* EIO means that the PTRACE_GETEVRREGS request isn't supported;
- we just return zeros. */
- if (errno == EIO)
- have_ptrace_getsetevrregs = 0;
- else
- /* Anything else needs to be reported. */
- perror_with_name (_("Unable to fetch SPE registers"));
- }
+ {
+ /* EIO means that the PTRACE_GETEVRREGS request isn't supported;
+ we just return zeros. */
+ if (errno == EIO)
+ have_ptrace_getsetevrregs = 0;
+ else
+ /* Anything else needs to be reported. */
+ perror_with_name (_("Unable to fetch SPE registers"));
+ }
}
memset (evrregset, 0, sizeof (*evrregset));
struct gdb_evrregset_t evrregs;
gdb_assert (sizeof (evrregs.evr[0])
- == register_size (gdbarch, tdep->ppc_ev0_upper_regnum));
+ == register_size (gdbarch, tdep->ppc_ev0_upper_regnum));
gdb_assert (sizeof (evrregs.acc)
- == register_size (gdbarch, tdep->ppc_acc_regnum));
+ == register_size (gdbarch, tdep->ppc_acc_regnum));
gdb_assert (sizeof (evrregs.spefscr)
- == register_size (gdbarch, tdep->ppc_spefscr_regnum));
+ == register_size (gdbarch, tdep->ppc_spefscr_regnum));
get_spe_registers (tid, &evrregs);
int i;
for (i = 0; i < ppc_num_gprs; i++)
- regcache->raw_supply (tdep->ppc_ev0_upper_regnum + i, &evrregs.evr[i]);
+ regcache->raw_supply (tdep->ppc_ev0_upper_regnum + i, &evrregs.evr[i]);
}
else if (tdep->ppc_ev0_upper_regnum <= regno
- && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
+ && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
regcache->raw_supply (regno,
&evrregs.evr[regno - tdep->ppc_ev0_upper_regnum]);
if (altivec_register_p (gdbarch, regno))
{
/* If this is the first time through, or if it is not the first
- time through, and we have confirmed that there is kernel
- support for such a ptrace request, then go and fetch the
- register. */
+ time through, and we have confirmed that there is kernel
+ support for such a ptrace request, then go and fetch the
+ register. */
if (have_ptrace_getvrregs)
{
- fetch_altivec_registers (regcache, tid, regno);
- return;
+ fetch_altivec_registers (regcache, tid, regno);
+ return;
}
/* If we have discovered that there is no ptrace support for
- AltiVec registers, fall through and return zeroes, because
- regaddr will be -1 in this case. */
+ AltiVec registers, fall through and return zeroes, because
+ regaddr will be -1 in this case. */
}
else if (vsx_register_p (gdbarch, regno))
{
regaddr += sizeof (long);
if (errno != 0)
{
- char message[128];
+ char message[128];
xsnprintf (message, sizeof (message), "reading register %s (#%d)",
gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message);
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
{
/* Little-endian values are always found at the left end of the
- bytes transferred. */
+ bytes transferred. */
regcache->raw_supply (regno, buf);
}
else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
/* Big-endian values are found at the right end of the bytes
- transferred. */
+ transferred. */
size_t padding = (bytes_transferred - register_size (gdbarch, regno));
regcache->raw_supply (regno, buf + padding);
}
else
internal_error (__FILE__, __LINE__,
- _("fetch_register: unexpected byte order: %d"),
- gdbarch_byte_order (gdbarch));
+ _("fetch_register: unexpected byte order: %d"),
+ gdbarch_byte_order (gdbarch));
}
/* This function actually issues the request to ptrace, telling
if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
{
if (errno == EIO)
- {
- have_ptrace_getsetregs = 0;
- return 0;
- }
+ {
+ have_ptrace_getsetregs = 0;
+ return 0;
+ }
perror_with_name (_("Couldn't get general-purpose registers."));
}
if (ptrace (PTRACE_GETFPREGS, tid, 0, (void *) &fpregs) < 0)
{
if (errno == EIO)
- {
- have_ptrace_getsetfpregs = 0;
- return 0;
- }
+ {
+ have_ptrace_getsetfpregs = 0;
+ return 0;
+ }
perror_with_name (_("Couldn't get floating-point registers."));
}
if (ret < 0)
{
if (errno == EIO)
- {
- have_ptrace_getvrregs = 0;
- return;
- }
+ {
+ have_ptrace_getvrregs = 0;
+ return;
+ }
perror_with_name (_("Unable to fetch AltiVec registers"));
}
if (have_ptrace_getsetevrregs)
{
if (ptrace (PTRACE_SETEVRREGS, tid, 0, evrregset) >= 0)
- return;
+ return;
else
- {
- /* EIO means that the PTRACE_SETEVRREGS request isn't
- supported; we fail silently, and don't try the call
- again. */
- if (errno == EIO)
- have_ptrace_getsetevrregs = 0;
- else
- /* Anything else needs to be reported. */
- perror_with_name (_("Unable to set SPE registers"));
- }
+ {
+ /* EIO means that the PTRACE_SETEVRREGS request isn't
+ supported; we fail silently, and don't try the call
+ again. */
+ if (errno == EIO)
+ have_ptrace_getsetevrregs = 0;
+ else
+ /* Anything else needs to be reported. */
+ perror_with_name (_("Unable to set SPE registers"));
+ }
}
}
struct gdb_evrregset_t evrregs;
gdb_assert (sizeof (evrregs.evr[0])
- == register_size (gdbarch, tdep->ppc_ev0_upper_regnum));
+ == register_size (gdbarch, tdep->ppc_ev0_upper_regnum));
gdb_assert (sizeof (evrregs.acc)
- == register_size (gdbarch, tdep->ppc_acc_regnum));
+ == register_size (gdbarch, tdep->ppc_acc_regnum));
gdb_assert (sizeof (evrregs.spefscr)
- == register_size (gdbarch, tdep->ppc_spefscr_regnum));
+ == register_size (gdbarch, tdep->ppc_spefscr_regnum));
if (regno == -1)
/* Since we're going to write out every register, the code below
&evrregs.evr[i]);
}
else if (tdep->ppc_ev0_upper_regnum <= regno
- && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
+ && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
regcache->raw_collect (regno,
&evrregs.evr[regno - tdep->ppc_ev0_upper_regnum]);
regaddr += sizeof (long);
if (errno == EIO
- && (regno == tdep->ppc_fpscr_regnum
+ && (regno == tdep->ppc_fpscr_regnum
|| regno == PPC_ORIG_R3_REGNUM
|| regno == PPC_TRAP_REGNUM))
{
if (errno != 0)
{
- char message[128];
+ char message[128];
xsnprintf (message, sizeof (message), "writing register %s (#%d)",
gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message);
if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
{
if (errno == EIO)
- {
- have_ptrace_getsetregs = 0;
- return 0;
- }
+ {
+ have_ptrace_getsetregs = 0;
+ return 0;
+ }
perror_with_name (_("Couldn't get general-purpose registers."));
}
if (ptrace (PTRACE_SETREGS, tid, 0, (void *) &gregset) < 0)
{
if (errno == EIO)
- {
- have_ptrace_getsetregs = 0;
- return 0;
- }
+ {
+ have_ptrace_getsetregs = 0;
+ return 0;
+ }
perror_with_name (_("Couldn't set general-purpose registers."));
}
if (ptrace (PTRACE_GETFPREGS, tid, 0, (void *) &fpregs) < 0)
{
if (errno == EIO)
- {
- have_ptrace_getsetfpregs = 0;
- return 0;
- }
+ {
+ have_ptrace_getsetfpregs = 0;
+ return 0;
+ }
perror_with_name (_("Couldn't get floating-point registers."));
}
if (ptrace (PTRACE_SETFPREGS, tid, 0, (void *) &fpregs) < 0)
{
if (errno == EIO)
- {
- have_ptrace_getsetfpregs = 0;
- return 0;
- }
+ {
+ have_ptrace_getsetfpregs = 0;
+ return 0;
+ }
perror_with_name (_("Couldn't set floating-point registers."));
}
struct gdb_evrregset_t evrregset;
if (ptrace (PTRACE_GETEVRREGS, tid, 0, &evrregset) >= 0)
- return tdesc_powerpc_e500l;
+ return tdesc_powerpc_e500l;
/* EIO means that the PTRACE_GETEVRREGS request isn't supported.
Anything else needs to be reported. */
gdb_vrregset_t vrregset;
if (ptrace (PTRACE_GETVRREGS, tid, 0, &vrregset) >= 0)
- features.altivec = true;
+ features.altivec = true;
/* EIO means that the PTRACE_GETVRREGS request isn't supported.
Anything else needs to be reported. */
/* Embedded DAC-based processors, like the PowerPC 440 have ranged
watchpoints and can watch any access within an arbitrary memory
region. This is useful to watch arrays and structs, for instance. It
- takes two hardware watchpoints though. */
+ takes two hardware watchpoints though. */
if (len > 1
&& hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
&& linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
else
region_size = hwdebug_info.data_bp_alignment;
/* Server processors provide one hardware watchpoint and addr+len should
- fall in the watchable region provided by the ptrace interface. */
+ fall in the watchable region provided by the ptrace interface. */
if (region_size
&& (addr + len > (addr & ~(region_size - 1)) + region_size))
return 0;
fpregs + i * tdep->wordsize);
}
trad_frame_set_reg_addr (this_cache, tdep->ppc_fpscr_regnum,
- fpregs + 32 * tdep->wordsize);
+ fpregs + 32 * tdep->wordsize);
}
trad_frame_set_id (this_cache, frame_id_build (base, func));
}
/* If we do, then it is safe to check the size. */
return register_size (gdbarch, PPC_ORIG_R3_REGNUM) > 0
- && register_size (gdbarch, PPC_TRAP_REGNUM) > 0;
+ && register_size (gdbarch, PPC_TRAP_REGNUM) > 0;
}
/* Return the current system call's number present in the
static const struct floatformat **
ppc_floatformat_for_type (struct gdbarch *gdbarch,
- const char *name, int len)
+ const char *name, int len)
{
if (len == 128 && name)
{
static void
ppc_linux_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+ struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct tdesc_arch_data *tdesc_data = info.tdesc_data;
set_gdbarch_return_value (gdbarch, ppc_linux_return_value);
set_gdbarch_memory_remove_breakpoint (gdbarch,
- ppc_linux_memory_remove_breakpoint);
+ ppc_linux_memory_remove_breakpoint);
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc_skip_trampoline_code);
set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ (gdbarch, svr4_ilp32_fetch_link_map_offsets);
/* Setting the correct XML syscall filename. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC);
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ (gdbarch, svr4_lp64_fetch_link_map_offsets);
/* Setting the correct XML syscall filename. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC64);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
if (tdesc_data)
{
const struct tdesc_feature *feature;
/* If we have target-described registers, then we can safely
- reserve a number for PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM
+ reserve a number for PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM
(whether they are described or not). */
gdb_assert (gdbarch_num_regs (gdbarch) <= PPC_ORIG_R3_REGNUM);
set_gdbarch_num_regs (gdbarch, PPC_TRAP_REGNUM + 1);
/* If they are present, then assign them to the reserved number. */
feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.power.linux");
+ "org.gnu.gdb.power.linux");
if (feature != NULL)
{
tdesc_numbered_register (feature, tdesc_data,
/* Register for all sub-families of the POWER/PowerPC: 32-bit and
64-bit PowerPC, and the older rs6k. */
gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_LINUX,
- ppc_linux_init_abi);
+ ppc_linux_init_abi);
gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_LINUX,
- ppc_linux_init_abi);
+ ppc_linux_init_abi);
gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX,
- ppc_linux_init_abi);
+ ppc_linux_init_abi);
/* Initialize the Linux target descriptions. */
initialize_tdesc_powerpc_32l ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
return ((regnum >= tdep->ppc_gp0_regnum
- && regnum < tdep->ppc_gp0_regnum + ppc_num_gprs)
- || regnum == tdep->ppc_lr_regnum
- || regnum == tdep->ppc_cr_regnum
- || regnum == tdep->ppc_xer_regnum
- || regnum == tdep->ppc_ctr_regnum
+ && regnum < tdep->ppc_gp0_regnum + ppc_num_gprs)
+ || regnum == tdep->ppc_lr_regnum
+ || regnum == tdep->ppc_cr_regnum
+ || regnum == tdep->ppc_xer_regnum
+ || regnum == tdep->ppc_ctr_regnum
|| regnum == gdbarch_pc_regnum (gdbarch));
}
gdb_assert (ppc_floating_point_unit_p (gdbarch));
return ((regnum >= tdep->ppc_fp0_regnum
- && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
+ && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
|| regnum == tdep->ppc_fpscr_regnum);
}
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_("Couldn't get registers"));
ppc_supply_gregset (&ppcnbsd_gregset, regcache,
regnum, ®s, sizeof regs);
static void
ppcnbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+ struct gdbarch *gdbarch)
{
nbsd_init_abi (info, gdbarch);
gdb_assert (ppc_floating_point_unit_p (gdbarch));
return ((regnum >= tdep->ppc_fp0_regnum
- && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
+ && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
|| regnum == tdep->ppc_fpscr_regnum);
}
static void
supply_register_at_address (struct regcache *regcache, int regnum,
- CORE_ADDR register_addr)
+ CORE_ADDR register_addr)
{
struct gdbarch *gdbarch = regcache->arch ();
int buf_size = register_size (gdbarch, regnum);
for (current_regnum = 0; current_regnum < num_regs; current_regnum++)
{
if (register_in_thread_descriptor_p (reg_info, current_regnum))
- {
- current_address = thread_descriptor_address
- + reg_info->context_offsets[current_regnum];
- supply_register_at_address (regcache, current_regnum,
- current_address);
- }
+ {
+ current_address = thread_descriptor_address
+ + reg_info->context_offsets[current_regnum];
+ supply_register_at_address (regcache, current_regnum,
+ current_address);
+ }
}
}
regcache->raw_collect (regnum, buf);
write_memory (register_address,
- buf,
- buf_size);
+ buf,
+ buf_size);
}
/* The ravenscar_reg_info for most PowerPC targets. */
{
int argno;
/* Next available floating point register for float and double
- arguments. */
+ arguments. */
int freg = 1;
/* Next available general register for non-float, non-vector
- arguments. */
+ arguments. */
int greg = 3;
/* Next available vector register for vector arguments. */
int vreg = 2;
int structoffset = argoffset + argspace;
/* If the function is returning a `struct', then the first word
- (which will be passed in r3) is used for struct return
- address. In that case we should advance one word and start
- from r4 register to copy parameters. */
+ (which will be passed in r3) is used for struct return
+ address. In that case we should advance one word and start
+ from r4 register to copy parameters. */
if (return_method == return_method_struct)
{
if (write_pass)
&& !tdep->soft_float)
{
/* Floating point value converted to "double" then
- passed in an FP register, when the registers run out,
- 8 byte aligned stack is used. */
+ passed in an FP register, when the registers run out,
+ 8 byte aligned stack is used. */
if (freg <= 8)
{
if (write_pass)
{
/* Always store the floating point value using
- the register's floating-point format. */
+ the register's floating-point format. */
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum + freg);
&& tdep->soft_float)))
{
/* "long long" or soft-float "double" or "_Decimal64"
- passed in an odd/even register pair with the low
- addressed word in the odd register and the high
- addressed word in the even register, or when the
- registers run out an 8 byte aligned stack
- location. */
+ passed in an odd/even register pair with the low
+ addressed word in the odd register and the high
+ addressed word in the even register, or when the
+ registers run out an 8 byte aligned stack
+ location. */
if (greg > 9)
{
/* Just in case GREG was 10. */
&& !tdep->soft_float)
{
/* 32-bit and 64-bit decimal floats go in f1 .. f8. They can
- end up in memory. */
+ end up in memory. */
if (freg <= 8)
{
}
/* If a 128-bit decimal float goes to the stack because only f7
- and f8 are free (thus there's no even/odd register pair
+ and f8 are free (thus there's no even/odd register pair
available), these registers should be marked as occupied.
Hence we increase freg even when writing to memory. */
freg += 2;
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
{
/* Vector parameter passed in an Altivec register, or
- when that runs out, 16 byte aligned stack location. */
+ when that runs out, 16 byte aligned stack location. */
if (vreg <= 13)
{
if (write_pass)
&& tdep->vector_abi == POWERPC_VEC_SPE)
{
/* Vector parameter passed in an e500 register, or when
- that runs out, 8 byte aligned stack location. Note
- that since e500 vector and general purpose registers
- both map onto the same underlying register set, a
- "greg" and not a "vreg" is consumed here. A cooked
- write stores the value in the correct locations
- within the raw register cache. */
+ that runs out, 8 byte aligned stack location. Note
+ that since e500 vector and general purpose registers
+ both map onto the same underlying register set, a
+ "greg" and not a "vreg" is consumed here. A cooked
+ write stores the value in the correct locations
+ within the raw register cache. */
if (greg <= 10)
{
if (write_pass)
else
{
/* Reduce the parameter down to something that fits in a
- "word". */
+ "word". */
gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, PPC_MAX_REGISTER_SIZE);
if (len > tdep->wordsize
/* Always goes in the low address. */
memcpy (word, val, len);
/* Store that "word" in a register, or on the stack.
- The words have "4" byte alignment. */
+ The words have "4" byte alignment. */
if (greg <= 10)
{
if (write_pass)
the required type. */
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch,
- tdep->ppc_fp0_regnum + 1);
+ tdep->ppc_fp0_regnum + 1);
regcache->cooked_read (tdep->ppc_fp0_regnum + 1, regval);
target_float_convert (regval, regtype, readbuf, type);
}
}
/* If the function is returning a `struct', then there is an
- extra hidden parameter (which will be passed in r3)
- containing the address of that struct.. In that case we
- should advance one word and start from r4 register to copy
- parameters. This also consumes one on-stack parameter slot. */
+ extra hidden parameter (which will be passed in r3)
+ containing the address of that struct.. In that case we
+ should advance one word and start from r4 register to copy
+ parameters. This also consumes one on-stack parameter slot. */
if (return_method == return_method_struct)
ppc64_sysv_abi_push_integer (gdbarch, struct_addr, &argpos);
}
/* The PLT descriptor will either point to the already resolved target
- address, or else to a glink stub. As the latter carry synthetic @plt
- symbols, find_solib_trampoline_target should be able to resolve them. */
+ address, or else to a glink stub. As the latter carry synthetic @plt
+ symbols, find_solib_trampoline_target should be able to resolve them. */
target = find_solib_trampoline_target (frame, pc);
return target ? target : pc;
}
{
type = float_type_from_length (type);
if (type->code () != TYPE_CODE_FLT)
- format = 0;
+ format = 0;
}
switch (format)
int line = 0;
if (build_address_symbolic (gdbarch, addr, do_demangle, false, &name,
- &offset, &filename, &line, &unmapped))
+ &offset, &filename, &line, &unmapped))
return 0;
fputs_filtered (leadin, stream);
3) The symbol address is not identical to that of the address
under consideration. */
if (symbol == NULL ||
- (!prefer_sym_over_minsym
+ (!prefer_sym_over_minsym
&& BMSYMBOL_VALUE_ADDRESS (msymbol) == addr
&& name_location != addr))
{
static CORE_ADDR
find_instruction_backward (struct gdbarch *gdbarch, CORE_ADDR addr,
- int inst_count, int *inst_read)
+ int inst_count, int *inst_read)
{
/* The vector PCS is used to store instruction addresses within
a pc range. */
pcs.clear ();
sal = find_pc_sect_line (loop_start, NULL, 1);
if (sal.line <= 0)
- {
- /* We reach here when line info is not available. In this case,
- we print a message and just exit the loop. The return value
- is calculated after the loop. */
- printf_filtered (_("No line number information available "
- "for address "));
- wrap_here (" ");
- print_address (gdbarch, loop_start - 1, gdb_stdout);
- printf_filtered ("\n");
- break;
- }
+ {
+ /* We reach here when line info is not available. In this case,
+ we print a message and just exit the loop. The return value
+ is calculated after the loop. */
+ printf_filtered (_("No line number information available "
+ "for address "));
+ wrap_here (" ");
+ print_address (gdbarch, loop_start - 1, gdb_stdout);
+ printf_filtered ("\n");
+ break;
+ }
loop_end = loop_start;
loop_start = sal.pc;
/* This loop pushes instruction addresses in the range from
- LOOP_START to LOOP_END. */
+ LOOP_START to LOOP_END. */
for (p = loop_start; p < loop_end;)
- {
+ {
pcs.push_back (p);
- p += gdb_insn_length (gdbarch, p);
- }
+ p += gdb_insn_length (gdbarch, p);
+ }
inst_count -= pcs.size ();
*inst_read += pcs.size ();
the reason below.
Let's assume the following instruction addresses and run 'x/-4i 0x400e'.
Line X of File
- 0x4000
- 0x4001
- 0x4005
+ 0x4000
+ 0x4001
+ 0x4005
Line Y of File
- 0x4009
- 0x400c
+ 0x4009
+ 0x400c
=> 0x400e
- 0x4011
+ 0x4011
find_instruction_backward is called with INST_COUNT = 4 and expected to
return 0x4001. When we reach here, INST_COUNT is set to -1 because
it was subtracted by 2 (from Line Y) and 3 (from Line X). The value
static int
read_memory_backward (struct gdbarch *gdbarch,
- CORE_ADDR memaddr, gdb_byte *myaddr, int len)
+ CORE_ADDR memaddr, gdb_byte *myaddr, int len)
{
int errcode;
int nread; /* Number of bytes actually read. */
memaddr += len;
myaddr += len;
for (nread = 0; nread < len; ++nread)
- {
- errcode = target_read_memory (--memaddr, --myaddr, 1);
- if (errcode != 0)
- {
- /* The read was unsuccessful, so exit the loop. */
- printf_filtered (_("Cannot access memory at address %s\n"),
- paddress (gdbarch, memaddr));
- break;
- }
- }
+ {
+ errcode = target_read_memory (--memaddr, --myaddr, 1);
+ if (errcode != 0)
+ {
+ /* The read was unsuccessful, so exit the loop. */
+ printf_filtered (_("Cannot access memory at address %s\n"),
+ paddress (gdbarch, memaddr));
+ break;
+ }
+ }
}
return nread;
}
static CORE_ADDR
find_string_backward (struct gdbarch *gdbarch,
- CORE_ADDR addr, int count, int char_size,
- const struct value_print_options *options,
- int *strings_counted)
+ CORE_ADDR addr, int count, int char_size,
+ const struct value_print_options *options,
+ int *strings_counted)
{
const int chunk_size = 0x20;
int read_error = 0;
addr -= chars_to_read * char_size;
chars_read = read_memory_backward (gdbarch, addr, buffer.data (),
- chars_to_read * char_size);
+ chars_to_read * char_size);
chars_read /= char_size;
read_error = (chars_read == chars_to_read) ? 0 : 1;
/* Searching for '\0' from the end of buffer in backward direction. */
for (i = 0; i < chars_read && count > 0 ; ++i, ++chars_counted)
- {
- int offset = (chars_to_read - i - 1) * char_size;
-
- if (integer_is_zero (&buffer[offset], char_size)
- || chars_counted == options->print_max)
- {
- /* Found '\0' or reached print_max. As OFFSET is the offset to
- '\0', we add CHAR_SIZE to return the start address of
- a string. */
- --count;
- string_start_addr = addr + offset + char_size;
- chars_counted = 0;
- }
- }
+ {
+ int offset = (chars_to_read - i - 1) * char_size;
+
+ if (integer_is_zero (&buffer[offset], char_size)
+ || chars_counted == options->print_max)
+ {
+ /* Found '\0' or reached print_max. As OFFSET is the offset to
+ '\0', we add CHAR_SIZE to return the start address of
+ a string. */
+ --count;
+ string_start_addr = addr + offset + char_size;
+ chars_counted = 0;
+ }
+ }
}
/* Update STRINGS_COUNTED with the actual number of loaded strings. */
if (read_error != 0)
{
/* In error case, STRING_START_ADDR is pointing to the string that
- was last successfully loaded. Rewind the partially loaded string. */
+ was last successfully loaded. Rewind the partially loaded string. */
string_start_addr -= chars_counted * char_size;
}
else if (size == 'w')
char_type = builtin_type (next_gdbarch)->builtin_char32;
if (char_type)
- val_type = char_type;
+ val_type = char_type;
else
- {
+ {
if (size != '\0' && size != 'b')
warning (_("Unable to display strings with "
"size '%c', using 'b' instead."), size);
size = 'b';
val_type = builtin_type (next_gdbarch)->builtin_int8;
- }
+ }
}
maxelts = 8;
if (count < 0)
{
/* This is the negative repeat count case.
- We rewind the address based on the given repeat count and format,
- then examine memory from there in forward direction. */
+ We rewind the address based on the given repeat count and format,
+ then examine memory from there in forward direction. */
count = -count;
if (format == 'i')
- {
- next_address = find_instruction_backward (gdbarch, addr, count,
- &count);
- }
+ {
+ next_address = find_instruction_backward (gdbarch, addr, count,
+ &count);
+ }
else if (format == 's')
- {
- next_address = find_string_backward (gdbarch, addr, count,
- TYPE_LENGTH (val_type),
- &opts, &count);
- }
+ {
+ next_address = find_string_backward (gdbarch, addr, count,
+ TYPE_LENGTH (val_type),
+ &opts, &count);
+ }
else
- {
- next_address = addr - count * TYPE_LENGTH (val_type);
- }
+ {
+ next_address = addr - count * TYPE_LENGTH (val_type);
+ }
/* The following call to print_formatted updates next_address in every
- iteration. In backward case, we store the start address here
- and update next_address with it before exiting the function. */
+ iteration. In backward case, we store the start address here
+ and update next_address with it before exiting the function. */
addr_rewound = (format == 's'
- ? next_address - TYPE_LENGTH (val_type)
- : next_address);
+ ? next_address - TYPE_LENGTH (val_type)
+ : next_address);
need_to_update_next_address = 1;
}
{
expression_up expr = parse_expression (exp);
/* Cause expression not to be there any more if this command is
- repeated with Newline. But don't clobber a user-defined
- command's definition. */
+ repeated with Newline. But don't clobber a user-defined
+ command's definition. */
if (from_tty)
set_repeat_arguments ("");
val = evaluate_expression (expr.get ());
if (TYPE_IS_REFERENCE (value_type (val)))
val = coerce_ref (val);
/* In rvalue contexts, such as this, functions are coerced into
- pointers to functions. This makes "x/i main" work. */
+ pointers to functions. This makes "x/i main" work. */
if (value_type (val)->code () == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory)
next_address = value_address (val);
if (last_examine_value != nullptr)
{
/* Make last address examined available to the user as $_. Use
- the correct pointer type. */
+ the correct pointer type. */
struct type *pointer_type
= lookup_pointer_type (value_type (last_examine_value.get ()));
set_internalvar (lookup_internalvar ("_"),
annotate_display_value ();
try
- {
+ {
struct value *val;
CORE_ADDR addr;
opts.raw = d->format.raw;
try
- {
+ {
struct value *val;
val = evaluate_expression (d->exp.get ());
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
fprintf_filtered (stream, current_substring,
- obstack_base (&output));
+ obstack_base (&output));
DIAGNOSTIC_POP
}
break;
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- fprintf_filtered (stream, current_substring, val);
+ fprintf_filtered (stream, current_substring, val);
DIAGNOSTIC_POP
break;
}
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- fprintf_filtered (stream, current_substring, val);
+ fprintf_filtered (stream, current_substring, val);
DIAGNOSTIC_POP
break;
}
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- fprintf_filtered (stream, current_substring, val);
+ fprintf_filtered (stream, current_substring, val);
DIAGNOSTIC_POP
break;
}
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- fprintf_filtered (stream, current_substring, val);
+ fprintf_filtered (stream, current_substring, val);
DIAGNOSTIC_POP
break;
}
"write (PCSSIG) ");
proc_prettyfprint_signal (procfs_file ? procfs_file : stdout,
arg[1] ? ((siginfo_t *) &arg[1])->si_signo
- : 0,
+ : 0,
0);
fprintf (procfs_file ? procfs_file : stdout, "\n");
break;
*/
cs = &producer[strlen ("GNU ")];
while (*cs && !isspace (*cs))
- cs++;
+ cs++;
if (*cs && isspace (*cs))
- cs++;
+ cs++;
if (sscanf (cs, "%d.%d", major, minor) == 2)
return 1;
}
producer_is_llvm (const char *producer)
{
return ((producer != NULL) && (startswith (producer, "clang ")
- || startswith (producer, " F90 Flang ")));
+ || startswith (producer, " F90 Flang ")));
}
#if defined GDB_SELF_TEST
Public release:
"Intel(R) Fortran Intel(R) 64 Compiler XE for applications
- running on Intel(R) 64, Version 14.0.1.074 Build 20130716";
- "Intel(R) C++ Intel(R) 64 Compiler XE for applications
- running on Intel(R) 64, Version 14.0.1.074 Build 20130716";
+ running on Intel(R) 64, Version 14.0.1.074 Build 20130716";
+ "Intel(R) C++ Intel(R) 64 Compiler XE for applications
+ running on Intel(R) 64, Version 14.0.1.074 Build 20130716";
Internal releases:
"Intel(R) C++ Intel(R) 64 Compiler for applications
/* We can add a constant to another constant. */
else if (a.kind == pvk_constant
- && b.kind == pvk_constant)
+ && b.kind == pvk_constant)
return pv_constant (a.k + b.k);
/* Anything else we don't know how to add. We don't have a
/* We can subtract a constant from a register. */
else if (a.kind == pvk_register
- && b.kind == pvk_constant)
+ && b.kind == pvk_constant)
return pv_register (a.reg, a.k - b.k);
/* We can subtract a register from itself, yielding a constant. */
else if (a.kind == pvk_register
- && b.kind == pvk_register
- && a.reg == b.reg)
+ && b.kind == pvk_register
+ && a.reg == b.reg)
return pv_constant (a.k - b.k);
/* We don't know how to subtract anything else. */
/* We can 'and' anything with the constant zero. */
else if (b.kind == pvk_constant
- && b.k == 0)
+ && b.k == 0)
return pv_constant (0);
/* We can 'and' anything with ~0. */
else if (b.kind == pvk_constant
- && b.k == ~ (CORE_ADDR) 0)
+ && b.k == ~ (CORE_ADDR) 0)
return a;
/* We can 'and' a register with itself. */
else if (a.kind == pvk_register
- && b.kind == pvk_register
- && a.reg == b.reg
- && a.k == b.k)
+ && b.kind == pvk_register
+ && a.reg == b.reg
+ && a.k == b.k)
return a;
/* Otherwise, we don't know. */
pv_is_register (pv_t a, int r)
{
return (a.kind == pvk_register
- && a.reg == r);
+ && a.reg == r);
}
pv_is_register_k (pv_t a, int r, CORE_ADDR k)
{
return (a.kind == pvk_register
- && a.reg == r
- && a.k == k);
+ && a.reg == r
+ && a.k == k);
}
enum pv_boolean
pv_is_array_ref (pv_t addr, CORE_ADDR size,
- pv_t array_addr, CORE_ADDR array_len,
- CORE_ADDR elt_size,
- int *i)
+ pv_t array_addr, CORE_ADDR array_len,
+ CORE_ADDR elt_size,
+ int *i)
{
/* Note that, since .k is a CORE_ADDR, and CORE_ADDR is unsigned, if
addr is *before* the start of the array, then this isn't going to
if (offset.kind == pvk_constant)
{
/* This is a rather odd test. We want to know if the SIZE bytes
- at ADDR don't overlap the array at all, so you'd expect it to
- be an || expression: "if we're completely before || we're
- completely after". But with unsigned arithmetic, things are
- different: since it's a number circle, not a number line, the
- right values for offset.k are actually one contiguous range. */
+ at ADDR don't overlap the array at all, so you'd expect it to
+ be an || expression: "if we're completely before || we're
+ completely after". But with unsigned arithmetic, things are
+ different: since it's a number circle, not a number line, the
+ right values for offset.k are actually one contiguous range. */
if (offset.k <= -size
- && offset.k >= array_len * elt_size)
- return pv_definite_no;
+ && offset.k >= array_len * elt_size)
+ return pv_definite_no;
else if (offset.k % elt_size != 0
- || size != elt_size)
- return pv_maybe;
+ || size != elt_size)
+ return pv_maybe;
else
- {
- *i = offset.k / elt_size;
- return pv_definite_yes;
- }
+ {
+ *i = offset.k / elt_size;
+ return pv_definite_yes;
+ }
}
else
return pv_maybe;
if (e)
{
/* This needs to be a do-while loop, in order to actually
- process the node being checked for in the terminating
- condition. */
+ process the node being checked for in the terminating
+ condition. */
do
- {
- struct area_entry *next = e->next;
+ {
+ struct area_entry *next = e->next;
- xfree (e);
- e = next;
- }
+ xfree (e);
+ e = next;
+ }
while (e != m_entry);
m_entry = 0;
value of the register, so we can't compare entry addresses to
constants. */
return (addr.kind == pvk_unknown
- || addr.kind == pvk_constant
- || (addr.kind == pvk_register && addr.reg != m_base_reg));
+ || addr.kind == pvk_constant
+ || (addr.kind == pvk_register && addr.reg != m_base_reg));
}
make sure both things we're comparing are on the same side of the
discontinuity. */
while (((e->next->offset - offset) & m_addr_mask)
- < ((e->offset - offset) & m_addr_mask))
+ < ((e->offset - offset) & m_addr_mask))
e = e->next;
/* If the previous entry would be better than the current one, then
scan backwards. */
while (((e->prev->offset - offset) & m_addr_mask)
- < ((e->offset - offset) & m_addr_mask))
+ < ((e->offset - offset) & m_addr_mask))
e = e->prev;
/* In case there's some locality to the searches, set the area's
{
/* Think carefully about wrap-around before simplifying this. */
return (((entry->offset - offset) & m_addr_mask) < size
- || ((offset - entry->offset) & m_addr_mask) < entry->size);
+ || ((offset - entry->offset) & m_addr_mask) < entry->size);
}
/* Delete all entries that we would overlap. */
while (e && overlaps (e, offset, size))
- {
- struct area_entry *next = (e->next == e) ? 0 : e->next;
+ {
+ struct area_entry *next = (e->next == e) ? 0 : e->next;
- e->prev->next = e->next;
- e->next->prev = e->prev;
+ e->prev->next = e->next;
+ e->next->prev = e->prev;
- xfree (e);
- e = next;
- }
+ xfree (e);
+ e = next;
+ }
/* Move the area's pointer to the next remaining entry. This
- will also zero the pointer if we've deleted all the entries. */
+ will also zero the pointer if we've deleted all the entries. */
m_entry = e;
}
e->value = value;
if (m_entry)
- {
- e->prev = m_entry->prev;
- e->next = m_entry;
- e->prev->next = e->next->prev = e;
- }
+ {
+ e->prev = m_entry->prev;
+ e->next = m_entry;
+ e->prev->next = e->next->prev = e;
+ }
else
- {
- e->prev = e->next = e;
- m_entry = e;
- }
+ {
+ e->prev = e->next = e;
+ m_entry = e;
+ }
}
}
struct area_entry *e = find_entry (offset);
/* If this entry exactly matches what we're looking for, then
- we're set. Otherwise, say it's unknown. */
+ we're set. Otherwise, say it's unknown. */
if (e->offset == offset && e->size == size)
- return e->value;
+ return e->value;
else
- return pv_unknown ();
+ return pv_unknown ();
}
}
if (e)
do
{
- if (e->value.kind == pvk_register
- && e->value.reg == reg
- && e->value.k == 0
- && e->size == register_size (gdbarch, reg))
- {
- if (offset_p)
- *offset_p = e->offset;
- return true;
- }
-
- e = e->next;
+ if (e->value.kind == pvk_register
+ && e->value.reg == reg
+ && e->value.k == 0
+ && e->size == register_size (gdbarch, reg))
+ {
+ if (offset_p)
+ *offset_p = e->offset;
+ return true;
+ }
+
+ e = e->next;
}
while (e != m_entry);
if (e)
do
{
- addr.k = e->offset;
- func (closure, addr, e->size, e->value);
- e = e->next;
+ addr.k = e->offset;
+ func (closure, addr, e->size, e->value);
+ e = e->next;
}
while (e != m_entry);
}
an element boundary, or doesn't refer to the whole element, return
pv_maybe. */
enum pv_boolean pv_is_array_ref (pv_t addr, CORE_ADDR size,
- pv_t array_addr, CORE_ADDR array_len,
- CORE_ADDR elt_size,
- int *i);
+ pv_t array_addr, CORE_ADDR array_len,
+ CORE_ADDR elt_size,
+ int *i);
/* A 'pv_area' keeps track of values stored in a particular region of
do_linear_search = 0;
/* Binary search. This search is guaranteed to end with center
- pointing at the earliest partial symbol whose name might be
- correct. At that point *all* partial symbols with an
- appropriate name will be checked against the correct
- domain. */
+ pointing at the earliest partial symbol whose name might be
+ correct. At that point *all* partial symbols with an
+ appropriate name will be checked against the correct
+ domain. */
bottom = start;
top = start + length - 1;
do_linear_search = 0;
/* Binary search. This search is guaranteed to end with center
- pointing at the earliest partial symbol whose name might be
- correct. At that point *all* partial symbols with an
- appropriate name will be checked against the correct
- domain. */
+ pointing at the earliest partial symbol whose name might be
+ correct. At that point *all* partial symbols with an
+ appropriate name will be checked against the correct
+ domain. */
bottom = start;
top = start + length - 1;
struct partial_symbol *sym2 = (struct partial_symbol *) addr2;
return (memcmp (&sym1->ginfo.value, &sym2->ginfo.value,
- sizeof (sym1->ginfo.value)) == 0
+ sizeof (sym1->ginfo.value)) == 0
&& sym1->ginfo.language () == sym2->ginfo.language ()
- && sym1->domain == sym2->domain
- && sym1->aclass == sym2->aclass
+ && sym1->domain == sym2->domain
+ && sym1->aclass == sym2->aclass
/* Note that psymbol names are interned via
compute_and_set_names, so there's no need to compare the
contents of the name here. */
- && sym1->ginfo.linkage_name () == sym2->ginfo.linkage_name ());
+ && sym1->ginfo.linkage_name () == sym2->ginfo.linkage_name ());
}
/* Helper function, initialises partial symbol structure and stashes
to be done first to ensure we do not lose information in the
conversion process. */
if (PyLong_Check (end_obj))
- end = PyLong_AsUnsignedLongLong (end_obj);
+ end = PyLong_AsUnsignedLongLong (end_obj);
#if PY_MAJOR_VERSION == 2
else if (PyInt_Check (end_obj))
- /* If the end_pc value is specified without a trailing 'L', end_obj will
- be an integer and not a long integer. */
- end = PyInt_AsLong (end_obj);
+ /* If the end_pc value is specified without a trailing 'L', end_obj will
+ be an integer and not a long integer. */
+ end = PyInt_AsLong (end_obj);
#endif
else
- {
- PyErr_SetString (PyExc_TypeError,
- _("Argument 'end_pc' should be a (long) integer."));
+ {
+ PyErr_SetString (PyExc_TypeError,
+ _("Argument 'end_pc' should be a (long) integer."));
- return NULL;
- }
+ return NULL;
+ }
if (end < start)
- {
- PyErr_SetString (PyExc_ValueError,
- _("Argument 'end_pc' should be greater than or "
- "equal to the argument 'start_pc'."));
+ {
+ PyErr_SetString (PyExc_ValueError,
+ _("Argument 'end_pc' should be greater than or "
+ "equal to the argument 'start_pc'."));
- return NULL;
- }
+ return NULL;
+ }
}
if (count_obj)
{
count = PyInt_AsLong (count_obj);
if (PyErr_Occurred () || count < 0)
- {
- PyErr_SetString (PyExc_TypeError,
- _("Argument 'count' should be an non-negative "
- "integer."));
+ {
+ PyErr_SetString (PyExc_TypeError,
+ _("Argument 'count' should be an non-negative "
+ "integer."));
- return NULL;
- }
+ return NULL;
+ }
}
gdbpy_ref<> result_list (PyList_New (0));
string_file stb;
try
- {
- insn_len = gdb_print_insn (gdbarch, pc, &stb, NULL);
- }
+ {
+ insn_len = gdb_print_insn (gdbarch, pc, &stb, NULL);
+ }
catch (const gdb_exception &except)
- {
+ {
gdbpy_convert_exception (except);
return NULL;
- }
+ }
gdbpy_ref<> pc_obj = gdb_py_object_from_ulongest (pc);
if (pc_obj == nullptr)
return nullptr;
if (PyDict_SetItemString (insn_dict.get (), "addr", pc_obj.get ())
- || PyDict_SetItemString (insn_dict.get (), "asm", asm_obj.get ())
- || PyDict_SetItemString (insn_dict.get (), "length", len_obj.get ()))
+ || PyDict_SetItemString (insn_dict.get (), "asm", asm_obj.get ())
+ || PyDict_SetItemString (insn_dict.get (), "length", len_obj.get ()))
return NULL;
pc += insn_len;
return NULL;
if (evpy_add_attribute (breakpoint_event_obj.get (),
- "breakpoint",
- first_bp) < 0)
+ "breakpoint",
+ first_bp) < 0)
return NULL;
if (evpy_add_attribute (breakpoint_event_obj.get (),
- "breakpoints",
- breakpoint_list) < 0)
+ "breakpoints",
+ breakpoint_list) < 0)
return NULL;
return breakpoint_event_obj;
int
gdbpy_initialize_event_generic (PyTypeObject *type,
- const char *name)
+ const char *name)
{
if (PyType_Ready (type) < 0)
return -1;
int
evpy_emit_event (PyObject *event,
- eventregistry_object *registry)
+ eventregistry_object *registry)
{
Py_ssize_t i;
/* Declare all event types. */
#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
extern PyTypeObject name##_event_object_type \
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
#include "py-event-types.def"
#undef GDB_PY_DEFINE_EVENT_TYPE
extern int emit_inferior_call_event (inferior_call_kind kind,
ptid_t thread, CORE_ADDR addr);
extern int emit_register_changed_event (struct frame_info *frame,
- int regnum);
+ int regnum);
extern int emit_memory_changed_event (CORE_ADDR addr, ssize_t len);
extern int evpy_emit_event (PyObject *event,
- eventregistry_object *registry);
+ eventregistry_object *registry);
extern gdbpy_ref<> create_event_object (PyTypeObject *py_type);
extern void evpy_dealloc (PyObject *self);
extern int evpy_add_attribute (PyObject *event,
- const char *name, PyObject *attr)
+ const char *name, PyObject *attr)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_event_generic (PyTypeObject *type, const char *name)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
bpfinishpy_dealloc (PyObject *self)
{
struct finish_breakpoint_object *self_bpfinish =
- (struct finish_breakpoint_object *) self;
+ (struct finish_breakpoint_object *) self;
Py_XDECREF (self_bpfinish->function_value);
Py_XDECREF (self_bpfinish->return_type);
bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
{
struct finish_breakpoint_object *self_finishbp =
- (struct finish_breakpoint_object *) bp_obj;
+ (struct finish_breakpoint_object *) bp_obj;
/* Can compute return_value only once. */
gdb_assert (!self_finishbp->return_value);
try
{
struct value *function =
- value_object_to_value (self_finishbp->function_value);
+ value_object_to_value (self_finishbp->function_value);
struct type *value_type =
- type_object_to_type (self_finishbp->return_type);
+ type_object_to_type (self_finishbp->return_type);
struct value *ret = get_return_value (function, value_type);
if (ret)
- {
- self_finishbp->return_value = value_to_value_object (ret);
- if (!self_finishbp->return_value)
- gdbpy_print_stack ();
- }
+ {
+ self_finishbp->return_value = value_to_value_object (ret);
+ if (!self_finishbp->return_value)
+ gdbpy_print_stack ();
+ }
else
- {
- Py_INCREF (Py_None);
- self_finishbp->return_value = Py_None;
- }
+ {
+ Py_INCREF (Py_None);
+ self_finishbp->return_value = Py_None;
+ }
}
catch (const gdb_exception &except)
{
if (inferior_ptid == null_ptid)
{
PyErr_SetString (PyExc_ValueError,
- _("No thread currently selected."));
+ _("No thread currently selected."));
return -1;
}
{
internal_bp = PyObject_IsTrue (internal);
if (internal_bp == -1)
- {
- PyErr_SetString (PyExc_ValueError,
- _("The value of `internal' must be a boolean."));
- return -1;
- }
+ {
+ PyErr_SetString (PyExc_ValueError,
+ _("The value of `internal' must be a boolean."));
+ return -1;
+ }
}
/* Find the function we will return from. */
try
{
if (get_frame_pc_if_available (frame, &pc))
- {
- function = find_pc_function (pc);
- if (function != NULL)
- {
- struct type *ret_type =
+ {
+ function = find_pc_function (pc);
+ if (function != NULL)
+ {
+ struct type *ret_type =
check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (function)));
- /* Remember only non-void return types. */
- if (ret_type->code () != TYPE_CODE_VOID)
- {
- struct value *func_value;
-
- /* Ignore Python errors at this stage. */
- self_bpfinish->return_type = type_to_type_object (ret_type);
- PyErr_Clear ();
- func_value = read_var_value (function, NULL, frame);
- self_bpfinish->function_value =
- value_to_value_object (func_value);
- PyErr_Clear ();
- }
- }
- }
+ /* Remember only non-void return types. */
+ if (ret_type->code () != TYPE_CODE_VOID)
+ {
+ struct value *func_value;
+
+ /* Ignore Python errors at this stage. */
+ self_bpfinish->return_type = type_to_type_object (ret_type);
+ PyErr_Clear ();
+ func_value = read_var_value (function, NULL, frame);
+ self_bpfinish->function_value =
+ value_to_value_object (func_value);
+ PyErr_Clear ();
+ }
+ }
+ }
}
catch (const gdb_exception &except)
{
event_location_up location
= new_address_location (get_frame_pc (prev_frame), NULL, 0);
create_breakpoint (python_gdbarch,
- location.get (), NULL, thread, NULL,
- 0,
- 1 /*temp_flag*/,
- bp_breakpoint,
- 0,
- AUTO_BOOLEAN_TRUE,
- &bkpt_breakpoint_ops,
- 0, 1, internal_bp, 0);
+ location.get (), NULL, thread, NULL,
+ 0,
+ 1 /*temp_flag*/,
+ bp_breakpoint,
+ 0,
+ AUTO_BOOLEAN_TRUE,
+ &bkpt_breakpoint_ops,
+ 0, 1, internal_bp, 0);
}
catch (const gdb_exception &except)
{
if (py_bp != NULL && b->py_bp_object->is_finish_bp)
{
struct finish_breakpoint_object *finish_bp =
- (struct finish_breakpoint_object *) py_bp;
+ (struct finish_breakpoint_object *) py_bp;
/* Check scope if not currently stopped at the FinishBreakpoint. */
if (b != bp_stopped)
- {
- try
- {
- if (b->pspace == current_inferior ()->pspace
- && (!target_has_registers ()
- || frame_find_by_id (b->frame_id) == NULL))
- bpfinishpy_out_of_scope (finish_bp);
- }
- catch (const gdb_exception &except)
- {
- gdbpy_convert_exception (except);
- gdbpy_print_stack ();
- }
- }
+ {
+ try
+ {
+ if (b->pspace == current_inferior ()->pspace
+ && (!target_has_registers ()
+ || frame_find_by_id (b->frame_id) == NULL))
+ bpfinishpy_out_of_scope (finish_bp);
+ }
+ catch (const gdb_exception &except)
+ {
+ gdbpy_convert_exception (except);
+ gdbpy_print_stack ();
+ }
+ }
}
return 0;
val = value_of_register (regnum, frame);
if (val == NULL)
- PyErr_SetString (PyExc_ValueError, _("Can't read register."));
+ PyErr_SetString (PyExc_ValueError, _("Can't read register."));
}
catch (const gdb_exception &except)
{
}
}
if (out->is_mi_like_p ())
- out->field_string ("arch",
- (gdbarch_bfd_arch_info (gdbarch))->printable_name);
+ out->field_string ("arch",
+ (gdbarch_bfd_arch_info (gdbarch))->printable_name);
}
bool source_print
}
/* Implementation of gdb.Inferior.thread_from_handle (self, handle)
- -> gdb.InferiorThread. */
+ -> gdb.InferiorThread. */
static PyObject *
infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
struct thread_info *thread_info;
thread_info = find_thread_by_handle
- (gdb::array_view<const gdb_byte> (bytes, bytes_len),
+ (gdb::array_view<const gdb_byte> (bytes, bytes_len),
inf_obj->inferior);
if (thread_info != NULL)
return thread_to_thread_object (thread_info).release ();
}
PyObject *object = PyBytes_FromStringAndSize ((const char *) hv.data (),
- hv.size());
+ hv.size());
return object;
}
try
{
struct symbol *sym = lookup_global_symbol_from_objfile
- (obj->objfile, GLOBAL_BLOCK, symbol_name, (domain_enum) domain).symbol;
+ (obj->objfile, GLOBAL_BLOCK, symbol_name, (domain_enum) domain).symbol;
if (sym == nullptr)
Py_RETURN_NONE;
try
{
struct symbol *sym = lookup_global_symbol_from_objfile
- (obj->objfile, STATIC_BLOCK, symbol_name, (domain_enum) domain).symbol;
+ (obj->objfile, STATIC_BLOCK, symbol_name, (domain_enum) domain).symbol;
if (sym == nullptr)
Py_RETURN_NONE;
3. Other. Always print a ",". */
if (i == 0)
{
- if (is_py_none)
- fputs_filtered ("{", stream);
- else
- fputs_filtered (" = {", stream);
+ if (is_py_none)
+ fputs_filtered ("{", stream);
+ else
+ fputs_filtered (" = {", stream);
}
else if (! is_map || i % 2 == 0)
{
long value;
if (gdb_py_int_as_long (pyo_reg_id, &value) && (int) value == value)
- {
+ {
if (user_reg_map_regnum_to_name (gdbarch, value) != NULL)
{
*reg_num = (int) value;
return true;
}
- }
+ }
}
/* The register could be a gdb.RegisterDescriptor object. */
else if (PyObject_IsInstance (pyo_reg_id,
if (signal_name_obj == NULL)
return NULL;
if (evpy_add_attribute (signal_event_obj.get (),
- "stop_signal",
- signal_name_obj.get ()) < 0)
+ "stop_signal",
+ signal_name_obj.get ()) < 0)
return NULL;
return signal_event_obj;
for (current_bs = bs; current_bs != NULL; current_bs = current_bs->next)
{
if (current_bs->breakpoint_at
- && current_bs->breakpoint_at->py_bp_object)
- {
- PyObject *current_py_bp =
- (PyObject *) current_bs->breakpoint_at->py_bp_object;
-
- if (list == NULL)
- {
- list.reset (PyList_New (0));
- if (list == NULL)
+ && current_bs->breakpoint_at->py_bp_object)
+ {
+ PyObject *current_py_bp =
+ (PyObject *) current_bs->breakpoint_at->py_bp_object;
+
+ if (list == NULL)
+ {
+ list.reset (PyList_New (0));
+ if (list == NULL)
return -1;
- }
+ }
- if (PyList_Append (list.get (), current_py_bp))
+ if (PyList_Append (list.get (), current_py_bp))
return -1;
- if (first_bp == NULL)
- first_bp = current_py_bp;
- }
+ if (first_bp == NULL)
+ first_bp = current_py_bp;
+ }
}
if (list != NULL)
extern void stop_evpy_dealloc (PyObject *self);
extern int emit_stop_event (struct bpstats *bs,
- enum gdb_signal stop_signal);
+ enum gdb_signal stop_signal);
extern gdbpy_ref<> create_breakpoint_event_object (PyObject *breakpoint_list,
PyObject *first_bp);
return NULL;
if (evpy_add_attribute (thread_event_obj.get (),
- "inferior_thread",
- thread) < 0)
+ "inferior_thread",
+ thread) < 0)
return NULL;
return thread_event_obj;
#define REQUIRE_WINDOW(Window) \
do { \
if ((Window)->window == nullptr) \
- return PyErr_Format (PyExc_RuntimeError, \
- _("TUI window is invalid.")); \
+ return PyErr_Format (PyExc_RuntimeError, \
+ _("TUI window is invalid.")); \
} while (0)
/* Python function which checks the validity of a TUI window
try
{
if ((value = value_object_to_value (pyo_value)) != NULL)
- {
- *addr = unpack_pointer (value_type (value),
- value_contents (value));
- rc = 1;
- }
+ {
+ *addr = unpack_pointer (value_type (value),
+ value_contents (value));
+ rc = 1;
+ }
}
catch (const gdb_exception &except)
{
static int
pyuw_object_attribute_to_pointer (PyObject *pyo, const char *attr_name,
- CORE_ADDR *addr)
+ CORE_ADDR *addr)
{
int rc = 0;
gdbpy_ref<> pyo_value (PyObject_GetAttrString (pyo, attr_name));
if (pyo_value != NULL && pyo_value != Py_None)
- {
- rc = pyuw_value_obj_to_pointer (pyo_value.get (), addr);
- if (!rc)
- PyErr_Format (
- PyExc_ValueError,
- _("The value of the '%s' attribute is not a pointer."),
- attr_name);
- }
+ {
+ rc = pyuw_value_obj_to_pointer (pyo_value.get (), addr);
+ if (!rc)
+ PyErr_Format (
+ PyExc_ValueError,
+ _("The value of the '%s' attribute is not a pointer."),
+ attr_name);
+ }
}
return rc;
}
stb.printf ("\nSaved registers: (");
for (const saved_reg ® : *unwind_info->saved_regs)
{
- struct value *value = value_object_to_value (reg.value.get ());
-
- stb.printf ("%s(%d, ", sep, reg.number);
- if (value != NULL)
- {
- try
- {
- value_print (value, &stb, &opts);
- stb.puts (")");
- }
- catch (const gdb_exception &except)
- {
- GDB_PY_HANDLE_EXCEPTION (except);
- }
- }
- else
- stb.puts ("<BAD>)");
- sep = ", ";
+ struct value *value = value_object_to_value (reg.value.get ());
+
+ stb.printf ("%s(%d, ", sep, reg.number);
+ if (value != NULL)
+ {
+ try
+ {
+ value_print (value, &stb, &opts);
+ stb.puts (")");
+ }
+ catch (const gdb_exception &except)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ }
+ else
+ stb.puts ("<BAD>)");
+ sep = ", ";
}
stb.puts (")");
}
static PyObject *
pyuw_create_unwind_info (PyObject *pyo_pending_frame,
- struct frame_id frame_id)
+ struct frame_id frame_id)
{
unwind_info_object *unwind_info
= PyObject_New (unwind_info_object, &unwind_info_object_type);
if (((pending_frame_object *) pyo_pending_frame)->frame_info == NULL)
{
PyErr_SetString (PyExc_ValueError,
- "Attempting to use stale PendingFrame");
+ "Attempting to use stale PendingFrame");
return NULL;
}
unwind_info->frame_id = frame_id;
if (pending_frame->frame_info == NULL)
{
PyErr_SetString (PyExc_ValueError,
- "UnwindInfo instance refers to a stale PendingFrame");
+ "UnwindInfo instance refers to a stale PendingFrame");
return NULL;
}
if (!PyArg_UnpackTuple (args, "previous_frame_register", 2, 2,
- &pyo_reg_id, &pyo_reg_value))
+ &pyo_reg_id, &pyo_reg_value))
return NULL;
if (!gdbpy_parse_register_id (pending_frame->gdbarch, pyo_reg_id, ®num))
{
if (pyo_reg_value == NULL
|| (value = value_object_to_value (pyo_reg_value)) == NULL)
{
- PyErr_SetString (PyExc_ValueError, "Bad register value");
- return NULL;
+ PyErr_SetString (PyExc_ValueError, "Bad register value");
+ return NULL;
}
data_size = register_size (pending_frame->gdbarch, regnum);
if (data_size != TYPE_LENGTH (value_type (value)))
{
- PyErr_Format (
- PyExc_ValueError,
- "The value of the register returned by the Python "
- "sniffer has unexpected size: %u instead of %u.",
- (unsigned) TYPE_LENGTH (value_type (value)),
- (unsigned) data_size);
- return NULL;
+ PyErr_Format (
+ PyExc_ValueError,
+ "The value of the register returned by the Python "
+ "sniffer has unexpected size: %u instead of %u.",
+ (unsigned) TYPE_LENGTH (value_type (value)),
+ (unsigned) data_size);
+ return NULL;
}
}
{
bool found = false;
for (saved_reg ® : *unwind_info->saved_regs)
{
- if (regnum == reg.number)
- {
+ if (regnum == reg.number)
+ {
found = true;
reg.value = std::move (new_value);
- break;
- }
+ break;
+ }
}
if (!found)
unwind_info->saved_regs->emplace_back (regnum, std::move (new_value));
if (pending_frame->frame_info == NULL)
{
PyErr_SetString (PyExc_ValueError,
- "Attempting to read register from stale PendingFrame");
+ "Attempting to read register from stale PendingFrame");
return NULL;
}
if (!PyArg_UnpackTuple (args, "read_register", 1, 1, &pyo_reg_id))
handle the user register case. */
val = value_of_register (regnum, pending_frame->frame_info);
if (val == NULL)
- PyErr_Format (PyExc_ValueError,
- "Cannot read register %d from frame.",
- regnum);
+ PyErr_Format (PyExc_ValueError,
+ "Cannot read register %d from frame.",
+ regnum);
}
catch (const gdb_exception &except)
{
if (!pyuw_object_attribute_to_pointer (pyo_frame_id, "sp", &sp))
{
PyErr_SetString (PyExc_ValueError,
- _("frame_id should have 'sp' attribute."));
+ _("frame_id should have 'sp' attribute."));
return NULL;
}
return pyuw_create_unwind_info (self, frame_id_build (sp, pc));
else
return pyuw_create_unwind_info (self,
- frame_id_build_special (sp, pc, special));
+ frame_id_build_special (sp, pc, special));
}
/* Implementation of PendingFrame.architecture (self) -> gdb.Architecture. */
if (pending_frame->frame_info == NULL)
{
PyErr_SetString (PyExc_ValueError,
- "Attempting to read register from stale PendingFrame");
+ "Attempting to read register from stale PendingFrame");
return NULL;
}
return gdbarch_to_arch_object (pending_frame->gdbarch);
static void
pyuw_this_id (struct frame_info *this_frame, void **cache_ptr,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
*this_id = ((cached_frame_info *) *cache_ptr)->frame_id;
if (pyuw_debug >= 1)
static struct value *
pyuw_prev_register (struct frame_info *this_frame, void **cache_ptr,
- int regnum)
+ int regnum)
{
cached_frame_info *cached_frame = (cached_frame_info *) *cache_ptr;
cached_reg_t *reg_info = cached_frame->reg;
cached_reg_t *reg_info_end = reg_info + cached_frame->reg_count;
TRACE_PY_UNWIND (1, "%s (frame=%p,...,reg=%d)\n", __FUNCTION__, this_frame,
- regnum);
+ regnum);
for (; reg_info < reg_info_end; ++reg_info)
{
if (regnum == reg_info->num)
- return frame_unwind_got_bytes (this_frame, regnum, reg_info->data);
+ return frame_unwind_got_bytes (this_frame, regnum, reg_info->data);
}
return frame_unwind_got_optimized (this_frame, regnum);
static int
pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame,
- void **cache_ptr)
+ void **cache_ptr)
{
struct gdbarch *gdbarch = (struct gdbarch *) (self->unwind_data);
cached_frame_info *cached_frame;
gdbpy_enter enter_py (gdbarch, current_language);
TRACE_PY_UNWIND (3, "%s (SP=%s, PC=%s)\n", __FUNCTION__,
- paddress (gdbarch, get_frame_sp (this_frame)),
- paddress (gdbarch, get_frame_pc (this_frame)));
+ paddress (gdbarch, get_frame_sp (this_frame)),
+ paddress (gdbarch, get_frame_pc (this_frame)));
/* Create PendingFrame instance to pass to sniffers. */
pending_frame_object *pfo = PyObject_New (pending_frame_object,
|| ! PyObject_HasAttrString (gdb_python_module, "_execute_unwinders"))
{
PyErr_SetString (PyExc_NameError,
- "Installation error: gdb._execute_unwinders function "
- "is missing");
+ "Installation error: gdb._execute_unwinders function "
+ "is missing");
gdbpy_print_stack ();
return 0;
}
/* Received UnwindInfo, cache data. */
if (PyObject_IsInstance (pyo_unwind_info.get (),
- (PyObject *) &unwind_info_object_type) <= 0)
+ (PyObject *) &unwind_info_object_type) <= 0)
error (_("A Unwinder should return gdb.UnwindInfo instance."));
{
{
saved_reg *reg = &(*unwind_info->saved_regs)[i];
- struct value *value = value_object_to_value (reg->value.get ());
- size_t data_size = register_size (gdbarch, reg->number);
+ struct value *value = value_object_to_value (reg->value.get ());
+ size_t data_size = register_size (gdbarch, reg->number);
cached_frame->reg[i].num = reg->number;
- /* `value' validation was done before, just assert. */
- gdb_assert (value != NULL);
- gdb_assert (data_size == TYPE_LENGTH (value_type (value)));
+ /* `value' validation was done before, just assert. */
+ gdb_assert (value != NULL);
+ gdb_assert (data_size == TYPE_LENGTH (value_type (value)));
cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
- memcpy (cached_frame->reg[i].data, value_contents (value), data_size);
+ memcpy (cached_frame->reg[i].data, value_contents (value), data_size);
}
}
if (!data->unwinder_registered)
{
struct frame_unwind *unwinder
- = GDBARCH_OBSTACK_ZALLOC (newarch, struct frame_unwind);
+ = GDBARCH_OBSTACK_ZALLOC (newarch, struct frame_unwind);
unwinder->type = NORMAL_FRAME;
unwinder->stop_reason = default_frame_unwind_stop_reason;
int rc;
add_setshow_zuinteger_cmd
("py-unwind", class_maintenance, &pyuw_debug,
- _("Set Python unwinder debugging."),
- _("Show Python unwinder debugging."),
- _("When non-zero, Python unwinder debugging is enabled."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ _("Set Python unwinder debugging."),
+ _("Show Python unwinder debugging."),
+ _("When non-zero, Python unwinder debugging is enabled."),
+ NULL,
+ NULL,
+ &setdebuglist, &showdebuglist);
pyuw_gdbarch_data
= gdbarch_data_register_post_init (pyuw_gdbarch_data_init);
gdb::observers::architecture_changed.attach (pyuw_on_new_gdbarch);
&& PyObject_GetBuffer (obj, &py_buf, PyBUF_SIMPLE) == 0)
{
/* Got a buffer, py_buf, out of obj. Cause it to be released
- when it goes out of scope. */
+ when it goes out of scope. */
buffer_up.reset (&py_buf);
}
else
{
type = type_object_to_type (type_obj);
if (type == nullptr)
- {
+ {
PyErr_SetString (PyExc_TypeError,
_("type argument must be a gdb.Type."));
return nullptr;
self_val = ((value_object *) self)->value;
switch (check_typedef (value_type (self_val))->code ())
- {
- case TYPE_CODE_PTR:
- res_val = value_ind (self_val);
- break;
- case TYPE_CODE_REF:
- case TYPE_CODE_RVALUE_REF:
- res_val = coerce_ref (self_val);
- break;
- default:
- error(_("Trying to get the referenced value from a value which is "
- "neither a pointer nor a reference."));
- }
+ {
+ case TYPE_CODE_PTR:
+ res_val = value_ind (self_val);
+ break;
+ case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
+ res_val = coerce_ref (self_val);
+ break;
+ default:
+ error(_("Trying to get the referenced value from a value which is "
+ "neither a pointer nor a reference."));
+ }
result = value_to_value_object (res_val);
}
{
PyErr_SetString (PyExc_AttributeError,
_("gdb.Field object has no name and no "
- "'bitpos' attribute."));
+ "'bitpos' attribute."));
return NULL;
}
res_val = value_cast (lookup_pointer_type (base_class_type), tmp);
else if (val_type->code () == TYPE_CODE_REF)
res_val = value_cast (lookup_lvalue_reference_type (base_class_type),
- tmp);
+ tmp);
else if (val_type->code () == TYPE_CODE_RVALUE_REF)
res_val = value_cast (lookup_rvalue_reference_type (base_class_type),
- tmp);
+ tmp);
else
res_val = value_cast (base_class_type, tmp);
}
if (PyErr_Occurred ())
{
/* If the error was an overflow, we can try converting to
- ULONGEST instead. */
+ ULONGEST instead. */
if (PyErr_ExceptionMatches (PyExc_OverflowError))
{
gdbpy_err_fetch fetched_error;
else if (TYPE_IS_REFERENCE (obj_type))
{
struct type *this_ref
- = lookup_reference_type (this_type, obj_type->code ());
+ = lookup_reference_type (this_type, obj_type->code ());
if (!types_equal (obj_type, this_ref))
obj = value_cast (this_ref, obj);
#define BPPY_REQUIRE_VALID(Breakpoint) \
do { \
if ((Breakpoint)->bp == NULL) \
- return PyErr_Format (PyExc_RuntimeError, \
- _("Breakpoint %d is invalid."), \
- (Breakpoint)->number); \
+ return PyErr_Format (PyExc_RuntimeError, \
+ _("Breakpoint %d is invalid."), \
+ (Breakpoint)->number); \
} while (0)
/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python
#define BPPY_SET_REQUIRE_VALID(Breakpoint) \
do { \
if ((Breakpoint)->bp == NULL) \
- { \
- PyErr_Format (PyExc_RuntimeError, _("Breakpoint %d is invalid."), \
- (Breakpoint)->number); \
- return -1; \
- } \
+ { \
+ PyErr_Format (PyExc_RuntimeError, _("Breakpoint %d is invalid."), \
+ (Breakpoint)->number); \
+ return -1; \
+ } \
} while (0)
if (Exception.reason < 0) \
{ \
gdbpy_convert_exception (Exception); \
- return NULL; \
+ return NULL; \
} \
} while (0)
#define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \
do { \
if (Exception.reason < 0) \
- { \
+ { \
gdbpy_convert_exception (Exception); \
return -1; \
} \
if (return_value == nullptr)
{
/* Use PyErr_PrintEx instead of gdbpy_print_stack to better match the
- behavior of the non-Windows codepath. */
+ behavior of the non-Windows codepath. */
PyErr_PrintEx(0);
}
try
{
switch (stream_type)
- {
- case 1:
- {
+ {
+ case 1:
+ {
fprintf_filtered (gdb_stderr, "%s", arg);
break;
- }
- case 2:
- {
+ }
+ case 2:
+ {
fprintf_filtered (gdb_stdlog, "%s", arg);
break;
- }
- default:
- fprintf_filtered (gdb_stdout, "%s", arg);
- }
+ }
+ default:
+ fprintf_filtered (gdb_stdout, "%s", arg);
+ }
}
catch (const gdb_exception &except)
{
/* Define all the event objects. */
#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
PyTypeObject name##_event_object_type \
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \
= { \
PyVarObject_HEAD_INIT (NULL, 0) \
"gdb." py_name, /* tp_name */ \
&show_ravenscar_list, "show ravenscar ", 0, &showlist);
add_setshow_boolean_cmd ("task-switching", class_obscure,
- &ravenscar_task_support, _("\
+ &ravenscar_task_support, _("\
Enable or disable support for GNAT Ravenscar tasks."), _("\
Show whether support for GNAT Ravenscar tasks is enabled."),
- _("\
+ _("\
Enable or disable support for task/thread switching with the GNAT\n\
Ravenscar run-time library for bareboard configuration."),
NULL, show_ravenscar_task_switching_command,
do \
{ \
if (record_debug != 0) \
- fprintf_unfiltered (gdb_stdlog, \
+ fprintf_unfiltered (gdb_stdlog, \
"[record-btrace] " msg "\n", ##args); \
} \
while (0)
gdb_pretty_print_disassembler disasm (gdbarch, uiout);
for (btrace_insn_iterator it = *begin; btrace_insn_cmp (&it, end) != 0;
- btrace_insn_next (&it, 1))
+ btrace_insn_next (&it, 1))
{
const struct btrace_insn *insn;
record_full_list serves two functions:
1) In record mode, it anchors the end of the list.
2) In replay mode, it traverses the list and points to
- the next instruction that must be emulated.
+ the next instruction that must be emulated.
record_full_arch_list_head and record_full_arch_list_tail are used
to manage a separate list, which is used to build up the change
{
gdb::byte_vector reg (entry->u.reg.len);
- if (record_debug > 1)
- fprintf_unfiltered (gdb_stdlog,
- "Process record: record_full_reg %s to "
- "inferior num = %d.\n",
- host_address_to_string (entry),
- entry->u.reg.num);
+ if (record_debug > 1)
+ fprintf_unfiltered (gdb_stdlog,
+ "Process record: record_full_reg %s to "
+ "inferior num = %d.\n",
+ host_address_to_string (entry),
+ entry->u.reg.num);
- regcache->cooked_read (entry->u.reg.num, reg.data ());
- regcache->cooked_write (entry->u.reg.num, record_full_get_loc (entry));
- memcpy (record_full_get_loc (entry), reg.data (), entry->u.reg.len);
+ regcache->cooked_read (entry->u.reg.num, reg.data ());
+ regcache->cooked_write (entry->u.reg.num, record_full_get_loc (entry));
+ memcpy (record_full_get_loc (entry), reg.data (), entry->u.reg.len);
}
break;
case record_full_mem: /* mem */
{
/* Nothing to do if the entry is flagged not_accessible. */
- if (!entry->u.mem.mem_entry_not_accessible)
- {
+ if (!entry->u.mem.mem_entry_not_accessible)
+ {
gdb::byte_vector mem (entry->u.mem.len);
- if (record_debug > 1)
- fprintf_unfiltered (gdb_stdlog,
- "Process record: record_full_mem %s to "
- "inferior addr = %s len = %d.\n",
- host_address_to_string (entry),
- paddress (gdbarch, entry->u.mem.addr),
- entry->u.mem.len);
+ if (record_debug > 1)
+ fprintf_unfiltered (gdb_stdlog,
+ "Process record: record_full_mem %s to "
+ "inferior addr = %s len = %d.\n",
+ host_address_to_string (entry),
+ paddress (gdbarch, entry->u.mem.addr),
+ entry->u.mem.len);
- if (record_read_memory (gdbarch,
+ if (record_read_memory (gdbarch,
entry->u.mem.addr, mem.data (),
entry->u.mem.len))
entry->u.mem.mem_entry_not_accessible = 1;
- else
- {
- if (target_write_memory (entry->u.mem.addr,
+ else
+ {
+ if (target_write_memory (entry->u.mem.addr,
record_full_get_loc (entry),
entry->u.mem.len))
- {
- entry->u.mem.mem_entry_not_accessible = 1;
- if (record_debug)
- warning (_("Process record: error writing memory at "
+ {
+ entry->u.mem.mem_entry_not_accessible = 1;
+ if (record_debug)
+ warning (_("Process record: error writing memory at "
"addr = %s len = %d."),
- paddress (gdbarch, entry->u.mem.addr),
- entry->u.mem.len);
- }
- else
+ paddress (gdbarch, entry->u.mem.addr),
+ entry->u.mem.len);
+ }
+ else
{
memcpy (record_full_get_loc (entry), mem.data (),
entry->u.mem.len);
entry->u.mem.addr, entry->u.mem.len))
record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
}
- }
- }
+ }
+ }
}
break;
}
record_full_message (get_current_regcache (), signal);
if (!step)
- {
- /* This is not hard single step. */
- if (!gdbarch_software_single_step_p (gdbarch))
- {
- /* This is a normal continue. */
- step = 1;
- }
- else
- {
- /* This arch supports soft single step. */
- if (thread_has_single_step_breakpoints_set (inferior_thread ()))
- {
- /* This is a soft single step. */
- record_full_resume_step = 1;
- }
- else
+ {
+ /* This is not hard single step. */
+ if (!gdbarch_software_single_step_p (gdbarch))
+ {
+ /* This is a normal continue. */
+ step = 1;
+ }
+ else
+ {
+ /* This arch supports soft single step. */
+ if (thread_has_single_step_breakpoints_set (inferior_thread ()))
+ {
+ /* This is a soft single step. */
+ record_full_resume_step = 1;
+ }
+ else
step = !insert_single_step_breakpoints (gdbarch);
- }
- }
+ }
+ }
/* Make sure the target beneath reports all signals. */
target_pass_signals ({});
}
for (thread_info *tp : all_non_exited_threads ())
- delete_single_step_breakpoints (tp);
+ delete_single_step_breakpoints (tp);
if (record_full_resume_step)
return ret;
else
{
/* This is a single-step trap. Record the
- insn and issue another step.
- FIXME: this part can be a random SIGTRAP too.
- But GDB cannot handle it. */
- int step = 1;
+ insn and issue another step.
+ FIXME: this part can be a random SIGTRAP too.
+ But GDB cannot handle it. */
+ int step = 1;
if (!record_full_message_wrapper_safe (regcache,
GDB_SIGNAL_0))
{
- status->kind = TARGET_WAITKIND_STOPPED;
- status->value.sig = GDB_SIGNAL_0;
- break;
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = GDB_SIGNAL_0;
+ break;
}
- if (gdbarch_software_single_step_p (gdbarch))
+ if (gdbarch_software_single_step_p (gdbarch))
{
process_stratum_target *proc_target
= current_inferior ()->process_target ();
if (!n)
{
/* Invalidate the value of regcache that was set in function
- "regcache_raw_write". */
+ "regcache_raw_write". */
if (regno < 0)
{
int i;
{
/* Let user choose if he wants to write memory or not. */
if (!query (_("Because GDB is in replay mode, writing to memory "
- "will make the execution log unusable from this "
- "point onward. Write memory at address %s?"),
+ "will make the execution log unusable from this "
+ "point onward. Write memory at address %s?"),
paddress (target_gdbarch (), offset)))
error (_("Process record canceled the operation."));
entry = XNEW (struct record_full_core_buf_entry);
entry->p = &p;
if (!bfd_malloc_and_get_section
- (p.the_bfd_section->owner,
+ (p.the_bfd_section->owner,
p.the_bfd_section,
&entry->buf))
{
1 byte: record type (record_full_reg, see enum record_full_type).
4 bytes: register id (network byte order).
n bytes: register value (n == actual register size).
- (eg. 4 bytes for x86 general registers).
+ (eg. 4 bytes for x86 general registers).
record_full_mem:
1 byte: record type (record_full_mem, see enum record_full_type).
4 bytes: memory length (network byte order).
{
record_full_insn_max_num = record_full_insn_num;
warning (_("Auto increase record/replay buffer limit to %u."),
- record_full_insn_max_num);
+ record_full_insn_max_num);
}
/* Succeeded. */
{
/* Check for beginning and end of log. */
if (record_full_list == &record_full_first)
- break;
+ break;
record_full_exec_insn (regcache, gdbarch, record_full_list);
if (record_full_list->prev)
- record_full_list = record_full_list->prev;
+ record_full_list = record_full_list->prev;
}
/* Compute the size needed for the extra bfd section. */
/* Make the new bfd section. */
osec = bfd_make_section_anyway_with_flags (obfd.get (), "precord",
- SEC_HAS_CONTENTS
- | SEC_READONLY);
+ SEC_HAS_CONTENTS
+ | SEC_READONLY);
if (osec == NULL)
error (_("Failed to create 'precord' section for corefile %s: %s"),
recfilename,
- bfd_errmsg (bfd_get_error ()));
+ bfd_errmsg (bfd_get_error ()));
bfd_set_section_size (osec, save_size);
bfd_set_section_vma (osec, 0);
bfd_set_section_alignment (osec, 0);
{
/* Save entry. */
if (record_full_list != &record_full_first)
- {
+ {
uint8_t type;
uint32_t regnum, len, signal, count;
- uint64_t addr;
+ uint64_t addr;
type = record_full_list->type;
- bfdcore_write (obfd.get (), osec, &type, sizeof (type), &bfd_offset);
+ bfdcore_write (obfd.get (), osec, &type, sizeof (type), &bfd_offset);
- switch (record_full_list->type)
- {
- case record_full_reg: /* reg */
+ switch (record_full_list->type)
+ {
+ case record_full_reg: /* reg */
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
" Writing register %d (1 "
(unsigned long) sizeof (regnum),
record_full_list->u.reg.len);
- /* Write regnum. */
- regnum = netorder32 (record_full_list->u.reg.num);
- bfdcore_write (obfd.get (), osec, ®num,
+ /* Write regnum. */
+ regnum = netorder32 (record_full_list->u.reg.num);
+ bfdcore_write (obfd.get (), osec, ®num,
sizeof (regnum), &bfd_offset);
- /* Write regval. */
- bfdcore_write (obfd.get (), osec,
+ /* Write regval. */
+ bfdcore_write (obfd.get (), osec,
record_full_get_loc (record_full_list),
record_full_list->u.reg.len, &bfd_offset);
- break;
+ break;
- case record_full_mem: /* mem */
+ case record_full_mem: /* mem */
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
" Writing memory %s (1 plus "
bfdcore_write (obfd.get (), osec,
record_full_get_loc (record_full_list),
record_full_list->u.mem.len, &bfd_offset);
- break;
+ break;
- case record_full_end:
+ case record_full_end:
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
" Writing record_full_end (1 + "
count = netorder32 (record_full_list->u.end.insn_num);
bfdcore_write (obfd.get (), osec, &count,
sizeof (count), &bfd_offset);
- break;
- }
- }
+ break;
+ }
+ }
/* Execute entry. */
record_full_exec_insn (regcache, gdbarch, record_full_list);
if (record_full_list->next)
- record_full_list = record_full_list->next;
+ record_full_list = record_full_list->next;
else
- break;
+ break;
}
/* Reverse execute to cur_record_full_list. */
{
/* Check for beginning and end of log. */
if (record_full_list == cur_record_full_list)
- break;
+ break;
record_full_exec_insn (regcache, gdbarch, record_full_list);
if (record_full_list->prev)
- record_full_list = record_full_list->prev;
+ record_full_list = record_full_list->prev;
}
unlink_file.keep ();
/* Count down record_full_insn_num while releasing records from list. */
while (record_full_insn_num > record_full_insn_max_num)
{
- record_full_list_release_first ();
- record_full_insn_num--;
+ record_full_list_release_first ();
+ record_full_insn_num--;
}
}
}
add_setshow_boolean_cmd ("memory-query", no_class,
&record_full_memory_query, _("\
Set whether query if PREC cannot record memory change of next instruction."),
- _("\
+ _("\
Show whether query if PREC cannot record memory change of next instruction."),
- _("\
+ _("\
Default is OFF.\n\
When ON, query if PREC cannot record memory change of next instruction."),
NULL, NULL,
{
/* Default recfile name is "gdb_record.PID". */
xsnprintf (recfilename_buffer, sizeof (recfilename_buffer),
- "gdb_record.%d", inferior_ptid.pid ());
+ "gdb_record.%d", inferior_ptid.pid ());
recfilename = recfilename_buffer;
}
add_cmd ("delete", class_obscure, cmd_record_delete,
_("Delete the rest of execution log and start recording it anew."),
- &record_cmdlist);
+ &record_cmdlist);
add_alias_cmd ("d", "delete", class_obscure, 1, &record_cmdlist);
add_alias_cmd ("del", "delete", class_obscure, 1, &record_cmdlist);
add_cmd ("stop", class_obscure, cmd_record_stop,
_("Stop the record/replay target."),
- &record_cmdlist);
+ &record_cmdlist);
add_alias_cmd ("s", "stop", class_obscure, 1, &record_cmdlist);
add_prefix_cmd ("goto", class_obscure, cmd_record_goto, _("\
from the first argument.\n\
The number of instructions to disassemble can be defined with \"set record \
instruction-history-size\"."),
- &record_cmdlist);
+ &record_cmdlist);
add_cmd ("function-call-history", class_obscure, cmd_record_call_history, _("\
Prints the execution history at function granularity.\n\
from the first argument.\n\
The number of functions to print can be defined with \"set record \
function-call-history-size\"."),
- &record_cmdlist);
+ &record_cmdlist);
/* Sync command control variables. */
record_insn_history_size_setshow_var = record_insn_history_size;
}
/* Note: If you change this, be sure to also update the
- documentation. */
+ documentation. */
fprintf_unfiltered (file, "\n");
/* Data structure describing a register set. */
typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
- int, const void *, size_t);
+ int, const void *, size_t);
typedef void (collect_regset_ftype) (const struct regset *,
- const struct regcache *,
- int, void *, size_t);
+ const struct regcache *,
+ int, void *, size_t);
struct regset
{
remote_fio_data.fd_map[1] = FIO_FD_CONSOLE_OUT;
remote_fio_data.fd_map[2] = FIO_FD_CONSOLE_OUT;
for (i = 3; i < 10; ++i)
- remote_fio_data.fd_map[i] = FIO_FD_INVALID;
+ remote_fio_data.fd_map[i] = FIO_FD_INVALID;
}
return 3;
}
switch (num)
{
case FILEIO_SEEK_SET:
- *flag = SEEK_SET;
+ *flag = SEEK_SET;
break;
case FILEIO_SEEK_CUR:
- *flag = SEEK_CUR;
+ *flag = SEEK_CUR;
break;
case FILEIO_SEEK_END:
- *flag = SEEK_END;
+ *flag = SEEK_END;
break;
default:
- return -1;
+ return -1;
}
return 0;
}
{
*retlong <<= 4;
if (**buf >= '0' && **buf <= '9')
- *retlong += **buf - '0';
+ *retlong += **buf - '0';
else if (**buf >= 'a' && **buf <= 'f')
- *retlong += **buf - 'a' + 10;
+ *retlong += **buf - 'a' + 10;
else if (**buf >= 'A' && **buf <= 'F')
- *retlong += **buf - 'A' + 10;
+ *retlong += **buf - 'A' + 10;
else
- return -1;
+ return -1;
}
*retlong *= sign;
*buf = c;
if (error || ctrl_c)
{
if (error && ctrl_c)
- error = FILEIO_EINTR;
+ error = FILEIO_EINTR;
if (error < 0)
- {
+ {
strcat (buf, "-");
error = -error;
}
sprintf (buf + strlen (buf), ",%x", error);
if (ctrl_c)
- strcat (buf, ",C");
+ strcat (buf, ",C");
}
quit_handler = remote_fileio_o_quit_handler;
putpkt (remote, buf);
if (ret == -1)
{
/* Special case: newpath is a non-empty directory. Some systems
- return ENOTEMPTY, some return EEXIST. We coerce that to be
+ return ENOTEMPTY, some return EEXIST. We coerce that to be
always EEXIST. */
if (errno == ENOTEMPTY)
- errno = EEXIST;
+ errno = EEXIST;
#ifdef __CYGWIN__
/* Workaround some Cygwin problems with correct errnos. */
if (errno == EACCES)
- {
+ {
if (!of && !nf && S_ISDIR (nst.st_mode))
{
if (S_ISREG (ost.st_mode))
if (!gettimeofday (&tv, NULL))
st.st_atime = st.st_mtime = st.st_ctime = tv.tv_sec;
else
- st.st_atime = st.st_mtime = st.st_ctime = (time_t) 0;
+ st.st_atime = st.st_mtime = st.st_ctime = (time_t) 0;
ret = 0;
}
else
int val = strtoul (args, &arg_end, 10);
if (*args && *arg_end == '\0')
- {
+ {
remote_fio_system_call_allowed = !!val;
return;
}
/* FIXME: This is a good reason to drop the packet. */
/* Possibly, there is a duplicate response. */
/* Possibilities :
- retransmit immediatly - race conditions
- retransmit after timeout - yes
- exit
- wait for packet, then exit
+ retransmit immediatly - race conditions
+ retransmit after timeout - yes
+ exit
+ wait for packet, then exit
*/
warning (_("HMM: threadlist did not echo arg thread, dropping it."));
return 0; /* I choose simply exiting. */
{
auto match_ptid = [&] (const thread_item &item)
{
- return item.ptid == ptid;
+ return item.ptid == ptid;
};
auto it = std::remove_if (this->items.begin (),
result = read_ptid (&rs->buf[2], &obuf);
if (*obuf != '\0' && remote_debug)
- fprintf_unfiltered (gdb_stdlog,
- "warning: garbage in qC reply\n");
+ fprintf_unfiltered (gdb_stdlog,
+ "warning: garbage in qC reply\n");
return result;
}
if (remote_debug)
fprintf_unfiltered (gdb_stdlog,
- "warning: couldn't determine remote "
+ "warning: couldn't determine remote "
"current thread; picking first in list.\n");
for (thread_info *tp : all_non_exited_threads (this,
getpkt (&rs->buf, 0);
if (packet_check_result (rs->buf) == PACKET_ERROR)
error (_("Could not read registers; remote failure reply '%s'"),
- rs->buf.data ());
+ rs->buf.data ());
/* We can get out of synch in various cases. If the first character
in the buffer is not a hex character, assume that has happened
}
/* Looks valid enough, we can assume this is the correct length
- for a 'g' packet. It's important not to adjust
- rsa->sizeof_g_packet if we have truncated registers otherwise
- this "if" won't be run the next time the method is called
- with a packet of the same size and one of the internal errors
- below will trigger instead. */
+ for a 'g' packet. It's important not to adjust
+ rsa->sizeof_g_packet if we have truncated registers otherwise
+ this "if" won't be run the next time the method is called
+ with a packet of the same size and one of the internal errors
+ below will trigger instead. */
rsa->sizeof_g_packet = sizeof_g_packet;
}
&& address_size < (sizeof (ULONGEST) * 8))
{
/* Only create a mask when that mask can safely be constructed
- in a ULONGEST variable. */
+ in a ULONGEST variable. */
ULONGEST mask = 1;
mask = (mask << address_size) - 1;
*p++ = ',';
/* Append the length and retain its location and size. It may need to be
- adjusted once the packet body has been created. */
+ adjusted once the packet body has been created. */
plen = p;
plenlen = hexnumstr (p, (ULONGEST) todo_units);
p += plenlen;
/* If this is a no acks version of the remote protocol, send the
packet and move on. */
if (rs->noack_mode)
- break;
+ break;
/* Read until either a timeout occurs (-2) or '+' is read.
Handle any notification that arrives in the mean time. */
break; /* Retransmit buffer. */
case '$':
{
- if (remote_debug)
+ if (remote_debug)
fprintf_unfiltered (gdb_stdlog,
"Packet instead of Ack, ignoring it\n");
/* It's probably an old response sent because an ACK
#if 0
/* This is wrong. If doing a long backtrace, the user should be
- able to get out next time we call QUIT, without anything as
- violent as interrupt_query. If we want to provide a way out of
- here without getting to the next QUIT, it should be based on
- hitting ^C twice as in remote_wait. */
+ able to get out next time we call QUIT, without anything as
+ violent as interrupt_query. If we want to provide a way out of
+ here without getting to the next QUIT, it should be based on
+ hitting ^C twice as in remote_wait. */
if (quit_flag)
{
quit_flag = 0;
pktcsum = (fromhex (check_0) << 4) | fromhex (check_1);
if (csum == pktcsum)
- return bc;
+ return bc;
if (remote_debug)
{
pktcsum, csum, str.c_str ());
}
/* Number of characters in buffer ignoring trailing
- NULL. */
+ NULL. */
return -1;
}
case '*': /* Run length encoding. */
- {
+ {
int repeat;
csum += c;
{
case PACKET_ERROR:
if (rs->buf[1] == '.')
- {
- message = strchr (&rs->buf[2], '.');
- if (message)
- error (_("Remote failure reply: %s"), message + 1);
- }
+ {
+ message = strchr (&rs->buf[2], '.');
+ if (message)
+ error (_("Remote failure reply: %s"), message + 1);
+ }
return -1;
case PACKET_UNKNOWN:
return -1;
gdb_assert (rs->remote_desc);
return remote_read_qxfer
("osdata", annex, readbuf, offset, len, xfered_len,
- &remote_protocol_packets[PACKET_qXfer_osdata]);
+ &remote_protocol_packets[PACKET_qXfer_osdata]);
case TARGET_OBJECT_THREADS:
gdb_assert (annex == NULL);
case TARGET_OBJECT_BTRACE:
return remote_read_qxfer ("btrace", annex, readbuf, offset, len,
xfered_len,
- &remote_protocol_packets[PACKET_qXfer_btrace]);
+ &remote_protocol_packets[PACKET_qXfer_btrace]);
case TARGET_OBJECT_BTRACE_CONF:
return remote_read_qxfer ("btrace-conf", annex, readbuf, offset,
QUIT; /* Allow user to bail out with ^C. */
rs->buf[0] = '\0';
if (getpkt_sane (&rs->buf, 0) == -1)
- {
- /* Timeout. Continue to (try to) read responses.
- This is better than stopping with an error, assuming the stub
- is still executing the (long) monitor command.
- If needed, the user can interrupt gdb using C-c, obtaining
- an effect similar to stop on timeout. */
- continue;
- }
+ {
+ /* Timeout. Continue to (try to) read responses.
+ This is better than stopping with an error, assuming the stub
+ is still executing the (long) monitor command.
+ If needed, the user can interrupt gdb using C-c, obtaining
+ an effect similar to stop on timeout. */
+ continue;
+ }
buf = rs->buf.data ();
if (buf[0] == '\0')
error (_("Target does not support this command."));
switch (errnum)
{
case FILEIO_EPERM:
- return EPERM;
+ return EPERM;
case FILEIO_ENOENT:
- return ENOENT;
+ return ENOENT;
case FILEIO_EINTR:
- return EINTR;
+ return EINTR;
case FILEIO_EIO:
- return EIO;
+ return EIO;
case FILEIO_EBADF:
- return EBADF;
+ return EBADF;
case FILEIO_EACCES:
- return EACCES;
+ return EACCES;
case FILEIO_EFAULT:
- return EFAULT;
+ return EFAULT;
case FILEIO_EBUSY:
- return EBUSY;
+ return EBUSY;
case FILEIO_EEXIST:
- return EEXIST;
+ return EEXIST;
case FILEIO_ENODEV:
- return ENODEV;
+ return ENODEV;
case FILEIO_ENOTDIR:
- return ENOTDIR;
+ return ENOTDIR;
case FILEIO_EISDIR:
- return EISDIR;
+ return EISDIR;
case FILEIO_EINVAL:
- return EINVAL;
+ return EINVAL;
case FILEIO_ENFILE:
- return ENFILE;
+ return ENFILE;
case FILEIO_EMFILE:
- return EMFILE;
+ return EMFILE;
case FILEIO_EFBIG:
- return EFBIG;
+ return EFBIG;
case FILEIO_ENOSPC:
- return ENOSPC;
+ return ENOSPC;
case FILEIO_ESPIPE:
- return ESPIPE;
+ return ESPIPE;
case FILEIO_EROFS:
- return EROFS;
+ return EROFS;
case FILEIO_ENOSYS:
- return ENOSYS;
+ return ENOSYS;
case FILEIO_ENAMETOOLONG:
- return ENAMETOOLONG;
+ return ENAMETOOLONG;
}
return -1;
}
if (*reply == '\0')
error (_("Target does not support this command."));
if (strcmp (reply, "OK") != 0)
- error (_("Bogus reply from target: %s"), reply);
+ error (_("Bogus reply from target: %s"), reply);
}
else if (val)
warning (_("Target does not support disconnected tracing."));
if (val < 0)
{
*buf++ = '-';
- buf += hexnumstr (buf, (ULONGEST) -val);
+ buf += hexnumstr (buf, (ULONGEST) -val);
}
else
buf += hexnumstr (buf, (ULONGEST) val);
{
pos = buf;
pos += xsnprintf (pos, endbuf - pos, "%s=0x%x", packet->name,
- conf->bts.size);
+ conf->bts.size);
putpkt (buf);
getpkt (&rs->buf, 0);
{
pos = buf;
pos += xsnprintf (pos, endbuf - pos, "%s=0x%x", packet->name,
- conf->pt.size);
+ conf->pt.size);
putpkt (buf);
getpkt (&rs->buf, 0);
remote_thread_info *priv = get_remote_thread_info (tp);
if (tp->inf == inf && priv != NULL)
- {
+ {
if (handle_len != priv->thread_handle.size ())
error (_("Thread handle size mismatch: %d vs %zu (from remote)"),
- handle_len, priv->thread_handle.size ());
+ handle_len, priv->thread_handle.size ());
if (memcmp (thread_handle, priv->thread_handle.data (),
- handle_len) == 0)
+ handle_len) == 0)
return tp;
}
}
"qXfer:memory-map:read", "memory-map", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_osdata],
- "qXfer:osdata:read", "osdata", 0);
+ "qXfer:osdata:read", "osdata", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_threads],
"qXfer:threads:read", "threads", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_siginfo_read],
- "qXfer:siginfo:read", "read-siginfo-object", 0);
+ "qXfer:siginfo:read", "read-siginfo-object", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_siginfo_write],
- "qXfer:siginfo:write", "write-siginfo-object", 0);
+ "qXfer:siginfo:write", "write-siginfo-object", 0);
add_packet_config_cmd
(&remote_protocol_packets[PACKET_qXfer_traceframe_info],
"InstallInTrace", "install-in-trace", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_statictrace_read],
- "qXfer:statictrace:read", "read-sdata-object", 0);
+ "qXfer:statictrace:read", "read-sdata-object", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_fdpic],
"qXfer:fdpic:read", "read-fdpic-loadmap", 0);
"multiprocess-feature", "multiprocess-feature", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_swbreak_feature],
- "swbreak-feature", "swbreak-feature", 0);
+ "swbreak-feature", "swbreak-feature", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_hwbreak_feature],
- "hwbreak-feature", "hwbreak-feature", 0);
+ "hwbreak-feature", "hwbreak-feature", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_fork_event_feature],
"fork-event-feature", "fork-event-feature", 0);
#define ALL_BOOKMARKS_SAFE(B,TMP) \
for ((B) = bookmark_chain; \
- (B) ? ((TMP) = (B)->next, 1) : 0; \
- (B) = (TMP))
+ (B) ? ((TMP) = (B)->next, 1) : 0; \
+ (B) = (TMP))
/* save_bookmark_command -- implement "bookmark" command.
Call target method to get a bookmark identifier.
static void
riscv_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
- iterate_over_regset_sections_cb *cb,
- void *cb_data,
- const struct regcache *regcache)
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
{
cb (".reg", (32 * riscv_isa_xlen (gdbarch)), (32 * riscv_isa_xlen (gdbarch)),
&riscv_linux_gregset, NULL, cb_data);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
set_gdbarch_iterate_over_regset_sections
(gdbarch, riscv_linux_iterate_over_regset_sections);
static void
supply_register_at_address (struct regcache *regcache, int regnum,
- CORE_ADDR register_addr)
+ CORE_ADDR register_addr)
{
struct gdbarch *gdbarch = regcache->arch ();
int buf_size = register_size (gdbarch, regnum);
int offset = register_offset (gdbarch, current_regnum);
if (offset != -1)
- {
- current_address = thread_descriptor_address + offset;
- supply_register_at_address (regcache, current_regnum,
- current_address);
- }
+ {
+ current_address = thread_descriptor_address + offset;
+ supply_register_at_address (regcache, current_regnum,
+ current_address);
+ }
}
}
reg.names.push_back (alias);
/* Setup the other csr aliases. We don't use a switch table here in
- case there are multiple aliases with the same value. Also filter
- based on ABRT_VER in order to avoid a very old alias for misa that
- duplicates the name "misa" but at a different CSR address. */
+ case there are multiple aliases with the same value. Also filter
+ based on ABRT_VER in order to avoid a very old alias for misa that
+ duplicates the name "misa" but at a different CSR address. */
#define DECLARE_CSR_ALIAS(NAME,VALUE,CLASS,DEF_VER,ABRT_VER) \
if (csr_num == VALUE && ABRT_VER >= PRIV_SPEC_CLASS_1P11) \
- reg.names.push_back ( # NAME );
+ reg.names.push_back ( # NAME );
#include "opcode/riscv-opc.h"
#undef DECLARE_CSR_ALIAS
}
if (regnum >= RISCV_FIRST_FP_REGNUM && regnum <= RISCV_LAST_FP_REGNUM)
{
if (riscv_has_fp_regs (gdbarch))
- {
- regnum -= RISCV_FIRST_FP_REGNUM;
- gdb_assert (regnum < riscv_freg_feature.registers.size ());
- return riscv_freg_feature.registers[regnum].names[0];
- }
+ {
+ regnum -= RISCV_FIRST_FP_REGNUM;
+ gdb_assert (regnum < riscv_freg_feature.registers.size ());
+ return riscv_freg_feature.registers[regnum].names[0];
+ }
else
- return NULL;
+ return NULL;
}
/* Some targets (QEMU) are reporting these three registers twice, once
if (riscv_is_fp_regno_p (regnum))
{
/* This spots the case for RV64 where the double is defined as
- either 'ieee_double' or 'float' (which is the generic name that
- converts to 'double' on 64-bit). In these cases its better to
- present the registers using a union type. */
+ either 'ieee_double' or 'float' (which is the generic name that
+ converts to 'double' on 64-bit). In these cases its better to
+ present the registers using a union type. */
int flen = riscv_isa_flen (gdbarch);
if (flen == 8
- && type->code () == TYPE_CODE_FLT
- && TYPE_LENGTH (type) == flen
- && (strcmp (type->name (), "builtin_type_ieee_double") == 0
- || strcmp (type->name (), "double") == 0))
- type = riscv_fpreg_d_type (gdbarch);
+ && type->code () == TYPE_CODE_FLT
+ && TYPE_LENGTH (type) == flen
+ && (strcmp (type->name (), "builtin_type_ieee_double") == 0
+ || strcmp (type->name (), "double") == 0))
+ type = riscv_fpreg_d_type (gdbarch);
}
if ((regnum == gdbarch_pc_regnum (gdbarch)
&& TYPE_LENGTH (type) == xlen)
{
/* This spots the case where some interesting registers are defined
- as simple integers of the expected size, we force these registers
- to be pointers as we believe that is more useful. */
+ as simple integers of the expected size, we force these registers
+ to be pointers as we believe that is more useful. */
if (regnum == gdbarch_pc_regnum (gdbarch)
- || regnum == RISCV_RA_REGNUM)
- type = builtin_type (gdbarch)->builtin_func_ptr;
+ || regnum == RISCV_RA_REGNUM)
+ type = builtin_type (gdbarch)->builtin_func_ptr;
else if (regnum == RISCV_FP_REGNUM
- || regnum == RISCV_SP_REGNUM
- || regnum == RISCV_GP_REGNUM
- || regnum == RISCV_TP_REGNUM)
+ || regnum == RISCV_SP_REGNUM
+ || regnum == RISCV_GP_REGNUM
+ || regnum == RISCV_TP_REGNUM)
type = builtin_type (gdbarch)->builtin_data_ptr;
}
catch (const gdb_exception_error &ex)
{
/* Handle failure to read a register without interrupting the entire
- 'info registers' flow. */
+ 'info registers' flow. */
fprintf_filtered (file, "%s\n", ex.what ());
return;
}
which groups this register should be in. */
int ret = tdesc_register_in_reggroup_p (gdbarch, regnum, reggroup);
if (ret != -1)
- return ret;
+ return ret;
return default_register_reggroup_p (gdbarch, regnum, reggroup);
}
if (regnum < RISCV_FIRST_CSR_REGNUM || regnum == RISCV_PRIV_REGNUM)
return 1;
if (riscv_is_regnum_a_named_csr (regnum))
- return 1;
+ return 1;
return 0;
}
else if (reggroup == float_reggroup)
if (regnum < RISCV_FIRST_CSR_REGNUM || regnum > RISCV_LAST_CSR_REGNUM)
return 0;
if (riscv_is_regnum_a_named_csr (regnum))
- return 1;
+ return 1;
return 0;
}
else if (reggroup == vector_reggroup)
/* Print one specified register. */
if (gdbarch_register_name (gdbarch, regnum) == NULL
|| *(gdbarch_register_name (gdbarch, regnum)) == '\0')
- error (_("Not a valid register for the current processor type"));
+ error (_("Not a valid register for the current processor type"));
riscv_print_one_register_info (gdbarch, file, frame, regnum);
}
else
m_imm.s = EXTRACT_RVC_ADDI4SPN_IMM (ival);
}
else if (is_c_lui_insn (ival))
- {
- m_opcode = LUI;
- m_rd = decode_register_index (ival, OP_SH_CRS1S);
- m_imm.s = EXTRACT_RVC_LUI_IMM (ival);
- }
+ {
+ m_opcode = LUI;
+ m_rd = decode_register_index (ival, OP_SH_CRS1S);
+ m_imm.s = EXTRACT_RVC_LUI_IMM (ival);
+ }
/* C_SD and C_FSW have the same opcode. C_SD is RV64 and RV128 only,
and C_FSW is RV32 only. */
else if (xlen != 4 && is_c_sd_insn (ival))
{
/* Handle: addi sp, sp, -i
or: addiw sp, sp, -i */
- gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
- gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
- regs[insn.rd ()]
- = pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ());
+ gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
+ gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
+ regs[insn.rd ()]
+ = pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ());
}
else if ((insn.opcode () == riscv_insn::SW
|| insn.opcode () == riscv_insn::SD)
or: sw reg, offset(s0)
or: sd reg, offset(s0) */
/* Instruction storing a register onto the stack. */
- gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
- gdb_assert (insn.rs2 () < RISCV_NUM_INTEGER_REGS);
- stack.store (pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ()),
- (insn.opcode () == riscv_insn::SW ? 4 : 8),
- regs[insn.rs2 ()]);
+ gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
+ gdb_assert (insn.rs2 () < RISCV_NUM_INTEGER_REGS);
+ stack.store (pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ()),
+ (insn.opcode () == riscv_insn::SW ? 4 : 8),
+ regs[insn.rs2 ()]);
}
else if (insn.opcode () == riscv_insn::ADDI
&& insn.rd () == RISCV_FP_REGNUM
{
/* Handle: addi s0, sp, size */
/* Instructions setting up the frame pointer. */
- gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
- gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
- regs[insn.rd ()]
- = pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ());
+ gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
+ gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
+ regs[insn.rd ()]
+ = pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ());
}
else if ((insn.opcode () == riscv_insn::ADD
|| insn.opcode () == riscv_insn::ADDW)
/* Handle: add s0, sp, 0
or: addw s0, sp, 0 */
/* Instructions setting up the frame pointer. */
- gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
- gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
- regs[insn.rd ()] = pv_add_constant (regs[insn.rs1 ()], 0);
+ gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
+ gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
+ regs[insn.rd ()] = pv_add_constant (regs[insn.rs1 ()], 0);
}
else if ((insn.opcode () == riscv_insn::ADDI
- && insn.rd () == RISCV_ZERO_REGNUM
- && insn.rs1 () == RISCV_ZERO_REGNUM
- && insn.imm_signed () == 0))
+ && insn.rd () == RISCV_ZERO_REGNUM
+ && insn.rs1 () == RISCV_ZERO_REGNUM
+ && insn.imm_signed () == 0))
{
/* Handle: add x0, x0, 0 (NOP) */
}
else if (insn.opcode () == riscv_insn::AUIPC)
- {
- gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
- regs[insn.rd ()] = pv_constant (cur_pc + insn.imm_signed ());
- }
+ {
+ gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
+ regs[insn.rd ()] = pv_constant (cur_pc + insn.imm_signed ());
+ }
else if (insn.opcode () == riscv_insn::LUI)
- {
+ {
/* Handle: lui REG, n
- Where REG is not gp register. */
- gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
- regs[insn.rd ()] = pv_constant (insn.imm_signed ());
- }
+ Where REG is not gp register. */
+ gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
+ regs[insn.rd ()] = pv_constant (insn.imm_signed ());
+ }
else if (insn.opcode () == riscv_insn::ADDI)
- {
- /* Handle: addi REG1, REG2, IMM */
- gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
- gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
- regs[insn.rd ()]
- = pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ());
- }
+ {
+ /* Handle: addi REG1, REG2, IMM */
+ gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
+ gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
+ regs[insn.rd ()]
+ = pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ());
+ }
else if (insn.opcode () == riscv_insn::ADD)
- {
- /* Handle: addi REG1, REG2, IMM */
- gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
- gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
- gdb_assert (insn.rs2 () < RISCV_NUM_INTEGER_REGS);
- regs[insn.rd ()] = pv_add (regs[insn.rs1 ()], regs[insn.rs2 ()]);
- }
+ {
+ /* Handle: addi REG1, REG2, IMM */
+ gdb_assert (insn.rd () < RISCV_NUM_INTEGER_REGS);
+ gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
+ gdb_assert (insn.rs2 () < RISCV_NUM_INTEGER_REGS);
+ regs[insn.rd ()] = pv_add (regs[insn.rs1 ()], regs[insn.rs2 ()]);
+ }
else
{
end_prologue_addr = cur_pc;
if (cache != NULL)
{
/* Figure out if it is a frame pointer or just a stack pointer. Also
- the offset held in the pv_t is from the original register value to
- the current value, which for a grows down stack means a negative
- value. The FRAME_BASE_OFFSET is the negation of this, how to get
- from the current value to the original value. */
+ the offset held in the pv_t is from the original register value to
+ the current value, which for a grows down stack means a negative
+ value. The FRAME_BASE_OFFSET is the negation of this, how to get
+ from the current value to the original value. */
if (pv_is_register (regs[RISCV_FP_REGNUM], RISCV_SP_REGNUM))
{
- cache->frame_base_reg = RISCV_FP_REGNUM;
- cache->frame_base_offset = -regs[RISCV_FP_REGNUM].k;
+ cache->frame_base_reg = RISCV_FP_REGNUM;
+ cache->frame_base_offset = -regs[RISCV_FP_REGNUM].k;
}
else
{
- cache->frame_base_reg = RISCV_SP_REGNUM;
- cache->frame_base_offset = -regs[RISCV_SP_REGNUM].k;
+ cache->frame_base_reg = RISCV_SP_REGNUM;
+ cache->frame_base_offset = -regs[RISCV_SP_REGNUM].k;
}
/* Assign offset from old SP to all saved registers. As we don't
- have the previous value for the frame base register at this
- point, we store the offset as the address in the trad_frame, and
- then convert this to an actual address later. */
+ have the previous value for the frame base register at this
+ point, we store the offset as the address in the trad_frame, and
+ then convert this to an actual address later. */
for (int i = 0; i <= RISCV_NUM_INTEGER_REGS; i++)
{
CORE_ADDR offset;
if (stack.find_reg (gdbarch, i, &offset))
- {
- if (riscv_debug_unwinder)
+ {
+ if (riscv_debug_unwinder)
{
/* Display OFFSET as a signed value, the offsets are from
the frame base address to the registers location on
gdbarch_register_name (gdbarch, i),
plongest ((LONGEST) offset));
}
- trad_frame_set_addr (cache->regs, i, offset);
- }
+ trad_frame_set_addr (cache->regs, i, offset);
+ }
}
}
case riscv_arg_info::location::in_reg:
{
regnum = info.argloc[0].loc_data.regno;
- gdb_assert (info.argloc[0].c_length <= arg_len);
- gdb_assert (info.argloc[0].c_length
+ gdb_assert (info.argloc[0].c_length <= arg_len);
+ gdb_assert (info.argloc[0].c_length
<= register_size (gdbarch, regnum));
if (readbuf)
case riscv_arg_info::location::in_reg:
regnum = info.argloc[1].loc_data.regno;
- gdb_assert ((info.argloc[0].c_length
+ gdb_assert ((info.argloc[0].c_length
+ info.argloc[1].c_length) <= arg_len);
- gdb_assert (info.argloc[1].c_length
+ gdb_assert (info.argloc[1].c_length
<= register_size (gdbarch, regnum));
if (readbuf)
+ cache->frame_base_offset);
if (riscv_debug_unwinder)
fprintf_unfiltered (gdb_stdlog, "Frame base is %s ($%s + 0x%x)\n",
- core_addr_to_string (cache->frame_base),
- gdbarch_register_name (gdbarch,
- cache->frame_base_reg),
- cache->frame_base_offset);
+ core_addr_to_string (cache->frame_base),
+ gdbarch_register_name (gdbarch,
+ cache->frame_base_reg),
+ cache->frame_base_offset);
/* The prologue scanner sets the address of registers stored to the stack
as the offset of that register from the frame base. The prologue
catch (const gdb_exception_error &ex)
{
/* Ignore errors, this leaves the frame id as the predefined outer
- frame id which terminates the backtrace at this point. */
+ frame id which terminates the backtrace at this point. */
}
}
static bool
riscv_check_tdesc_feature (struct tdesc_arch_data *tdesc_data,
- const struct tdesc_feature *main_feature,
- const struct tdesc_feature *csr_feature,
- const struct riscv_register_feature *reg_set,
- std::vector<riscv_pending_register_alias> *aliases)
+ const struct tdesc_feature *main_feature,
+ const struct tdesc_feature *csr_feature,
+ const struct riscv_register_feature *reg_set,
+ std::vector<riscv_pending_register_alias> *aliases)
{
for (const auto ® : reg_set->registers)
{
std::vector<riscv_pending_register_alias> pending_aliases;
bool valid_p = riscv_check_tdesc_feature (tdesc_data.get (),
- feature_cpu, feature_csr,
- &riscv_xreg_feature,
- &pending_aliases);
+ feature_cpu, feature_csr,
+ &riscv_xreg_feature,
+ &pending_aliases);
if (valid_p)
{
/* Check that all of the core cpu registers have the same bitsize. */
int xlen_bitsize = tdesc_register_bitsize (feature_cpu, "pc");
for (auto &tdesc_reg : feature_cpu->registers)
- valid_p &= (tdesc_reg->bitsize == xlen_bitsize);
+ valid_p &= (tdesc_reg->bitsize == xlen_bitsize);
if (riscv_debug_gdbarch)
- fprintf_filtered
- (gdb_stdlog,
- "From target-description, xlen = %d\n", xlen_bitsize);
+ fprintf_filtered
+ (gdb_stdlog,
+ "From target-description, xlen = %d\n", xlen_bitsize);
features.xlen = (xlen_bitsize / 8);
}
{
valid_p &= riscv_check_tdesc_feature (tdesc_data.get (), feature_fpu,
feature_csr,
- &riscv_freg_feature,
- &pending_aliases);
+ &riscv_freg_feature,
+ &pending_aliases);
/* Search for the first floating point register (by any alias), to
- determine the bitsize. */
+ determine the bitsize. */
int bitsize = -1;
const auto &fp0 = riscv_freg_feature.registers[0];
features.flen = (bitsize / 8);
if (riscv_debug_gdbarch)
- fprintf_filtered
- (gdb_stdlog,
- "From target-description, flen = %d\n", bitsize);
+ fprintf_filtered
+ (gdb_stdlog,
+ "From target-description, flen = %d\n", bitsize);
}
else
{
features.flen = 0;
if (riscv_debug_gdbarch)
- fprintf_filtered
- (gdb_stdlog,
- "No FPU in target-description, assume soft-float ABI\n");
+ fprintf_filtered
+ (gdb_stdlog,
+ "No FPU in target-description, assume soft-float ABI\n");
}
if (feature_virtual)
riscv_check_tdesc_feature (tdesc_data.get (), feature_virtual, feature_csr,
- &riscv_virtual_feature,
- &pending_aliases);
+ &riscv_virtual_feature,
+ &pending_aliases);
if (feature_csr)
riscv_check_tdesc_feature (tdesc_data.get (), feature_csr, nullptr,
- &riscv_csr_feature,
- &pending_aliases);
+ &riscv_csr_feature,
+ &pending_aliases);
if (!valid_p)
{
if (riscv_debug_gdbarch)
- fprintf_unfiltered (gdb_stdlog, "Target description is not valid\n");
+ fprintf_unfiltered (gdb_stdlog, "Target description is not valid\n");
return NULL;
}
that the requested xlen match the targets xlen. */
if (abi_features.xlen != 0 && abi_features.xlen != features.xlen)
error (_("bfd requires xlen %d, but target has xlen %d"),
- abi_features.xlen, features.xlen);
+ abi_features.xlen, features.xlen);
/* We do support running binaries compiled for 32-bit float on targets
with 64-bit float, so we only complain if the binary requires more
than the target has available. */
if (abi_features.flen > features.flen)
error (_("bfd requires flen %d, but target has flen %d"),
- abi_features.flen, features.flen);
+ abi_features.flen, features.flen);
/* If the ABI_FEATURES xlen is 0 then this indicates we got no useful abi
features from the INFO object. In this case we assume that the xlen
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
/* Check that the feature set of the ARCHES matches the feature set
- we are looking for. If it doesn't then we can't reuse this
- gdbarch. */
+ we are looking for. If it doesn't then we can't reuse this
+ gdbarch. */
struct gdbarch_tdep *other_tdep = gdbarch_tdep (arches->gdbarch);
if (other_tdep->isa_features != features
|| other_tdep->abi_features != abi_features)
- continue;
+ continue;
break;
}
int elf_flags;
struct type *rl78_void,
- *rl78_uint8,
+ *rl78_uint8,
*rl78_int8,
*rl78_uint16,
*rl78_int16,
else if (reg_nr == RL78_PSW_REGNUM)
return rl78_psw_type (gdbarch);
else if (reg_nr <= RL78_MEM_REGNUM
- || (RL78_X_REGNUM <= reg_nr && reg_nr <= RL78_H_REGNUM)
+ || (RL78_X_REGNUM <= reg_nr && reg_nr <= RL78_H_REGNUM)
|| (RL78_BANK0_R0_REGNUM <= reg_nr
&& reg_nr <= RL78_BANK3_R7_REGNUM))
return tdep->rl78_int8;
else if (reg_nr == RL78_SP_REGNUM
- || (RL78_BANK0_RP0_PTR_REGNUM <= reg_nr
+ || (RL78_BANK0_RP0_PTR_REGNUM <= reg_nr
&& reg_nr <= RL78_BANK3_RP3_PTR_REGNUM))
return tdep->rl78_data_pointer;
else
static enum register_status
rl78_pseudo_register_read (struct gdbarch *gdbarch,
readable_regcache *regcache,
- int reg, gdb_byte *buffer)
+ int reg, gdb_byte *buffer)
{
enum register_status status;
if (RL78_BANK0_R0_REGNUM <= reg && reg <= RL78_BANK3_R7_REGNUM)
{
int raw_regnum = RL78_RAW_BANK0_R0_REGNUM
- + (reg - RL78_BANK0_R0_REGNUM);
+ + (reg - RL78_BANK0_R0_REGNUM);
status = regcache->raw_read (raw_regnum, buffer);
}
else if (RL78_BANK0_RP0_REGNUM <= reg && reg <= RL78_BANK3_RP3_REGNUM)
{
int raw_regnum = 2 * (reg - RL78_BANK0_RP0_REGNUM)
- + RL78_RAW_BANK0_R0_REGNUM;
+ + RL78_RAW_BANK0_R0_REGNUM;
status = regcache->raw_read (raw_regnum, buffer);
if (status == REG_VALID)
else if (RL78_BANK0_RP0_PTR_REGNUM <= reg && reg <= RL78_BANK3_RP3_PTR_REGNUM)
{
int raw_regnum = 2 * (reg - RL78_BANK0_RP0_PTR_REGNUM)
- + RL78_RAW_BANK0_R0_REGNUM;
+ + RL78_RAW_BANK0_R0_REGNUM;
status = regcache->raw_read (raw_regnum, buffer);
if (status == REG_VALID)
/* RSB0 is at bit 3; RSBS1 is at bit 5. */
int bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
int raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK
- + (reg - RL78_X_REGNUM);
+ + (reg - RL78_X_REGNUM);
status = regcache->raw_read (raw_regnum, buffer);
}
}
/* RSB0 is at bit 3; RSBS1 is at bit 5. */
int bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
int raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK
- + 2 * (reg - RL78_AX_REGNUM);
+ + 2 * (reg - RL78_AX_REGNUM);
status = regcache->raw_read (raw_regnum, buffer);
if (status == REG_VALID)
status = regcache->raw_read (raw_regnum + 1, buffer + 1);
static void
rl78_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int reg, const gdb_byte *buffer)
+ struct regcache *regcache,
+ int reg, const gdb_byte *buffer)
{
if (RL78_BANK0_R0_REGNUM <= reg && reg <= RL78_BANK3_R7_REGNUM)
{
int raw_regnum = RL78_RAW_BANK0_R0_REGNUM
- + (reg - RL78_BANK0_R0_REGNUM);
+ + (reg - RL78_BANK0_R0_REGNUM);
regcache->raw_write (raw_regnum, buffer);
}
else if (RL78_BANK0_RP0_REGNUM <= reg && reg <= RL78_BANK3_RP3_REGNUM)
{
int raw_regnum = 2 * (reg - RL78_BANK0_RP0_REGNUM)
- + RL78_RAW_BANK0_R0_REGNUM;
+ + RL78_RAW_BANK0_R0_REGNUM;
regcache->raw_write (raw_regnum, buffer);
regcache->raw_write (raw_regnum + 1, buffer + 1);
else if (RL78_BANK0_RP0_PTR_REGNUM <= reg && reg <= RL78_BANK3_RP3_PTR_REGNUM)
{
int raw_regnum = 2 * (reg - RL78_BANK0_RP0_PTR_REGNUM)
- + RL78_RAW_BANK0_R0_REGNUM;
+ + RL78_RAW_BANK0_R0_REGNUM;
regcache->raw_write (raw_regnum, buffer);
regcache->raw_write (raw_regnum + 1, buffer + 1);
bank = ((psw >> 3) & 1) | ((psw >> 4) & 1);
/* RSB0 is at bit 3; RSBS1 is at bit 5. */
raw_regnum = RL78_RAW_BANK0_R0_REGNUM + bank * RL78_REGS_PER_BANK
- + (reg - RL78_X_REGNUM);
+ + (reg - RL78_X_REGNUM);
regcache->raw_write (raw_regnum, buffer);
}
else if (RL78_AX_REGNUM <= reg && reg <= RL78_HL_REGNUM)
switch (opcreg)
{
case RL78_Reg_X:
- return RL78_X_REGNUM;
+ return RL78_X_REGNUM;
case RL78_Reg_A:
return RL78_A_REGNUM;
case RL78_Reg_C:
static void
check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size,
- pv_t value)
+ pv_t value)
{
struct rl78_prologue *result = (struct rl78_prologue *) result_untyped;
bank = opc.op[1].addend;
}
else if (opc.id == RLO_mov
- && opc.op[0].type == RL78_Operand_PreDec
- && opc.op[0].reg == RL78_Reg_SP
+ && opc.op[0].type == RL78_Operand_PreDec
+ && opc.op[0].reg == RL78_Reg_SP
&& opc.op[1].type == RL78_Operand_Register)
{
int rsrc = (bank * RL78_REGS_PER_BANK)
after_last_frame_setup_insn = next_pc;
}
else if (opc.id == RLO_sub
- && opc.op[0].type == RL78_Operand_Register
+ && opc.op[0].type == RL78_Operand_Register
&& opc.op[0].reg == RL78_Reg_SP
&& opc.op[1].type == RL78_Operand_Immediate)
{
int addend = opc.op[1].addend;
reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM],
- -addend);
+ -addend);
after_last_frame_setup_insn = next_pc;
}
else if (opc.id == RLO_mov
- && opc.size == RL78_Word
+ && opc.size == RL78_Word
&& opc.op[0].type == RL78_Operand_Register
&& opc.op[1].type == RL78_Operand_Indirect
&& opc.op[1].addend == RL78_SP_ADDR)
= reg[RL78_SP_REGNUM];
}
else if (opc.id == RLO_sub
- && opc.size == RL78_Word
+ && opc.size == RL78_Word
&& opc.op[0].type == RL78_Operand_Register
&& opc.op[1].type == RL78_Operand_Immediate)
{
reg[regnum] = pv_add_constant (reg[regnum], -addend);
}
else if (opc.id == RLO_mov
- && opc.size == RL78_Word
+ && opc.size == RL78_Word
&& opc.op[0].type == RL78_Operand_Indirect
&& opc.op[0].addend == RL78_SP_ADDR
&& opc.op[1].type == RL78_Operand_Register)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
- addr & 0xffffff);
+ addr & 0xffffff);
}
/* Implement the "pointer_to_address" gdbarch method. */
static CORE_ADDR
rl78_pointer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+ struct type *type, const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR addr
rl78_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
{
return rl78_addr_bits_remove
- (arch, frame_unwind_register_unsigned (next_frame,
- RL78_PC_REGNUM));
+ (arch, frame_unwind_register_unsigned (next_frame,
+ RL78_PC_REGNUM));
}
/* Given a frame described by THIS_FRAME, decode the prologue of its
stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
- just initialize the prologue cache, but don't do anything. */
+ just initialize the prologue cache, but don't do anything. */
if (!func_start)
stop_addr = func_start;
void **this_prologue_cache, struct frame_id *this_id)
{
*this_id = frame_id_build (rl78_frame_base (this_frame,
- this_prologue_cache),
+ this_prologue_cache),
get_frame_func (this_frame));
}
static struct value *
rl78_prev_register (struct frame_info *this_frame,
- void **this_prologue_cache, int regnum)
+ void **this_prologue_cache, int regnum)
{
struct rl78_prologue *p
= rl78_analyze_frame_prologue (this_frame, this_prologue_cache);
else if (regnum == RL78_SPL_REGNUM)
return frame_unwind_got_constant (this_frame, regnum,
- (frame_base & 0xff));
+ (frame_base & 0xff));
else if (regnum == RL78_SPH_REGNUM)
return frame_unwind_got_constant (this_frame, regnum,
- ((frame_base >> 8) & 0xff));
+ ((frame_base >> 8) & 0xff));
/* If prologue analysis says we saved this register somewhere,
return a description of the stack slot holding it. */
else if (p->reg_offset[regnum] != 1)
{
struct value *rv =
- frame_unwind_got_memory (this_frame, regnum,
+ frame_unwind_got_memory (this_frame, regnum,
frame_base + p->reg_offset[regnum]);
if (regnum == RL78_PC_REGNUM)
if (0 <= reg && reg <= 31)
{
if ((reg & 1) == 0)
- /* Map even registers to their 16-bit counterparts which have a
+ /* Map even registers to their 16-bit counterparts which have a
pointer type. This is usually what is required from the DWARF
info. */
return (reg >> 1) + RL78_BANK0_RP0_PTR_REGNUM;
{
if (is_g10)
u = read_memory_integer (g10_raddr, 1,
- gdbarch_byte_order (gdbarch));
+ gdbarch_byte_order (gdbarch));
else
regcache_cooked_read_unsigned (regcache, argreg, &u);
store_unsigned_integer (readbuf + offset, 1, byte_order, u);
{
return
frame_id_build (rl78_make_data_address
- (get_frame_register_unsigned
- (this_frame, RL78_SP_REGNUM)),
+ (get_frame_register_unsigned
+ (this_frame, RL78_SP_REGNUM)),
get_frame_pc (this_frame));
}
sp -= container_len;
write_memory (rl78_make_data_address (sp),
- value_contents_all (args[i]), len);
+ value_contents_all (args[i]), len);
}
/* Store struct value address. */
(*this_cache) = this_trad_cache;
base = get_frame_register_unsigned (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ gdbarch_sp_regnum (gdbarch));
base_orig = base;
if (tdep->wordsize == 4)
if (tdep->wordsize == 4)
trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum,
- base_orig + 0x38 + 52 + 8);
+ base_orig + 0x38 + 52 + 8);
else
trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum,
- base_orig + 0x70 + 320);
+ base_orig + 0x70 + 320);
trad_frame_set_id (this_trad_cache, frame_id_build (base, func));
trad_frame_set_this_base (this_trad_cache, base);
memcpy (word,
((char *) value_contents (arg)) + argbytes,
(len - argbytes) > reg_size
- ? reg_size : len - argbytes);
+ ? reg_size : len - argbytes);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
++ii, argbytes += reg_size;
sp -= space;
/* This is another instance we need to be concerned about
- securing our stack space. If we write anything underneath %sp
- (r1), we might conflict with the kernel who thinks he is free
- to use this area. So, update %sp first before doing anything
- else. */
+ securing our stack space. If we write anything underneath %sp
+ (r1), we might conflict with the kernel who thinks he is free
+ to use this area. So, update %sp first before doing anything
+ else. */
regcache_raw_write_signed (regcache,
gdbarch_sp_regnum (gdbarch), sp);
/* If the last argument copied into the registers didn't fit there
- completely, push the rest of it into stack. */
+ completely, push the rest of it into stack. */
if (argbytes)
{
/* Float types should be passed in fpr's, as well as in the
- stack. */
+ stack. */
if (type->code () == TYPE_CODE_FLT && f_argno < 13)
{
struct obj_section *pc_section;
try
- {
- pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
- }
+ {
+ pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
+ }
catch (const gdb_exception_error &e)
- {
- /* An error occured during reading. Probably a memory error
- due to the section not being loaded yet. This address
- cannot be a function descriptor. */
- return addr;
- }
+ {
+ /* An error occured during reading. Probably a memory error
+ due to the section not being loaded yet. This address
+ cannot be a function descriptor. */
+ return addr;
+ }
pc_section = find_pc_section (pc);
if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
- return pc;
+ return pc;
}
return addr;
if (ext_op == 16) /* br conditional register */
{
- dest = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
+ dest = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
/* If we are about to return from a signal handler, dest is
something like 0x3c90. The current frame is a signal handler
else if (ext_op == 528) /* br cond to count reg */
{
- dest = regcache_raw_get_unsigned (regcache,
+ dest = regcache_raw_get_unsigned (regcache,
tdep->ppc_ctr_regnum) & ~3;
/* If we are about to execute a system call, dest is something
like 0x22fc or 0x3b00. Upon completion the system call
will return to the address in the link register. */
if (dest < AIX_TEXT_SEGMENT_BASE)
- dest = regcache_raw_get_unsigned (regcache,
+ dest = regcache_raw_get_unsigned (regcache,
tdep->ppc_lr_regnum) & ~3;
}
else
#define pinfo(type,member) \
{ \
struct type ldi = {0}; \
- \
+ \
printf (" {%d, %d},\t/* %s */\n", \
- offsetof (struct type, member), \
- sizeof (ldi.member), \
- #member); \
+ offsetof (struct type, member), \
+ sizeof (ldi.member), \
+ #member); \
} \
while (0)
else
{
if (len > len_avail - offset)
- len = len_avail - offset;
+ len = len_avail - offset;
memcpy (readbuf, buf + offset, len);
}
_initialize_rs6000_aix_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_rs6000,
- bfd_target_xcoff_flavour,
- rs6000_aix_osabi_sniffer);
+ bfd_target_xcoff_flavour,
+ rs6000_aix_osabi_sniffer);
gdbarch_register_osabi_sniffer (bfd_arch_powerpc,
- bfd_target_xcoff_flavour,
- rs6000_aix_osabi_sniffer);
+ bfd_target_xcoff_flavour,
+ rs6000_aix_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_AIX,
- rs6000_aix_init_osabi);
+ rs6000_aix_init_osabi);
gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_AIX,
- rs6000_aix_init_osabi);
+ rs6000_aix_init_osabi);
}
memcpy (word,
((char *) value_contents (arg)) + argbytes,
(len - argbytes) > reg_size
- ? reg_size : len - argbytes);
+ ? reg_size : len - argbytes);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
++ii, argbytes += reg_size;
sp -= space;
/* This is another instance we need to be concerned about
- securing our stack space. If we write anything underneath %sp
- (r1), we might conflict with the kernel who thinks he is free
- to use this area. So, update %sp first before doing anything
- else. */
+ securing our stack space. If we write anything underneath %sp
+ (r1), we might conflict with the kernel who thinks he is free
+ to use this area. So, update %sp first before doing anything
+ else. */
regcache_raw_write_signed (regcache,
gdbarch_sp_regnum (gdbarch), sp);
/* If the last argument copied into the registers didn't fit there
- completely, push the rest of it into stack. */
+ completely, push the rest of it into stack. */
if (argbytes)
{
/* Float types should be passed in fpr's, as well as in the
- stack. */
+ stack. */
if (type->code () == TYPE_CODE_FLT && f_argno < 13)
{
_initialize_rs6000_lynx178_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_rs6000,
- bfd_target_xcoff_flavour,
- rs6000_lynx178_osabi_sniffer);
+ bfd_target_xcoff_flavour,
+ rs6000_lynx178_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_LYNXOS178,
- rs6000_lynx178_init_osabi);
+ rs6000_lynx178_init_osabi);
}
&& regno < tdep->ppc_gp0_regnum + ppc_num_gprs)
return regno;
else if (tdep->ppc_fp0_regnum >= 0
- && tdep->ppc_fp0_regnum <= regno
- && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)
+ && tdep->ppc_fp0_regnum <= regno
+ && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)
{
*isfloat = 1;
return regno - tdep->ppc_fp0_regnum + FPR0;
else if (regno == tdep->ppc_xer_regnum)
return XER;
else if (tdep->ppc_fpscr_regnum >= 0
- && regno == tdep->ppc_fpscr_regnum)
+ && regno == tdep->ppc_fpscr_regnum)
return FPSCR;
else if (tdep->ppc_mq_regnum >= 0 && regno == tdep->ppc_mq_regnum)
return MQ;
else
{
/* The PT_WRITE_GPR operation is rather odd. For 32-bit inferiors,
- the register's value is passed by value, but for 64-bit inferiors,
+ the register's value is passed by value, but for 64-bit inferiors,
the address of a buffer containing the value is passed. */
if (!ARCH64 ())
rs6000_ptrace32 (PT_WRITE_GPR, pid, (int *) nr, *addr, 0);
/* Read 32 general purpose registers. */
for (regno = tdep->ppc_gp0_regnum;
- regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
+ regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
regno++)
{
fetch_register (regcache, regno);
/* Read general purpose floating point registers. */
if (tdep->ppc_fp0_regnum >= 0)
- for (regno = 0; regno < ppc_num_fprs; regno++)
- fetch_register (regcache, tdep->ppc_fp0_regnum + regno);
+ for (regno = 0; regno < ppc_num_fprs; regno++)
+ fetch_register (regcache, tdep->ppc_fp0_regnum + regno);
/* Read special registers. */
fetch_register (regcache, gdbarch_pc_regnum (gdbarch));
fetch_register (regcache, tdep->ppc_ctr_regnum);
fetch_register (regcache, tdep->ppc_xer_regnum);
if (tdep->ppc_fpscr_regnum >= 0)
- fetch_register (regcache, tdep->ppc_fpscr_regnum);
+ fetch_register (regcache, tdep->ppc_fpscr_regnum);
if (tdep->ppc_mq_regnum >= 0)
fetch_register (regcache, tdep->ppc_mq_regnum);
}
/* Write general purpose registers first. */
for (regno = tdep->ppc_gp0_regnum;
- regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
+ regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
regno++)
{
store_register (regcache, regno);
/* Write floating point registers. */
if (tdep->ppc_fp0_regnum >= 0)
- for (regno = 0; regno < ppc_num_fprs; regno++)
- store_register (regcache, tdep->ppc_fp0_regnum + regno);
+ for (regno = 0; regno < ppc_num_fprs; regno++)
+ store_register (regcache, tdep->ppc_fp0_regnum + regno);
/* Write special registers. */
store_register (regcache, gdbarch_pc_regnum (gdbarch));
store_register (regcache, tdep->ppc_ctr_regnum);
store_register (regcache, tdep->ppc_xer_regnum);
if (tdep->ppc_fpscr_regnum >= 0)
- store_register (regcache, tdep->ppc_fpscr_regnum);
+ store_register (regcache, tdep->ppc_fpscr_regnum);
if (tdep->ppc_mq_regnum >= 0)
store_register (regcache, tdep->ppc_mq_regnum);
}
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
return (tdep->ppc_fp0_regnum >= 0
- && tdep->ppc_fpscr_regnum >= 0);
+ && tdep->ppc_fpscr_regnum >= 0);
}
/* Return non-zero if the architecture described by GDBARCH has
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
return (tdep->ppc_vr0_regnum >= 0
- && tdep->ppc_vrsave_regnum >= 0);
+ && tdep->ppc_vrsave_regnum >= 0);
}
/* Check that TABLE[GDB_REGNO] is not already initialized, and then
if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++)
set_sim_regno (sim_regno,
- tdep->ppc_fp0_regnum + i,
- sim_ppc_f0_regnum + i);
+ tdep->ppc_fp0_regnum + i,
+ sim_ppc_f0_regnum + i);
if (tdep->ppc_fpscr_regnum >= 0)
set_sim_regno (sim_regno, tdep->ppc_fpscr_regnum, sim_ppc_fpscr_regnum);
if (tdep->ppc_vr0_regnum >= 0)
{
for (i = 0; i < ppc_num_vrs; i++)
- set_sim_regno (sim_regno,
- tdep->ppc_vr0_regnum + i,
- sim_ppc_vr0_regnum + i);
+ set_sim_regno (sim_regno,
+ tdep->ppc_vr0_regnum + i,
+ sim_ppc_vr0_regnum + i);
/* FIXME: jimb/2004-07-15: when we have tdep->ppc_vscr_regnum,
- we can treat this more like the other cases. */
+ we can treat this more like the other cases. */
set_sim_regno (sim_regno,
- tdep->ppc_vr0_regnum + ppc_num_vrs,
- sim_ppc_vscr_regnum);
+ tdep->ppc_vr0_regnum + ppc_num_vrs,
+ sim_ppc_vscr_regnum);
}
/* vsave is a special-purpose register, so the code below handles it. */
if (tdep->ppc_ev0_upper_regnum >= 0)
for (i = 0; i < ppc_num_gprs; i++)
set_sim_regno (sim_regno,
- tdep->ppc_ev0_upper_regnum + i,
- sim_ppc_rh0_regnum + i);
+ tdep->ppc_ev0_upper_regnum + i,
+ sim_ppc_rh0_regnum + i);
if (tdep->ppc_acc_regnum >= 0)
set_sim_regno (sim_regno, tdep->ppc_acc_regnum, sim_ppc_acc_regnum);
/* spefscr is a special-purpose register, so the code below handles it. */
/* Changes the stack pointer. */
/* NOTE: There are many ways to change the value of a given register.
- The ways below are those used when the register is R1, the SP,
- in a funtion's epilogue. */
+ The ways below are those used when the register is R1, the SP,
+ in a funtion's epilogue. */
if (opcode == 31 && subcode == 444 && a == 1)
return 1; /* mr R1,Rn */
1) scan forward from the point of execution:
a) If you find an instruction that modifies the stack pointer
- or transfers control (except a return), execution is not in
- an epilogue, return.
+ or transfers control (except a return), execution is not in
+ an epilogue, return.
b) Stop scanning if you find a return instruction or reach the
- end of the function or reach the hard limit for the size of
- an epilogue.
+ end of the function or reach the hard limit for the size of
+ an epilogue.
2) scan backward from the point of execution:
- a) If you find an instruction that modifies the stack pointer,
- execution *is* in an epilogue, return.
- b) Stop scanning if you reach an instruction that transfers
- control or the beginning of the function or reach the hard
- limit for the size of an epilogue. */
+ a) If you find an instruction that modifies the stack pointer,
+ execution *is* in an epilogue, return.
+ b) Stop scanning if you reach an instruction that transfers
+ control or the beginning of the function or reach the hard
+ limit for the size of an epilogue. */
static int
rs6000_in_function_epilogue_frame_p (struct frame_info *curfrm,
for (scan_pc = pc; scan_pc < epilogue_end; scan_pc += PPC_INSN_SIZE)
{
if (!safe_frame_unwind_memory (curfrm, scan_pc, insn_buf, PPC_INSN_SIZE))
- return 0;
+ return 0;
insn = extract_unsigned_integer (insn_buf, PPC_INSN_SIZE, byte_order);
if (insn == 0x4e800020)
- break;
+ break;
/* Assume a bctr is a tail call unless it points strictly within
this function. */
if (insn == 0x4e800420)
break;
}
if (insn_changes_sp_or_jumps (insn))
- return 0;
+ return 0;
}
/* Scan backward until adjustment to stack pointer (R1). */
scan_pc -= PPC_INSN_SIZE)
{
if (!safe_frame_unwind_memory (curfrm, scan_pc, insn_buf, PPC_INSN_SIZE))
- return 0;
+ return 0;
insn = extract_unsigned_integer (insn_buf, PPC_INSN_SIZE, byte_order);
if (insn_changes_sp_or_jumps (insn))
- return 1;
+ return 1;
}
return 0;
write_memory (to, buf, len);
displaced_debug_printf ("copy %s->%s: %s",
- paddress (gdbarch, from), paddress (gdbarch, to),
+ paddress (gdbarch, from), paddress (gdbarch, to),
displaced_step_dump_bytes (buf, len).c_str ());;
/* This is a work around for a problem with g++ 4.8. */
insn = read_memory_integer (loc, PPC_INSN_SIZE, byte_order);
/* Assume that there is at most one conditional branch in the atomic
- sequence. If a conditional branch is found, put a breakpoint in
- its destination address. */
+ sequence. If a conditional branch is found, put a breakpoint in
+ its destination address. */
if ((insn & BRANCH_MASK) == BC_INSN)
- {
- int immediate = ((insn & 0xfffc) ^ 0x8000) - 0x8000;
- int absolute = insn & 2;
+ {
+ int immediate = ((insn & 0xfffc) ^ 0x8000) - 0x8000;
+ int absolute = insn & 2;
- if (bc_insn_count >= 1)
- return {}; /* More than one conditional branch found, fallback
- to the standard single-step code. */
+ if (bc_insn_count >= 1)
+ return {}; /* More than one conditional branch found, fallback
+ to the standard single-step code. */
if (absolute)
breaks[1] = immediate;
bc_insn_count++;
last_breakpoint++;
- }
+ }
if (IS_STORE_CONDITIONAL_INSN (insn))
- break;
+ break;
}
/* Assume that the atomic sequence ends with a Store Conditional
const int ry_regno = GET_SRC_REG (op);
if (rx_regno == 0 && ry_regno >= 3 && ry_regno <= 10)
- {
- *r0_contains_arg = 1;
- return 1;
- }
+ {
+ *r0_contains_arg = 1;
+ return 1;
+ }
else
- return 0;
+ return 0;
}
/* Save a General Purpose Register on stack. */
return (rx_regno >= 3 && rx_regno <= 10);
}
-
+
/* Save a General Purpose Register on stack via the Frame Pointer. */
if (framep &&
(op & 0xfc1f0000) == 0xd81f0000)) /* stfd Rx,NUM(r31) */
{
/* Rx: Usually, only r3 - r10 are used for parameter passing.
- However, the compiler sometimes uses r0 to hold an argument. */
+ However, the compiler sometimes uses r0 to hold an argument. */
const int rx_regno = GET_SRC_REG (op);
return ((rx_regno >= 3 && rx_regno <= 10)
- || (rx_regno == 0 && *r0_contains_arg));
+ || (rx_regno == 0 && *r0_contains_arg));
}
if ((op & 0xfc1f0000) == 0xfc010000) /* frsp, fp?,NUM(r1) */
unsigned long op = rs6000_fetch_instruction (gdbarch, pc);
/* First possible sequence: A small number of probes.
- stw 0, -<some immediate>(1)
- [repeat this instruction any (small) number of times]. */
+ stw 0, -<some immediate>(1)
+ [repeat this instruction any (small) number of times]. */
if ((op & 0xffff0000) == 0x90010000)
{
while ((op & 0xffff0000) == 0x90010000)
- {
- pc = pc + 4;
- op = rs6000_fetch_instruction (gdbarch, pc);
- }
+ {
+ pc = pc + 4;
+ op = rs6000_fetch_instruction (gdbarch, pc);
+ }
return pc;
}
/* Second sequence: A probing loop.
- addi 12,1,-<some immediate>
- lis 0,-<some immediate>
- [possibly ori 0,0,<some immediate>]
- add 0,12,0
- cmpw 0,12,0
- beq 0,<disp>
- addi 12,12,-<some immediate>
- stw 0,0(12)
- b <disp>
- [possibly one last probe: stw 0,<some immediate>(12)]. */
+ addi 12,1,-<some immediate>
+ lis 0,-<some immediate>
+ [possibly ori 0,0,<some immediate>]
+ add 0,12,0
+ cmpw 0,12,0
+ beq 0,<disp>
+ addi 12,12,-<some immediate>
+ stw 0,0(12)
+ b <disp>
+ [possibly one last probe: stw 0,<some immediate>(12)]. */
while (1)
{
/* addi 12,1,-<some immediate> */
if ((op & 0xffff0000) != 0x39810000)
- break;
+ break;
/* lis 0,-<some immediate> */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xffff0000) != 0x3c000000)
- break;
+ break;
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
/* [possibly ori 0,0,<some immediate>] */
if ((op & 0xffff0000) == 0x60000000)
- {
- pc = pc + 4;
- op = rs6000_fetch_instruction (gdbarch, pc);
- }
+ {
+ pc = pc + 4;
+ op = rs6000_fetch_instruction (gdbarch, pc);
+ }
/* add 0,12,0 */
if (op != 0x7c0c0214)
- break;
+ break;
/* cmpw 0,12,0 */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if (op != 0x7c0c0000)
- break;
+ break;
/* beq 0,<disp> */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xff9f0001) != 0x41820000)
- break;
+ break;
/* addi 12,12,-<some immediate> */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xffff0000) != 0x398c0000)
- break;
+ break;
/* stw 0,0(12) */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if (op != 0x900c0000)
- break;
+ break;
/* b <disp> */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xfc000001) != 0x48000000)
- break;
+ break;
/* [possibly one last probe: stw 0,<some immediate>(12)]. */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xffff0000) == 0x900c0000)
- {
- pc = pc + 4;
- op = rs6000_fetch_instruction (gdbarch, pc);
- }
+ {
+ pc = pc + 4;
+ op = rs6000_fetch_instruction (gdbarch, pc);
+ }
/* We found a valid stack-check sequence, return the new PC. */
return pc;
limit (saved in a run-time global variable) and the current stack
pointer:
- addi 0,1,-<some immediate>
- lis 12,__gnat_stack_limit@ha
- lwz 12,__gnat_stack_limit@l(12)
- twllt 0,12
+ addi 0,1,-<some immediate>
+ lis 12,__gnat_stack_limit@ha
+ lwz 12,__gnat_stack_limit@l(12)
+ twllt 0,12
or, with a small variant in the case of a bigger stack frame:
- addis 0,1,<some immediate>
- addic 0,0,-<some immediate>
- lis 12,__gnat_stack_limit@ha
- lwz 12,__gnat_stack_limit@l(12)
- twllt 0,12
+ addis 0,1,<some immediate>
+ addic 0,0,-<some immediate>
+ lis 12,__gnat_stack_limit@ha
+ lwz 12,__gnat_stack_limit@l(12)
+ twllt 0,12
*/
while (1)
{
/* addi 0,1,-<some immediate> */
if ((op & 0xffff0000) != 0x38010000)
- {
- /* small stack frame variant not recognized; try the
- big stack frame variant: */
+ {
+ /* small stack frame variant not recognized; try the
+ big stack frame variant: */
- /* addis 0,1,<some immediate> */
- if ((op & 0xffff0000) != 0x3c010000)
- break;
+ /* addis 0,1,<some immediate> */
+ if ((op & 0xffff0000) != 0x3c010000)
+ break;
- /* addic 0,0,-<some immediate> */
- pc = pc + 4;
- op = rs6000_fetch_instruction (gdbarch, pc);
- if ((op & 0xffff0000) != 0x30000000)
- break;
- }
+ /* addic 0,0,-<some immediate> */
+ pc = pc + 4;
+ op = rs6000_fetch_instruction (gdbarch, pc);
+ if ((op & 0xffff0000) != 0x30000000)
+ break;
+ }
/* lis 12,<some immediate> */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xffff0000) != 0x3d800000)
- break;
+ break;
/* lwz 12,<some immediate>(12) */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xffff0000) != 0x818c0000)
- break;
+ break;
/* twllt 0,12 */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xfffffffe) != 0x7c406008)
- break;
+ break;
/* We found a valid stack-check sequence, return the new PC. */
return pc;
for (;; pc += 4)
{
/* Sometimes it isn't clear if an instruction is a prologue
- instruction or not. When we encounter one of these ambiguous
+ instruction or not. When we encounter one of these ambiguous
cases, we'll set prev_insn_was_prologue_insn to 0 (false).
Otherwise, we'll assume that it really is a prologue instruction. */
if (prev_insn_was_prologue_insn)
ones. */
if (lr_reg == -1)
lr_reg = (op & 0x03e00000) >> 21;
- if (lr_reg == 0)
- r0_contains_arg = 0;
+ if (lr_reg == 0)
+ r0_contains_arg = 0;
continue;
}
else if ((op & 0xfc1fffff) == 0x7c000026)
{ /* mfcr Rx */
cr_reg = (op & 0x03e00000) >> 21;
- if (cr_reg == 0)
- r0_contains_arg = 0;
+ if (cr_reg == 0)
+ r0_contains_arg = 0;
continue;
}
continue;
}
else if (op == 0x60000000)
- {
+ {
/* nop */
/* Allow nops in the prologue, but do not consider them to
be part of the prologue unless followed by other prologue
{ /* addis 0,0,NUM, used for >= 32k frames */
fdata->offset = (op & 0x0000ffff) << 16;
fdata->frameless = 0;
- r0_contains_arg = 0;
+ r0_contains_arg = 0;
continue;
}
{ /* ori 0,0,NUM, 2nd half of >= 32k frames */
fdata->offset |= (op & 0x0000ffff);
fdata->frameless = 0;
- r0_contains_arg = 0;
+ r0_contains_arg = 0;
continue;
}
/* If the return address has already been saved, we can skip
calls to blrl (for PIC). */
- if (lr_reg != -1 && bl_to_blrl_insn_p (pc, op, byte_order))
+ if (lr_reg != -1 && bl_to_blrl_insn_p (pc, op, byte_order))
{
fdata->used_bl = 1;
continue;
continue;
/* move parameters from argument registers to local variable
- registers */
+ registers */
}
else if ((op & 0xfc0007fe) == 0x7c000378 && /* mr(.) Rx,Ry */
- (((op >> 21) & 31) >= 3) && /* R3 >= Ry >= R10 */
- (((op >> 21) & 31) <= 10) &&
- ((long) ((op >> 16) & 31)
+ (((op >> 21) & 31) >= 3) && /* R3 >= Ry >= R10 */
+ (((op >> 21) & 31) <= 10) &&
+ ((long) ((op >> 16) & 31)
>= fdata->saved_gpr)) /* Rx: local var reg */
{
continue;
}
/* Move parameters from argument registers to temporary register. */
else if (store_param_on_stack_p (op, framep, &r0_contains_arg))
- {
+ {
continue;
/* Set up frame pointer */
mtspr SPR256 Rn == 011111 nnnnn 0000001000 01110100110 */
else if ((op & 0xfc1fffff) == 0x7c0042a6) /* mfvrsave Rn */
{
- vrsave_reg = GET_SRC_REG (op);
+ vrsave_reg = GET_SRC_REG (op);
continue;
}
else if ((op & 0xfc1fffff) == 0x7c0043a6) /* mtvrsave Rn */
- {
- continue;
- }
+ {
+ continue;
+ }
/* Store the register where vrsave was saved to onto the stack:
- rS is the register where vrsave was stored in a previous
+ rS is the register where vrsave was stored in a previous
instruction. */
/* 100100 sssss 00001 dddddddd dddddddd */
else if ((op & 0xfc1f0000) == 0x90010000) /* stw rS, d(r1) */
- {
- if (vrsave_reg == GET_SRC_REG (op))
+ {
+ if (vrsave_reg == GET_SRC_REG (op))
{
fdata->vrsave_offset = SIGNED_SHORT (op) + offset;
vrsave_reg = -1;
}
- continue;
- }
+ continue;
+ }
/* Compute the new value of vrsave, by modifying the register
- where vrsave was saved to. */
+ where vrsave was saved to. */
else if (((op & 0xfc000000) == 0x64000000) /* oris Ra, Rs, UIMM */
|| ((op & 0xfc000000) == 0x60000000))/* ori Ra, Rs, UIMM */
{
/* 001110 00000 00000 iiii iiii iiii iiii */
/* 001110 01110 00000 iiii iiii iiii iiii */
else if ((op & 0xffff0000) == 0x38000000 /* li r0, SIMM */
- || (op & 0xffff0000) == 0x39c00000) /* li r14, SIMM */
+ || (op & 0xffff0000) == 0x39c00000) /* li r14, SIMM */
{
- if ((op & 0xffff0000) == 0x38000000)
- r0_contains_arg = 0;
+ if ((op & 0xffff0000) == 0x38000000)
+ r0_contains_arg = 0;
li_found_pc = pc;
vr_saved_offset = SIGNED_SHORT (op);
- /* This insn by itself is not part of the prologue, unless
- if part of the pair of insns mentioned above. So do not
- record this insn as part of the prologue yet. */
- prev_insn_was_prologue_insn = 0;
+ /* This insn by itself is not part of the prologue, unless
+ if part of the pair of insns mentioned above. So do not
+ record this insn as part of the prologue yet. */
+ prev_insn_was_prologue_insn = 0;
}
/* Store vector register S at (r31+r0) aligned to 16 bytes. */
/* 011111 sssss 11111 00000 00111001110 */
else if ((op & 0xfc1fffff) == 0x7c1f01ce) /* stvx Vs, R31, R0 */
- {
+ {
if (pc == (li_found_pc + 4))
{
vr_reg = GET_SRC_REG (op);
/* Start BookE related instructions. */
/* Store gen register S at (r31+uimm).
- Any register less than r13 is volatile, so we don't care. */
+ Any register less than r13 is volatile, so we don't care. */
/* 000100 sssss 11111 iiiii 01100100001 */
else if (arch_info->mach == bfd_mach_ppc_e500
&& (op & 0xfc1f07ff) == 0x101f0321) /* evstdd Rs,uimm(R31) */
{
- if ((op & 0x03e00000) >= 0x01a00000) /* Rs >= r13 */
+ if ((op & 0x03e00000) >= 0x01a00000) /* Rs >= r13 */
{
- unsigned int imm;
+ unsigned int imm;
ev_reg = GET_SRC_REG (op);
- imm = (op >> 11) & 0x1f;
+ imm = (op >> 11) & 0x1f;
ev_offset = imm * 8;
/* If this is the first vector reg to be saved, or if
it has a lower number than others previously seen,
fdata->ev_offset = ev_offset + offset;
}
}
- continue;
- }
+ continue;
+ }
/* Store gen register rS at (r1+rB). */
/* 000100 sssss 00001 bbbbb 01100100000 */
else if (arch_info->mach == bfd_mach_ppc_e500
&& (op & 0xffe007ff) == 0x13e00320) /* evstddx RS,R1,Rb */
{
- if (pc == (li_found_pc + 4))
- {
- ev_reg = GET_SRC_REG (op);
+ if (pc == (li_found_pc + 4))
+ {
+ ev_reg = GET_SRC_REG (op);
/* If this is the first vector reg to be saved, or if
- it has a lower number than others previously seen,
- reupdate the frame info. */
- /* We know the contents of rB from the previous instruction. */
+ it has a lower number than others previously seen,
+ reupdate the frame info. */
+ /* We know the contents of rB from the previous instruction. */
if (fdata->saved_ev == -1 || fdata->saved_ev > ev_reg)
{
- fdata->saved_ev = ev_reg;
- fdata->ev_offset = vr_saved_offset + offset;
+ fdata->saved_ev = ev_reg;
+ fdata->ev_offset = vr_saved_offset + offset;
}
vr_saved_offset = -1;
ev_reg = -1;
li_found_pc = 0;
- }
- continue;
- }
+ }
+ continue;
+ }
/* Store gen register r31 at (rA+uimm). */
/* 000100 11111 aaaaa iiiii 01100100001 */
else if (arch_info->mach == bfd_mach_ppc_e500
&& (op & 0xffe007ff) == 0x13e00321) /* evstdd R31,Ra,UIMM */
- {
- /* Wwe know that the source register is 31 already, but
- it can't hurt to compute it. */
+ {
+ /* Wwe know that the source register is 31 already, but
+ it can't hurt to compute it. */
ev_reg = GET_SRC_REG (op);
- ev_offset = ((op >> 11) & 0x1f) * 8;
+ ev_offset = ((op >> 11) & 0x1f) * 8;
/* If this is the first vector reg to be saved, or if
it has a lower number than others previously seen,
reupdate the frame info. */
continue;
}
/* Store gen register S at (r31+r0).
- Store param on stack when offset from SP bigger than 4 bytes. */
+ Store param on stack when offset from SP bigger than 4 bytes. */
/* 000100 sssss 11111 00000 01100100000 */
else if (arch_info->mach == bfd_mach_ppc_e500
&& (op & 0xfc1fffff) == 0x101f0320) /* evstddx Rs,R31,R0 */
{
- if (pc == (li_found_pc + 4))
- {
- if ((op & 0x03e00000) >= 0x01a00000)
+ if (pc == (li_found_pc + 4))
+ {
+ if ((op & 0x03e00000) >= 0x01a00000)
{
ev_reg = GET_SRC_REG (op);
/* If this is the first vector reg to be saved, or if
it has a lower number than others previously seen,
reupdate the frame info. */
- /* We know the contents of r0 from the previous
- instruction. */
+ /* We know the contents of r0 from the previous
+ instruction. */
if (fdata->saved_ev == -1 || fdata->saved_ev > ev_reg)
{
fdata->saved_ev = ev_reg;
vr_saved_offset = -1;
li_found_pc = 0;
continue;
- }
+ }
}
/* End BookE related instructions. */
struct bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
/* We check for ___eabi (three leading underscores) in addition
- to __eabi in case the GCC option "-fleading-underscore" was
+ to __eabi in case the GCC option "-fleading-underscore" was
used to compile the program. */
if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
+ && s.minsym->linkage_name () != NULL
&& (strcmp (s.minsym->linkage_name (), "__eabi") == 0
|| strcmp (s.minsym->linkage_name (), "___eabi") == 0))
pc += 4;
static int
rs6000_register_to_value (struct frame_info *frame,
- int regnum,
- struct type *type,
- gdb_byte *to,
+ int regnum,
+ struct type *type,
+ gdb_byte *to,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
static void
rs6000_value_to_register (struct frame_info *frame,
- int regnum,
- struct type *type,
- const gdb_byte *from)
+ int regnum,
+ struct type *type,
+ const gdb_byte *from)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte to[PPC_MAX_REGISTER_SIZE];
switch (num)
{
case 64:
- return tdep->ppc_mq_regnum;
+ return tdep->ppc_mq_regnum;
case 65:
- return tdep->ppc_lr_regnum;
+ return tdep->ppc_lr_regnum;
case 66:
- return tdep->ppc_ctr_regnum;
+ return tdep->ppc_ctr_regnum;
case 76:
- return tdep->ppc_xer_regnum;
+ return tdep->ppc_xer_regnum;
case 109:
- return tdep->ppc_vrsave_regnum;
+ return tdep->ppc_vrsave_regnum;
case 110:
- return tdep->ppc_vrsave_regnum - 1; /* vscr */
+ return tdep->ppc_vrsave_regnum - 1; /* vscr */
case 111:
- return tdep->ppc_acc_regnum;
+ return tdep->ppc_acc_regnum;
case 112:
- return tdep->ppc_spefscr_regnum;
+ return tdep->ppc_spefscr_regnum;
default:
- return num;
+ return num;
}
}
case 64:
return tdep->ppc_cr_regnum;
case 67:
- return tdep->ppc_vrsave_regnum - 1; /* vscr */
+ return tdep->ppc_vrsave_regnum - 1; /* vscr */
case 99:
- return tdep->ppc_acc_regnum;
+ return tdep->ppc_acc_regnum;
case 100:
- return tdep->ppc_mq_regnum;
+ return tdep->ppc_mq_regnum;
case 101:
- return tdep->ppc_xer_regnum;
+ return tdep->ppc_xer_regnum;
case 108:
- return tdep->ppc_lr_regnum;
+ return tdep->ppc_lr_regnum;
case 109:
- return tdep->ppc_ctr_regnum;
+ return tdep->ppc_ctr_regnum;
case 356:
- return tdep->ppc_vrsave_regnum;
+ return tdep->ppc_vrsave_regnum;
case 612:
- return tdep->ppc_spefscr_regnum;
+ return tdep->ppc_spefscr_regnum;
}
/* Unknown DWARF register number. */
if (safe_read_memory_unsigned_integer (cache->base, wordsize,
byte_order, &backchain))
- cache->base = (CORE_ADDR) backchain;
+ cache->base = (CORE_ADDR) backchain;
}
trad_frame_set_value (cache->saved_regs,
CORE_ADDR fpr_addr = cache->base + fdata.fpr_offset;
/* If skip_prologue says floating-point registers were saved,
- but the current architecture has no floating-point registers,
- then that's strange. But we have no indices to even record
- the addresses under, so we just ignore it. */
+ but the current architecture has no floating-point registers,
+ then that's strange. But we have no indices to even record
+ the addresses under, so we just ignore it. */
if (ppc_floating_point_unit_p (gdbarch))
- for (i = fdata.saved_fpr; i < ppc_num_fprs; i++)
- {
- cache->saved_regs[tdep->ppc_fp0_regnum + i].addr = fpr_addr;
- fpr_addr += 8;
- }
+ for (i = fdata.saved_fpr; i < ppc_num_fprs; i++)
+ {
+ cache->saved_regs[tdep->ppc_fp0_regnum + i].addr = fpr_addr;
+ fpr_addr += 8;
+ }
}
/* if != -1, fdata.saved_gpr is the smallest number of saved_gpr.
{
case 0: /* VSX Scalar Extract Exponent Double-Precision */
case 1: /* VSX Scalar Extract Significand Double-Precision */
- record_full_arch_list_add_reg (regcache,
+ record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
return 0;
case 16: /* VSX Scalar Convert Half-Precision format to
case 583:
switch (PPC_FIELD (insn, 11, 5))
- {
+ {
case 1: /* Move From FPSCR & Clear Enables */
case 20: /* Move From FPSCR Control & set DRN */
case 21: /* Move From FPSCR Control & set DRN Immediate */
tdep->ppc_fp0_regnum
+ PPC_FRT (insn));
return 0;
- }
+ }
break;
case 8: /* Floating Copy Sign */
case 57:
switch (insn & 0x3)
- {
+ {
case 0: /* Load Floating-Point Double Pair */
tmp = tdep->ppc_fp0_regnum + (PPC_RT (insn) & ~1);
record_full_arch_list_add_reg (regcache, tmp);
if (elf_abi == POWERPC_ELF_AUTO)
{
if (wordsize == 8 && info.byte_order == BFD_ENDIAN_LITTLE)
- elf_abi = POWERPC_ELF_V2;
+ elf_abi = POWERPC_ELF_V2;
else
- elf_abi = POWERPC_ELF_V1;
+ elf_abi = POWERPC_ELF_V1;
}
if (soft_float_flag == AUTO_BOOLEAN_TRUE)
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
/* Word size in the various PowerPC bfd_arch_info structs isn't
- meaningful, because 64-bit CPUs can run in 32-bit mode. So, perform
- separate word size check. */
+ meaningful, because 64-bit CPUs can run in 32-bit mode. So, perform
+ separate word size check. */
tdep = gdbarch_tdep (arches->gdbarch);
if (tdep && tdep->elf_abi != elf_abi)
continue;
if (params != nullptr)
{
for (const rust_op *op : *params)
- result.push_back (convert_ast_to_type (op));
+ result.push_back (convert_ast_to_type (op));
}
return result;
if (!is_tuple)
{
if (type->name () != NULL)
- fprintf_filtered (stream, "%s", type->name ());
+ fprintf_filtered (stream, "%s", type->name ());
if (type->num_fields () == 0)
- return;
+ return;
if (type->name () != NULL)
- fputs_filtered (" ", stream);
+ fputs_filtered (" ", stream);
}
if (is_tuple || is_tuple_struct)
for (i = 0; i < type->num_fields (); ++i)
{
if (field_is_static (&type->field (i)))
- continue;
+ continue;
if (!first_field)
- fputs_filtered (",", stream);
+ fputs_filtered (",", stream);
if (options->prettyformat)
- {
+ {
fputs_filtered ("\n", stream);
print_spaces_filtered (2 + 2 * recurse, stream);
- }
+ }
else if (!first_field)
- fputs_filtered (" ", stream);
+ fputs_filtered (" ", stream);
first_field = 0;
if (!is_tuple && !is_tuple_struct)
- {
+ {
fputs_styled (TYPE_FIELD_NAME (type, i),
variable_name_style.style (), stream);
fputs_filtered (": ", stream);
- }
+ }
rust_value_print_inner (value_field (val, i), stream, recurse + 1,
&opts);
&& type->name () != NULL)
{
/* Rust calls the unit type "void" in its debuginfo,
- but we don't want to print it as that. */
+ but we don't want to print it as that. */
if (type->code () == TYPE_CODE_VOID)
- fputs_filtered ("()", stream);
+ fputs_filtered ("()", stream);
else
- fputs_filtered (type->name (), stream);
+ fputs_filtered (type->name (), stream);
return;
}
fputs_filtered (")", stream);
/* If it returns unit, we can omit the return type. */
if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
- {
- fputs_filtered (" -> ", stream);
- rust_internal_print_type (TYPE_TARGET_TYPE (type), "", stream,
+ {
+ fputs_filtered (" -> ", stream);
+ rust_internal_print_type (TYPE_TARGET_TYPE (type), "", stream,
-1, 0, flags, false, podata);
- }
+ }
break;
case TYPE_CODE_ARRAY:
case STRUCTOP_ANONYMOUS:
{
- /* Anonymous field access, i.e. foo.1. */
- struct value *lhs;
- int pc, field_number, nfields;
- struct type *type;
-
- pc = (*pos)++;
- field_number = longest_to_int (exp->elts[pc + 1].longconst);
- (*pos) += 2;
+ /* Anonymous field access, i.e. foo.1. */
+ struct value *lhs;
+ int pc, field_number, nfields;
+ struct type *type;
+
+ pc = (*pos)++;
+ field_number = longest_to_int (exp->elts[pc + 1].longconst);
+ (*pos) += 2;
lhs = evaluate_subexp (nullptr, exp, pos, noside);
type = value_type (lhs);
case STRUCTOP_STRUCT:
{
- struct value *lhs;
- struct type *type;
- int tem, pc;
+ struct value *lhs;
+ struct type *type;
+ int tem, pc;
- pc = (*pos)++;
- tem = longest_to_int (exp->elts[pc + 1].longconst);
- (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
+ pc = (*pos)++;
+ tem = longest_to_int (exp->elts[pc + 1].longconst);
+ (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
lhs = evaluate_subexp (nullptr, exp, pos, noside);
const char *field_name = &exp->elts[pc + 2].string;
- type = value_type (lhs);
- if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
+ type = value_type (lhs);
+ if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
{
gdb::array_view<const gdb_byte> view (value_contents (lhs),
TYPE_LENGTH (type));
static void
rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
- enum rx_frame_type frame_type,
+ enum rx_frame_type frame_type,
struct rx_prologue *result)
{
CORE_ADDR pc, next_pc;
if (frame_type == RX_FRAME_TYPE_FAST_INTERRUPT)
{
/* This code won't do anything useful at present, but this is
- what happens for fast interrupts. */
+ what happens for fast interrupts. */
reg[RX_BPSW_REGNUM] = reg[RX_PSW_REGNUM];
reg[RX_BPC_REGNUM] = reg[RX_PC_REGNUM];
}
else
{
/* When an exception occurs, the PSW is saved to the interrupt stack
- first. */
+ first. */
if (frame_type == RX_FRAME_TYPE_EXCEPTION)
{
reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
}
/* The call instruction (or an exception/interrupt) has saved the return
- address on the stack. */
+ address on the stack. */
reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
stack.store (reg[RX_SP_REGNUM], 4, reg[RX_PC_REGNUM]);
stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
- just initialize the prologue cache, but don't do anything. */
+ just initialize the prologue cache, but don't do anything. */
if (!func_start)
stop_addr = func_start;
else if (opc.id == RXO_rtfi)
return RX_FRAME_TYPE_FAST_INTERRUPT;
else if (opc.id == RXO_rte)
- return RX_FRAME_TYPE_EXCEPTION;
+ return RX_FRAME_TYPE_EXCEPTION;
pc += bytes_read;
}
static void
rx_frame_this_id (struct frame_info *this_frame, void **this_cache,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
*this_id = frame_id_build (rx_frame_base (this_frame, this_cache),
get_frame_func (this_frame));
static struct value *
rx_frame_prev_register (struct frame_info *this_frame, void **this_cache,
- int regnum)
+ int regnum)
{
enum rx_frame_type frame_type = rx_frame_type (this_frame, this_cache);
struct rx_prologue *p
if (regnum == RX_SP_REGNUM)
{
if (frame_type == RX_FRAME_TYPE_EXCEPTION)
- {
+ {
struct value *psw_val;
CORE_ADDR psw;
psw_val = rx_frame_prev_register (this_frame, this_cache,
- RX_PSW_REGNUM);
+ RX_PSW_REGNUM);
psw = extract_unsigned_integer (value_contents_all (psw_val), 4,
gdbarch_byte_order (
get_frame_arch (this_frame)));
if ((psw & 0x20000 /* U bit */) != 0)
return rx_frame_prev_register (this_frame, this_cache,
- RX_USP_REGNUM);
+ RX_USP_REGNUM);
- /* Fall through for the case where U bit is zero. */
+ /* Fall through for the case where U bit is zero. */
}
return frame_unwind_got_constant (this_frame, regnum, frame_base);
if (frame_type == RX_FRAME_TYPE_FAST_INTERRUPT)
{
if (regnum == RX_PC_REGNUM)
- return rx_frame_prev_register (this_frame, this_cache,
- RX_BPC_REGNUM);
+ return rx_frame_prev_register (this_frame, this_cache,
+ RX_BPC_REGNUM);
if (regnum == RX_PSW_REGNUM)
- return rx_frame_prev_register (this_frame, this_cache,
- RX_BPSW_REGNUM);
+ return rx_frame_prev_register (this_frame, this_cache,
+ RX_BPSW_REGNUM);
}
/* If prologue analysis says we saved this register somewhere,
exception_frame_p (enum rx_frame_type frame_type)
{
return (frame_type == RX_FRAME_TYPE_EXCEPTION
- || frame_type == RX_FRAME_TYPE_FAST_INTERRUPT);
+ || frame_type == RX_FRAME_TYPE_FAST_INTERRUPT);
}
/* Common code used by both normal and exception frame sniffers. */
static int
rx_frame_sniffer_common (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ struct frame_info *this_frame,
void **this_cache,
int (*sniff_p)(enum rx_frame_type) )
{
enum rx_frame_type frame_type = rx_frame_type (this_frame, this_cache);
if (sniff_p (frame_type))
- {
+ {
/* The call below will fill in the cache, including the frame
type. */
(void) rx_analyze_frame_prologue (this_frame, frame_type, this_cache);
return 1;
- }
+ }
else
- return 0;
+ return 0;
}
else
{
static int
rx_frame_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ struct frame_info *this_frame,
void **this_cache)
{
return rx_frame_sniffer_common (self, this_frame, this_cache,
- normal_frame_p);
+ normal_frame_p);
}
/* Frame sniffer for exception frames. */
static int
rx_exception_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
+ struct frame_info *this_frame,
void **this_cache)
{
return rx_frame_sniffer_common (self, this_frame, this_cache,
- exception_frame_p);
+ exception_frame_p);
}
/* Data structure for normal code using instruction-based prologue
byte_order) == struct_addr)
{
/* This argument represents the address at which C++ (and
- possibly other languages) store their return value.
- Put this value in R15. */
+ possibly other languages) store their return value.
+ Put this value in R15. */
if (write_pass)
regcache_cooked_write_unsigned (regcache, RX_R15_REGNUM,
struct_addr);
&& arg_reg <= RX_R4_REGNUM - 1)
{
/* If argument registers are going to be used to pass
- an 8 byte scalar, the ABI specifies that two registers
- must be available. */
+ an 8 byte scalar, the ABI specifies that two registers
+ must be available. */
if (write_pass)
{
regcache_cooked_write_unsigned (regcache, arg_reg,
else
{
/* Argument is a struct or union. Pass as much of the struct
- in registers, if possible. Pass the rest on the stack. */
+ in registers, if possible. Pass the rest on the stack. */
while (arg_size > 0)
{
if (i < num_register_candidate_args
CORE_ADDR prologue_end = skip_prologue_using_sal (gdbarch, pc);
if (prologue_end != 0)
- return prologue_end;
+ return prologue_end;
}
warning (_("%s Failed to find end of prologue PC = %08x"),
if (start_addr == 0)
{
warning (_("Couldn't find function including address %s SP is %s"),
- paddress (gdbarch, this_pc),
- paddress (gdbarch, this_sp));
+ paddress (gdbarch, this_pc),
+ paddress (gdbarch, this_sp));
/* JPB: 28-Apr-11. This is a temporary patch, to get round GDB
crashing right at the beginning. Build the frame ID as best we
{
/* Only do if executing. */
if (0 != this_sp)
- {
- this_sp_for_id = this_sp - frame_size;
- trad_frame_set_this_base (info, this_sp_for_id);
- }
+ {
+ this_sp_for_id = this_sp - frame_size;
+ trad_frame_set_this_base (info, this_sp_for_id);
+ }
trad_frame_set_reg_value (info, REG_S, this_sp + 3);
trad_frame_set_reg_addr (info, REG_P, this_sp);
}
{
gdb_assert (this_sp == this_sp_for_id);
/* The stack pointer of the prev frame is frame_size greater
- than the stack pointer of this frame plus one address
- size (caused by the JSR or BSR). */
+ than the stack pointer of this frame plus one address
+ size (caused by the JSR or BSR). */
trad_frame_set_reg_value (info, REG_S,
- this_sp + frame_size + 3);
+ this_sp + frame_size + 3);
trad_frame_set_reg_addr (info, REG_P, this_sp + frame_size);
}
0xD0. */
static void
s12z_print_ccw_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- struct frame_info *frame,
- int reg)
+ struct ui_file *file,
+ struct frame_info *frame,
+ int reg)
{
struct value *v = value_of_register (reg, frame);
const char *name = gdbarch_register_name (gdbarch, reg);
for (int b = 15; b >= 0; --b)
{
if (ccw & (0x1u << b))
- {
- if (ccw_bits[b] == 0)
- fputc_filtered ('1', file);
- else
- fputc_filtered (ccw_bits[b], file);
- }
+ {
+ if (ccw_bits[b] == 0)
+ fputc_filtered ('1', file);
+ else
+ fputc_filtered (ccw_bits[b], file);
+ }
else
- fputc_filtered (tolower (ccw_bits[b]), file);
+ fputc_filtered (tolower (ccw_bits[b]), file);
}
fputc_filtered ('\n', file);
}
if (regnum == -1)
{
for (int reg = 0; reg < numregs; reg++)
- {
- if (REG_CCW == reg_perm[reg])
- {
- s12z_print_ccw_info (gdbarch, file, frame, reg);
- continue;
- }
- default_print_registers_info (gdbarch, file, frame, reg, print_all);
- }
+ {
+ if (REG_CCW == reg_perm[reg])
+ {
+ s12z_print_ccw_info (gdbarch, file, frame, reg);
+ continue;
+ }
+ default_print_registers_info (gdbarch, file, frame, reg, print_all);
+ }
}
else if (REG_CCW == reg_perm[regnum])
s12z_print_ccw_info (gdbarch, file, frame, regnum);
static void
s12z_extract_return_value (struct type *type, struct regcache *regcache,
- void *valbuf)
+ void *valbuf)
{
int reg = -1;
static enum return_value_convention
s12z_return_value (struct gdbarch *gdbarch, struct value *function,
- struct type *type, struct regcache *regcache,
- gdb_byte *readbuf, const gdb_byte *writebuf)
+ struct type *type, struct regcache *regcache,
+ gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION
add_cmd ("bdccsr", class_support, show_bdccsr_command,
_("Show the current value of the microcontroller's BDCCSR."),
- &maintenanceinfolist);
+ &maintenanceinfolist);
/* Target data types. */
set_gdbarch_short_bit (gdbarch, 16);
for (i = 0; i < 16; i++)
{
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + i))
- return -1;
+ return -1;
if (record_full_arch_list_add_reg (regcache, S390_A0_REGNUM + i))
- return -1;
+ return -1;
if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + i))
- return -1;
+ return -1;
if (tdep->gpr_full_regnum != -1)
- if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
- return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
+ return -1;
if (tdep->v0_full_regnum != -1)
- {
- if (record_full_arch_list_add_reg (regcache, S390_V0_LOWER_REGNUM + i))
- return -1;
- if (record_full_arch_list_add_reg (regcache, S390_V16_REGNUM + i))
- return -1;
- }
+ {
+ if (record_full_arch_list_add_reg (regcache, S390_V0_LOWER_REGNUM + i))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_V16_REGNUM + i))
+ return -1;
+ }
}
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
case 197: /* fstat64 */
case 221: /* fcntl64 */
if (abi == ABI_LINUX_S390)
- return (enum gdb_syscall) syscall;
+ return (enum gdb_syscall) syscall;
return gdb_sys_no_syscall;
/* These syscalls don't exist on s390. */
case 17: /* break */
return gdb_sys_readahead;
case 223:
if (abi == ABI_LINUX_S390)
- return gdb_sys_sendfile64;
+ return gdb_sys_sendfile64;
return gdb_sys_no_syscall;
/* 224-235 handled below */
case 236:
/* 263 reserved */
case 264:
if (abi == ABI_LINUX_S390)
- return gdb_sys_fadvise64_64;
+ return gdb_sys_fadvise64_64;
return gdb_sys_no_syscall;
case 265:
return gdb_sys_statfs64;
/* 282-312 handled below */
case 293:
if (abi == ABI_LINUX_S390)
- return gdb_sys_fstatat64;
+ return gdb_sys_fstatat64;
return gdb_sys_newfstatat;
/* 313+ not yet supported */
default:
if (syscall_gdb < 0)
{
printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- plongest (syscall_native));
+ "support syscall number %s\n"),
+ plongest (syscall_native));
return -1;
}
|| syscall_gdb == gdb_sys_rt_sigreturn)
{
if (s390_all_but_pc_registers_record (regcache))
- return -1;
+ return -1;
return 0;
}
if (tdep->abi == ABI_LINUX_ZSERIES)
ret = record_linux_system_call (syscall_gdb, regcache,
- &s390x_linux_record_tdep);
+ &s390x_linux_record_tdep);
else
ret = record_linux_system_call (syscall_gdb, regcache,
- &s390_linux_record_tdep);
+ &s390_linux_record_tdep);
if (ret)
return ret;
static int
s390_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
- enum gdb_signal signal)
+ enum gdb_signal signal)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* There are two kinds of signal frames on s390. rt_sigframe is always
the larger one, so don't even bother with sigframe. */
const int sizeof_rt_sigframe = (tdep->abi == ABI_LINUX_ZSERIES ?
- 160 + 8 + 128 + 1024 : 96 + 8 + 128 + 1000);
+ 160 + 8 + 128 + 1024 : 96 + 8 + 128 + 1000);
ULONGEST sp;
int i;
for (i = 0; i < 16; i++)
{
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + i))
- return -1;
+ return -1;
if (tdep->gpr_full_regnum != -1)
- if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
- return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_R0_UPPER_REGNUM + i))
+ return -1;
}
if (record_full_arch_list_add_reg (regcache, S390_PSWA_REGNUM))
return -1;
static void
s390_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
- enum s390_abi_kind abi)
+ enum s390_abi_kind abi)
{
/* These values are the size of the type that will be used in a system
call. They are obtained from Linux Kernel source. */
score_register_type (struct gdbarch *gdbarch, int regnum)
{
gdb_assert (regnum >= 0
- && regnum < ((target_mach == bfd_mach_score7)
+ && regnum < ((target_mach == bfd_mach_score7)
? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
return builtin_type (gdbarch)->builtin_uint32;
}
score_register_sim_regno (struct gdbarch *gdbarch, int regnum)
{
gdb_assert (regnum >= 0
- && regnum < ((target_mach == bfd_mach_score7)
+ && regnum < ((target_mach == bfd_mach_score7)
? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
return regnum;
}
/* Fetch instruction from target. */
ret = target_read_memory (addr & ~0x3, buf, SCORE_INSTLEN);
if (ret)
- {
- error (_("Error: target_read_memory in file:%s, line:%d!"),
- __FILE__, __LINE__);
- return 0;
- }
+ {
+ error (_("Error: target_read_memory in file:%s, line:%d!"),
+ __FILE__, __LINE__);
+ return 0;
+ }
}
inst.raw = extract_unsigned_integer (buf, SCORE_INSTLEN, byte_order);
if (inst.len == 2)
{
if (big ^ ((addr & 0x2) == 2))
- inst.v = G_FLD (inst.v, 29, 15);
+ inst.v = G_FLD (inst.v, 29, 15);
else
- inst.v = G_FLD (inst.v, 14, 0);
+ inst.v = G_FLD (inst.v, 14, 0);
}
return &inst;
}
* 0 1 0 * # 2
* 0 1 1 0 # 3
0 1 1 0 * # 6
- table 2 (column 1, 2, 3)
+ table 2 (column 1, 2, 3)
* 0 0 * * # 0, 4
0 1 0 * * # 2
1 1 0 * * # 6
{
ret = target_read_memory (adjust_pc + 2 * i, buf[i], EXTRACT_LEN);
if (ret != 0)
- {
- buf[i][0] = '\0';
- buf[i][1] = '\0';
+ {
+ buf[i][0] = '\0';
+ buf[i][1] = '\0';
if (i == 2)
- error (_("Error: target_read_memory in file:%s, line:%d!"),
+ error (_("Error: target_read_memory in file:%s, line:%d!"),
__FILE__, __LINE__);
- }
+ }
raw = extract_unsigned_integer (buf[i], EXTRACT_LEN, byte_order);
cbits = (cbits << 1) | (raw >> 15);
for (; count > 0; i++, count--)
{
inst.raw = (inst.raw << 16)
- | extract_unsigned_integer (buf[i], EXTRACT_LEN, byte_order);
+ | extract_unsigned_integer (buf[i], EXTRACT_LEN, byte_order);
}
switch (inst.len)
static void
score_xfer_register (struct regcache *regcache, int regnum, int length,
- enum bfd_endian endian, gdb_byte *readbuf,
- const gdb_byte *writebuf, int buf_offset)
+ enum bfd_endian endian, gdb_byte *readbuf,
+ const gdb_byte *writebuf, int buf_offset)
{
int reg_offset = 0;
gdb_assert (regnum >= 0
- && regnum < ((target_mach == bfd_mach_score7)
+ && regnum < ((target_mach == bfd_mach_score7)
? SCORE7_NUM_REGS : SCORE3_NUM_REGS));
switch (endian)
break;
default:
error (_("Error: score_xfer_register in file:%s, line:%d!"),
- __FILE__, __LINE__);
+ __FILE__, __LINE__);
}
if (readbuf != NULL)
static enum return_value_convention
score_return_value (struct gdbarch *gdbarch, struct value *function,
- struct type *type, struct regcache *regcache,
- gdb_byte * readbuf, const gdb_byte * writebuf)
+ struct type *type, struct regcache *regcache,
+ gdb_byte * readbuf, const gdb_byte * writebuf)
{
if (type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION
int offset;
int regnum;
for (offset = 0, regnum = SCORE_A0_REGNUM;
- offset < TYPE_LENGTH (type);
- offset += SCORE_REGSIZE, regnum++)
- {
- int xfer = SCORE_REGSIZE;
-
- if (offset + xfer > TYPE_LENGTH (type))
- xfer = TYPE_LENGTH (type) - offset;
- score_xfer_register (regcache, regnum, xfer,
+ offset < TYPE_LENGTH (type);
+ offset += SCORE_REGSIZE, regnum++)
+ {
+ int xfer = SCORE_REGSIZE;
+
+ if (offset + xfer > TYPE_LENGTH (type))
+ xfer = TYPE_LENGTH (type) - offset;
+ score_xfer_register (regcache, regnum, xfer,
gdbarch_byte_order(gdbarch),
- readbuf, writebuf, offset);
- }
+ readbuf, writebuf, offset);
+ }
return RETURN_VALUE_REGISTER_CONVENTION;
}
}
n = type->num_fields ();
for (i = 0; i < n; i++)
- if (score_type_needs_double_align (type->field (i).type ()))
- return 1;
+ if (score_type_needs_double_align (type->field (i).type ()))
+ return 1;
return 0;
}
return 0;
static CORE_ADDR
score_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
sp = align_down (sp, 16);
for (argnum = 0; argnum < nargs; argnum++)
arglen += align_up (TYPE_LENGTH (value_type (args[argnum])),
- SCORE_REGSIZE);
+ SCORE_REGSIZE);
sp -= align_up (arglen, 16);
argreg = SCORE_BEGIN_ARG_REGNUM;
arglen = TYPE_LENGTH (arg_type);
/* If a arg should be aligned to 8 bytes (long long or double),
- the value should be put to even register numbers. */
+ the value should be put to even register numbers. */
if (score_type_needs_double_align (arg_type))
- {
- if (argreg & 1)
- argreg++;
- }
+ {
+ if (argreg & 1)
+ argreg++;
+ }
/* If sizeof a block < SCORE_REGSIZE, then Score GCC will chose
- the default "downward"/"upward" method:
+ the default "downward"/"upward" method:
- Example:
+ Example:
- struct struc
- {
- char a; char b; char c;
- } s = {'a', 'b', 'c'};
+ struct struc
+ {
+ char a; char b; char c;
+ } s = {'a', 'b', 'c'};
- Big endian: s = {X, 'a', 'b', 'c'}
- Little endian: s = {'a', 'b', 'c', X}
+ Big endian: s = {X, 'a', 'b', 'c'}
+ Little endian: s = {'a', 'b', 'c', X}
- Where X is a hole. */
+ Where X is a hole. */
if (gdbarch_byte_order(gdbarch) == BFD_ENDIAN_BIG
- && (typecode == TYPE_CODE_STRUCT
- || typecode == TYPE_CODE_UNION)
- && argreg > SCORE_LAST_ARG_REGNUM
- && arglen < SCORE_REGSIZE)
- downward_offset += (SCORE_REGSIZE - arglen);
+ && (typecode == TYPE_CODE_STRUCT
+ || typecode == TYPE_CODE_UNION)
+ && argreg > SCORE_LAST_ARG_REGNUM
+ && arglen < SCORE_REGSIZE)
+ downward_offset += (SCORE_REGSIZE - arglen);
while (arglen > 0)
- {
- int partial_len = arglen < SCORE_REGSIZE ? arglen : SCORE_REGSIZE;
- ULONGEST regval = extract_unsigned_integer (val, partial_len,
+ {
+ int partial_len = arglen < SCORE_REGSIZE ? arglen : SCORE_REGSIZE;
+ ULONGEST regval = extract_unsigned_integer (val, partial_len,
byte_order);
- /* The last part of a arg should shift left when
- gdbarch_byte_order is BFD_ENDIAN_BIG. */
- if (byte_order == BFD_ENDIAN_BIG
- && arg_last_part_p == 1
- && (typecode == TYPE_CODE_STRUCT
- || typecode == TYPE_CODE_UNION))
- regval <<= ((SCORE_REGSIZE - partial_len) * TARGET_CHAR_BIT);
-
- /* Always increase the stack_offset and save args to stack. */
- addr = sp + stack_offset + downward_offset;
- write_memory (addr, val, partial_len);
-
- if (argreg <= SCORE_LAST_ARG_REGNUM)
- {
- regcache_cooked_write_unsigned (regcache, argreg++, regval);
- if (arglen > SCORE_REGSIZE && arglen < SCORE_REGSIZE * 2)
- arg_last_part_p = 1;
- }
-
- val += partial_len;
- arglen -= partial_len;
- stack_offset += align_up (partial_len, SCORE_REGSIZE);
- }
+ /* The last part of a arg should shift left when
+ gdbarch_byte_order is BFD_ENDIAN_BIG. */
+ if (byte_order == BFD_ENDIAN_BIG
+ && arg_last_part_p == 1
+ && (typecode == TYPE_CODE_STRUCT
+ || typecode == TYPE_CODE_UNION))
+ regval <<= ((SCORE_REGSIZE - partial_len) * TARGET_CHAR_BIT);
+
+ /* Always increase the stack_offset and save args to stack. */
+ addr = sp + stack_offset + downward_offset;
+ write_memory (addr, val, partial_len);
+
+ if (argreg <= SCORE_LAST_ARG_REGNUM)
+ {
+ regcache_cooked_write_unsigned (regcache, argreg++, regval);
+ if (arglen > SCORE_REGSIZE && arglen < SCORE_REGSIZE * 2)
+ arg_last_part_p = 1;
+ }
+
+ val += partial_len;
+ arglen -= partial_len;
+ stack_offset += align_up (partial_len, SCORE_REGSIZE);
+ }
}
/* Step 5, Save SP. */
{
inst_t *inst = score7_fetch_inst (gdbarch, cpc, NULL);
if (!inst)
- break;
+ break;
if ((inst->len == 4) && !stack_sub
- && (G_FLD (inst->v, 29, 25) == 0x1
- && G_FLD (inst->v, 24, 20) == 0x0))
- {
- /* addi r0, offset */
- stack_sub = cpc + SCORE_INSTLEN;
- pc = cpc + SCORE_INSTLEN;
- }
+ && (G_FLD (inst->v, 29, 25) == 0x1
+ && G_FLD (inst->v, 24, 20) == 0x0))
+ {
+ /* addi r0, offset */
+ stack_sub = cpc + SCORE_INSTLEN;
+ pc = cpc + SCORE_INSTLEN;
+ }
else if ((inst->len == 4)
- && (G_FLD (inst->v, 29, 25) == 0x0)
- && (G_FLD (inst->v, 24, 20) == 0x2)
- && (G_FLD (inst->v, 19, 15) == 0x0)
- && (G_FLD (inst->v, 14, 10) == 0xF)
- && (G_FLD (inst->v, 9, 0) == 0x56))
- {
- /* mv r2, r0 */
- pc = cpc + SCORE_INSTLEN;
- break;
- }
+ && (G_FLD (inst->v, 29, 25) == 0x0)
+ && (G_FLD (inst->v, 24, 20) == 0x2)
+ && (G_FLD (inst->v, 19, 15) == 0x0)
+ && (G_FLD (inst->v, 14, 10) == 0xF)
+ && (G_FLD (inst->v, 9, 0) == 0x56))
+ {
+ /* mv r2, r0 */
+ pc = cpc + SCORE_INSTLEN;
+ break;
+ }
else if ((inst->len == 2)
- && (G_FLD (inst->v, 14, 12) == 0x0)
- && (G_FLD (inst->v, 11, 8) == 0x2)
- && (G_FLD (inst->v, 7, 4) == 0x0)
- && (G_FLD (inst->v, 3, 0) == 0x3))
- {
- /* mv! r2, r0 */
- pc = cpc + SCORE16_INSTLEN;
- break;
- }
+ && (G_FLD (inst->v, 14, 12) == 0x0)
+ && (G_FLD (inst->v, 11, 8) == 0x2)
+ && (G_FLD (inst->v, 7, 4) == 0x0)
+ && (G_FLD (inst->v, 3, 0) == 0x3))
+ {
+ /* mv! r2, r0 */
+ pc = cpc + SCORE16_INSTLEN;
+ break;
+ }
else if ((inst->len == 2)
- && ((G_FLD (inst->v, 14, 12) == 3) /* j15 form */
- || (G_FLD (inst->v, 14, 12) == 4) /* b15 form */
- || (G_FLD (inst->v, 14, 12) == 0x0
- && G_FLD (inst->v, 3, 0) == 0x4))) /* br! */
- break;
+ && ((G_FLD (inst->v, 14, 12) == 3) /* j15 form */
+ || (G_FLD (inst->v, 14, 12) == 4) /* b15 form */
+ || (G_FLD (inst->v, 14, 12) == 0x0
+ && G_FLD (inst->v, 3, 0) == 0x4))) /* br! */
+ break;
else if ((inst->len == 4)
- && ((G_FLD (inst->v, 29, 25) == 2) /* j32 form */
- || (G_FLD (inst->v, 29, 25) == 4) /* b32 form */
- || (G_FLD (inst->v, 29, 25) == 0x0
- && G_FLD (inst->v, 6, 1) == 0x4))) /* br */
- break;
+ && ((G_FLD (inst->v, 29, 25) == 2) /* j32 form */
+ || (G_FLD (inst->v, 29, 25) == 4) /* b32 form */
+ || (G_FLD (inst->v, 29, 25) == 0x0
+ && G_FLD (inst->v, 6, 1) == 0x4))) /* br */
+ break;
cpc += (inst->len == 2) ? SCORE16_INSTLEN : SCORE_INSTLEN;
}
gdbarch_byte_order (gdbarch));
if (!inst)
- break;
+ break;
if (inst->len == 4 && !stack_sub
- && (G_FLD (inst->v, 29, 25) == 0x1)
- && (G_FLD (inst->v, 19, 17) == 0x0)
+ && (G_FLD (inst->v, 29, 25) == 0x1)
+ && (G_FLD (inst->v, 19, 17) == 0x0)
&& (G_FLD (inst->v, 24, 20) == 0x0))
- {
- /* addi r0, offset */
- stack_sub = cpc + inst->len;
- pc = cpc + inst->len;
- }
+ {
+ /* addi r0, offset */
+ stack_sub = cpc + inst->len;
+ pc = cpc + inst->len;
+ }
else if (inst->len == 4
- && (G_FLD (inst->v, 29, 25) == 0x0)
+ && (G_FLD (inst->v, 29, 25) == 0x0)
&& (G_FLD (inst->v, 24, 20) == 0x2)
&& (G_FLD (inst->v, 19, 15) == 0x0)
&& (G_FLD (inst->v, 14, 10) == 0xF)
&& (G_FLD (inst->v, 9, 0) == 0x56))
- {
- /* mv r2, r0 */
- pc = cpc + inst->len;
- break;
- }
+ {
+ /* mv r2, r0 */
+ pc = cpc + inst->len;
+ break;
+ }
else if ((inst->len == 2)
- && (G_FLD (inst->v, 14, 10) == 0x10)
- && (G_FLD (inst->v, 9, 5) == 0x2)
+ && (G_FLD (inst->v, 14, 10) == 0x10)
+ && (G_FLD (inst->v, 9, 5) == 0x2)
&& (G_FLD (inst->v, 4, 0) == 0x0))
- {
- /* mv! r2, r0 */
- pc = cpc + inst->len;
- break;
- }
+ {
+ /* mv! r2, r0 */
+ pc = cpc + inst->len;
+ break;
+ }
else if (inst->len == 2
- && ((G_FLD (inst->v, 14, 12) == 3) /* b15 form */
- || (G_FLD (inst->v, 14, 12) == 0x0
- && G_FLD (inst->v, 11, 5) == 0x4))) /* br! */
- break;
+ && ((G_FLD (inst->v, 14, 12) == 3) /* b15 form */
+ || (G_FLD (inst->v, 14, 12) == 0x0
+ && G_FLD (inst->v, 11, 5) == 0x4))) /* br! */
+ break;
else if (inst->len == 4
- && ((G_FLD (inst->v, 29, 25) == 2) /* j32 form */
- || (G_FLD (inst->v, 29, 25) == 4))) /* b32 form */
- break;
+ && ((G_FLD (inst->v, 29, 25) == 2) /* j32 form */
+ || (G_FLD (inst->v, 29, 25) == 4))) /* b32 form */
+ break;
cpc += inst->len;
}
if (inst->v == 0x23)
return 1; /* mv! r0, r2 */
else if (G_FLD (inst->v, 14, 12) == 0x2
- && G_FLD (inst->v, 3, 0) == 0xa)
+ && G_FLD (inst->v, 3, 0) == 0xa)
return 1; /* pop! */
else if (G_FLD (inst->v, 14, 12) == 0x0
- && G_FLD (inst->v, 7, 0) == 0x34)
+ && G_FLD (inst->v, 7, 0) == 0x34)
return 1; /* br! r3 */
else if (G_FLD (inst->v, 29, 15) == 0x2
- && G_FLD (inst->v, 6, 1) == 0x2b)
+ && G_FLD (inst->v, 6, 1) == 0x2b)
return 1; /* mv r0, r2 */
else if (G_FLD (inst->v, 29, 25) == 0x0
- && G_FLD (inst->v, 6, 1) == 0x4
- && G_FLD (inst->v, 19, 15) == 0x3)
+ && G_FLD (inst->v, 6, 1) == 0x4
+ && G_FLD (inst->v, 19, 15) == 0x3)
return 1; /* br r3 */
else
return 0;
&& (G_FLD (inst->v, 4, 0) == 0x2))
return 1; /* mv! r0, r2 */
else if (inst->len == 4
- && (G_FLD (inst->v, 29, 25) == 0x0)
- && (G_FLD (inst->v, 24, 20) == 0x2)
- && (G_FLD (inst->v, 19, 15) == 0x0)
+ && (G_FLD (inst->v, 29, 25) == 0x0)
+ && (G_FLD (inst->v, 24, 20) == 0x2)
+ && (G_FLD (inst->v, 19, 15) == 0x0)
&& (G_FLD (inst->v, 14, 10) == 0xF)
&& (G_FLD (inst->v, 9, 0) == 0x56))
return 1; /* mv r0, r2 */
else if (inst->len == 2
- && (G_FLD (inst->v, 14, 12) == 0x0)
- && (G_FLD (inst->v, 11, 5) == 0x2))
+ && (G_FLD (inst->v, 14, 12) == 0x0)
+ && (G_FLD (inst->v, 11, 5) == 0x2))
return 1; /* pop! */
else if (inst->len == 2
- && (G_FLD (inst->v, 14, 12) == 0x0)
- && (G_FLD (inst->v, 11, 7) == 0x0)
- && (G_FLD (inst->v, 6, 5) == 0x2))
+ && (G_FLD (inst->v, 14, 12) == 0x0)
+ && (G_FLD (inst->v, 11, 7) == 0x0)
+ && (G_FLD (inst->v, 6, 5) == 0x2))
return 1; /* rpop! */
else if (inst->len == 2
- && (G_FLD (inst->v, 14, 12) == 0x0)
- && (G_FLD (inst->v, 11, 5) == 0x4)
- && (G_FLD (inst->v, 4, 0) == 0x3))
+ && (G_FLD (inst->v, 14, 12) == 0x0)
+ && (G_FLD (inst->v, 11, 5) == 0x4)
+ && (G_FLD (inst->v, 4, 0) == 0x3))
return 1; /* br! r3 */
else if (inst->len == 4
- && (G_FLD (inst->v, 29, 25) == 0x0)
- && (G_FLD (inst->v, 24, 20) == 0x0)
- && (G_FLD (inst->v, 19, 15) == 0x3)
- && (G_FLD (inst->v, 14, 10) == 0xF)
- && (G_FLD (inst->v, 9, 0) == 0x8))
+ && (G_FLD (inst->v, 29, 25) == 0x0)
+ && (G_FLD (inst->v, 24, 20) == 0x0)
+ && (G_FLD (inst->v, 19, 15) == 0x3)
+ && (G_FLD (inst->v, 14, 10) == 0xF)
+ && (G_FLD (inst->v, 9, 0) == 0x8))
return 1; /* br r3 */
else
return 0;
if (ret)
{
error (_("Error: target_read_memory in file:%s, line:%d!"),
- __FILE__, __LINE__);
+ __FILE__, __LINE__);
return NULL;
}
return memblock;
static void
score7_adjust_memblock_ptr (gdb_byte **memblock, CORE_ADDR prev_pc,
- CORE_ADDR cur_pc)
+ CORE_ADDR cur_pc)
{
if (prev_pc == -1)
{
static void
score7_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
- struct frame_info *this_frame,
- struct score_frame_cache *this_cache)
+ struct frame_info *this_frame,
+ struct score_frame_cache *this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR sp;
{
inst_t *inst = NULL;
if (memblock != NULL)
- {
- /* Reading memory block from target successfully and got all
- the instructions(from STARTADDR to PC) needed. */
- score7_adjust_memblock_ptr (&memblock, prev_pc, cur_pc);
- inst = score7_fetch_inst (gdbarch, cur_pc, memblock);
- }
+ {
+ /* Reading memory block from target successfully and got all
+ the instructions(from STARTADDR to PC) needed. */
+ score7_adjust_memblock_ptr (&memblock, prev_pc, cur_pc);
+ inst = score7_fetch_inst (gdbarch, cur_pc, memblock);
+ }
else
- {
- /* Otherwise, we fetch 4 bytes from target, and GDB also
- work correctly. */
- inst = score7_fetch_inst (gdbarch, cur_pc, NULL);
- }
+ {
+ /* Otherwise, we fetch 4 bytes from target, and GDB also
+ work correctly. */
+ inst = score7_fetch_inst (gdbarch, cur_pc, NULL);
+ }
/* FIXME: make a full-power prologue analyzer. */
if (inst->len == 2)
- {
- inst_len = SCORE16_INSTLEN;
-
- if (G_FLD (inst->v, 14, 12) == 0x2
- && G_FLD (inst->v, 3, 0) == 0xe)
- {
- /* push! */
- sp_offset += 4;
-
- if (G_FLD (inst->v, 11, 7) == 0x6
- && ra_offset_p == 0)
- {
- /* push! r3, [r0] */
- ra_offset = sp_offset;
- ra_offset_p = 1;
- }
- else if (G_FLD (inst->v, 11, 7) == 0x4
- && fp_offset_p == 0)
- {
- /* push! r2, [r0] */
- fp_offset = sp_offset;
- fp_offset_p = 1;
- }
- }
- else if (G_FLD (inst->v, 14, 12) == 0x2
- && G_FLD (inst->v, 3, 0) == 0xa)
- {
- /* pop! */
- sp_offset -= 4;
- }
- else if (G_FLD (inst->v, 14, 7) == 0xc1
- && G_FLD (inst->v, 2, 0) == 0x0)
- {
- /* subei! r0, n */
- sp_offset += (int) pow (2.0, G_FLD (inst->v, 6, 3));
- }
- else if (G_FLD (inst->v, 14, 7) == 0xc0
- && G_FLD (inst->v, 2, 0) == 0x0)
- {
- /* addei! r0, n */
+ {
+ inst_len = SCORE16_INSTLEN;
+
+ if (G_FLD (inst->v, 14, 12) == 0x2
+ && G_FLD (inst->v, 3, 0) == 0xe)
+ {
+ /* push! */
+ sp_offset += 4;
+
+ if (G_FLD (inst->v, 11, 7) == 0x6
+ && ra_offset_p == 0)
+ {
+ /* push! r3, [r0] */
+ ra_offset = sp_offset;
+ ra_offset_p = 1;
+ }
+ else if (G_FLD (inst->v, 11, 7) == 0x4
+ && fp_offset_p == 0)
+ {
+ /* push! r2, [r0] */
+ fp_offset = sp_offset;
+ fp_offset_p = 1;
+ }
+ }
+ else if (G_FLD (inst->v, 14, 12) == 0x2
+ && G_FLD (inst->v, 3, 0) == 0xa)
+ {
+ /* pop! */
+ sp_offset -= 4;
+ }
+ else if (G_FLD (inst->v, 14, 7) == 0xc1
+ && G_FLD (inst->v, 2, 0) == 0x0)
+ {
+ /* subei! r0, n */
+ sp_offset += (int) pow (2.0, G_FLD (inst->v, 6, 3));
+ }
+ else if (G_FLD (inst->v, 14, 7) == 0xc0
+ && G_FLD (inst->v, 2, 0) == 0x0)
+ {
+ /* addei! r0, n */
/* Solaris 11+gcc 5.5 has ambiguous overloads of pow, so we
pass 2.0 instead of 2 to get the right one. */
- sp_offset -= (int) pow (2.0, G_FLD (inst->v, 6, 3));
- }
- }
+ sp_offset -= (int) pow (2.0, G_FLD (inst->v, 6, 3));
+ }
+ }
else
- {
- inst_len = SCORE_INSTLEN;
-
- if (G_FLD(inst->v, 29, 25) == 0x3
- && G_FLD(inst->v, 2, 0) == 0x4
- && G_FLD(inst->v, 19, 15) == 0)
- {
- /* sw rD, [r0, offset]+ */
- sp_offset += SCORE_INSTLEN;
-
- if (G_FLD(inst->v, 24, 20) == 0x3)
- {
- /* rD = r3 */
- if (ra_offset_p == 0)
- {
- ra_offset = sp_offset;
- ra_offset_p = 1;
- }
- }
- else if (G_FLD(inst->v, 24, 20) == 0x2)
- {
- /* rD = r2 */
- if (fp_offset_p == 0)
- {
- fp_offset = sp_offset;
- fp_offset_p = 1;
- }
- }
- }
- else if (G_FLD(inst->v, 29, 25) == 0x14
- && G_FLD(inst->v, 19,15) == 0)
- {
- /* sw rD, [r0, offset] */
- if (G_FLD(inst->v, 24, 20) == 0x3)
- {
- /* rD = r3 */
- ra_offset = sp_offset - G_FLD(inst->v, 14, 0);
- ra_offset_p = 1;
- }
- else if (G_FLD(inst->v, 24, 20) == 0x2)
- {
- /* rD = r2 */
- fp_offset = sp_offset - G_FLD(inst->v, 14, 0);
- fp_offset_p = 1;
- }
- }
- else if (G_FLD (inst->v, 29, 15) == 0x1c60
- && G_FLD (inst->v, 2, 0) == 0x0)
- {
- /* lw r3, [r0]+, 4 */
- sp_offset -= SCORE_INSTLEN;
- ra_offset_p = 1;
- }
- else if (G_FLD (inst->v, 29, 15) == 0x1c40
- && G_FLD (inst->v, 2, 0) == 0x0)
- {
- /* lw r2, [r0]+, 4 */
- sp_offset -= SCORE_INSTLEN;
- fp_offset_p = 1;
- }
-
- else if (G_FLD (inst->v, 29, 17) == 0x100
- && G_FLD (inst->v, 0, 0) == 0x0)
- {
- /* addi r0, -offset */
- sp_offset += 65536 - G_FLD (inst->v, 16, 1);
- }
- else if (G_FLD (inst->v, 29, 17) == 0x110
- && G_FLD (inst->v, 0, 0) == 0x0)
- {
- /* addi r2, offset */
- if (pc - cur_pc > 4)
- {
- unsigned int save_v = inst->v;
- inst_t *inst2 =
- score7_fetch_inst (gdbarch, cur_pc + SCORE_INSTLEN, NULL);
- if (inst2->v == 0x23)
- {
- /* mv! r0, r2 */
- sp_offset -= G_FLD (save_v, 16, 1);
- }
- }
- }
- }
+ {
+ inst_len = SCORE_INSTLEN;
+
+ if (G_FLD(inst->v, 29, 25) == 0x3
+ && G_FLD(inst->v, 2, 0) == 0x4
+ && G_FLD(inst->v, 19, 15) == 0)
+ {
+ /* sw rD, [r0, offset]+ */
+ sp_offset += SCORE_INSTLEN;
+
+ if (G_FLD(inst->v, 24, 20) == 0x3)
+ {
+ /* rD = r3 */
+ if (ra_offset_p == 0)
+ {
+ ra_offset = sp_offset;
+ ra_offset_p = 1;
+ }
+ }
+ else if (G_FLD(inst->v, 24, 20) == 0x2)
+ {
+ /* rD = r2 */
+ if (fp_offset_p == 0)
+ {
+ fp_offset = sp_offset;
+ fp_offset_p = 1;
+ }
+ }
+ }
+ else if (G_FLD(inst->v, 29, 25) == 0x14
+ && G_FLD(inst->v, 19,15) == 0)
+ {
+ /* sw rD, [r0, offset] */
+ if (G_FLD(inst->v, 24, 20) == 0x3)
+ {
+ /* rD = r3 */
+ ra_offset = sp_offset - G_FLD(inst->v, 14, 0);
+ ra_offset_p = 1;
+ }
+ else if (G_FLD(inst->v, 24, 20) == 0x2)
+ {
+ /* rD = r2 */
+ fp_offset = sp_offset - G_FLD(inst->v, 14, 0);
+ fp_offset_p = 1;
+ }
+ }
+ else if (G_FLD (inst->v, 29, 15) == 0x1c60
+ && G_FLD (inst->v, 2, 0) == 0x0)
+ {
+ /* lw r3, [r0]+, 4 */
+ sp_offset -= SCORE_INSTLEN;
+ ra_offset_p = 1;
+ }
+ else if (G_FLD (inst->v, 29, 15) == 0x1c40
+ && G_FLD (inst->v, 2, 0) == 0x0)
+ {
+ /* lw r2, [r0]+, 4 */
+ sp_offset -= SCORE_INSTLEN;
+ fp_offset_p = 1;
+ }
+
+ else if (G_FLD (inst->v, 29, 17) == 0x100
+ && G_FLD (inst->v, 0, 0) == 0x0)
+ {
+ /* addi r0, -offset */
+ sp_offset += 65536 - G_FLD (inst->v, 16, 1);
+ }
+ else if (G_FLD (inst->v, 29, 17) == 0x110
+ && G_FLD (inst->v, 0, 0) == 0x0)
+ {
+ /* addi r2, offset */
+ if (pc - cur_pc > 4)
+ {
+ unsigned int save_v = inst->v;
+ inst_t *inst2 =
+ score7_fetch_inst (gdbarch, cur_pc + SCORE_INSTLEN, NULL);
+ if (inst2->v == 0x23)
+ {
+ /* mv! r0, r2 */
+ sp_offset -= G_FLD (save_v, 16, 1);
+ }
+ }
+ }
+ }
}
/* Save RA. */
if (ra_offset_p == 1)
{
if (this_cache->saved_regs[SCORE_PC_REGNUM].addr == -1)
- this_cache->saved_regs[SCORE_PC_REGNUM].addr =
- sp + sp_offset - ra_offset;
+ this_cache->saved_regs[SCORE_PC_REGNUM].addr =
+ sp + sp_offset - ra_offset;
}
else
{
this_cache->saved_regs[SCORE_PC_REGNUM] =
- this_cache->saved_regs[SCORE_RA_REGNUM];
+ this_cache->saved_regs[SCORE_RA_REGNUM];
}
/* Save FP. */
if (fp_offset_p == 1)
{
if (this_cache->saved_regs[SCORE_FP_REGNUM].addr == -1)
- this_cache->saved_regs[SCORE_FP_REGNUM].addr =
- sp + sp_offset - fp_offset;
+ this_cache->saved_regs[SCORE_FP_REGNUM].addr =
+ sp + sp_offset - fp_offset;
}
/* Save SP and FP. */
static void
score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
- struct frame_info *this_frame,
- struct score_frame_cache *this_cache)
+ struct frame_info *this_frame,
+ struct score_frame_cache *this_cache)
{
CORE_ADDR sp;
CORE_ADDR fp;
/* FIXME: make a full-power prologue analyzer. */
if (inst->len == 2)
- {
- if (G_FLD (inst->v, 14, 12) == 0x0
- && G_FLD (inst->v, 11, 7) == 0x0
- && G_FLD (inst->v, 6, 5) == 0x3)
- {
- /* push! */
- sp_offset += 4;
-
- if (G_FLD (inst->v, 4, 0) == 0x3
- && ra_offset_p == 0)
- {
- /* push! r3, [r0] */
- ra_offset = sp_offset;
- ra_offset_p = 1;
- }
- else if (G_FLD (inst->v, 4, 0) == 0x2
- && fp_offset_p == 0)
- {
- /* push! r2, [r0] */
- fp_offset = sp_offset;
- fp_offset_p = 1;
- }
- }
- else if (G_FLD (inst->v, 14, 12) == 0x6
- && G_FLD (inst->v, 11, 10) == 0x3)
- {
- /* rpush! */
- int start_r = G_FLD (inst->v, 9, 5);
- int cnt = G_FLD (inst->v, 4, 0);
+ {
+ if (G_FLD (inst->v, 14, 12) == 0x0
+ && G_FLD (inst->v, 11, 7) == 0x0
+ && G_FLD (inst->v, 6, 5) == 0x3)
+ {
+ /* push! */
+ sp_offset += 4;
+
+ if (G_FLD (inst->v, 4, 0) == 0x3
+ && ra_offset_p == 0)
+ {
+ /* push! r3, [r0] */
+ ra_offset = sp_offset;
+ ra_offset_p = 1;
+ }
+ else if (G_FLD (inst->v, 4, 0) == 0x2
+ && fp_offset_p == 0)
+ {
+ /* push! r2, [r0] */
+ fp_offset = sp_offset;
+ fp_offset_p = 1;
+ }
+ }
+ else if (G_FLD (inst->v, 14, 12) == 0x6
+ && G_FLD (inst->v, 11, 10) == 0x3)
+ {
+ /* rpush! */
+ int start_r = G_FLD (inst->v, 9, 5);
+ int cnt = G_FLD (inst->v, 4, 0);
- if ((ra_offset_p == 0)
+ if ((ra_offset_p == 0)
&& (start_r <= SCORE_RA_REGNUM)
- && (SCORE_RA_REGNUM < start_r + cnt))
- {
- /* rpush! contains r3 */
- ra_offset_p = 1;
- ra_offset = sp_offset + 4 * (SCORE_RA_REGNUM - start_r) + 4;
- }
-
- if ((fp_offset_p == 0)
+ && (SCORE_RA_REGNUM < start_r + cnt))
+ {
+ /* rpush! contains r3 */
+ ra_offset_p = 1;
+ ra_offset = sp_offset + 4 * (SCORE_RA_REGNUM - start_r) + 4;
+ }
+
+ if ((fp_offset_p == 0)
&& (start_r <= SCORE_FP_REGNUM)
- && (SCORE_FP_REGNUM < start_r + cnt))
- {
- /* rpush! contains r2 */
- fp_offset_p = 1;
- fp_offset = sp_offset + 4 * (SCORE_FP_REGNUM - start_r) + 4;
- }
-
- sp_offset += 4 * cnt;
- }
- else if (G_FLD (inst->v, 14, 12) == 0x0
- && G_FLD (inst->v, 11, 7) == 0x0
- && G_FLD (inst->v, 6, 5) == 0x2)
- {
- /* pop! */
- sp_offset -= 4;
- }
- else if (G_FLD (inst->v, 14, 12) == 0x6
- && G_FLD (inst->v, 11, 10) == 0x2)
- {
- /* rpop! */
- sp_offset -= 4 * G_FLD (inst->v, 4, 0);
- }
- else if (G_FLD (inst->v, 14, 12) == 0x5
- && G_FLD (inst->v, 11, 10) == 0x3
- && G_FLD (inst->v, 9, 6) == 0x0)
- {
- /* addi! r0, -offset */
- int imm = G_FLD (inst->v, 5, 0);
+ && (SCORE_FP_REGNUM < start_r + cnt))
+ {
+ /* rpush! contains r2 */
+ fp_offset_p = 1;
+ fp_offset = sp_offset + 4 * (SCORE_FP_REGNUM - start_r) + 4;
+ }
+
+ sp_offset += 4 * cnt;
+ }
+ else if (G_FLD (inst->v, 14, 12) == 0x0
+ && G_FLD (inst->v, 11, 7) == 0x0
+ && G_FLD (inst->v, 6, 5) == 0x2)
+ {
+ /* pop! */
+ sp_offset -= 4;
+ }
+ else if (G_FLD (inst->v, 14, 12) == 0x6
+ && G_FLD (inst->v, 11, 10) == 0x2)
+ {
+ /* rpop! */
+ sp_offset -= 4 * G_FLD (inst->v, 4, 0);
+ }
+ else if (G_FLD (inst->v, 14, 12) == 0x5
+ && G_FLD (inst->v, 11, 10) == 0x3
+ && G_FLD (inst->v, 9, 6) == 0x0)
+ {
+ /* addi! r0, -offset */
+ int imm = G_FLD (inst->v, 5, 0);
if (imm >> 5)
imm = -(0x3F - imm + 1);
sp_offset -= imm;
- }
- else if (G_FLD (inst->v, 14, 12) == 0x5
- && G_FLD (inst->v, 11, 10) == 0x3
- && G_FLD (inst->v, 9, 6) == 0x2)
- {
- /* addi! r2, offset */
- if (pc - cur_pc >= 2)
- {
+ }
+ else if (G_FLD (inst->v, 14, 12) == 0x5
+ && G_FLD (inst->v, 11, 10) == 0x3
+ && G_FLD (inst->v, 9, 6) == 0x2)
+ {
+ /* addi! r2, offset */
+ if (pc - cur_pc >= 2)
+ {
inst_t *inst2;
cur_pc += inst->len;
inst2 = score3_adjust_pc_and_fetch_inst (&cur_pc, NULL,
byte_order);
- if (inst2->len == 2
- && G_FLD (inst2->v, 14, 10) == 0x10
- && G_FLD (inst2->v, 9, 5) == 0x0
- && G_FLD (inst2->v, 4, 0) == 0x2)
- {
- /* mv! r0, r2 */
- int imm = G_FLD (inst->v, 5, 0);
- if (imm >> 5)
- imm = -(0x3F - imm + 1);
- sp_offset -= imm;
- }
- }
+ if (inst2->len == 2
+ && G_FLD (inst2->v, 14, 10) == 0x10
+ && G_FLD (inst2->v, 9, 5) == 0x0
+ && G_FLD (inst2->v, 4, 0) == 0x2)
+ {
+ /* mv! r0, r2 */
+ int imm = G_FLD (inst->v, 5, 0);
+ if (imm >> 5)
+ imm = -(0x3F - imm + 1);
+ sp_offset -= imm;
+ }
+ }
}
- }
+ }
else if (inst->len == 4)
- {
- if (G_FLD (inst->v, 29, 25) == 0x3
- && G_FLD (inst->v, 2, 0) == 0x4
- && G_FLD (inst->v, 24, 20) == 0x3
- && G_FLD (inst->v, 19, 15) == 0x0)
- {
- /* sw r3, [r0, offset]+ */
- sp_offset += inst->len;
- if (ra_offset_p == 0)
- {
- ra_offset = sp_offset;
- ra_offset_p = 1;
- }
- }
- else if (G_FLD (inst->v, 29, 25) == 0x3
- && G_FLD (inst->v, 2, 0) == 0x4
- && G_FLD (inst->v, 24, 20) == 0x2
- && G_FLD (inst->v, 19, 15) == 0x0)
- {
- /* sw r2, [r0, offset]+ */
- sp_offset += inst->len;
- if (fp_offset_p == 0)
- {
- fp_offset = sp_offset;
- fp_offset_p = 1;
- }
- }
- else if (G_FLD (inst->v, 29, 25) == 0x7
- && G_FLD (inst->v, 2, 0) == 0x0
- && G_FLD (inst->v, 24, 20) == 0x3
- && G_FLD (inst->v, 19, 15) == 0x0)
- {
- /* lw r3, [r0]+, 4 */
- sp_offset -= inst->len;
- ra_offset_p = 1;
- }
- else if (G_FLD (inst->v, 29, 25) == 0x7
- && G_FLD (inst->v, 2, 0) == 0x0
- && G_FLD (inst->v, 24, 20) == 0x2
- && G_FLD (inst->v, 19, 15) == 0x0)
- {
- /* lw r2, [r0]+, 4 */
- sp_offset -= inst->len;
- fp_offset_p = 1;
- }
- else if (G_FLD (inst->v, 29, 25) == 0x1
- && G_FLD (inst->v, 19, 17) == 0x0
- && G_FLD (inst->v, 24, 20) == 0x0
- && G_FLD (inst->v, 0, 0) == 0x0)
- {
- /* addi r0, -offset */
- int imm = G_FLD (inst->v, 16, 1);
+ {
+ if (G_FLD (inst->v, 29, 25) == 0x3
+ && G_FLD (inst->v, 2, 0) == 0x4
+ && G_FLD (inst->v, 24, 20) == 0x3
+ && G_FLD (inst->v, 19, 15) == 0x0)
+ {
+ /* sw r3, [r0, offset]+ */
+ sp_offset += inst->len;
+ if (ra_offset_p == 0)
+ {
+ ra_offset = sp_offset;
+ ra_offset_p = 1;
+ }
+ }
+ else if (G_FLD (inst->v, 29, 25) == 0x3
+ && G_FLD (inst->v, 2, 0) == 0x4
+ && G_FLD (inst->v, 24, 20) == 0x2
+ && G_FLD (inst->v, 19, 15) == 0x0)
+ {
+ /* sw r2, [r0, offset]+ */
+ sp_offset += inst->len;
+ if (fp_offset_p == 0)
+ {
+ fp_offset = sp_offset;
+ fp_offset_p = 1;
+ }
+ }
+ else if (G_FLD (inst->v, 29, 25) == 0x7
+ && G_FLD (inst->v, 2, 0) == 0x0
+ && G_FLD (inst->v, 24, 20) == 0x3
+ && G_FLD (inst->v, 19, 15) == 0x0)
+ {
+ /* lw r3, [r0]+, 4 */
+ sp_offset -= inst->len;
+ ra_offset_p = 1;
+ }
+ else if (G_FLD (inst->v, 29, 25) == 0x7
+ && G_FLD (inst->v, 2, 0) == 0x0
+ && G_FLD (inst->v, 24, 20) == 0x2
+ && G_FLD (inst->v, 19, 15) == 0x0)
+ {
+ /* lw r2, [r0]+, 4 */
+ sp_offset -= inst->len;
+ fp_offset_p = 1;
+ }
+ else if (G_FLD (inst->v, 29, 25) == 0x1
+ && G_FLD (inst->v, 19, 17) == 0x0
+ && G_FLD (inst->v, 24, 20) == 0x0
+ && G_FLD (inst->v, 0, 0) == 0x0)
+ {
+ /* addi r0, -offset */
+ int imm = G_FLD (inst->v, 16, 1);
if (imm >> 15)
imm = -(0xFFFF - imm + 1);
- sp_offset -= imm;
- }
- else if (G_FLD (inst->v, 29, 25) == 0x1
- && G_FLD (inst->v, 19, 17) == 0x0
- && G_FLD (inst->v, 24, 20) == 0x2
- && G_FLD (inst->v, 0, 0) == 0x0)
- {
- /* addi r2, offset */
- if (pc - cur_pc >= 2)
- {
+ sp_offset -= imm;
+ }
+ else if (G_FLD (inst->v, 29, 25) == 0x1
+ && G_FLD (inst->v, 19, 17) == 0x0
+ && G_FLD (inst->v, 24, 20) == 0x2
+ && G_FLD (inst->v, 0, 0) == 0x0)
+ {
+ /* addi r2, offset */
+ if (pc - cur_pc >= 2)
+ {
inst_t *inst2;
cur_pc += inst->len;
inst2 = score3_adjust_pc_and_fetch_inst (&cur_pc, NULL,
byte_order);
- if (inst2->len == 2
- && G_FLD (inst2->v, 14, 10) == 0x10
- && G_FLD (inst2->v, 9, 5) == 0x0
- && G_FLD (inst2->v, 4, 0) == 0x2)
- {
- /* mv! r0, r2 */
- int imm = G_FLD (inst->v, 16, 1);
- if (imm >> 15)
- imm = -(0xFFFF - imm + 1);
- sp_offset -= imm;
- }
- }
- }
- }
+ if (inst2->len == 2
+ && G_FLD (inst2->v, 14, 10) == 0x10
+ && G_FLD (inst2->v, 9, 5) == 0x0
+ && G_FLD (inst2->v, 4, 0) == 0x2)
+ {
+ /* mv! r0, r2 */
+ int imm = G_FLD (inst->v, 16, 1);
+ if (imm >> 15)
+ imm = -(0xFFFF - imm + 1);
+ sp_offset -= imm;
+ }
+ }
+ }
+ }
}
/* Save RA. */
if (ra_offset_p == 1)
{
if (this_cache->saved_regs[SCORE_PC_REGNUM].addr == -1)
- this_cache->saved_regs[SCORE_PC_REGNUM].addr =
- sp + sp_offset - ra_offset;
+ this_cache->saved_regs[SCORE_PC_REGNUM].addr =
+ sp + sp_offset - ra_offset;
}
else
{
this_cache->saved_regs[SCORE_PC_REGNUM] =
- this_cache->saved_regs[SCORE_RA_REGNUM];
+ this_cache->saved_regs[SCORE_RA_REGNUM];
}
/* Save FP. */
if (fp_offset_p == 1)
{
if (this_cache->saved_regs[SCORE_FP_REGNUM].addr == -1)
- this_cache->saved_regs[SCORE_FP_REGNUM].addr =
- sp + sp_offset - fp_offset;
+ this_cache->saved_regs[SCORE_FP_REGNUM].addr =
+ sp + sp_offset - fp_offset;
}
/* Save SP and FP. */
static void
score_prologue_this_id (struct frame_info *this_frame, void **this_cache,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
struct score_frame_cache *info = score_make_prologue_cache (this_frame,
- this_cache);
+ this_cache);
(*this_id) = frame_id_build (info->base, get_frame_func (this_frame));
}
static struct value *
score_prologue_prev_register (struct frame_info *this_frame,
- void **this_cache, int regnum)
+ void **this_cache, int regnum)
{
struct score_frame_cache *info = score_make_prologue_cache (this_frame,
- this_cache);
+ this_cache);
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
static CORE_ADDR
score_prologue_frame_base_address (struct frame_info *this_frame,
- void **this_cache)
+ void **this_cache)
{
struct score_frame_cache *info =
score_make_prologue_cache (this_frame, this_cache);
else if (scb->bufcnt == 0)
{
/* Prime the input FIFO. The readchar() function is used to
- pull characters out of the buffer. See also
- generic_readchar(). */
+ pull characters out of the buffer. See also
+ generic_readchar(). */
int nr;
do
int nfds;
/* NOTE: Some OS's can scramble the READFDS when the select()
- call fails (ex the kernel with Red Hat 5.2). Initialize all
- arguments before each call. */
+ call fails (ex the kernel with Red Hat 5.2). Initialize all
+ arguments before each call. */
tv.tv_sec = timeout;
tv.tv_usec = 0;
while (1)
{
/* N.B. The UI may destroy our world (for instance by calling
- remote_stop,) in which case we want to get out of here as
- quickly as possible. It is not safe to touch scb, since
- someone else might have freed it. The
- deprecated_ui_loop_hook signals that we should exit by
- returning 1. */
+ remote_stop,) in which case we want to get out of here as
+ quickly as possible. It is not safe to touch scb, since
+ someone else might have freed it. The
+ deprecated_ui_loop_hook signals that we should exit by
+ returning 1. */
if (deprecated_ui_loop_hook)
{
status = ser_base_wait_for (scb, delta);
if (timeout > 0)
- timeout -= delta;
+ timeout -= delta;
/* If we got a character or an error back from wait_for, then we can
- break from the loop before the timeout is completed. */
+ break from the loop before the timeout is completed. */
if (status != SERIAL_TIMEOUT)
break;
/* If we have exhausted the original timeout, then generate
- a SERIAL_TIMEOUT, and pass it out of the loop. */
+ a SERIAL_TIMEOUT, and pass it out of the loop. */
else if (timeout == 0)
{
status = SERIAL_TIMEOUT;
if (status <= 0)
{
if (status == 0)
- return SERIAL_EOF;
+ return SERIAL_EOF;
else
/* Got an error from read. */
return SERIAL_ERROR;
const char *err_msg
= pex_run (ps->pex, PEX_SEARCH | PEX_BINARY_INPUT | PEX_BINARY_OUTPUT
| PEX_STDERR_TO_PIPE,
- argv[0], argv.get (), NULL, NULL,
- &err);
+ argv[0], argv.get (), NULL, NULL,
+ &err);
if (err_msg)
{
- /* Our caller expects us to return -1, but all they'll do with
- it generally is print the message based on errno. We have
- all the same information here, plus err_msg provided by
- pex_run, so we just raise the error here. */
- if (err)
- error (_("error starting child process '%s': %s: %s"),
- name, err_msg, safe_strerror (err));
- else
- error (_("error starting child process '%s': %s"),
- name, err_msg);
+ /* Our caller expects us to return -1, but all they'll do with
+ it generally is print the message based on errno. We have
+ all the same information here, plus err_msg provided by
+ pex_run, so we just raise the error here. */
+ if (err)
+ error (_("error starting child process '%s': %s: %s"),
+ name, err_msg, safe_strerror (err));
+ else
+ error (_("error starting child process '%s': %s"),
+ name, err_msg);
}
}
if (strlen (name) > UNIX_PATH_MAX - 1)
{
warning
- (_("The socket name is too long. It may be no longer than %s bytes."),
- pulongest (UNIX_PATH_MAX - 1L));
+ (_("The socket name is too long. It may be no longer than %s bytes."),
+ pulongest (UNIX_PATH_MAX - 1L));
return -1;
}
{
/* test for perfect macth. */
if (rate == baudtab[i].rate)
- return baudtab[i].code;
+ return baudtab[i].code;
else
- {
+ {
/* check if it is in between valid values. */
- if (rate < baudtab[i].rate)
+ if (rate < baudtab[i].rate)
{
if (i)
- {
- warning (_("Invalid baud rate %d. "
+ {
+ warning (_("Invalid baud rate %d. "
"Closest values are %d and %d."),
rate, baudtab[i - 1].rate, baudtab[i].rate);
}
else
- {
- warning (_("Invalid baud rate %d. Minimum value is %d."),
+ {
+ warning (_("Invalid baud rate %d. Minimum value is %d."),
rate, baudtab[0].rate);
}
return -1;
}
- }
+ }
}
/* The requested speed was too large. */
warning (_("Invalid baud rate %d. Maximum value is %d."),
- rate, baudtab[i - 1].rate);
+ rate, baudtab[i - 1].rate);
return -1;
}
if (baud_code < 0)
{
/* The baud rate was not valid.
- A warning has already been issued. */
+ A warning has already been issued. */
errno = EINVAL;
return -1;
}
{
#ifndef USE_WIN32API
/* Check to see if name is a socket. If it is, then treat it
- as such. Otherwise assume that it's a character device. */
+ as such. Otherwise assume that it's a character device. */
struct stat sb;
if (stat (name, &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFSOCK)
ops = serial_interface_lookup ("local");
serial_logchar (serial_logfp, 'r', ch, timeout);
/* Make sure that the log file is as up-to-date as possible,
- in case we are getting ready to dump core or something. */
+ in case we are getting ready to dump core or something. */
gdb_flush (serial_logfp);
}
if (serial_debug_p (scb))
serial_logchar (serial_logfp, 'w', str[c] & 0xff, 0);
/* Make sure that the log file is as up-to-date as possible,
- in case we are getting ready to dump core or something. */
+ in case we are getting ready to dump core or something. */
gdb_flush (serial_logfp);
}
if (serial_debug_p (scb))
&serial_set_cmdlist, &serial_show_cmdlist);
add_setshow_enum_cmd ("parity", no_class, parity_enums,
- &parity, _("\
+ &parity, _("\
Set parity for remote serial I/O."), _("\
Show parity for remote serial I/O."), NULL,
- set_parity,
- NULL, /* FIXME: i18n: */
- &serial_set_cmdlist, &serial_show_cmdlist);
+ set_parity,
+ NULL, /* FIXME: i18n: */
+ &serial_set_cmdlist, &serial_show_cmdlist);
add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
Set filename for remote session recording."), _("\
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
static void
shnbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+ struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
nbsd_init_abi (info, gdbarch);
func_type = check_typedef (func_type);
if (func_type->code () == TYPE_CODE_PTR)
- func_type = check_typedef (TYPE_TARGET_TYPE (func_type));
+ func_type = check_typedef (TYPE_TARGET_TYPE (func_type));
if (func_type->code () == TYPE_CODE_FUNC
- && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh)
- val = 1;
+ && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh)
+ val = 1;
}
if (sh_active_calling_convention == sh_cc_renesas)
}
else if (IS_MOVI20 (inst)
&& (pc + 2 < limit_pc))
- {
+ {
if (sav_reg < 0)
{
reg = GET_TARGET_REG (inst);
if (reg < 14)
- {
+ {
sav_reg = reg;
sav_offset = GET_SOURCE_REG (inst) << 16;
/* MOVI20 is a 32 bit instruction! */
{
post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return std::max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
/* Can't determine prologue from the symbol table, need to examine
val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
/* Some decisions have to be made how various types are handled.
- This also differs in different ABIs. */
+ This also differs in different ABIs. */
pass_on_stack = 0;
/* Find out the next register to use for a floating point value. */
{
if ((treat_as_flt && flt_argreg > FLOAT_ARGLAST_REGNUM)
|| (!treat_as_flt && (argreg > ARGLAST_REGNUM
- || pass_on_stack))
+ || pass_on_stack))
|| argnum > last_reg_arg)
{
/* The data goes entirely on the stack, 4-byte aligned. */
reg_size = register_size (gdbarch, flt_argreg);
regval = extract_unsigned_integer (val, reg_size, byte_order);
/* In little endian mode, float types taking two registers
- (doubles on sh4, long doubles on sh2e, sh3e and sh4) must
+ (doubles on sh4, long doubles on sh2e, sh3e and sh4) must
be stored swapped in the argument registers. The below
code first writes the first 32 bits in the next but one
register, increments the val and len values accordingly
and then proceeds as normal by writing the second 32 bits
into the next register. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE
- && TYPE_LENGTH (type) == 2 * reg_size)
- {
+ && TYPE_LENGTH (type) == 2 * reg_size)
+ {
regcache_cooked_write_unsigned (regcache, flt_argreg + 1,
regval);
val += reg_size;
|| argnum > last_reg_arg)
{
/* The remainder of the data goes entirely on the stack,
- 4-byte aligned. */
+ 4-byte aligned. */
reg_size = (len + 3) & ~3;
write_memory (sp + stack_offset, val, reg_size);
stack_offset += reg_size;
if (tdep->sh_littlebyte_bigword_type == NULL)
tdep->sh_littlebyte_bigword_type
= arch_float_type (gdbarch, -1, "builtin_type_sh_littlebyte_bigword",
- floatformats_ieee_double_littlebyte_bigword);
+ floatformats_ieee_double_littlebyte_bigword);
return tdep->sh_littlebyte_bigword_type;
}
if (reg_nr == PSEUDO_BANK_REGNUM)
{
/* When the bank register is written to, the whole register bank
- is switched and all values in the bank registers must be read
+ is switched and all values in the bank registers must be read
from the target/sim again. We're just invalidating the regcache
so that a re-read happens next time it's necessary. */
int bregnum;
regcache->raw_write (BANK_REGNUM, buffer);
for (bregnum = R0_BANK0_REGNUM; bregnum < MACLB_REGNUM; ++bregnum)
- regcache->invalidate (bregnum);
+ regcache->invalidate (bregnum);
}
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
switch (nr)
{
case TBR_REGNUM:
- return SIM_SH_TBR_REGNUM;
+ return SIM_SH_TBR_REGNUM;
case IBNR_REGNUM:
- return SIM_SH_IBNR_REGNUM;
+ return SIM_SH_IBNR_REGNUM;
case IBCR_REGNUM:
- return SIM_SH_IBCR_REGNUM;
+ return SIM_SH_IBCR_REGNUM;
case BANK_REGNUM:
- return SIM_SH_BANK_REGNUM;
+ return SIM_SH_BANK_REGNUM;
case MACLB_REGNUM:
- return SIM_SH_BANK_MACL_REGNUM;
+ return SIM_SH_BANK_MACL_REGNUM;
case GBRB_REGNUM:
- return SIM_SH_BANK_GBR_REGNUM;
+ return SIM_SH_BANK_GBR_REGNUM;
case PRB_REGNUM:
- return SIM_SH_BANK_PR_REGNUM;
+ return SIM_SH_BANK_PR_REGNUM;
case IVNB_REGNUM:
- return SIM_SH_BANK_IVN_REGNUM;
+ return SIM_SH_BANK_IVN_REGNUM;
case MACHB_REGNUM:
- return SIM_SH_BANK_MACH_REGNUM;
+ return SIM_SH_BANK_MACH_REGNUM;
default:
- break;
+ break;
}
return legacy_register_sim_regno (gdbarch, nr);
}
static void
sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
- struct dwarf2_frame_state_reg *reg,
+ struct dwarf2_frame_state_reg *reg,
struct frame_info *this_frame)
{
/* Mark the PC as the destination for the return address. */
if (!cache->uses_fp)
{
/* We didn't find a valid frame, which means that CACHE->base
- currently holds the frame pointer for our calling frame. If
- we're at the start of a function, or somewhere half-way its
- prologue, the function's frame probably hasn't been fully
- setup yet. Try to reconstruct the base address for the stack
- frame by looking at the stack pointer. For truly "frameless"
- functions this might work too. */
+ currently holds the frame pointer for our calling frame. If
+ we're at the start of a function, or somewhere half-way its
+ prologue, the function's frame probably hasn't been fully
+ setup yet. Try to reconstruct the base address for the stack
+ frame by looking at the stack pointer. For truly "frameless"
+ functions this might work too. */
cache->base = get_frame_register_unsigned
(this_frame, gdbarch_sp_regnum (gdbarch));
}
if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
return frame_unwind_got_memory (this_frame, regnum,
- cache->saved_regs[regnum]);
+ cache->saved_regs[regnum]);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
static void
sh_stub_this_id (struct frame_info *this_frame, void **this_cache,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
struct sh_frame_cache *cache;
static int
sh_stub_unwind_sniffer (const struct frame_unwind *self,
- struct frame_info *this_frame,
- void **this_prologue_cache)
+ struct frame_info *this_frame,
+ void **this_prologue_cache)
{
CORE_ADDR addr_in_block;
{
ULONGEST inst;
/* The sh epilogue is max. 14 bytes long. Give another 14 bytes
- for a nop and some fixed data (e.g. big offsets) which are
- unfortunately also treated as part of the function (which
- means, they are below func_end. */
+ for a nop and some fixed data (e.g. big offsets) which are
+ unfortunately also treated as part of the function (which
+ means, they are below func_end. */
CORE_ADDR addr = func_end - 28;
if (addr < func_addr + 4)
addr = func_addr + 4;
return 0;
/* At this point we should find a mov.l @r15+,r14 instruction,
- either before or after the rts. If not, then the function has
- probably no "normal" epilogue and we bail out here. */
+ either before or after the rts. If not, then the function has
+ probably no "normal" epilogue and we bail out here. */
inst = read_memory_unsigned_integer (addr - 2, 2, byte_order);
if (IS_RESTORE_FP (read_memory_unsigned_integer (addr - 2, 2,
byte_order)))
}
/* Now check for FP adjustments, using add #imm,r14 or add rX, r14
- instructions. */
+ instructions. */
while (addr > func_addr + 4
&& (IS_ADD_REG_TO_FP (inst) || IS_ADD_IMM_FP (inst)))
{
}
/* On SH2a check if the previous instruction was perhaps a MOVI20.
- That's allowed for the epilogue. */
+ That's allowed for the epilogue. */
if ((gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_sh2a
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_sh2a_nofpu)
- && addr > func_addr + 6
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_sh2a_nofpu)
+ && addr > func_addr + 6
&& IS_MOVI20 (read_memory_unsigned_integer (addr - 4, 2,
byte_order)))
addr -= 4;
if (m_function_is_regexp)
{
if (debug_skip)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"skip: checking if function %s matches regex %s...",
function_name, m_function.c_str ());
else
{
if (debug_skip)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
("skip: checking if function %s matches non-regex "
"%s..."),
function_name, m_function.c_str ());
FUNCTION-SPEC is one of:\n\
-fu|-function FUNCTION-NAME\n\
-rfu|-rfunction FUNCTION-NAME-REGULAR-EXPRESSION"),
- &skiplist, "skip ", 1, &cmdlist);
+ &skiplist, "skip ", 1, &cmdlist);
c = add_cmd ("file", class_breakpoint, skip_file_command, _("\
Ignore a file while stepping.\n\
if (inferior_ptid.tid_p () || !target_thread_alive (inferior_ptid))
{
/* It's either a thread or an LWP that isn't alive. Any live
- LWP will do so use the first available.
+ LWP will do so use the first available.
NOTE: We don't need to call switch_to_thread; we're just
reading memory. */
if (inferior_ptid.tid_p () || !target_thread_alive (inferior_ptid))
{
/* It's either a thread or an LWP that isn't alive. Any live
- LWP will do so use the first available.
+ LWP will do so use the first available.
NOTE: We don't need to call switch_to_thread; we're just
reading memory. */
if (thread_info == NULL)
{
/* The list of threads is probably not up to date. Find any
- thread that is missing from the list, and try again. */
+ thread that is missing from the list, and try again. */
update_thread_list ();
thread_info = iterate_over_threads (thread_db_find_thread_from_tid,
- &thread);
+ &thread);
}
gdb_assert (thread_info != NULL);
{
have_warned = 1;
warning (_("Can not parse XML library list; XML support was disabled "
- "at compile time"));
+ "at compile time"));
}
return {};
static void
library_list_start_list (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element,
+ void *user_data,
std::vector<gdb_xml_value> &attributes)
{
char *version
if (strcmp (version, "1.0") != 0)
gdb_xml_error (parser,
- _("Library list has unsupported version \"%s\""),
- version);
+ _("Library list has unsupported version \"%s\""),
+ version);
}
/* The allowed elements and attributes for an AIX library list
/* Add it to the list. */
if (!start)
- last = start = new_solib;
+ last = start = new_solib;
else
- {
- last->next = new_solib;
- last = new_solib;
- }
+ {
+ last->next = new_solib;
+ last = new_solib;
+ }
}
return start;
Control the debugging traces for the solib-aix module."), _("\
Show whether solib-aix debugging traces are enabled."), _("\
When on, solib-aix debugging traces are enabled."),
- NULL,
- show_solib_aix_debug,
- &setdebuglist, &showdebuglist);
+ NULL,
+ show_solib_aix_debug,
+ &setdebuglist, &showdebuglist);
}
bfd_mach_o_load_command *cmd;
if (bfd_mach_o_lookup_command (current_program_space->exec_bfd (),
- BFD_MACH_O_LC_LOAD_DYLINKER, &cmd) == 1)
- return cmd->command.dylinker.name_str;
+ BFD_MACH_O_LC_LOAD_DYLINKER, &cmd) == 1)
+ return cmd->command.dylinker.name_str;
}
/* If we didn't find it, read from memory.
break;
/* Discard wrong magic numbers. Shouldn't happen. */
hdr_val = extract_unsigned_integer
- (hdr.magic, sizeof (hdr.magic), byte_order);
+ (hdr.magic, sizeof (hdr.magic), byte_order);
if (hdr_val != BFD_MACH_O_MH_MAGIC && hdr_val != BFD_MACH_O_MH_MAGIC_64)
- continue;
+ continue;
/* Discard executable. Should happen only once. */
hdr_val = extract_unsigned_integer
- (hdr.filetype, sizeof (hdr.filetype), byte_order);
+ (hdr.filetype, sizeof (hdr.filetype), byte_order);
if (hdr_val == BFD_MACH_O_MH_EXECUTE)
- continue;
+ continue;
gdb::unique_xmalloc_ptr<char> file_path
= target_read_string (path_addr, SO_NAME_MAX_PATH_SIZE - 1);
the current pc (which should point at the entry point for the
dynamic linker) and subtracting the offset of the entry point. */
load_addr = (regcache_read_pc (get_current_regcache ())
- - bfd_get_start_address (dyld_bfd.get ()));
+ - bfd_get_start_address (dyld_bfd.get ()));
/* Now try to set a breakpoint in the dynamic linker. */
info->all_image_addr =
if (start == 0)
notifier = 0;
else
- {
- gdb_bfd_ref_ptr dyld_bfd = darwin_get_dyld_bfd ();
- if (dyld_bfd != NULL)
- {
- CORE_ADDR dyld_bfd_start_address;
- CORE_ADDR dyld_relocated_base_address;
- CORE_ADDR pc;
-
- dyld_bfd_start_address = bfd_get_start_address (dyld_bfd.get());
-
- /* We find the dynamic linker's base address by examining
- the current pc (which should point at the entry point
- for the dynamic linker) and subtracting the offset of
- the entry point. */
-
- pc = regcache_read_pc (get_current_regcache ());
- dyld_relocated_base_address = pc - dyld_bfd_start_address;
-
- /* We get the proper notifier relocated address by
- adding the dyld relocated base address to the current
- notifier offset value. */
-
- notifier += dyld_relocated_base_address;
- }
- }
+ {
+ gdb_bfd_ref_ptr dyld_bfd = darwin_get_dyld_bfd ();
+ if (dyld_bfd != NULL)
+ {
+ CORE_ADDR dyld_bfd_start_address;
+ CORE_ADDR dyld_relocated_base_address;
+ CORE_ADDR pc;
+
+ dyld_bfd_start_address = bfd_get_start_address (dyld_bfd.get());
+
+ /* We find the dynamic linker's base address by examining
+ the current pc (which should point at the entry point
+ for the dynamic linker) and subtracting the offset of
+ the entry point. */
+
+ pc = regcache_read_pc (get_current_regcache ());
+ dyld_relocated_base_address = pc - dyld_bfd_start_address;
+
+ /* We get the proper notifier relocated address by
+ adding the dyld relocated base address to the current
+ notifier offset value. */
+
+ notifier += dyld_relocated_base_address;
+ }
+ }
}
/* Add the breakpoint which is hit by dyld when the list of solib is
/* Fetch initial portion of the loadmap. */
if (target_read_memory (ldmaddr, (gdb_byte *) &ext_ldmbuf_partial,
- sizeof ext_ldmbuf_partial))
+ sizeof ext_ldmbuf_partial))
{
/* Problem reading the target's memory. */
return NULL;
/* Extract the version. */
version = extract_unsigned_integer (ext_ldmbuf_partial.version,
- sizeof ext_ldmbuf_partial.version,
+ sizeof ext_ldmbuf_partial.version,
byte_order);
if (version != 0)
{
/* Extract the number of segments. */
nsegs = extract_unsigned_integer (ext_ldmbuf_partial.nsegs,
- sizeof ext_ldmbuf_partial.nsegs,
+ sizeof ext_ldmbuf_partial.nsegs,
byte_order);
if (nsegs <= 0)
/* Allocate space for the complete (external) loadmap. */
ext_ldmbuf_size = sizeof (struct ext_elf32_fdpic_loadmap)
- + (nsegs - 1) * sizeof (struct ext_elf32_fdpic_loadseg);
+ + (nsegs - 1) * sizeof (struct ext_elf32_fdpic_loadseg);
ext_ldmbuf = (struct ext_elf32_fdpic_loadmap *) xmalloc (ext_ldmbuf_size);
/* Copy over the portion of the loadmap that's already been read. */
/* Read the rest of the loadmap from the target. */
if (target_read_memory (ldmaddr + sizeof ext_ldmbuf_partial,
- (gdb_byte *) ext_ldmbuf + sizeof ext_ldmbuf_partial,
- ext_ldmbuf_size - sizeof ext_ldmbuf_partial))
+ (gdb_byte *) ext_ldmbuf + sizeof ext_ldmbuf_partial,
+ ext_ldmbuf_size - sizeof ext_ldmbuf_partial))
{
/* Couldn't read rest of the loadmap. */
xfree (ext_ldmbuf);
/* Allocate space into which to put information extract from the
external loadsegs. I.e, allocate the internal loadsegs. */
int_ldmbuf_size = sizeof (struct int_elf32_fdpic_loadmap)
- + (nsegs - 1) * sizeof (struct int_elf32_fdpic_loadseg);
+ + (nsegs - 1) * sizeof (struct int_elf32_fdpic_loadseg);
int_ldmbuf = (struct int_elf32_fdpic_loadmap *) xmalloc (int_ldmbuf_size);
/* Place extracted information in internal structs. */
{
int_ldmbuf->segs[seg].addr
= extract_unsigned_integer (ext_ldmbuf->segs[seg].addr,
- sizeof (ext_ldmbuf->segs[seg].addr),
+ sizeof (ext_ldmbuf->segs[seg].addr),
byte_order);
int_ldmbuf->segs[seg].p_vaddr
= extract_unsigned_integer (ext_ldmbuf->segs[seg].p_vaddr,
- sizeof (ext_ldmbuf->segs[seg].p_vaddr),
+ sizeof (ext_ldmbuf->segs[seg].p_vaddr),
byte_order);
int_ldmbuf->segs[seg].p_memsz
= extract_unsigned_integer (ext_ldmbuf->segs[seg].p_memsz,
- sizeof (ext_ldmbuf->segs[seg].p_memsz),
+ sizeof (ext_ldmbuf->segs[seg].p_memsz),
byte_order);
}
return lm_base_cache;
got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL,
- current_program_space->symfile_object_file);
+ current_program_space->symfile_object_file);
if (got_sym.minsym == 0)
{
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
- "lm_base: _GLOBAL_OFFSET_TABLE_ not found.\n");
+ "lm_base: _GLOBAL_OFFSET_TABLE_ not found.\n");
return 0;
}
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog, "current_sos: name = %s\n",
- name_buf.get ());
+ name_buf.get ());
if (name_buf == nullptr)
warning (_("Can't read pathname for link map entry."));
static CORE_ADDR
displacement_from_map (struct int_elf32_fdpic_loadmap *map,
- CORE_ADDR addr)
+ CORE_ADDR addr)
{
int seg;
for (seg = 0; seg < map->nsegs; seg++)
{
if (map->segs[seg].p_vaddr <= addr
- && addr < map->segs[seg].p_vaddr + map->segs[seg].p_memsz)
+ && addr < map->segs[seg].p_vaddr + map->segs[seg].p_memsz)
{
return map->segs[seg].addr - map->segs[seg].p_vaddr;
}
enable_break_failure_warning (void)
{
warning (_("Unable to find dynamic linker breakpoint function.\n"
- "GDB will be unable to debug shared library initializers\n"
+ "GDB will be unable to debug shared library initializers\n"
"and track explicitly loaded dynamic code."));
}
struct int_elf32_fdpic_loadmap *ldm;
/* Read the contents of the .interp section into a local buffer;
- the contents specify the dynamic linker this program uses. */
+ the contents specify the dynamic linker this program uses. */
interp_sect_size = bfd_section_size (interp_sect);
buf = (char *) alloca (interp_sect_size);
bfd_get_section_contents (current_program_space->exec_bfd (),
interp_sect, buf, 0, interp_sect_size);
/* Now we need to figure out where the dynamic linker was
- loaded so that we can load its symbols and place a breakpoint
- in the dynamic linker itself.
+ loaded so that we can load its symbols and place a breakpoint
+ in the dynamic linker itself.
- This address is stored on the stack. However, I've been unable
- to find any magic formula to find it for Solaris (appears to
- be trivial on GNU/Linux). Therefore, we have to try an alternate
- mechanism to find the dynamic linker's base address. */
+ This address is stored on the stack. However, I've been unable
+ to find any magic formula to find it for Solaris (appears to
+ be trivial on GNU/Linux). Therefore, we have to try an alternate
+ mechanism to find the dynamic linker's base address. */
gdb_bfd_ref_ptr tmp_bfd;
try
- {
- tmp_bfd = solib_bfd_open (buf);
- }
+ {
+ tmp_bfd = solib_bfd_open (buf);
+ }
catch (const gdb_exception &ex)
{
}
}
status = frv_fdpic_loadmap_addresses (target_gdbarch (),
- &interp_loadmap_addr, 0);
+ &interp_loadmap_addr, 0);
if (status < 0)
{
warning (_("Unable to determine dynamic linker loadmap address."));
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
- "enable_break: interp_loadmap_addr = %s\n",
+ "enable_break: interp_loadmap_addr = %s\n",
hex_string_custom (interp_loadmap_addr, 8));
ldm = fetch_loadmap (interp_loadmap_addr);
if (ldm == NULL)
{
warning (_("Unable to load dynamic linker loadmap at address %s."),
- hex_string_custom (interp_loadmap_addr, 8));
+ hex_string_custom (interp_loadmap_addr, 8));
enable_break_failure_warning ();
return 0;
}
/* Record the relocated start and end address of the dynamic linker
- text and plt section for svr4_in_dynsym_resolve_code. */
+ text and plt section for svr4_in_dynsym_resolve_code. */
interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text");
if (interp_sect)
{
{
warning (_("Unable to fetch contents of _dl_debug_addr "
"(at address %s) from dynamic linker"),
- hex_string_custom (addr, 8));
+ hex_string_custom (addr, 8));
}
addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order);
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
- "enable_break: _dl_debug_addr[0..3] = %s\n",
- hex_string_custom (addr, 8));
+ "enable_break: _dl_debug_addr[0..3] = %s\n",
+ hex_string_custom (addr, 8));
/* If it's zero, then the ldso hasn't initialized yet, and so
- there are no shared libs yet loaded. */
+ there are no shared libs yet loaded. */
if (addr == 0)
{
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
- "enable_break: ldso not yet initialized\n");
+ "enable_break: ldso not yet initialized\n");
/* Do not warn, but mark to run again. */
return 0;
}
/* Fetch the r_brk field. It's 8 bytes from the start of
- _dl_debug_addr. */
+ _dl_debug_addr. */
if (target_read_memory (addr + 8, addr_buf, sizeof addr_buf) != 0)
{
warning (_("Unable to fetch _dl_debug_addr->r_brk "
"(at address %s) from dynamic linker"),
- hex_string_custom (addr + 8, 8));
+ hex_string_custom (addr + 8, 8));
enable_break_failure_warning ();
return 0;
}
{
warning (_("Unable to fetch _dl_debug_addr->.r_brk entry point "
"(at address %s) from dynamic linker"),
- hex_string_custom (addr, 8));
+ hex_string_custom (addr, 8));
enable_break_failure_warning ();
return 0;
}
xfree (ldm);
/* Remove all the solib event breakpoints. Their addresses
- may have changed since the last time we ran the program. */
+ may have changed since the last time we ran the program. */
remove_solib_event_breakpoints ();
/* Now (finally!) create the solib breakpoint. */
struct obj_section *osect;
status = frv_fdpic_loadmap_addresses (target_gdbarch (),
- &interp_addr, &exec_addr);
+ &interp_addr, &exec_addr);
if (status < 0 || (exec_addr == 0 && interp_addr == 0))
{
static void
frv_relocate_section_addresses (struct so_list *so,
- struct target_section *sec)
+ struct target_section *sec)
{
int seg;
lm_info_frv *li = (lm_info_frv *) so->lm_info;
for (seg = 0; seg < map->nsegs; seg++)
{
if (map->segs[seg].p_vaddr <= sec->addr
- && sec->addr < map->segs[seg].p_vaddr + map->segs[seg].p_memsz)
+ && sec->addr < map->segs[seg].p_vaddr + map->segs[seg].p_memsz)
{
CORE_ADDR displ = map->segs[seg].addr - map->segs[seg].p_vaddr;
/* Check the main executable. */
objfile *objf = current_program_space->symfile_object_file;
addr = find_canonical_descriptor_in_load_object
- (entry_point, got_value, name, objf->obfd,
+ (entry_point, got_value, name, objf->obfd,
main_executable_lm_info);
/* If descriptor not found via main executable, check each load object
rel = lm->dyn_relocs[i];
/* Relocs of interest are those which meet the following
- criteria:
+ criteria:
- the names match (assuming the caller could provide
a name which matches ``entry_point'').
this address (which is a GOT entry) to obtain a descriptor
address. */
if ((name == 0 || strcmp (name, (*rel->sym_ptr_ptr)->name) == 0)
- && rel->howto->type == R_FRV_FUNCDESC)
+ && rel->howto->type == R_FRV_FUNCDESC)
{
gdb_byte buf [FRV_PTR_SIZE];
try
{
addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
- ptr_type);
+ ptr_type);
}
catch (const gdb_exception_error &ex)
{
}
/* For SVR4 versions, the first entry in the link map is for the
- inferior executable, so we must ignore it. For some versions of
- SVR4, it has no name. For others (Solaris 2.3 for example), it
- does have a name, so we can no longer use a missing name to
- decide when to ignore it. */
+ inferior executable, so we must ignore it. For some versions of
+ SVR4, it has no name. For others (Solaris 2.3 for example), it
+ does have a name, so we can no longer use a missing name to
+ decide when to ignore it. */
if (ignore_first && li->l_prev == 0)
{
first_l_name = li->l_name;
sym_addr = 0;
/* Now we need to figure out where the dynamic linker was
- loaded so that we can load its symbols and place a breakpoint
- in the dynamic linker itself.
+ loaded so that we can load its symbols and place a breakpoint
+ in the dynamic linker itself.
- This address is stored on the stack. However, I've been unable
- to find any magic formula to find it for Solaris (appears to
- be trivial on GNU/Linux). Therefore, we have to try an alternate
- mechanism to find the dynamic linker's base address. */
+ This address is stored on the stack. However, I've been unable
+ to find any magic formula to find it for Solaris (appears to
+ be trivial on GNU/Linux). Therefore, we have to try an alternate
+ mechanism to find the dynamic linker's base address. */
gdb_bfd_ref_ptr tmp_bfd;
try
- {
+ {
tmp_bfd = solib_bfd_open (interp_name);
}
catch (const gdb_exception &ex)
goto bkpt_at_symbol;
/* Now convert the TMP_BFD into a target. That way target, as
- well as BFD operations can be used. target_bfd_reopen
- acquires its own reference. */
+ well as BFD operations can be used. target_bfd_reopen
+ acquires its own reference. */
tmp_bfd_target = target_bfd_reopen (tmp_bfd.get ());
/* On a running target, we can get the dynamic linker's base
- address from the shared library table. */
+ address from the shared library table. */
for (struct so_list *so : current_program_space->solibs ())
{
if (svr4_same_1 (interp_name, so->so_original_name))
}
/* If we were not able to find the base address of the loader
- from our so_list, then try using the AT_BASE auxilliary entry. */
+ from our so_list, then try using the AT_BASE auxilliary entry. */
if (!load_addr_found)
if (target_auxv_search (current_top_target (), AT_BASE, &load_addr) > 0)
{
the current pc (which should point at the entry point for the
dynamic linker) and subtracting the offset of the entry point.
- This is more fragile than the previous approaches, but is a good
- fallback method because it has actually been working well in
- most cases. */
+ This is more fragile than the previous approaches, but is a good
+ fallback method because it has actually been working well in
+ most cases. */
if (!load_addr_found)
{
struct regcache *regcache
}
/* Record the relocated start and end address of the dynamic linker
- text and plt section for svr4_in_dynsym_resolve_code. */
+ text and plt section for svr4_in_dynsym_resolve_code. */
interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text");
if (interp_sect)
{
tmp_bfd_target);
/* We're done with both the temporary bfd and target. Closing
- the target closes the underlying bfd, because it holds the
- only remaining reference. */
+ the target closes the underlying bfd, because it holds the
+ only remaining reference. */
target_close (tmp_bfd_target);
if (sym_addr != 0)
}
/* For whatever reason we couldn't set a breakpoint in the dynamic
- linker. Warn and drop into the old code. */
+ linker. Warn and drop into the old code. */
bkpt_at_symbol:
warning (_("Unable to find dynamic linker breakpoint function.\n"
- "GDB will be unable to debug shared library initializers\n"
- "and track explicitly loaded dynamic code."));
+ "GDB will be unable to debug shared library initializers\n"
+ "and track explicitly loaded dynamic code."));
}
/* Scan through the lists of symbols, trying to look up the symbol and
return 0;
else if (arch_size == 32
&& phdrs_target->size () >= sizeof (Elf32_External_Phdr)
- && phdrs_target->size () % sizeof (Elf32_External_Phdr) == 0)
+ && phdrs_target->size () % sizeof (Elf32_External_Phdr) == 0)
{
Elf_Internal_Ehdr *ehdr2
= elf_tdata (current_program_space->exec_bfd ())->elf_header;
}
/* Now compare program headers from the target and the binary
- with optional DISPLACEMENT. */
+ with optional DISPLACEMENT. */
for (i = 0;
i < phdrs_target->size () / sizeof (Elf32_External_Phdr);
}
else if (arch_size == 64
&& phdrs_target->size () >= sizeof (Elf64_External_Phdr)
- && phdrs_target->size () % sizeof (Elf64_External_Phdr) == 0)
+ && phdrs_target->size () % sizeof (Elf64_External_Phdr) == 0)
{
Elf_Internal_Ehdr *ehdr2
= elf_tdata (current_program_space->exec_bfd ())->elf_header;
static void
svr4_relocate_section_addresses (struct so_list *so,
- struct target_section *sec)
+ struct target_section *sec)
{
bfd *abfd = sec->the_bfd_section->owner;
void
set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
- struct link_map_offsets *(*flmo) (void))
+ struct link_map_offsets *(*flmo) (void))
{
struct solib_svr4_ops *ops
= (struct solib_svr4_ops *) gdbarch_data (gdbarch, solib_svr4_data);
bfd *abfd;
if (current_objfile->separate_debug_objfile_backlink != nullptr)
- current_objfile = current_objfile->separate_debug_objfile_backlink;
+ current_objfile = current_objfile->separate_debug_objfile_backlink;
if (current_objfile == current_program_space->symfile_object_file)
abfd = current_program_space->exec_bfd ();
may need to glue them with a directory separator. Cases to
consider:
- | sysroot | separator | in_pathname |
- |-----------------+-----------+----------------|
- | /some/dir | / | c:/foo/bar.dll |
- | /some/dir | | /foo/bar.dll |
- | target: | | c:/foo/bar.dll |
- | target: | | /foo/bar.dll |
- | target:some/dir | / | c:/foo/bar.dll |
- | target:some/dir | | /foo/bar.dll |
+ | sysroot | separator | in_pathname |
+ |-----------------+-----------+----------------|
+ | /some/dir | / | c:/foo/bar.dll |
+ | /some/dir | | /foo/bar.dll |
+ | target: | | c:/foo/bar.dll |
+ | target: | | /foo/bar.dll |
+ | target:some/dir | / | c:/foo/bar.dll |
+ | target:some/dir | | /foo/bar.dll |
IOW, we don't need to add a separator if IN_PATHNAME already
has one, or when the sysroot is exactly "target:".
for (target_section &p : *so->sections)
{
/* Relocate the section binding addresses as recorded in the shared
- object's file by the base address to which the object was actually
- mapped. */
+ object's file by the base address to which the object was actually
+ mapped. */
ops->relocate_section_addresses (so, &p);
/* If the target didn't provide information about the address
}
/* If the shared object appears on the inferior's list too, then
- it's still loaded, so we don't need to do anything. Delete
- it from the inferior's list, and leave it on GDB's list. */
+ it's still loaded, so we don't need to do anything. Delete
+ it from the inferior's list, and leave it on GDB's list. */
if (i)
{
*i_link = i->next;
symfile_add_flags add_flags = SYMFILE_DEFER_BP_RESET;
if (from_tty)
- add_flags |= SYMFILE_VERBOSE;
+ add_flags |= SYMFILE_VERBOSE;
for (struct so_list *gdb : current_program_space->solibs ())
if (! pattern || re_exec (gdb->so_name))
{
- /* Normally, we would read the symbols from that library
- only if READSYMS is set. However, we're making a small
- exception for the pthread library, because we sometimes
- need the library symbols to be loaded in order to provide
- thread support (x86-linux for instance). */
- const int add_this_solib =
- (readsyms || libpthread_solib_p (gdb));
+ /* Normally, we would read the symbols from that library
+ only if READSYMS is set. However, we're making a small
+ exception for the pthread library, because we sometimes
+ need the library symbols to be loaded in order to provide
+ thread support (x86-linux for instance). */
+ const int add_this_solib =
+ (readsyms || libpthread_solib_p (gdb));
any_matches = true;
if (add_this_solib)
symaddr = sym->value;
/* Some ELF targets fiddle with addresses of symbols they
- consider special. They use minimal symbols to do that
- and this is needed for correct breakpoint placement,
- but we do not have full data here to build a complete
- minimal symbol, so just set the address and let the
- targets cope with that. */
+ consider special. They use minimal symbols to do that
+ and this is needed for correct breakpoint placement,
+ but we do not have full data here to build a complete
+ minimal symbol, so just set the address and let the
+ targets cope with that. */
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& gdbarch_elf_make_msymbol_special_p (gdbarch))
{
gdb::unique_xmalloc_ptr<char> new_name_holder;
/* Spaces and tabs will have been removed by buildargv().
- NAME is the start of the directory.
+ NAME is the start of the directory.
P is the '\0' following the end. */
p = name + strlen (name);
static int
substitute_path_rule_matches (const struct substitute_path_rule *rule,
- const char *path)
+ const char *path)
{
const int from_len = strlen (rule->from);
const int path_len = strlen (path);
if (*fullname)
{
/* The user may have requested that source paths be rewritten
- according to substitution rules he provided. If a substitution
- rule applies to this path, then apply it. */
+ according to substitution rules he provided. If a substitution
+ rule applies to this path, then apply it. */
gdb::unique_xmalloc_ptr<char> rewritten_fullname
= rewrite_source_path (fullname->get ());
if (dirname != NULL)
{
/* If necessary, rewrite the compilation directory name according
- to the source path substitution rules specified by the user. */
+ to the source path substitution rules specified by the user. */
rewritten_dirname = rewrite_source_path (dirname);
last_line_listed = loc->line ();
if (flags & PRINT_SOURCE_LINES_FILENAME)
- {
- uiout->text (symtab_to_filename_for_display (s));
- uiout->text (":");
- }
+ {
+ uiout->text (symtab_to_filename_for_display (s));
+ uiout->text (":");
+ }
xsnprintf (buf, sizeof (buf), "%d\t", new_lineno++);
uiout->text (buf);
if (sal.pc != 0)
{
/* This is useful for "info line *0x7f34". If we can't tell the
- user about a source line, at least let them have the symbolic
- address. */
+ user about a source line, at least let them have the symbolic
+ address. */
printf_filtered (" for address ");
wrap_here (" ");
print_address (gdbarch, sal.pc, gdb_stdout);
while (c != '\n' && (c = fgetc (stream.get ())) >= 0);
/* Remove the \r, if any, at the end of the line, otherwise
- regular expressions that end with $ or \n won't work. */
+ regular expressions that end with $ or \n won't work. */
size_t sz = buf.size ();
if (sz >= 2 && buf[sz - 2] == '\r')
{
while (rule != NULL)
{
if (FILENAME_CMP (rule->from, from) == 0)
- return rule;
+ return rule;
rule = rule->next;
}
struct substitute_path_rule *prev = substitute_path_rules;
while (prev != NULL && prev->next != rule)
- prev = prev->next;
+ prev = prev->next;
gdb_assert (prev != NULL);
while (rule != NULL)
{
if (from == NULL || substitute_path_rule_matches (rule, from) != 0)
- printf_filtered (" `%s' -> `%s'.\n", rule->from, rule->to);
+ printf_filtered (" `%s' -> `%s'.\n", rule->from, rule->to);
rule = rule->next;
}
}
struct substitute_path_rule *next = rule->next;
if (from == NULL || FILENAME_CMP (from, rule->from) == 0)
- {
- delete_substitute_path_rule (rule);
- rule_found = 1;
- }
+ {
+ delete_substitute_path_rule (rule);
+ rule_found = 1;
+ }
rule = next;
}
&setlist, &showlist);
add_cmd ("substitute-path", class_files, set_substitute_path_command,
- _("\
+ _("\
Add a substitution rule to rewrite the source directories.\n\
Usage: set substitute-path FROM TO\n\
The rule is applied only if the directory name starts with FROM\n\
directly followed by a directory separator.\n\
If a substitution rule was previously set for FROM, the old rule\n\
is replaced by the new one."),
- &setlist);
+ &setlist);
add_cmd ("substitute-path", class_files, unset_substitute_path_command,
- _("\
+ _("\
Delete one or all substitution rules rewriting the source directories.\n\
Usage: unset substitute-path [FROM]\n\
Delete the rule for substituting FROM in source directories. If FROM\n\
is not specified, all substituting rules are deleted.\n\
If the debugger cannot find a rule for FROM, it will display a warning."),
- &unsetlist);
+ &unsetlist);
add_cmd ("substitute-path", class_files, show_substitute_path_command,
- _("\
+ _("\
Show one or all substitution rules rewriting the source directories.\n\
Usage: show substitute-path [FROM]\n\
Print the rule for substituting FROM in source directories. If FROM\n\
is not specified, print all substitution rules."),
- &showlist);
+ &showlist);
add_setshow_enum_cmd ("filename-display", class_files,
filename_display_kind_names,
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
/* Make sure we can single-step over signal return system calls. */
tdep->step_trap = sparc32_linux_step_trap;
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_SPARC32);
set_gdbarch_get_syscall_number (gdbarch,
- sparc32_linux_get_syscall_number);
+ sparc32_linux_get_syscall_number);
set_gdbarch_gdb_signal_from_target (gdbarch,
sparc32_linux_gdb_signal_from_target);
cache->pc = sparc32nbsd_sigtramp_start;
/* Since we couldn't find the frame's function, the cache was
- initialized under the assumption that we're frameless. */
+ initialized under the assumption that we're frameless. */
sparc_record_save_insn (cache);
addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
cache->base = addr;
cache->pc &= ~(sparc32obsd_page_size - 1);
/* Since we couldn't find the frame's function, the cache was
- initialized under the assumption that we're frameless. */
+ initialized under the assumption that we're frameless. */
sparc_record_save_insn (cache);
addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
cache->base = addr;
static void
supply_register_at_address (struct regcache *regcache, int regnum,
- CORE_ADDR register_addr)
+ CORE_ADDR register_addr)
{
struct gdbarch *gdbarch = regcache->arch ();
int buf_size = register_size (gdbarch, regnum);
for (current_regnum = 0; current_regnum < num_regs; current_regnum ++)
{
if (register_in_thread_descriptor_p (current_regnum))
- {
- current_address = thread_descriptor_address
- + sparc_register_offsets [current_regnum];
- supply_register_at_address (regcache, current_regnum,
- current_address);
- }
+ {
+ current_address = thread_descriptor_address
+ + sparc_register_offsets [current_regnum];
+ supply_register_at_address (regcache, current_regnum,
+ current_address);
+ }
else if (register_on_stack_p (current_regnum))
- {
- current_address = stack_address
- + sparc_register_offsets [current_regnum];
- supply_register_at_address (regcache, current_regnum,
- current_address);
- }
+ {
+ current_address = stack_address
+ + sparc_register_offsets [current_regnum];
+ supply_register_at_address (regcache, current_regnum,
+ current_address);
+ }
}
}
else if (register_on_stack_p (regnum))
{
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM,
- ®ister_address);
+ ®ister_address);
register_address += sparc_register_offsets [regnum];
}
else
regcache->raw_collect (regnum, buf);
write_memory (register_address,
- buf,
- buf_size);
+ buf,
+ buf_size);
}
static struct sparc_ravenscar_ops sparc_ravenscar_ops;
OP2=5: Branch on FP Condition Codes with Prediction (FBfcc).
OP2=6: Branch on FP Condition Codes (FBcc).
OP2=3 && Bit28=0:
- Branch on Integer Register with Prediction (BPr).
+ Branch on Integer Register with Prediction (BPr).
This leaves out ILLTRAP (OP2=0), SETHI/NOP (OP2=4) and the V8
coprocessor branch instructions (Op2=7). */
return sparc32_pseudo_register_names[regnum];
internal_error (__FILE__, __LINE__,
- _("sparc32_pseudo_register_name: bad register number %d"),
- regnum);
+ _("sparc32_pseudo_register_name: bad register number %d"),
+ regnum);
}
/* Return the name of register REGNUM. */
return builtin_type (gdbarch)->builtin_double;
internal_error (__FILE__, __LINE__,
- _("sparc32_pseudo_register_type: bad register number %d"),
- regnum);
+ _("sparc32_pseudo_register_type: bad register number %d"),
+ regnum);
}
/* Return the GDB type object for the "standard" data type of data in
sp -= len;
/* Use doubleword alignment for these values. That's always
- correct, and wasting a few bytes shouldn't be a problem. */
+ correct, and wasting a few bytes shouldn't be a problem. */
sp &= ~0x7;
write_memory (sp, value_contents (args[i]), len);
gdb_byte buf[4];
if (len < 4)
- {
- memset (buf, 0, 4 - len);
- memcpy (buf + 4 - len, valbuf, len);
- valbuf = buf;
- len = 4;
- }
+ {
+ memset (buf, 0, 4 - len);
+ memcpy (buf + 4 - len, valbuf, len);
+ valbuf = buf;
+ len = 4;
+ }
gdb_assert (len == 4 || len == 8);
/* With GCC, all stack checking sequences begin with the same two
instructions, plus an optional one in the case of a probing loop:
- sethi <some immediate>, %g1
- sub %sp, %g1, %g1
+ sethi <some immediate>, %g1
+ sub %sp, %g1, %g1
or:
- sethi <some immediate>, %g1
- sethi <some immediate>, %g4
- sub %sp, %g1, %g1
+ sethi <some immediate>, %g1
+ sethi <some immediate>, %g4
+ sub %sp, %g1, %g1
or:
- sethi <some immediate>, %g1
- sub %sp, %g1, %g1
- sethi <some immediate>, %g4
+ sethi <some immediate>, %g1
+ sub %sp, %g1, %g1
+ sethi <some immediate>, %g4
If the optional instruction is found (setting g4), assume that a
probing loop will follow. */
/* sub %sp, %g1, %g1 */
if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x4 && !X_I(insn)
- && X_RD (insn) == 1 && X_RS1 (insn) == 14 && X_RS2 (insn) == 1))
+ && X_RD (insn) == 1 && X_RS1 (insn) == 14 && X_RS2 (insn) == 1))
return start_pc;
insn = sparc_fetch_instruction (pc);
}
/* First possible sequence:
- [first two instructions above]
- clr [%g1 - some immediate] */
+ [first two instructions above]
+ clr [%g1 - some immediate] */
/* clr [%g1 - some immediate] */
if (X_OP (insn) == 3 && X_OP3(insn) == 0x4 && X_I(insn)
}
/* Second possible sequence: A small number of probes.
- [first two instructions above]
- clr [%g1]
- add %g1, -<some immediate>, %g1
- clr [%g1]
- [repeat the two instructions above any (small) number of times]
- clr [%g1 - some immediate] */
+ [first two instructions above]
+ clr [%g1]
+ add %g1, -<some immediate>, %g1
+ clr [%g1]
+ [repeat the two instructions above any (small) number of times]
+ clr [%g1 - some immediate] */
/* clr [%g1] */
else if (X_OP (insn) == 3 && X_OP3(insn) == 0x4 && !X_I(insn)
&& X_RS1 (insn) == 1 && X_RD (insn) == 0)
{
while (1)
- {
- /* add %g1, -<some immediate>, %g1 */
- insn = sparc_fetch_instruction (pc);
- pc = pc + 4;
- if (!(X_OP (insn) == 2 && X_OP3(insn) == 0 && X_I(insn)
- && X_RS1 (insn) == 1 && X_RD (insn) == 1))
- break;
-
- /* clr [%g1] */
- insn = sparc_fetch_instruction (pc);
- pc = pc + 4;
- if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4 && !X_I(insn)
- && X_RD (insn) == 0 && X_RS1 (insn) == 1))
- return start_pc;
- }
+ {
+ /* add %g1, -<some immediate>, %g1 */
+ insn = sparc_fetch_instruction (pc);
+ pc = pc + 4;
+ if (!(X_OP (insn) == 2 && X_OP3(insn) == 0 && X_I(insn)
+ && X_RS1 (insn) == 1 && X_RD (insn) == 1))
+ break;
+
+ /* clr [%g1] */
+ insn = sparc_fetch_instruction (pc);
+ pc = pc + 4;
+ if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4 && !X_I(insn)
+ && X_RD (insn) == 0 && X_RS1 (insn) == 1))
+ return start_pc;
+ }
/* clr [%g1 - some immediate] */
if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4 && X_I(insn)
- && X_RS1 (insn) == 1 && X_RD (insn) == 0))
- return start_pc;
+ && X_RS1 (insn) == 1 && X_RD (insn) == 0))
+ return start_pc;
/* We found a valid stack-check sequence, return the new PC. */
return pc;
}
/* Third sequence: A probing loop.
- [first three instructions above]
- sub %g1, %g4, %g4
- cmp %g1, %g4
- be <disp>
- add %g1, -<some immediate>, %g1
- ba <disp>
- clr [%g1]
+ [first three instructions above]
+ sub %g1, %g4, %g4
+ cmp %g1, %g4
+ be <disp>
+ add %g1, -<some immediate>, %g1
+ ba <disp>
+ clr [%g1]
And an optional last probe for the remainder:
- clr [%g4 - some immediate] */
+ clr [%g4 - some immediate] */
if (probing_loop)
{
/* sub %g1, %g4, %g4 */
if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x4 && !X_I(insn)
- && X_RD (insn) == 4 && X_RS1 (insn) == 1 && X_RS2 (insn) == 4))
- return start_pc;
+ && X_RD (insn) == 4 && X_RS1 (insn) == 1 && X_RS2 (insn) == 4))
+ return start_pc;
/* cmp %g1, %g4 */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x14 && !X_I(insn)
- && X_RD (insn) == 0 && X_RS1 (insn) == 1 && X_RS2 (insn) == 4))
- return start_pc;
+ && X_RD (insn) == 0 && X_RS1 (insn) == 1 && X_RS2 (insn) == 4))
+ return start_pc;
/* be <disp> */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
if (!(X_OP (insn) == 0 && X_COND (insn) == 0x1))
- return start_pc;
+ return start_pc;
/* add %g1, -<some immediate>, %g1 */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
if (!(X_OP (insn) == 2 && X_OP3(insn) == 0 && X_I(insn)
- && X_RS1 (insn) == 1 && X_RD (insn) == 1))
- return start_pc;
+ && X_RS1 (insn) == 1 && X_RD (insn) == 1))
+ return start_pc;
/* ba <disp> */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
if (!(X_OP (insn) == 0 && X_COND (insn) == 0x8))
- return start_pc;
+ return start_pc;
/* clr [%g1] (st %g0, [%g1] or st %g0, [%g1+0]) */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4
- && X_RD (insn) == 0 && X_RS1 (insn) == 1
+ && X_RD (insn) == 0 && X_RS1 (insn) == 1
&& (!X_I(insn) || X_SIMM13 (insn) == 0)))
- return start_pc;
+ return start_pc;
/* We found a valid stack-check sequence, return the new PC. */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4 && X_I(insn)
- && X_RS1 (insn) == 4 && X_RD (insn) == 0))
- return pc - 4;
+ && X_RS1 (insn) == 4 && X_RD (insn) == 0))
+ return pc - 4;
else
return pc;
}
if (cache->frameless_p)
{
/* This function is frameless, so %fp (%i6) holds the frame
- pointer for our calling frame. Use %sp (%o6) as this frame's
- base address. */
+ pointer for our calling frame. Use %sp (%o6) as this frame's
+ base address. */
cache->base =
- get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM);
+ get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM);
}
else
{
/* For normal frames, %fp (%i6) holds the frame pointer, the
- base address for the current stack frame. */
+ base address for the current stack frame. */
cache->base =
get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
}
else
{
/* There is no debugging information for this function to
- help us determine whether this function returns a struct
- or not. So we rely on another heuristic which is to check
- the instruction at the return address and see if this is
- an "unimp" instruction. If it is, then it is a struct-return
- function. */
+ help us determine whether this function returns a struct
+ or not. So we rely on another heuristic which is to check
+ the instruction at the return address and see if this is
+ an "unimp" instruction. If it is, then it is a struct-return
+ function. */
CORE_ADDR pc;
int regnum =
(cache->copied_regs_mask & 0x80) ? SPARC_I7_REGNUM : SPARC_O7_REGNUM;
pc = get_frame_register_unsigned (this_frame, regnum) + 8;
if (sparc_is_unimp_insn (pc))
- cache->struct_return_p = 1;
+ cache->struct_return_p = 1;
}
return cache;
if (wcookie != 0 && !cache->frameless_p && regnum == SPARC_I7_REGNUM)
{
- CORE_ADDR addr = cache->base + (regnum - SPARC_L0_REGNUM) * 4;
- ULONGEST i7;
+ CORE_ADDR addr = cache->base + (regnum - SPARC_L0_REGNUM) * 4;
+ ULONGEST i7;
- /* Read the value in from memory. */
- i7 = get_frame_memory_unsigned (this_frame, addr, 4);
- return frame_unwind_got_constant (this_frame, regnum, i7 ^ wcookie);
+ /* Read the value in from memory. */
+ i7 = get_frame_memory_unsigned (this_frame, addr, 4);
+ return frame_unwind_got_constant (this_frame, regnum, i7 ^ wcookie);
}
}
else if (X_OP (insn) == 0 && X_OP2 (insn) == 5)
{
/* Branch on Floating-Point Condition Codes with Prediction
- (FBPfcc). */
+ (FBPfcc). */
branch_p = 1;
offset = 4 * X_DISP19 (insn);
}
static int
validate_tdesc_registers (const struct target_desc *tdesc,
- struct tdesc_arch_data *tdesc_data,
- const char *feature_name,
- const char * const register_names[],
- unsigned int registers_num,
- unsigned int reg_start)
+ struct tdesc_arch_data *tdesc_data,
+ const char *feature_name,
+ const char * const register_names[],
+ unsigned int registers_num,
+ unsigned int reg_start)
{
int valid_p = 1;
const struct tdesc_feature *feature;
for (unsigned int i = 0; i < registers_num; i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data,
- reg_start + i,
- register_names[i]);
+ reg_start + i,
+ register_names[i]);
return valid_p;
}
tdesc_arch_data_up tdesc_data = tdesc_data_alloc ();
/* Validate that the descriptor provides the mandatory registers
- and allocate their numbers. */
+ and allocate their numbers. */
valid_p &= validate_tdesc_registers (tdesc, tdesc_data.get (),
- "org.gnu.gdb.sparc.cpu",
- sparc_core_register_names,
- ARRAY_SIZE (sparc_core_register_names),
- SPARC_G0_REGNUM);
+ "org.gnu.gdb.sparc.cpu",
+ sparc_core_register_names,
+ ARRAY_SIZE (sparc_core_register_names),
+ SPARC_G0_REGNUM);
valid_p &= validate_tdesc_registers (tdesc, tdesc_data.get (),
- "org.gnu.gdb.sparc.fpu",
- tdep->fpu_register_names,
- tdep->fpu_registers_num,
- SPARC_F0_REGNUM);
+ "org.gnu.gdb.sparc.fpu",
+ tdep->fpu_register_names,
+ tdep->fpu_registers_num,
+ SPARC_F0_REGNUM);
valid_p &= validate_tdesc_registers (tdesc, tdesc_data.get (),
- "org.gnu.gdb.sparc.cp0",
- tdep->cp0_register_names,
- tdep->cp0_registers_num,
- SPARC_F0_REGNUM
- + tdep->fpu_registers_num);
+ "org.gnu.gdb.sparc.cp0",
+ tdep->cp0_register_names,
+ tdep->cp0_registers_num,
+ SPARC_F0_REGNUM
+ + tdep->fpu_registers_num);
if (!valid_p)
return NULL;
if ((regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM) || regnum == -1)
{
/* Not all of the register set variants include Locals and
- Inputs. For those that don't, we read them off the stack. */
+ Inputs. For those that don't, we read them off the stack. */
if (gregmap->r_l0_offset == -1)
{
ULONGEST sp;
if ((regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM) || regnum == -1)
{
/* Not all of the register set variants include Locals and
- Inputs. For those that don't, we read them off the stack. */
+ Inputs. For those that don't, we read them off the stack. */
if (gregmap->r_l0_offset != -1)
{
int offset = gregmap->r_l0_offset;
si_code = parse_and_eval_long ("$_siginfo.si_code\n");
if (si_code >= SEGV_ACCADI && si_code <= SEGV_ADIPERR)
- addr = parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
+ addr = parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
}
catch (const gdb_exception &exception)
{
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
/* Make sure we can single-step over signal return system calls. */
tdep->step_trap = sparc64_linux_step_trap;
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_SPARC64);
set_gdbarch_get_syscall_number (gdbarch,
- sparc64_linux_get_syscall_number);
+ sparc64_linux_get_syscall_number);
set_gdbarch_report_signal_info (gdbarch, sparc64_linux_report_signal_info);
}
cache->pc = sparc64nbsd_sigtramp_start;
/* Since we couldn't find the frame's function, the cache was
- initialized under the assumption that we're frameless. */
+ initialized under the assumption that we're frameless. */
sparc_record_save_insn (cache);
addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
if (addr & 1)
cache->pc &= ~(sparc64obsd_page_size - 1);
/* Since we couldn't find the frame's function, the cache was
- initialized under the assumption that we're frameless. */
+ initialized under the assumption that we're frameless. */
sparc_record_save_insn (cache);
addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
if (addr & 1)
get_adi_info_proc (pid_t pid)
{
auto found = std::find_if (adi_proc_list.begin (), adi_proc_list.end (),
- [&pid] (const sparc64_adi_info &info)
- {
- return info.pid == pid;
- });
+ [&pid] (const sparc64_adi_info &info)
+ {
+ return info.pid == pid;
+ });
if (found == adi_proc_list.end ())
{
{
if ((*it).pid == pid)
{
- if ((*it).stat.tag_fd > 0)
- target_fileio_close ((*it).stat.tag_fd, &target_errno);
+ if ((*it).stat.tag_fd > 0)
+ target_fileio_close ((*it).stat.tag_fd, &target_errno);
adi_proc_list.erase_after (pit);
- break;
+ break;
}
else
pit = it++;
static void
read_maps_entry (const char *line,
- ULONGEST *addr, ULONGEST *endaddr)
+ ULONGEST *addr, ULONGEST *endaddr)
{
const char *p = line;
snprintf (cl_name, sizeof(cl_name), "/proc/%ld/adi/tags", (long) pid);
int target_errno;
proc->stat.tag_fd = target_fileio_open (NULL, cl_name, O_RDWR|O_EXCL,
- false, 0, &target_errno);
+ false, 0, &target_errno);
return proc->stat.tag_fd;
}
for (char *line = strtok_r (data.get (), "\n", &saveptr);
line;
line = strtok_r (NULL, "\n", &saveptr))
- {
- ULONGEST addr, endaddr;
+ {
+ ULONGEST addr, endaddr;
- read_maps_entry (line, &addr, &endaddr);
+ read_maps_entry (line, &addr, &endaddr);
- while (((vaddr + i) * adi_stat.blksize) >= addr
- && ((vaddr + i) * adi_stat.blksize) < endaddr)
- {
- if (++i == cnt)
+ while (((vaddr + i) * adi_stat.blksize) >= addr
+ && ((vaddr + i) * adi_stat.blksize) < endaddr)
+ {
+ if (++i == cnt)
return true;
- }
- }
+ }
+ }
}
else
warning (_("unable to open /proc file '%s'"), filename);
{
adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
error(_("Address at %s is not in ADI maps"),
- paddress (target_gdbarch (), vaddr * ast.blksize));
+ paddress (target_gdbarch (), vaddr * ast.blksize));
}
int target_errno;
{
adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
error(_("Address at %s is not in ADI maps"),
- paddress (target_gdbarch (), vaddr * ast.blksize));
+ paddress (target_gdbarch (), vaddr * ast.blksize));
}
int target_errno;
{
QUIT;
printf_filtered ("%s:\t",
- paddress (target_gdbarch (), vaddr * adi_stat.blksize));
+ paddress (target_gdbarch (), vaddr * adi_stat.blksize));
for (int i = maxelts; i > 0 && cnt > 0; i--, cnt--)
- {
- if (tags[v_idx] == 0xff) /* no version tag */
- printf_filtered ("-");
- else
- printf_filtered ("%1X", tags[v_idx]);
+ {
+ if (tags[v_idx] == 0xff) /* no version tag */
+ printf_filtered ("-");
+ else
+ printf_filtered ("%1X", tags[v_idx]);
if (cnt > 1)
- printf_filtered (" ");
- ++v_idx;
- }
+ printf_filtered (" ");
+ ++v_idx;
+ }
printf_filtered ("\n");
vaddr += maxelts;
}
adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
version = parse_and_eval_long (q);
if (version < 0 || version > ast.max_version)
- error (_("Invalid ADI version tag %d"), version);
+ error (_("Invalid ADI version tag %d"), version);
}
do_assign (next_address, cnt, version);
_("ADI version related commands."),
&sparc64adilist, "adi ", 0, &cmdlist);
add_cmd ("examine", class_support, adi_examine_command,
- _("Examine ADI versions."), &sparc64adilist);
+ _("Examine ADI versions."), &sparc64adilist);
add_alias_cmd ("x", "examine", no_class, 1, &sparc64adilist);
add_cmd ("assign", class_support, adi_assign_command,
- _("Assign ADI versions."), &sparc64adilist);
+ _("Assign ADI versions."), &sparc64adilist);
}
\f
return sparc64_pseudo_register_names[regnum];
internal_error (__FILE__, __LINE__,
- _("sparc64_pseudo_register_name: bad register number %d"),
- regnum);
+ _("sparc64_pseudo_register_name: bad register number %d"),
+ regnum);
}
/* Return the name of register REGNUM. */
return builtin_type (gdbarch)->builtin_long_double;
internal_error (__FILE__, __LINE__,
- _("sparc64_pseudo_register_type: bad register number %d"),
- regnum);
+ _("sparc64_pseudo_register_type: bad register number %d"),
+ regnum);
}
/* Return the GDB type object for the "standard" data type of data in
if (wcookie != 0 && !cache->frameless_p && regnum == SPARC_I7_REGNUM)
{
- CORE_ADDR addr = cache->base + (regnum - SPARC_L0_REGNUM) * 8;
- ULONGEST i7;
+ CORE_ADDR addr = cache->base + (regnum - SPARC_L0_REGNUM) * 8;
+ ULONGEST i7;
- /* Read the value in from memory. */
- i7 = get_frame_memory_unsigned (this_frame, addr, 8);
- return frame_unwind_got_constant (this_frame, regnum, i7 ^ wcookie);
+ /* Read the value in from memory. */
+ i7 = get_frame_memory_unsigned (this_frame, addr, 8);
+ return frame_unwind_got_constant (this_frame, regnum, i7 ^ wcookie);
}
}
struct type *t = check_typedef (TYPE_TARGET_TYPE (type));
if (sparc64_floating_p (t))
- return 1;
+ return 1;
}
if (sparc64_floating_p (type) && TYPE_LENGTH (type) == 16)
return 1;
valbuf += bitpos / 8;
if (len < 8)
- {
- memset (buf, 0, 8 - len);
- memcpy (buf + 8 - len, valbuf, len);
- valbuf = buf;
- len = 8;
- }
+ {
+ memset (buf, 0, 8 - len);
+ memcpy (buf + 8 - len, valbuf, len);
+ valbuf = buf;
+ len = 8;
+ }
for (int n = 0; n < (len + 3) / 4; n++)
- regcache->cooked_write (regnum + n, valbuf + n * 4);
+ regcache->cooked_write (regnum + n, valbuf + n * 4);
}
else if (sparc64_floating_p (type)
|| (sparc64_complex_floating_p (type) && len <= 16))
gdb_assert (bitpos == 0 || bitpos == 64);
regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM
- + element + bitpos / 64;
+ + element + bitpos / 64;
regcache->cooked_write (regnum, valbuf + (bitpos / 8));
}
else
}
/* GCC has an interesting bug. If TYPE is a structure that has
- a single `float' member, GCC doesn't treat it as a structure
- at all, but rather as an ordinary `float' argument. This
- argument will be stored in %f1, as required by the psABI.
- However, as a member of a structure the psABI requires it to
- be stored in %f0. This bug is present in GCC 3.3.2, but
- probably in older releases to. To appease GCC, if a
- structure has only a single `float' member, we store its
- value in %f1 too (we already have stored in %f0). */
+ a single `float' member, GCC doesn't treat it as a structure
+ at all, but rather as an ordinary `float' argument. This
+ argument will be stored in %f1, as required by the psABI.
+ However, as a member of a structure the psABI requires it to
+ be stored in %f0. This bug is present in GCC 3.3.2, but
+ probably in older releases to. To appease GCC, if a
+ structure has only a single `float' member, we store its
+ value in %f1 too (we already have stored in %f0). */
if (type->num_fields () == 1)
{
struct type *subtype = check_typedef (type->field (0).type ());
valbuf += bitpos / 8;
if (len < 4)
- {
- gdb_byte buf[4];
- regcache->cooked_read (regnum, buf);
- memcpy (valbuf, buf + 4 - len, len);
- }
+ {
+ gdb_byte buf[4];
+ regcache->cooked_read (regnum, buf);
+ memcpy (valbuf, buf + 4 - len, len);
+ }
else
- for (int i = 0; i < (len + 3) / 4; i++)
- regcache->cooked_read (regnum + i, valbuf + i * 4);
+ for (int i = 0; i < (len + 3) / 4; i++)
+ regcache->cooked_read (regnum + i, valbuf + i * 4);
}
else if (sparc64_floating_p (type))
{
gdb_assert (bitpos == 0 || bitpos == 128);
regnum = gdbarch_num_regs (gdbarch) + SPARC64_Q0_REGNUM
- + bitpos / 128;
+ + bitpos / 128;
regcache->cooked_read (regnum, valbuf + (bitpos / 8));
}
else if (len == 8)
sp -= len;
/* Use 16-byte alignment for these values. That's
- always correct, and wasting a few bytes shouldn't be
- a problem. */
+ always correct, and wasting a few bytes shouldn't be
+ a problem. */
sp &= ~0xf;
write_memory (sp, value_contents (args[i]), len);
if (len == 16)
{
/* The psABI says that "Each quad-precision parameter
- value will be assigned to two extended words in the
- parameter array. */
+ value will be assigned to two extended words in the
+ parameter array. */
num_elements += 2;
/* The psABI says that "Long doubles must be
- quad-aligned, and thus a hole might be introduced
- into the parameter array to force alignment." Skip
- an element if necessary. */
+ quad-aligned, and thus a hole might be introduced
+ into the parameter array to force alignment." Skip
+ an element if necessary. */
if ((num_elements % 2) && sparc64_16_byte_align_p (type))
num_elements++;
}
element++;
if (element < 16)
regnum = gdbarch_num_regs (gdbarch) + SPARC64_Q0_REGNUM
- + element / 2;
+ + element / 2;
}
else if (len == 8)
{
if (element < 16)
regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM
- + element;
+ + element;
}
else if (len == 4)
{
/* The psABI says "Each single-precision parameter value
- will be assigned to one extended word in the
- parameter array, and right-justified within that
- word; the left half (even float register) is
- undefined." Even though the psABI says that "the
- left half is undefined", set it to zero here. */
+ will be assigned to one extended word in the
+ parameter array, and right-justified within that
+ word; the left half (even float register) is
+ undefined." Even though the psABI says that "the
+ left half is undefined", set it to zero here. */
memset (buf, 0, 4);
memcpy (buf + 4, valbuf, 4);
valbuf = buf;
len = 8;
if (element < 16)
regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM
- + element;
+ + element;
}
}
else
regcache->cooked_write (regnum, valbuf);
/* If we're storing the value in a floating-point register,
- also store it in the corresponding %0 register(s). */
+ also store it in the corresponding %0 register(s). */
if (regnum >= gdbarch_num_regs (gdbarch))
- {
- regnum -= gdbarch_num_regs (gdbarch);
-
- if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
- {
- gdb_assert (element < 6);
- regnum = SPARC_O0_REGNUM + element;
- regcache->cooked_write (regnum, valbuf);
- }
- else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
- {
- gdb_assert (element < 5);
- regnum = SPARC_O0_REGNUM + element;
- regcache->cooked_write (regnum, valbuf);
- regcache->cooked_write (regnum + 1, valbuf + 8);
- }
- }
+ {
+ regnum -= gdbarch_num_regs (gdbarch);
+
+ if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
+ {
+ gdb_assert (element < 6);
+ regnum = SPARC_O0_REGNUM + element;
+ regcache->cooked_write (regnum, valbuf);
+ }
+ else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
+ {
+ gdb_assert (element < 5);
+ regnum = SPARC_O0_REGNUM + element;
+ regcache->cooked_write (regnum, valbuf);
+ regcache->cooked_write (regnum + 1, valbuf + 8);
+ }
+ }
}
/* Always store the argument in memory. */
gdb_assert (sparc64_integral_or_pointer_p (type));
/* Just stripping off any unused bytes should preserve the
- signed-ness just fine. */
+ signed-ness just fine. */
regcache->cooked_read (SPARC_O0_REGNUM, buf);
memcpy (valbuf, buf + 8 - len, len);
}
gdb_assert (len <= 32);
/* Simplify matters by storing the complete value (including
- floating members) into %o0 and %o1. Floating members are
- also store in the appropriate floating-point registers. */
+ floating members) into %o0 and %o1. Floating members are
+ also store in the appropriate floating-point registers. */
memset (buf, 0, sizeof (buf));
memcpy (buf, valbuf, len);
for (i = 0; i < ((len + 7) / 8); i++)
if ((regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM) || regnum == -1)
{
/* Not all of the register set variants include Locals and
- Inputs. For those that don't, we read them off the stack. */
+ Inputs. For those that don't, we read them off the stack. */
if (gregmap->r_l0_offset == -1)
{
ULONGEST sp;
if ((regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM) || regnum == -1)
{
/* Not all of the register set variants include Locals and
- Inputs. For those that don't, we read them off the stack. */
+ Inputs. For those that don't, we read them off the stack. */
if (gregmap->r_l0_offset != -1)
{
int offset = gregmap->r_l0_offset;
struct objfile *);
static struct type *read_struct_type (const char **, struct type *,
- enum type_code,
+ enum type_code,
struct objfile *);
static struct type *read_array_type (const char **, struct type *,
reg_value_complaint (int regnum, int num_regs, const char *sym)
{
complaint (_("bad register number %d (max %d) in symbol %s"),
- regnum, num_regs - 1, sym);
+ regnum, num_regs - 1, sym);
}
static void
}
/* Type is defined outside of header files.
- Find it in this object file's type vector. */
+ Find it in this object file's type vector. */
if (index >= type_vector_length)
{
old_len = type_vector_length;
if (stabs)
{
/* for all the stab entries, find their corresponding symbols and
- patch their types! */
+ patch their types! */
for (ii = 0; ii < stabs->count; ++ii)
{
if (!sym)
{
/* FIXME-maybe: it would be nice if we noticed whether
- the variable was defined *anywhere*, not just whether
- it is defined in this compilation unit. But neither
- xlc or GCC seem to need such a definition, and until
- we do psymtabs (so that the minimal symbols from all
- compilation units are available now), I'm not sure
- how to get the information. */
+ the variable was defined *anywhere*, not just whether
+ it is defined in this compilation unit. But neither
+ xlc or GCC seem to need such a definition, and until
+ we do psymtabs (so that the minimal symbols from all
+ compilation units are available now), I'm not sure
+ how to get the information. */
/* On xcoff, if a global is defined and never referenced,
- ld will remove it from the executable. There is then
- a N_GSYM stab for it, but no regular (C_EXT) symbol. */
+ ld will remove it from the executable. There is then
+ a N_GSYM stab for it, but no regular (C_EXT) symbol. */
sym = new (&objfile->objfile_obstack) symbol;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
else
{
/* Must be a reference. Either the symbol has already been defined,
- or this is a forward reference to it. */
+ or this is a forward reference to it. */
*string = p;
return -1;
}
if (processing_gcc_compilation)
{
/* GCC 2.x puts the line number in desc. SunOS apparently puts in the
- number of bytes occupied by a type or object, which we ignore. */
+ number of bytes occupied by a type or object, which we ignore. */
SYMBOL_LINE (sym) = desc;
}
else
{
case 'c':
/* c is a special case, not followed by a type-number.
- SYMBOL:c=iVALUE for an integer constant symbol.
- SYMBOL:c=rVALUE for a floating constant symbol.
- SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
- e.g. "b:c=e6,0" for "const b = blob1"
- (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
+ SYMBOL:c=iVALUE for an integer constant symbol.
+ SYMBOL:c=rVALUE for a floating constant symbol.
+ SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
+ e.g. "b:c=e6,0" for "const b = blob1"
+ (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
if (*p != '=')
{
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
process_function_types:
/* Function result types are described as the result type in stabs.
- We need to convert this to the function-returning-type-X type
- in GDB. E.g. "int" is converted to "function returning int". */
+ We need to convert this to the function-returning-type-X type
+ in GDB. E.g. "int" is converted to "function returning int". */
if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_FUNC)
SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym));
/* All functions in C++ have prototypes. Stabs does not offer an
- explicit way to identify prototyped or unprototyped functions,
- but both GCC and Sun CC emit stabs for the "call-as" type rather
- than the "declared-as" type for unprototyped functions, so
- we treat all functions as if they were prototyped. This is used
- primarily for promotion when calling the function from GDB. */
+ explicit way to identify prototyped or unprototyped functions,
+ but both GCC and Sun CC emit stabs for the "call-as" type rather
+ than the "declared-as" type for unprototyped functions, so
+ we treat all functions as if they were prototyped. This is used
+ primarily for promotion when calling the function from GDB. */
SYMBOL_TYPE (sym)->set_is_prototyped (true);
/* fall into process_prototype_types. */
struct type *ptype;
/* A type number of zero indicates the start of varargs.
- FIXME: GDB currently ignores vararg functions. */
+ FIXME: GDB currently ignores vararg functions. */
if (p[0] == '0' && p[1] == '\0')
break;
ptype = read_type (&p, objfile);
/* The Sun compilers mark integer arguments, which should
- be promoted to the width of the calling conventions, with
- a type which references itself. This type is turned into
- a TYPE_CODE_VOID type by read_type, and we have to turn
- it back into builtin_int here.
- FIXME: Do we need a new builtin_promoted_int_arg ? */
+ be promoted to the width of the calling conventions, with
+ a type which references itself. This type is turned into
+ a TYPE_CODE_VOID type by read_type, and we have to turn
+ it back into builtin_int here.
+ FIXME: Do we need a new builtin_promoted_int_arg ? */
if (ptype->code () == TYPE_CODE_VOID)
ptype = objfile_type (objfile)->builtin_int;
ftype->field (nparams).set_type (ptype);
case 'G':
/* For a class G (global) symbol, it appears that the
- value is not correct. It is necessary to search for the
- corresponding linker definition to find the value.
- These definitions appear at the end of the namelist. */
+ value is not correct. It is necessary to search for the
+ corresponding linker definition to find the value.
+ These definitions appear at the end of the namelist. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
/* Don't add symbol references to global_sym_chain.
- Symbol references don't have valid names and wont't match up with
- minimal symbols when the global_sym_chain is relocated.
- We'll fixup symbol references when we fixup the defining symbol. */
+ Symbol references don't have valid names and wont't match up with
+ minimal symbols when the global_sym_chain is relocated.
+ We'll fixup symbol references when we fixup the defining symbol. */
if (sym->linkage_name () && sym->linkage_name ()[0] != '#')
{
i = hashname (sym->linkage_name ());
break;
/* This case is faked by a conditional above,
- when there is no code letter in the dbx data.
- Dbx data never actually contains 'l'. */
+ when there is no code letter in the dbx data.
+ Dbx data never actually contains 'l'. */
case 's':
case 'l':
SYMBOL_TYPE (sym) = read_type (&p, objfile);
case 'P':
/* acc seems to use P to declare the prototypes of functions that
- are referenced by this file. gdb is not prepared to deal
- with this extra information. FIXME, it ought to. */
+ are referenced by this file. gdb is not prepared to deal
+ with this extra information. FIXME, it ought to. */
if (type == N_FUN)
{
SYMBOL_TYPE (sym) = read_type (&p, objfile);
case 't':
/* In Ada, there is no distinction between typedef and non-typedef;
- any type declaration implicitly has the equivalent of a typedef,
- and thus 't' is in fact equivalent to 'Tt'.
-
- Therefore, for Ada units, we check the character immediately
- before the 't', and if we do not find a 'T', then make sure to
- create the associated symbol in the STRUCT_DOMAIN ('t' definitions
- will be stored in the VAR_DOMAIN). If the symbol was indeed
- defined as 'Tt' then the STRUCT_DOMAIN symbol will be created
- elsewhere, so we don't need to take care of that.
-
- This is important to do, because of forward references:
- The cleanup of undefined types stored in undef_types only uses
- STRUCT_DOMAIN symbols to perform the replacement. */
+ any type declaration implicitly has the equivalent of a typedef,
+ and thus 't' is in fact equivalent to 'Tt'.
+
+ Therefore, for Ada units, we check the character immediately
+ before the 't', and if we do not find a 'T', then make sure to
+ create the associated symbol in the STRUCT_DOMAIN ('t' definitions
+ will be stored in the VAR_DOMAIN). If the symbol was indeed
+ defined as 'Tt' then the STRUCT_DOMAIN symbol will be created
+ elsewhere, so we don't need to take care of that.
+
+ This is important to do, because of forward references:
+ The cleanup of undefined types stored in undef_types only uses
+ STRUCT_DOMAIN symbols to perform the replacement. */
synonym = (sym->language () == language_ada && p[-2] != 'T');
/* Typedef */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
/* For a nameless type, we don't want a create a symbol, thus we
- did not use `sym'. Return without further processing. */
+ did not use `sym'. Return without further processing. */
if (nameless)
return NULL;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
/* C++ vagaries: we may have a type which is derived from
- a base type which did not have its name defined when the
- derived class was output. We fill in the derived class's
- base part member's name here in that case. */
+ a base type which did not have its name defined when the
+ derived class was output. We fill in the derived class's
+ base part member's name here in that case. */
if (SYMBOL_TYPE (sym)->name () != NULL)
if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT
|| SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION)
|| SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as "pointer to
- foo" or "function returning foo", we better not set
- the TYPE_NAME. If the program contains "typedef char
- *caddr_t;", we don't want all variables of type char
- * to print as caddr_t. This is not just a
- consequence of GDB's type management; PCC and GCC (at
- least through version 2.4) both output variables of
- either type char * or caddr_t with the type number
- defined in the 't' symbol for caddr_t. If a future
- compiler cleans this up it GDB is not ready for it
- yet, but if it becomes ready we somehow need to
- disable this check (without breaking the PCC/GCC2.4
- case).
-
- Sigh.
-
- Fortunately, this check seems not to be necessary
- for anything except pointers or functions. */
- /* ezannoni: 2000-10-26. This seems to apply for
+ foo" or "function returning foo", we better not set
+ the TYPE_NAME. If the program contains "typedef char
+ *caddr_t;", we don't want all variables of type char
+ * to print as caddr_t. This is not just a
+ consequence of GDB's type management; PCC and GCC (at
+ least through version 2.4) both output variables of
+ either type char * or caddr_t with the type number
+ defined in the 't' symbol for caddr_t. If a future
+ compiler cleans this up it GDB is not ready for it
+ yet, but if it becomes ready we somehow need to
+ disable this check (without breaking the PCC/GCC2.4
+ case).
+
+ Sigh.
+
+ Fortunately, this check seems not to be necessary
+ for anything except pointers or functions. */
+ /* ezannoni: 2000-10-26. This seems to apply for
versions of gcc older than 2.8. This was the original
problem: with the following code gdb would tell that
the type for name1 is caddr_t, and func is char().
- typedef char *caddr_t;
+ typedef char *caddr_t;
char *name2;
struct x
{
add_symbol_to_list (sym, get_file_symbols ());
if (synonym)
- {
- /* Create the STRUCT_DOMAIN clone. */
- struct symbol *struct_sym = new (&objfile->objfile_obstack) symbol;
-
- *struct_sym = *sym;
- SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF;
- SYMBOL_VALUE (struct_sym) = valu;
- SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN;
- if (SYMBOL_TYPE (sym)->name () == 0)
+ {
+ /* Create the STRUCT_DOMAIN clone. */
+ struct symbol *struct_sym = new (&objfile->objfile_obstack) symbol;
+
+ *struct_sym = *sym;
+ SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF;
+ SYMBOL_VALUE (struct_sym) = valu;
+ SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN;
+ if (SYMBOL_TYPE (sym)->name () == 0)
SYMBOL_TYPE (sym)->set_name
(obconcat (&objfile->objfile_obstack, sym->linkage_name (),
(char *) NULL));
- add_symbol_to_list (struct_sym, get_file_symbols ());
- }
+ add_symbol_to_list (struct_sym, get_file_symbols ());
+ }
break;
case 'T':
/* Struct, union, or enum tag. For GNU C++, this can be be followed
- by 't' which means we are typedef'ing it as well. */
+ by 't' which means we are typedef'ing it as well. */
synonym = *p == 't';
if (synonym)
SYMBOL_TYPE (sym) = read_type (&p, objfile);
/* For a nameless type, we don't want a create a symbol, thus we
- did not use `sym'. Return without further processing. */
+ did not use `sym'. Return without further processing. */
if (nameless)
return NULL;
case 'X':
/* This is used by Sun FORTRAN for "function result value".
- Sun claims ("dbx and dbxtool interfaces", 2nd ed)
- that Pascal uses it too, but when I tried it Pascal used
- "x:3" (local symbol) instead. */
+ Sun claims ("dbx and dbxtool interfaces", 2nd ed)
+ that Pascal uses it too, but when I tried it Pascal used
+ "x:3" (local symbol) instead. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL;
SYMBOL_VALUE (sym) = valu;
&& SYMBOL_IS_ARGUMENT (sym))
{
/* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for
- variables passed in a register). */
+ variables passed in a register). */
if (SYMBOL_CLASS (sym) == LOC_REGISTER)
SYMBOL_ACLASS_INDEX (sym) = LOC_REGPARM_ADDR;
/* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th
return error_type (pp, objfile);
if (**pp != '=')
- {
- /* Type is not being defined here. Either it already
- exists, or this is a forward reference to it.
- dbx_alloc_type handles both cases. */
- type = dbx_alloc_type (typenums, objfile);
+ {
+ /* Type is not being defined here. Either it already
+ exists, or this is a forward reference to it.
+ dbx_alloc_type handles both cases. */
+ type = dbx_alloc_type (typenums, objfile);
- /* If this is a forward reference, arrange to complain if it
- doesn't get patched up by the time we're done
- reading. */
- if (type->code () == TYPE_CODE_UNDEF)
- add_undefined_type (type, typenums);
+ /* If this is a forward reference, arrange to complain if it
+ doesn't get patched up by the time we're done
+ reading. */
+ if (type->code () == TYPE_CODE_UNDEF)
+ add_undefined_type (type, typenums);
- return type;
- }
+ return type;
+ }
/* Type is being defined here. */
/* Skip the '='.
- Also skip the type descriptor - we get it below with (*pp)[-1]. */
+ Also skip the type descriptor - we get it below with (*pp)[-1]. */
(*pp) += 2;
}
else
{
/* 'typenums=' not present, type is anonymous. Read and return
- the definition, but don't put it in the type vector. */
+ the definition, but don't put it in the type vector. */
typenums[0] = typenums[1] = -1;
(*pp)++;
}
*pp = p + 1;
}
- /* If this type has already been declared, then reuse the same
- type, rather than allocating a new one. This saves some
- memory. */
+ /* If this type has already been declared, then reuse the same
+ type, rather than allocating a new one. This saves some
+ memory. */
for (ppt = *get_file_symbols (); ppt; ppt = ppt->next)
for (i = 0; i < ppt->nsyms; i++)
{
obstack_free (&objfile->objfile_obstack, type_name);
type = SYMBOL_TYPE (sym);
- if (typenums[0] != -1)
- *dbx_lookup_type (typenums, objfile) = type;
+ if (typenums[0] != -1)
+ *dbx_lookup_type (typenums, objfile) = type;
return type;
}
}
(*pp)--;
/* We deal with something like t(1,2)=(3,4)=... which
- the Lucid compiler and recent gcc versions (post 2.7.3) use. */
+ the Lucid compiler and recent gcc versions (post 2.7.3) use. */
/* Allocate and enter the typedef type first.
- This handles recursive types. */
+ This handles recursive types. */
type = dbx_alloc_type (typenums, objfile);
type->set_code (TYPE_CODE_TYPEDEF);
{
here as well. Once a type pointed to has been created it
should not be modified.
- Well, it's not *absolutely* wrong. Constructing recursive
- types (trees, linked lists) necessarily entails modifying
- types after creating them. Constructing any loop structure
- entails side effects. The Dwarf 2 reader does handle this
- more gracefully (it never constructs more than once
- instance of a type object, so it doesn't have to copy type
- objects wholesale), but it still mutates type objects after
- other folks have references to them.
-
- Keep in mind that this circularity/mutation issue shows up
- at the source language level, too: C's "incomplete types",
- for example. So the proper cleanup, I think, would be to
- limit GDB's type smashing to match exactly those required
- by the source language. So GDB could have a
- "complete_this_type" function, but never create unnecessary
- copies of a type otherwise. */
+ Well, it's not *absolutely* wrong. Constructing recursive
+ types (trees, linked lists) necessarily entails modifying
+ types after creating them. Constructing any loop structure
+ entails side effects. The Dwarf 2 reader does handle this
+ more gracefully (it never constructs more than once
+ instance of a type object, so it doesn't have to copy type
+ objects wholesale), but it still mutates type objects after
+ other folks have references to them.
+
+ Keep in mind that this circularity/mutation issue shows up
+ at the source language level, too: C's "incomplete types",
+ for example. So the proper cleanup, I think, would be to
+ limit GDB's type smashing to match exactly those required
+ by the source language. So GDB could have a
+ "complete_this_type" function, but never create unnecessary
+ copies of a type otherwise. */
replace_type (type, xtype);
type->set_name (NULL);
}
break;
/* In the following types, we must be sure to overwrite any existing
- type that the typenums refer to, rather than allocating a new one
- and making the typenums point to the new one. This is because there
- may already be pointers to the existing type (if it had been
- forward-referenced), and we must change it to a pointer, function,
- reference, or whatever, *in-place*. */
+ type that the typenums refer to, rather than allocating a new one
+ and making the typenums point to the new one. This is because there
+ may already be pointers to the existing type (if it had been
+ forward-referenced), and we must change it to a pointer, function,
+ reference, or whatever, *in-place*. */
case '*': /* Pointer to another type */
type1 = read_type (pp, objfile);
case '&': /* Reference to another type */
type1 = read_type (pp, objfile);
type = make_reference_type (type1, dbx_lookup_type (typenums, objfile),
- TYPE_CODE_REF);
+ TYPE_CODE_REF);
break;
case 'f': /* Function returning another type */
case 'g': /* Prototyped function. (Sun) */
{
- /* Unresolved questions:
-
- - According to Sun's ``STABS Interface Manual'', for 'f'
- and 'F' symbol descriptors, a `0' in the argument type list
- indicates a varargs function. But it doesn't say how 'g'
- type descriptors represent that info. Someone with access
- to Sun's toolchain should try it out.
-
- - According to the comment in define_symbol (search for
- `process_prototype_types:'), Sun emits integer arguments as
- types which ref themselves --- like `void' types. Do we
- have to deal with that here, too? Again, someone with
- access to Sun's toolchain should try it out and let us
- know. */
-
- const char *type_start = (*pp) - 1;
- struct type *return_type = read_type (pp, objfile);
- struct type *func_type
- = make_function_type (return_type,
+ /* Unresolved questions:
+
+ - According to Sun's ``STABS Interface Manual'', for 'f'
+ and 'F' symbol descriptors, a `0' in the argument type list
+ indicates a varargs function. But it doesn't say how 'g'
+ type descriptors represent that info. Someone with access
+ to Sun's toolchain should try it out.
+
+ - According to the comment in define_symbol (search for
+ `process_prototype_types:'), Sun emits integer arguments as
+ types which ref themselves --- like `void' types. Do we
+ have to deal with that here, too? Again, someone with
+ access to Sun's toolchain should try it out and let us
+ know. */
+
+ const char *type_start = (*pp) - 1;
+ struct type *return_type = read_type (pp, objfile);
+ struct type *func_type
+ = make_function_type (return_type,
dbx_lookup_type (typenums, objfile));
- struct type_list {
- struct type *type;
- struct type_list *next;
- } *arg_types = 0;
- int num_args = 0;
-
- while (**pp && **pp != '#')
- {
- struct type *arg_type = read_type (pp, objfile);
- struct type_list *newobj = XALLOCA (struct type_list);
- newobj->type = arg_type;
- newobj->next = arg_types;
- arg_types = newobj;
- num_args++;
- }
- if (**pp == '#')
- ++*pp;
- else
- {
+ struct type_list {
+ struct type *type;
+ struct type_list *next;
+ } *arg_types = 0;
+ int num_args = 0;
+
+ while (**pp && **pp != '#')
+ {
+ struct type *arg_type = read_type (pp, objfile);
+ struct type_list *newobj = XALLOCA (struct type_list);
+ newobj->type = arg_type;
+ newobj->next = arg_types;
+ arg_types = newobj;
+ num_args++;
+ }
+ if (**pp == '#')
+ ++*pp;
+ else
+ {
complaint (_("Prototyped function type didn't "
"end arguments with `#':\n%s"),
type_start);
- }
+ }
- /* If there is just one argument whose type is `void', then
- that's just an empty argument list. */
- if (arg_types
- && ! arg_types->next
- && arg_types->type->code () == TYPE_CODE_VOID)
- num_args = 0;
+ /* If there is just one argument whose type is `void', then
+ that's just an empty argument list. */
+ if (arg_types
+ && ! arg_types->next
+ && arg_types->type->code () == TYPE_CODE_VOID)
+ num_args = 0;
func_type->set_fields
((struct field *) TYPE_ALLOC (func_type,
num_args * sizeof (struct field)));
- memset (func_type->fields (), 0, num_args * sizeof (struct field));
- {
- int i;
- struct type_list *t;
-
- /* We stuck each argument type onto the front of the list
- when we read it, so the list is reversed. Build the
- fields array right-to-left. */
- for (t = arg_types, i = num_args - 1; t; t = t->next, i--)
- func_type->field (i).set_type (t->type);
- }
- func_type->set_num_fields (num_args);
+ memset (func_type->fields (), 0, num_args * sizeof (struct field));
+ {
+ int i;
+ struct type_list *t;
+
+ /* We stuck each argument type onto the front of the list
+ when we read it, so the list is reversed. Build the
+ fields array right-to-left. */
+ for (t = arg_types, i = num_args - 1; t; t = t->next, i--)
+ func_type->field (i).set_type (t->type);
+ }
+ func_type->set_num_fields (num_args);
func_type->set_is_prototyped (true);
- type = func_type;
- break;
+ type = func_type;
+ break;
}
case 'k': /* Const qualifier on some type (Sun) */
default:
/* Ignore unrecognized type attributes, so future compilers
- can invent new ones. */
+ can invent new ones. */
break;
}
++*pp;
case 's': /* Struct type */
case 'u': /* Union type */
{
- enum type_code type_code = TYPE_CODE_UNDEF;
- type = dbx_alloc_type (typenums, objfile);
- switch (type_descriptor)
- {
- case 's':
- type_code = TYPE_CODE_STRUCT;
- break;
- case 'u':
- type_code = TYPE_CODE_UNION;
- break;
- }
- type = read_struct_type (pp, type, type_code, objfile);
- break;
+ enum type_code type_code = TYPE_CODE_UNDEF;
+ type = dbx_alloc_type (typenums, objfile);
+ switch (type_descriptor)
+ {
+ case 's':
+ type_code = TYPE_CODE_STRUCT;
+ break;
+ case 'u':
+ type_code = TYPE_CODE_UNION;
+ break;
+ }
+ type = read_struct_type (pp, type, type_code, objfile);
+ break;
}
case 'a': /* Array type */
{
case 1:
/* The size of this and all the other types are fixed, defined
- by the debugging format. If there is a type called "int" which
- is other than 32 bits, then it should use a new negative type
- number (or avoid negative type numbers for that case).
- See stabs.texinfo. */
+ by the debugging format. If there is a type called "int" which
+ is other than 32 bits, then it should use a new negative type
+ number (or avoid negative type numbers for that case).
+ See stabs.texinfo. */
rettype = init_integer_type (objfile, 32, 0, "int");
break;
case 2:
break;
case 14:
/* This is an IEEE double on the RS/6000, and different machines with
- different sizes for "long double" should use different negative
- type numbers. See stabs.texinfo. */
+ different sizes for "long double" should use different negative
+ type numbers. See stabs.texinfo. */
rettype = init_float_type (objfile, 64, "long double",
floatformats_ieee_double);
break;
while (**pp != ';')
{
/* We should be positioned at the start of the function name.
- Scan forward to find the first ':' and if it is not the
- first of a "::" delimiter, then this is not a member function. */
+ Scan forward to find the first ':' and if it is not the
+ first of a "::" delimiter, then this is not a member function. */
p = *pp;
while (*p != ':')
{
So, to summarize what we expect and handle here:
- Given Given Real Real Action
+ Given Given Real Real Action
method name physname physname method name
__opi [none] __opi__3Foo operator int opname
- [now or later]
+ [now or later]
Foo _._3Foo _._3Foo ~Foo separate and
- rename
+ rename
operator i _ZN3FoocviEv _ZN3FoocviEv operator int demangle
__comp_ctor _ZN3FooC1ERKS_ _ZN3FooC1ERKS_ Foo demangle
*/
*pp = p + 1;
/* At this point, *pp points to something like "22:23=*22...",
- where the type number before the ':' is the "context" and
- everything after is a regular type definition. Lookup the
- type, find it's name, and construct the field name. */
+ where the type number before the ':' is the "context" and
+ everything after is a regular type definition. Lookup the
+ type, find it's name, and construct the field name. */
context = read_type (pp, objfile);
}
/* At this point, *pp points to the ':'. Skip it and read the
- field type. */
+ field type. */
p = ++(*pp);
if (p[-1] != ':')
{
invalid_cpp_abbrev_complaint (*pp);
/* We have no idea what syntax an unrecognized abbrev would have, so
- better return 0. If we returned 1, we would need to at least advance
- *pp to avoid an infinite loop. */
+ better return 0. If we returned 1, we would need to at least advance
+ *pp to avoid an infinite loop. */
return 0;
}
return 1;
&& FIELD_BITSIZE (fip->list->field) == 0)
{
/* This can happen in two cases: (1) at least for gcc 2.4.5 or so,
- it is a field which has been optimized out. The correct stab for
- this case is to use VISIBILITY_IGNORE, but that is a recent
- invention. (2) It is a 0-size array. For example
- union { int num; char str[0]; } foo. Printing _("<no value>" for
- str in "p foo" is OK, since foo.str (and thus foo.str[3])
- will continue to work, and a 0-size array as a whole doesn't
- have any contents to print.
-
- I suspect this probably could also happen with gcc -gstabs (not
- -gstabs+) for static fields, and perhaps other C++ extensions.
- Hopefully few people use -gstabs with gdb, since it is intended
- for dbx compatibility. */
+ it is a field which has been optimized out. The correct stab for
+ this case is to use VISIBILITY_IGNORE, but that is a recent
+ invention. (2) It is a 0-size array. For example
+ union { int num; char str[0]; } foo. Printing _("<no value>" for
+ str in "p foo" is OK, since foo.str (and thus foo.str[3])
+ will continue to work, and a 0-size array as a whole doesn't
+ have any contents to print.
+
+ I suspect this probably could also happen with gcc -gstabs (not
+ -gstabs+) for static fields, and perhaps other C++ extensions.
+ Hopefully few people use -gstabs with gdb, since it is intended
+ for dbx compatibility. */
/* Ignore this field. */
fip->list->visibility = VISIBILITY_IGNORE;
else
{
/* Detect an unpacked field and mark it as such.
- dbx gives a bit size for all fields.
- Note that forward refs cannot be packed,
- and treat enums as if they had the width of ints. */
+ dbx gives a bit size for all fields.
+ Note that forward refs cannot be packed,
+ and treat enums as if they had the width of ints. */
struct type *field_type = check_typedef (fip->list->field.type ());
p = *pp;
/* If is starts with CPLUS_MARKER it is a special abbreviation,
- unless the CPLUS_MARKER is followed by an underscore, in
- which case it is just the name of an anonymous type, which we
- should handle like any other type name. */
+ unless the CPLUS_MARKER is followed by an underscore, in
+ which case it is just the name of an anonymous type, which we
+ should handle like any other type name. */
if (is_cplus_marker (p[0]) && p[1] != '_')
{
}
/* Look for the ':' that separates the field name from the field
- values. Data members are delimited by a single ':', while member
- functions are delimited by a pair of ':'s. When we hit the member
- functions (if any), terminate scan loop and return. */
+ values. Data members are delimited by a single ':', while member
+ functions are delimited by a pair of ':'s. When we hit the member
+ functions (if any), terminate scan loop and return. */
while (*p != ':' && *p != '\0')
{
if (p[0] == ':' && p[1] == ':')
{
/* (the deleted) chill the list of fields: the last entry (at
- the head) is a partially constructed entry which we now
- scrub. */
+ the head) is a partially constructed entry which we now
+ scrub. */
fip->list = fip->list->next;
}
return 1;
}
/* The last piece of baseclass information is the type of the
- base class. Read it, and remember it's type name as this
- field's name. */
+ base class. Read it, and remember it's type name as this
+ field's name. */
newobj->field.set_type (read_type (pp, objfile));
newobj->field.name = newobj->field.type ()->name ();
{
name = type->name ();
switch (type->code ())
- {
- case TYPE_CODE_STRUCT: kind = "struct "; break;
- case TYPE_CODE_UNION: kind = "union "; break;
- case TYPE_CODE_ENUM: kind = "enum "; break;
- default: kind = "";
- }
+ {
+ case TYPE_CODE_STRUCT: kind = "struct "; break;
+ case TYPE_CODE_UNION: kind = "union "; break;
+ case TYPE_CODE_ENUM: kind = "enum "; break;
+ default: kind = "";
+ }
}
else
{
for instance the following scenario where we have the following two
stabs entries:
- .stabs "t:p(0,21)=*(0,22)=k(0,23)=xsdummy:",160,0,28,-24
- .stabs "dummy:T(0,23)=s16x:(0,1),0,3[...]"
+ .stabs "t:p(0,21)=*(0,22)=k(0,23)=xsdummy:",160,0,28,-24
+ .stabs "dummy:T(0,23)=s16x:(0,1),0,3[...]"
A stubbed version of type dummy is created while processing the first
stabs entry. The length of that type is initially set to zero, since
if (TYPE_LENGTH(ntype) == 0)
TYPE_LENGTH (ntype) = TYPE_LENGTH (type);
else
- complain_about_struct_wipeout (ntype);
+ complain_about_struct_wipeout (ntype);
ntype = TYPE_CHAIN (ntype);
}
}
static struct type *
read_struct_type (const char **pp, struct type *type, enum type_code type_code,
- struct objfile *objfile)
+ struct objfile *objfile)
{
struct stab_field_info fi;
scribbling on existing structure type objects when new definitions
appear. */
if (! (type->code () == TYPE_CODE_UNDEF
- || type->is_stub ()))
+ || type->is_stub ()))
{
complain_about_struct_wipeout (type);
while ((c = *p++) >= '0' && c < ('0' + radix))
{
if (n <= upper_limit)
- {
- if (twos_complement_representation)
- {
+ {
+ if (twos_complement_representation)
+ {
/* Octal, signed, twos complement representation. In
this case, n is the corresponding absolute value. */
if (n == 0)
n = -sn;
}
- else
- {
- n *= radix;
- n -= c - '0';
- }
- }
- else
- {
- /* unsigned representation */
- n *= radix;
- n += c - '0'; /* FIXME this overflows anyway. */
- }
- }
+ else
+ {
+ n *= radix;
+ n -= c - '0';
+ }
+ }
+ else
+ {
+ /* unsigned representation */
+ n *= radix;
+ n += c - '0'; /* FIXME this overflows anyway. */
+ }
+ }
else
- overflow = 1;
+ overflow = 1;
/* This depends on large values being output in octal, which is
- what GCC does. */
+ what GCC does. */
if (radix == 8)
{
if (nbits == 0)
}
/* -0x7f is the same as 0x80. So deal with it by adding one to
- the number of bits. Two's complement represention octals
- can't have a '-' in front. */
+ the number of bits. Two's complement represention octals
+ can't have a '-' in front. */
if (sign == -1 && !twos_complement_representation)
++nbits;
if (bits)
static struct type *
read_range_type (const char **pp, int typenums[2], int type_size,
- struct objfile *objfile)
+ struct objfile *objfile)
{
struct gdbarch *gdbarch = objfile->arch ();
const char *orig_pp = *pp;
int nbits = 0;
/* If a type size attribute has been specified, the bounds of
- the range should fit in this size. If the lower bounds needs
- more bits than the upper bound, then the type is signed. */
+ the range should fit in this size. If the lower bounds needs
+ more bits than the upper bound, then the type is signed. */
if (n2bits <= type_size && n3bits <= type_size)
- {
- if (n2bits == type_size && n2bits > n3bits)
- got_signed = 1;
- else
- got_unsigned = 1;
- nbits = type_size;
- }
+ {
+ if (n2bits == type_size && n2bits > n3bits)
+ got_signed = 1;
+ else
+ got_unsigned = 1;
+ nbits = type_size;
+ }
/* Range from 0 to <large number> is an unsigned large integral type. */
else if ((n2bits == 0 && n2 == 0) && n3bits != 0)
{
nbits = n3bits;
}
/* Range from <large number> to <large number>-1 is a large signed
- integral type. Take care of the case where <large number> doesn't
- fit in a long but <large number>-1 does. */
+ integral type. Take care of the case where <large number> doesn't
+ fit in a long but <large number>-1 does. */
else if ((n2bits != 0 && n3bits != 0 && n2bits == n3bits + 1)
|| (n2bits != 0 && n3bits == 0
&& (n2bits == sizeof (long) * HOST_CHAR_BIT)
else if (n2 == 0)
{
/* -1 is used for the upper bound of (4 byte) "unsigned int" and
- "unsigned long", and we already checked for that,
- so don't need to test for it here. */
+ "unsigned long", and we already checked for that,
+ so don't need to test for it here. */
if (n3 < 0)
/* n3 actually gives the size. */
return init_integer_type (objfile, -n3 * TARGET_CHAR_BIT, 1, NULL);
/* Is n3 == 2**(8n)-1 for some integer n? Then it's an
- unsigned n-byte integer. But do require n to be a power of
- two; we don't want 3- and 5-byte integers flying around. */
+ unsigned n-byte integer. But do require n to be a power of
+ two; we don't want 3- and 5-byte integers flying around. */
{
int bytes;
unsigned long bits;
if (index_type == NULL)
{
/* Does this actually ever happen? Is that why we are worrying
- about dealing with it rather than just calling error_type? */
+ about dealing with it rather than just calling error_type? */
complaint (_("base type %d of range type is not defined"), rangenums[1]);
type = dbx_lookup_type (nat.typenums, objfile);
if (nat.type != *type && (*type)->code () != TYPE_CODE_UNDEF)
- {
- /* The instance flags of the undefined type are still unset,
- and needs to be copied over from the reference type.
- Since replace_type expects them to be identical, we need
- to set these flags manually before hand. */
- nat.type->set_instance_flags ((*type)->instance_flags ());
- replace_type (nat.type, *type);
- }
+ {
+ /* The instance flags of the undefined type are still unset,
+ and needs to be copied over from the reference type.
+ Since replace_type expects them to be identical, we need
+ to set these flags manually before hand. */
+ nat.type->set_instance_flags ((*type)->instance_flags ());
+ replace_type (nat.type, *type);
+ }
}
noname_undefs_length = 0;
It is important to check the instance flags, because we have seen
examples where the debug info contained definitions such as:
- "foo_t:t30=B31=xefoo_t:"
+ "foo_t:t30=B31=xefoo_t:"
In this case, we have created an undefined type named "foo_t" whose
instance flags is null (when processing "xefoo_t"), and then created
default:
{
complaint (_("forward-referenced types left unresolved, "
- "type code %d."),
+ "type code %d."),
(*type)->code ());
}
break;
while (1)
{
/* Avoid expensive loop through all minimal symbols if there are
- no unresolved symbols. */
+ no unresolved symbols. */
for (hash = 0; hash < HASHSIZE; hash++)
{
if (global_sym_chain[hash])
void
read_frame_arg (const frame_print_options &fp_opts,
symbol *sym, frame_info *frame,
- struct frame_arg *argp, struct frame_arg *entryargp)
+ struct frame_arg *argp, struct frame_arg *entryargp)
{
struct value *val = NULL, *entryval = NULL;
char *val_error = NULL, *entryval_error = NULL;
struct symbol *sym;
ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
+ {
struct frame_arg arg, entryarg;
QUIT;
Reasons for using the LOC_ARG:
(1) Because find_saved_registers may be slow for
- remote debugging.
+ remote debugging.
(2) Because registers are often re-used and stack
- slots rarely (never?) are. Therefore using
- the stack slot is much less likely to print
- garbage.
+ slots rarely (never?) are. Therefore using
+ the stack slot is much less likely to print
+ garbage.
Reasons why we might want to use the LOC_REGISTER:
(1) So that the backtrace prints the same value
- as "print foo". I see no compelling reason
- why this needs to be the case; having the
- backtrace print the value which was passed
- in, and "print foo" print the value as
- modified within the called function, makes
- perfect sense to me.
+ as "print foo". I see no compelling reason
+ why this needs to be the case; having the
+ backtrace print the value which was passed
+ in, and "print foo" print the value as
+ modified within the called function, makes
+ perfect sense to me.
Additional note: It might be nice if "info args"
displayed both values.
fprintf_filtered (file,
_("Debugger's willingness to use "
"disassemble-next-line is %s.\n"),
- value);
+ value);
}
/* Use TRY_CATCH to catch the exception from the gdb_disassembly
{
*what
= print_frame_info_to_print_what
- (user_frame_print_options.print_frame_info);
+ (user_frame_print_options.print_frame_info);
}
/* Print information about frame FRAME. The output is format according
gdbarch, get_frame_pc (frame));
/* Do this regardless of SOURCE because we don't have any source
- to list for this frame. */
+ to list for this frame. */
if (print_level)
- {
- uiout->text ("#");
- uiout->field_fmt_signed (2, ui_left, "level",
+ {
+ uiout->text ("#");
+ uiout->field_fmt_signed (2, ui_left, "level",
frame_relative_level (frame));
- }
+ }
if (uiout->is_mi_like_p ())
- {
- annotate_frame_address ();
+ {
+ annotate_frame_address ();
print_pc (uiout, gdbarch, frame, get_frame_pc (frame));
- annotate_frame_address_end ();
- }
+ annotate_frame_address_end ();
+ }
if (get_frame_type (frame) == DUMMY_FRAME)
- {
- annotate_function_call ();
- uiout->field_string ("func", "<function called from gdb>",
+ {
+ annotate_function_call ();
+ uiout->field_string ("func", "<function called from gdb>",
metadata_style.style ());
}
else if (get_frame_type (frame) == SIGTRAMP_FRAME)
- {
+ {
annotate_signal_handler_caller ();
- uiout->field_string ("func", "<signal handler called>",
+ uiout->field_string ("func", "<signal handler called>",
metadata_style.style ());
- }
+ }
else if (get_frame_type (frame) == ARCH_FRAME)
- {
- uiout->field_string ("func", "<cross-architecture call>",
+ {
+ uiout->field_string ("func", "<cross-architecture call>",
metadata_style.style ());
}
uiout->text ("\n");
int realnum;
/* Find out the location of the saved register without
- fetching the corresponding value. */
+ fetching the corresponding value. */
frame_register_unwind (fi, i, &optimized, &unavailable,
&lval, &addr, &realnum, NULL);
/* For moment, only display registers that were saved on the
if (count != 0 && count_exp == NULL)
{
/* We only do this if COUNT_EXP is not specified. That way
- "down" means to really go down (and let me know if that is
- impossible), but "down 9999" can be used to mean go all the
- way down without getting an error. */
+ "down" means to really go down (and let me know if that is
+ impossible), but "down 9999" can be used to mean go all the
+ way down without getting an error. */
error (_("Bottom (innermost) frame selected; you cannot go down."));
}
struct type *return_type = NULL;
/* Compute the return value. Should the computation fail, this
- call throws an error. */
+ call throws an error. */
return_value = evaluate_expression (retval_expr.get ());
/* Cast return value to the return type of the function. Should
- the cast fail, this call throws an error. */
+ the cast fail, this call throws an error. */
if (thisfun != NULL)
return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun));
if (return_type == NULL)
return_value = value_cast (return_type, return_value);
/* Make sure the value is fully evaluated. It may live in the
- stack frame we're about to pop. */
+ stack frame we're about to pop. */
if (value_lazy (return_value))
value_fetch_lazy (return_value);
rv_conv = RETURN_VALUE_REGISTER_CONVENTION;
if (return_type->code () == TYPE_CODE_VOID)
/* If the return-type is "void", don't try to find the
- return-value's location. However, do still evaluate the
- return expression so that, even when the expression result
- is discarded, side effects such as "return i++" still
- occur. */
+ return-value's location. However, do still evaluate the
+ return expression so that, even when the expression result
+ is discarded, side effects such as "return i++" still
+ occur. */
return_value = NULL;
else if (thisfun != NULL)
{
frame apply -3 info frame Apply 'info frame' to outermost 3 frames.
frame apply all x/i $pc Apply 'x/i $pc' cmd to all frames.
frame apply all -s p local_var_no_idea_in_which_frame
- If a frame has a local variable called
- local_var_no_idea_in_which_frame, print frame
- and value of local_var_no_idea_in_which_frame.
+ If a frame has a local variable called
+ local_var_no_idea_in_which_frame, print frame
+ and value of local_var_no_idea_in_which_frame.
frame apply all -s -q p local_var_no_idea_in_which_frame
- Same as before, but only print the variable value.
+ Same as before, but only print the variable value.
frame apply level 2-5 0 4-7 -s p i = i + 1
- Adds 1 to the variable i in the specified frames.
- Note that i will be incremented twice in
- frames 4 and 5. */
+ Adds 1 to the variable i in the specified frames.
+ Note that i will be incremented twice in
+ frames 4 and 5. */
/* Apply a GDB command to COUNT stack frames, starting at TRAILING.
CMD starts with 0 or more qcs flags followed by the GDB command to apply.
This is useful in command scripts."));
add_prefix_cmd ("frame", class_stack,
- &frame_cmd.base_command, _("\
+ &frame_cmd.base_command, _("\
Select and print a stack frame.\n\
With no argument, print the selected stack frame. (See also \"info frame\").\n\
A single numerical argument specifies the frame to select."),
- &frame_cmd_list, "frame ", 1, &cmdlist);
+ &frame_cmd_list, "frame ", 1, &cmdlist);
add_com_alias ("f", "frame", class_stack, 1);
#define FRAME_APPLY_OPTION_HELP "\
deprecate_cmd (cmd, "set print raw-frame-arguments");
add_setshow_auto_boolean_cmd ("disassemble-next-line", class_stack,
- &disassemble_next_line, _("\
+ &disassemble_next_line, _("\
Set whether to disassemble next source line or insn when execution stops."),
_("\
Show whether to disassemble next source line or insn when execution stops."),
cannot be displayed.\n\
If OFF (which is the default), never display the disassembly of the next\n\
source line."),
- NULL,
- show_disassemble_next_line,
- &setlist, &showlist);
+ NULL,
+ show_disassemble_next_line,
+ &setlist, &showlist);
disassemble_next_line = AUTO_BOOLEAN_FALSE;
gdb::option::add_setshow_cmds_for_options
A single operand can be:
- an unary operation (e.g., `-5', `~2', or even with subexpressions
- like `-(2 + 1)')
+ like `-(2 + 1)')
- a register displacement, which will be treated as a register
- operand (e.g., `-4(%eax)' on x86)
+ operand (e.g., `-4(%eax)' on x86)
- a numeric constant, or
- a register operand (see function `stap_parse_register_operand')
extern void ots$fill (void *addr, size_t len, unsigned char b);
extern void ots$move (void *dst, size_t len, const void *src);
extern int ots$strcmp_eql (const void *str1, size_t str1len,
- const void *str2, size_t str2len);
+ const void *str2, size_t str2len);
/* Stub port number. */
static unsigned int serv_port = 1234;
struct _iosb iosb;
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- term_chan, /* I/O channel. */
- IO$_WRITEVBLK, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- (char *)str, /* P1 - buffer address. */
- len, /* P2 - buffer length. */
- 0, 0, 0, 0);
+ term_chan, /* I/O channel. */
+ IO$_WRITEVBLK, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ (char *)str, /* P1 - buffer address. */
+ len, /* P2 - buffer length. */
+ 0, 0, 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
/* Translate the logical name. */
status = SYS$TRNLNM (0, /* Attr of the logical name. */
- (void *) &tabdesc, /* Logical name table. */
- (void *) &logdesc, /* Logical name. */
- 0, /* Access mode. */
- item_lst); /* Item list. */
+ (void *) &tabdesc, /* Logical name table. */
+ (void *) &logdesc, /* Logical name. */
+ 0, /* Access mode. */
+ item_lst); /* Item list. */
if (!(status & STS$M_SUCCESS))
LIB$SIGNAL (status);
/* Assign a channel. */
status = sys$assign (&term_desc, /* Device name. */
- &term_chan, /* I/O channel. */
- 0, /* Access mode. */
- 0);
+ &term_chan, /* I/O channel. */
+ 0, /* Access mode. */
+ 0);
if (!(status & STS$M_SUCCESS))
LIB$SIGNAL (status);
}
/* Create a listen socket. */
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_SETMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- &listen_sockchar, /* P1 - socket characteristics. */
- 0, 0, 0, 0, 0);
+ listen_channel, /* I/O channel. */
+ IO$_SETMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ &listen_sockchar, /* P1 - socket characteristics. */
+ 0, 0, 0, 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
if (!(status & STS$M_SUCCESS))
sockopt_itemlst.ile2$ps_bufaddr = &reuseaddr_itemlst;
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_SETMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- 0, /* P3. */
- 0, /* P4. */
- (__int64) &sockopt_itemlst, /* P5 - socket options. */
- 0);
+ listen_channel, /* I/O channel. */
+ IO$_SETMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ 0, /* P3. */
+ 0, /* P4. */
+ (__int64) &sockopt_itemlst, /* P5 - socket options. */
+ 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
if (!(status & STS$M_SUCCESS))
serv_itemlst.ile2$ps_bufaddr = &serv_addr;
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_SETMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- (__int64) &serv_itemlst, /* P3 - local socket name. */
- 0, 0, 0);
+ listen_channel, /* I/O channel. */
+ IO$_SETMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ (__int64) &serv_itemlst, /* P3 - local socket name. */
+ 0, 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
if (!(status & STS$M_SUCCESS))
/* Set socket as a listen socket. */
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_SETMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- 0, /* P3. */
- 1, /* P4 - connection backlog. */
- 0, 0);
+ listen_channel, /* I/O channel. */
+ IO$_SETMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ 0, /* P3. */
+ 1, /* P4 - connection backlog. */
+ 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
if (!(status & STS$M_SUCCESS))
wordswap (serv_addr.sin_port));
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_ACCESS|IO$M_ACCEPT, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- 0, /* P3. */
- (__int64) &conn_channel, /* P4 - I/O channel for conn. */
- 0, 0);
+ listen_channel, /* I/O channel. */
+ IO$_ACCESS|IO$M_ACCEPT, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ 0, /* P3. */
+ (__int64) &conn_channel, /* P4 - I/O channel for conn. */
+ 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
cli_itemlst.ile3$ps_retlen_addr = &cli_addrlen;
ots$fill (&cli_addr, sizeof(cli_addr), 0);
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- conn_channel, /* I/O channel. */
- IO$_SENSEMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- 0, /* P3. */
- (__int64) &cli_itemlst, /* P4 - peer socket name. */
- 0, 0);
+ conn_channel, /* I/O channel. */
+ IO$_SENSEMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ 0, /* P3. */
+ (__int64) &cli_itemlst, /* P4 - peer socket name. */
+ 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
if (!(status & STS$M_SUCCESS))
/* Close socket. */
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- conn_channel, /* I/O channel. */
- IO$_DEACCESS, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, 0, 0, 0, 0, 0);
+ conn_channel, /* I/O channel. */
+ IO$_DEACCESS, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, 0, 0, 0, 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
static unsigned int
page_set_rw (unsigned __int64 startva, unsigned __int64 len,
- unsigned int *oldprot)
+ unsigned int *oldprot)
{
unsigned int status;
unsigned __int64 retva;
unsigned __int64 retlen;
status = SYS$SETPRT_64 ((void *)startva, len, PSL$C_USER, PRT$C_UW,
- (void *)&retva, &retlen, oldprot);
+ (void *)&retva, &retlen, oldprot);
return status;
}
static void
page_restore_rw (unsigned __int64 startva, unsigned __int64 len,
- unsigned int prot)
+ unsigned int prot)
{
unsigned int status;
unsigned __int64 retva;
unsigned int oldprot;
status = SYS$SETPRT_64 ((void *)startva, len, PSL$C_USER, prot,
- (void *)&retva, &retlen, &oldprot);
+ (void *)&retva, &retlen, &oldprot);
if (!(status & STS$M_SUCCESS))
LIB$SIGNAL (status);
}
int r = hex2nibble (pkt[*pos]);
if (r < 0)
- return res;
+ return res;
res = (res << 4) | r;
(*pos)++;
}
case '}':
case '*':
case 0:
- gdb_buf[gdb_blen++] = '}';
- gdb_buf[gdb_blen++] = b[i] ^ 0x20;
- break;
+ gdb_buf[gdb_blen++] = '}';
+ gdb_buf[gdb_blen++] = b[i] ^ 0x20;
+ break;
default:
- gdb_buf[gdb_blen++] = b[i];
- break;
+ gdb_buf[gdb_blen++] = b[i];
+ break;
}
}
pc = pkt2val (pkt, &pos);
if (pkt[pos] != ':')
- return;
+ return;
pos++;
off = pkt2val (pkt, &pos);
if (pkt[pos] != ',' || off != 0)
- return;
+ return;
pos++;
len = pkt2val (pkt, &pos);
if (pkt[pos] != '#' || len != 0x20)
- return;
+ return;
res = SYS$GET_UNWIND_ENTRY_INFO (pc, &uei.data, 0);
if (res == SS$_NODATA || res != SS$_NORMAL)
- ots$fill (uei.bytes, sizeof (uei.bytes), 0);
+ ots$fill (uei.bytes, sizeof (uei.bytes), 0);
if (trace_unwind)
{
thr = (pthread_t) pkt2val (pkt, &pos);
if (pkt[pos] != '#')
- return;
+ return;
res = pthread_debug_thd_get_info_addr (thr, &info);
if (res != 0)
{
{
case '?':
if (len == 1)
- {
+ {
packet_status ();
- return 0;
- }
+ return 0;
+ }
break;
case 'c':
if (len == 1)
- {
- /* Clear psr.ss. */
- excp_regs.psr.v &= ~(unsigned __int64)PSR$M_SS;
- return 1;
- }
+ {
+ /* Clear psr.ss. */
+ excp_regs.psr.v &= ~(unsigned __int64)PSR$M_SS;
+ return 1;
+ }
else
- packet_error (0);
+ packet_error (0);
break;
case 'g':
if (len == 1)
- {
- unsigned int i;
+ {
+ unsigned int i;
struct ia64_all_regs *regs = get_selected_regs ();
- unsigned char *p = regs->gr[0].b;
+ unsigned char *p = regs->gr[0].b;
- for (i = 0; i < 8 * 32; i++)
- byte2hex (gdb_buf + 1 + 2 * i, p[i]);
- gdb_blen += 2 * 8 * 32;
- return 0;
- }
+ for (i = 0; i < 8 * 32; i++)
+ byte2hex (gdb_buf + 1 + 2 * i, p[i]);
+ gdb_blen += 2 * 8 * 32;
+ return 0;
+ }
break;
case 'H':
if (pkt[1] == 'g')
break;
case 'm':
{
- unsigned __int64 addr;
+ unsigned __int64 addr;
unsigned __int64 paddr;
- unsigned int l;
- unsigned int i;
-
- addr = pkt2val (pkt, &pos);
- if (pkt[pos] != ',')
- {
- packet_error (0);
- return 0;
- }
- pos++;
- l = pkt2val (pkt, &pos);
- if (pkt[pos] != '#')
- {
- packet_error (0);
- return 0;
- }
+ unsigned int l;
+ unsigned int i;
+
+ addr = pkt2val (pkt, &pos);
+ if (pkt[pos] != ',')
+ {
+ packet_error (0);
+ return 0;
+ }
+ pos++;
+ l = pkt2val (pkt, &pos);
+ if (pkt[pos] != '#')
+ {
+ packet_error (0);
+ return 0;
+ }
/* Check access. */
i = l + (addr & VMS_PAGE_MASK);
break;
case 'M':
{
- unsigned __int64 addr;
- unsigned __int64 paddr;
- unsigned int l;
- unsigned int i;
- unsigned int oldprot;
-
- addr = pkt2val (pkt, &pos);
- if (pkt[pos] != ',')
- {
- packet_error (0);
- return 0;
- }
- pos++;
- l = pkt2val (pkt, &pos);
- if (pkt[pos] != ':')
- {
- packet_error (0);
- return 0;
- }
- pos++;
- page_set_rw (addr, l, &oldprot);
+ unsigned __int64 addr;
+ unsigned __int64 paddr;
+ unsigned int l;
+ unsigned int i;
+ unsigned int oldprot;
+
+ addr = pkt2val (pkt, &pos);
+ if (pkt[pos] != ',')
+ {
+ packet_error (0);
+ return 0;
+ }
+ pos++;
+ l = pkt2val (pkt, &pos);
+ if (pkt[pos] != ':')
+ {
+ packet_error (0);
+ return 0;
+ }
+ pos++;
+ page_set_rw (addr, l, &oldprot);
/* Check access. */
i = l + (addr & VMS_PAGE_MASK);
}
/* Write. */
- for (i = 0; i < l; i++)
- {
- int v = hex2byte (pkt + pos);
- pos += 2;
- ((unsigned char *)addr)[i] = v;
- }
+ for (i = 0; i < l; i++)
+ {
+ int v = hex2byte (pkt + pos);
+ pos += 2;
+ ((unsigned char *)addr)[i] = v;
+ }
/* Sync caches. */
- for (i = 0; i < l; i += 15)
- __fc (addr + i);
- __fc (addr + l);
+ for (i = 0; i < l; i += 15)
+ __fc (addr + i);
+ __fc (addr + l);
- page_restore_rw (addr, l, oldprot);
- packet_ok ();
+ page_restore_rw (addr, l, oldprot);
+ packet_ok ();
}
break;
case 'p':
{
- unsigned int num = 0;
- unsigned int i;
+ unsigned int num = 0;
+ unsigned int i;
struct ia64_all_regs *regs = get_selected_regs ();
- num = pkt2val (pkt, &pos);
- if (pos != len)
- {
- packet_error (0);
- return 0;
- }
-
- switch (num)
- {
- case IA64_IP_REGNUM:
- ireg2pkt (regs->ip.b);
- break;
- case IA64_BR0_REGNUM:
- ireg2pkt (regs->br[0].b);
- break;
- case IA64_PSR_REGNUM:
- ireg2pkt (regs->psr.b);
- break;
- case IA64_BSP_REGNUM:
- ireg2pkt (regs->bsp.b);
- break;
- case IA64_CFM_REGNUM:
- ireg2pkt (regs->cfm.b);
- break;
- case IA64_PFS_REGNUM:
- ireg2pkt (regs->pfs.b);
- break;
- case IA64_PR_REGNUM:
- ireg2pkt (regs->pr.b);
- break;
- default:
- TERM_FAO ("gdbserv: unhandled reg !UW!/", num);
- packet_error (0);
- return 0;
- }
+ num = pkt2val (pkt, &pos);
+ if (pos != len)
+ {
+ packet_error (0);
+ return 0;
+ }
+
+ switch (num)
+ {
+ case IA64_IP_REGNUM:
+ ireg2pkt (regs->ip.b);
+ break;
+ case IA64_BR0_REGNUM:
+ ireg2pkt (regs->br[0].b);
+ break;
+ case IA64_PSR_REGNUM:
+ ireg2pkt (regs->psr.b);
+ break;
+ case IA64_BSP_REGNUM:
+ ireg2pkt (regs->bsp.b);
+ break;
+ case IA64_CFM_REGNUM:
+ ireg2pkt (regs->cfm.b);
+ break;
+ case IA64_PFS_REGNUM:
+ ireg2pkt (regs->pfs.b);
+ break;
+ case IA64_PR_REGNUM:
+ ireg2pkt (regs->pr.b);
+ break;
+ default:
+ TERM_FAO ("gdbserv: unhandled reg !UW!/", num);
+ packet_error (0);
+ return 0;
+ }
}
break;
case 'q':
break;
case 's':
if (len == 1)
- {
- /* Set psr.ss. */
- excp_regs.psr.v |= (unsigned __int64)PSR$M_SS;
- return 1;
- }
+ {
+ /* Set psr.ss. */
+ excp_regs.psr.v |= (unsigned __int64)PSR$M_SS;
+ return 1;
+ }
else
- packet_error (0);
+ packet_error (0);
break;
case 'T':
/* Thread status. */
/* Write data to connection. */
status = sys$qiow (EFN$C_ENF, /* Event flag. */
- conn_channel, /* I/O channel. */
- IO$_WRITEVBLK, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- (char *)buf, /* P1 - buffer address. */
- len, /* P2 - buffer length. */
- 0, 0, 0, 0);
+ conn_channel, /* I/O channel. */
+ IO$_WRITEVBLK, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ (char *)buf, /* P1 - buffer address. */
+ len, /* P2 - buffer length. */
+ 0, 0, 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
if (!(status & STS$M_SUCCESS))
{
off = 0;
while (1)
- {
- /* Read data from connection. */
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- conn_channel, /* I/O channel. */
- IO$_READVBLK, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- gdb_buf + off, /* P1 - buffer address. */
- sizeof (gdb_buf) - off, /* P2 - buffer leng. */
- 0, 0, 0, 0);
- if (status & STS$M_SUCCESS)
- status = iosb.iosb$w_status;
- if (!(status & STS$M_SUCCESS))
- {
- term_puts ("Failed to read data from connection\n" );
- LIB$SIGNAL (status);
- }
+ {
+ /* Read data from connection. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ conn_channel, /* I/O channel. */
+ IO$_READVBLK, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ gdb_buf + off, /* P1 - buffer address. */
+ sizeof (gdb_buf) - off, /* P2 - buffer leng. */
+ 0, 0, 0, 0);
+ if (status & STS$M_SUCCESS)
+ status = iosb.iosb$w_status;
+ if (!(status & STS$M_SUCCESS))
+ {
+ term_puts ("Failed to read data from connection\n" );
+ LIB$SIGNAL (status);
+ }
#ifdef RAW_DUMP
- term_puts ("{: ");
- term_write ((char *)gdb_buf + off, iosb.iosb$w_bcnt);
- term_putnl ();
+ term_puts ("{: ");
+ term_write ((char *)gdb_buf + off, iosb.iosb$w_bcnt);
+ term_putnl ();
#endif
- gdb_blen = off + iosb.iosb$w_bcnt;
-
- if (off == 0)
- {
- /* Search for '$'. */
- for (dollar_off = 0; dollar_off < gdb_blen; dollar_off++)
- if (gdb_buf[dollar_off] == '$')
- break;
- if (dollar_off >= gdb_blen)
- {
- /* Not found, discard the data. */
- off = 0;
- continue;
- }
- /* Search for '#'. */
- for (sharp_off = dollar_off + 1;
+ gdb_blen = off + iosb.iosb$w_bcnt;
+
+ if (off == 0)
+ {
+ /* Search for '$'. */
+ for (dollar_off = 0; dollar_off < gdb_blen; dollar_off++)
+ if (gdb_buf[dollar_off] == '$')
+ break;
+ if (dollar_off >= gdb_blen)
+ {
+ /* Not found, discard the data. */
+ off = 0;
+ continue;
+ }
+ /* Search for '#'. */
+ for (sharp_off = dollar_off + 1;
sharp_off < gdb_blen;
sharp_off++)
- if (gdb_buf[sharp_off] == '#')
- break;
- }
- else if (sharp_off >= off)
- {
- /* Search for '#'. */
- for (; sharp_off < gdb_blen; sharp_off++)
- if (gdb_buf[sharp_off] == '#')
- break;
- }
-
- /* Got packet with checksum. */
- if (sharp_off + 2 <= gdb_blen)
- break;
-
- off = gdb_blen;
- if (gdb_blen == sizeof (gdb_buf))
- {
- /* Packet too large, discard. */
- off = 0;
- }
- }
+ if (gdb_buf[sharp_off] == '#')
+ break;
+ }
+ else if (sharp_off >= off)
+ {
+ /* Search for '#'. */
+ for (; sharp_off < gdb_blen; sharp_off++)
+ if (gdb_buf[sharp_off] == '#')
+ break;
+ }
+
+ /* Got packet with checksum. */
+ if (sharp_off + 2 <= gdb_blen)
+ break;
+
+ off = gdb_blen;
+ if (gdb_blen == sizeof (gdb_buf))
+ {
+ /* Packet too large, discard. */
+ off = 0;
+ }
+ }
/* Validate and acknowledge a packet. */
{
- unsigned char chksum = 0;
- unsigned int i;
- int v;
-
- for (i = dollar_off + 1; i < sharp_off; i++)
- chksum += gdb_buf[i];
- v = hex2byte (gdb_buf + sharp_off + 1);
- if (v != chksum)
- {
- term_puts ("Discard bad checksum packet\n");
- continue;
- }
- else
- {
- sock_write ((const unsigned char *)"+", 1);
- break;
- }
+ unsigned char chksum = 0;
+ unsigned int i;
+ int v;
+
+ for (i = dollar_off + 1; i < sharp_off; i++)
+ chksum += gdb_buf[i];
+ v = hex2byte (gdb_buf + sharp_off + 1);
+ if (v != chksum)
+ {
+ term_puts ("Discard bad checksum packet\n");
+ continue;
+ }
+ else
+ {
+ sock_write ((const unsigned char *)"+", 1);
+ break;
+ }
}
}
char msg2[160];
unsigned short msg2len;
struct dsc$descriptor_s msg2_desc =
- { sizeof (msg2), DSC$K_DTYPE_T, DSC$K_CLASS_S, msg2};
+ { sizeof (msg2), DSC$K_DTYPE_T, DSC$K_CLASS_S, msg2};
msg_desc.dsc$w_length = msglen;
status = SYS$FAOL_64 (&msg_desc, &msg2len, &msg2_desc,
- &sig64->chf64$q_sig_arg1);
+ &sig64->chf64$q_sig_arg1);
if (status & STS$M_SUCCESS)
- term_write (msg2, msg2len);
+ term_write (msg2, msg2len);
}
else
term_puts ("no message");
static int
excp_handler (struct chf$signal_array *sig,
- struct chf$mech_array *mech)
+ struct chf$mech_array *mech)
{
struct chf64$signal_array *sig64 =
(struct chf64$signal_array *)mech->chf$ph_mch_sig64_addr;
static unsigned int entry_prot;
if (trace_entry)
- term_puts ("initial entry breakpoint\n");
+ term_puts ("initial entry breakpoint\n");
page_set_rw (entry_pc, 16, &entry_prot);
ots$move ((void *)entry_pc, 16, entry_saved);
{
case SS$_ACCVIO & STS$M_COND_ID:
if (trace_excp <= 1)
- display_excp (sig64, mech);
+ display_excp (sig64, mech);
/* Fall through. */
case SS$_BREAK & STS$M_COND_ID:
case SS$_OPCDEC & STS$M_COND_ID:
case SS$_TBIT & STS$M_COND_ID:
case SS$_DEBUG & STS$M_COND_ID:
if (trace_excp > 1)
- {
+ {
int i;
struct _intstk *intstk =
(struct _intstk *)mech->chf$q_mch_esf_addr;
- display_excp (sig64, mech);
+ display_excp (sig64, mech);
- TERM_FAO (" intstk: !XH!/", intstk);
- for (i = 0; i < cnt + 1; i++)
+ TERM_FAO (" intstk: !XH!/", intstk);
+ for (i = 0; i < cnt + 1; i++)
TERM_FAO (" !XH!/", ((unsigned __int64 *)sig64)[i]);
- }
+ }
do_debug (mech);
ret = SS$_CONTINUE_64;
break;
/* Translate the logical name. */
status = SYS$TRNLNM (0, /* Attributes of the logical name. */
- (void *)&tabdesc, /* Logical name table. */
- (void *)&logdesc, /* Logical name. */
- 0, /* Access mode. */
- &item_lst); /* Item list. */
+ (void *)&tabdesc, /* Logical name table. */
+ (void *)&logdesc, /* Logical name. */
+ 0, /* Access mode. */
+ &item_lst); /* Item list. */
if (status == SS$_NOLOGNAM)
return;
if (!(status & STS$M_SUCCESS))
{
if ((i == len || resstring[i] == ',' || resstring[i] == ';')
&& i != start)
- {
+ {
int j;
- sub_desc.dsc$a_pointer = resstring + start;
- sub_desc.dsc$w_length = i - start;
+ sub_desc.dsc$a_pointer = resstring + start;
+ sub_desc.dsc$w_length = i - start;
for (j = 0; j < NBR_DEBUG_FLAGS; j++)
if (str$case_blind_compare (&sub_desc,
if (j == NBR_DEBUG_FLAGS)
TERM_FAO ("GDBSTUB$TRACE: unknown directive !AS!/", &sub_desc);
- start = i + 1;
- }
+ start = i + 1;
+ }
}
TERM_FAO ("GDBSTUB$TRACE=!AD ->", len, resstring);
static int
stub_start (unsigned __int64 *progxfer, void *cli_util,
- EIHD *imghdr, IFD *imgfile,
- unsigned int linkflag, unsigned int cliflag)
+ EIHD *imghdr, IFD *imgfile,
+ unsigned int linkflag, unsigned int cliflag)
{
static int initialized;
int i;
if (entry_pc == 0)
{
while (one_command () == 0)
- ;
+ ;
}
/* We will see! */
else /* continuing, not single-stepping */
{
/* OK, about to do a "continue". First check to see if the
- target pc is on an odd boundary (second instruction in the
- word). If so, we must do a single-step first, because
- ya can't jump or return back to an odd boundary! */
+ target pc is on an odd boundary (second instruction in the
+ word). If so, we must do a single-step first, because
+ ya can't jump or return back to an odd boundary! */
if ((registers[PC] & 2) != 0)
prepare_to_step (1);
}
for (i = 0; i < count; i++)
{
/* Check for any escaped characters. Be paranoid and
- only unescape chars that should be escaped. */
+ only unescape chars that should be escaped. */
if (*buf == 0x7d)
{
switch (*(buf + 1))
/* STDOUT section:
Stuff pertaining to simulating stdout by sending chars to gdb to be echoed.
Functions: gdb_putchar(char ch)
- gdb_puts(char *str)
- gdb_write(char *str, int len)
- gdb_error(char *format, char *parm)
+ gdb_puts(char *str)
+ gdb_write(char *str, int len)
+ gdb_error(char *format, char *parm)
*/
/* Function: gdb_putchar(int)
/* many of the fpa registers are 12 byte (96 bit) registers */
#define NUMREGBYTES 180
enum regnames {D0,D1,D2,D3,D4,D5,D6,D7,
- A0,A1,A2,A3,A4,A5,A6,A7,
- PS,PC,
- FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7,
- FPCONTROL,FPSTATUS,FPIADDR
- };
+ A0,A1,A2,A3,A4,A5,A6,A7,
+ PS,PC,
+ FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7,
+ FPCONTROL,FPSTATUS,FPIADDR
+ };
\f
/* We keep a whole frame cache here. "Why?", I hear you cry, "doesn't
.text
.globl _return_to_super
_return_to_super:
- movel _registers+60,sp /* get new stack pointer */
- movel _lastFrame,a0 /* get last frame info */
- bra return_to_any
+ movel _registers+60,sp /* get new stack pointer */
+ movel _lastFrame,a0 /* get last frame info */
+ bra return_to_any
.globl _return_to_user
_return_to_user:
- movel _registers+60,a0 /* get usp */
- movel a0,usp /* set usp */
- movel _superStack,sp /* get original stack pointer */
+ movel _registers+60,a0 /* get usp */
+ movel a0,usp /* set usp */
+ movel _superStack,sp /* get original stack pointer */
return_to_any:
- movel _lastFrame,a0 /* get last frame info */
- movel a0@+,_lastFrame /* link in previous frame */
- addql #8,a0 /* skip over pc, vector#*/
- movew a0@+,d0 /* get # of words in cpu frame */
- addw d0,a0 /* point to end of data */
- addw d0,a0 /* point to end of data */
- movel a0,a1
+ movel _lastFrame,a0 /* get last frame info */
+ movel a0@+,_lastFrame /* link in previous frame */
+ addql #8,a0 /* skip over pc, vector#*/
+ movew a0@+,d0 /* get # of words in cpu frame */
+ addw d0,a0 /* point to end of data */
+ addw d0,a0 /* point to end of data */
+ movel a0,a1
#
# copy the stack frame
- subql #1,d0
+ subql #1,d0
copyUserLoop:
- movew a1@-,sp@-
- dbf d0,copyUserLoop
+ movew a1@-,sp@-
+ dbf d0,copyUserLoop
");
- RESTORE_FP_REGS()
+ RESTORE_FP_REGS()
asm(" moveml _registers,d0-d7/a0-a6");
asm(" rte"); /* pop and go! */
asm(" andiw #0x700,d0
cmpiw #0x700,d0
beq _already7
- movew sp@+,d0
- bra __catchException
+ movew sp@+,d0
+ bra __catchException
_already7:
movew sp@+,d0");
#if !defined (mc68020) && !defined (mc68332)
__catchException:");
DISABLE_INTERRUPTS();
asm("
- moveml d0-d7/a0-a6,_registers /* save registers */
+ moveml d0-d7/a0-a6,_registers /* save registers */
movel _lastFrame,a0 /* last frame pointer */
");
SAVE_FP_REGS();
asm("
lea _registers,a5 /* get address of registers */
- movew sp@,d1 /* get status register */
- movew d1,a5@(66) /* save sr */
+ movew sp@,d1 /* get status register */
+ movew d1,a5@(66) /* save sr */
movel sp@(2),a4 /* save pc in a4 for later use */
- movel a4,a5@(68) /* save pc in _regisers[] */
+ movel a4,a5@(68) /* save pc in _regisers[] */
#
# figure out how many bytes in the stack frame
movew sp@(6),d0 /* get '020 exception format */
- movew d0,d2 /* make a copy of format word */
- andiw #0xf000,d0 /* mask off format type */
- rolw #5,d0 /* rotate into the low byte *2 */
- lea _exceptionSize,a1
- addw d0,a1 /* index into the table */
+ movew d0,d2 /* make a copy of format word */
+ andiw #0xf000,d0 /* mask off format type */
+ rolw #5,d0 /* rotate into the low byte *2 */
+ lea _exceptionSize,a1
+ addw d0,a1 /* index into the table */
movew a1@,d0 /* get number of words in frame */
- movew d0,d3 /* save it */
- subw d0,a0 /* adjust save pointer */
- subw d0,a0 /* adjust save pointer(bytes) */
+ movew d0,d3 /* save it */
+ subw d0,a0 /* adjust save pointer */
+ subw d0,a0 /* adjust save pointer(bytes) */
movel a0,a1 /* copy save pointer */
subql #1,d0 /* predecrement loop counter */
#
#
# now that the stack has been clenaed,
# save the a7 in use at time of exception
- movel sp,_superStack /* save supervisor sp */
- andiw #0x2000,d1 /* were we in supervisor mode ? */
- beq userMode
- movel a7,a5@(60) /* save a7 */
- bra a7saveDone
+ movel sp,_superStack /* save supervisor sp */
+ andiw #0x2000,d1 /* were we in supervisor mode ? */
+ beq userMode
+ movel a7,a5@(60) /* save a7 */
+ bra a7saveDone
userMode:
movel usp,a1
- movel a1,a5@(60) /* save user stack pointer */
+ movel a1,a5@(60) /* save user stack pointer */
a7saveDone:
#
# save size of frame
- movew d3,a0@-
+ movew d3,a0@-
#
# compute exception number
andl #0xfff,d2 /* mask off vector offset */
lsrw #2,d2 /* divide by 4 to get vect num */
- movel d2,a0@- /* save it */
+ movel d2,a0@- /* save it */
#
# save pc causing exception
- movel a4,a0@-
+ movel a4,a0@-
#
# save old frame link and set the new value
movel _lastFrame,a1 /* last frame pointer */
movel a1,a0@- /* save pointer to prev frame */
- movel a0,_lastFrame
+ movel a0,_lastFrame
- movel d2,sp@- /* push exception num */
+ movel d2,sp@- /* push exception num */
movel _exceptionHook,a0 /* get address of handler */
- jbsr a0@ /* and call it */
- clrl sp@ /* replace exception num parm with frame ptr */
- jbsr __returnFromException /* jbsr, but never returns */
+ jbsr a0@ /* and call it */
+ clrl sp@ /* replace exception num parm with frame ptr */
+ jbsr __returnFromException /* jbsr, but never returns */
");
#else /* mc68000 */
/* This function is called when an exception occurs. It translates the
__catchException:");
DISABLE_INTERRUPTS();
asm("
- moveml d0-d7/a0-a6,_registers /* save registers */
+ moveml d0-d7/a0-a6,_registers /* save registers */
movel _lastFrame,a0 /* last frame pointer */
");
SAVE_FP_REGS();
asm("
- lea _registers,a5 /* get address of registers */
- movel sp@+,d2 /* pop return address */
+ lea _registers,a5 /* get address of registers */
+ movel sp@+,d2 /* pop return address */
addl #1530,d2 /* convert return addr to */
divs #6,d2 /* exception number */
extl d2
- moveql #3,d3 /* assume a three word frame */
+ moveql #3,d3 /* assume a three word frame */
- cmpiw #3,d2 /* bus error or address error ? */
- bgt normal /* if >3 then normal error */
- movel sp@+,a0@- /* copy error info to frame buff*/
- movel sp@+,a0@- /* these are never used */
- moveql #7,d3 /* this is a 7 word frame */
+ cmpiw #3,d2 /* bus error or address error ? */
+ bgt normal /* if >3 then normal error */
+ movel sp@+,a0@- /* copy error info to frame buff*/
+ movel sp@+,a0@- /* these are never used */
+ moveql #7,d3 /* this is a 7 word frame */
normal:
movew sp@+,d1 /* pop status register */
- movel sp@+,a4 /* pop program counter */
- movew d1,a5@(66) /* save sr */
- movel a4,a5@(68) /* save pc in _regisers[] */
- movel a4,a0@- /* copy pc to frame buffer */
+ movel sp@+,a4 /* pop program counter */
+ movew d1,a5@(66) /* save sr */
+ movel a4,a5@(68) /* save pc in _regisers[] */
+ movel a4,a0@- /* copy pc to frame buffer */
movew d1,a0@- /* copy sr to frame buffer */
- movel sp,_superStack /* save supervisor sp */
+ movel sp,_superStack /* save supervisor sp */
- andiw #0x2000,d1 /* were we in supervisor mode ? */
- beq userMode
- movel a7,a5@(60) /* save a7 */
- bra saveDone
+ andiw #0x2000,d1 /* were we in supervisor mode ? */
+ beq userMode
+ movel a7,a5@(60) /* save a7 */
+ bra saveDone
userMode:
- movel usp,a1 /* save user stack pointer */
- movel a1,a5@(60) /* save user stack pointer */
+ movel usp,a1 /* save user stack pointer */
+ movel a1,a5@(60) /* save user stack pointer */
saveDone:
- movew d3,a0@- /* push frame size in words */
- movel d2,a0@- /* push vector number */
- movel a4,a0@- /* push exception pc */
+ movew d3,a0@- /* push frame size in words */
+ movel d2,a0@- /* push vector number */
+ movel a4,a0@- /* push exception pc */
#
# save old frame link and set the new value
movel _lastFrame,a1 /* last frame pointer */
movel a1,a0@- /* save pointer to prev frame */
- movel a0,_lastFrame
+ movel a0,_lastFrame
- movel d2,sp@- /* push exception num */
+ movel d2,sp@- /* push exception num */
movel _exceptionHook,a0 /* get address of handler */
- jbsr a0@ /* and call it */
- clrl sp@ /* replace exception num parm with frame ptr */
- jbsr __returnFromException /* jbsr, but never returns */
+ jbsr a0@ /* and call it */
+ clrl sp@ /* replace exception num parm with frame ptr */
+ jbsr __returnFromException /* jbsr, but never returns */
");
#endif
break; /* line 1111 emulator */
/* Coprocessor protocol violation. Using a standard MMU or FPU
- this cannot be triggered by software. Call it a SIGBUS. */
+ this cannot be triggered by software. Call it a SIGBUS. */
case 13:
sigval = 10;
break;
break; /* breakpoint */
/* This is a trap #8 instruction. Apparently it is someone's software
- convention for some sort of SIGFPE condition. Whose? How many
- people are being screwed by having this code the way it is?
- Is there a clean solution? */
+ convention for some sort of SIGFPE condition. Whose? How many
+ people are being screwed by having this code the way it is?
+ Is there a clean solution? */
case 40:
sigval = 8;
break; /* floating point err */
frame = lastFrame - 1;
/* by using a bunch of print commands with breakpoints,
- it's possible for the frame stack to creep down. If it creeps
- too far, give up and reset it to the top. Normal use should
- not see this happen.
+ it's possible for the frame stack to creep down. If it creeps
+ too far, give up and reset it to the top. Normal use should
+ not see this happen.
*/
if ((unsigned int) (frame - 2) < (unsigned int) &gdbFrameStack)
{
reply OK for success
ENN for an error
- write reg Pn...=r... Write register n... with value r...,
+ write reg Pn...=r... Write register n... with value r...,
which contains two hex digits for each
byte in the register (target byte
order).
resume at same address.
last signal ? Reply the current reason for stopping.
- This is the same reply as is generated
+ This is the same reply as is generated
for step or cont : SAA where AA is the
signal number.
while (count < BUFMAX - 1)
{
ch = getDebugChar ();
- if (ch == '$')
- goto retry;
+ if (ch == '$')
+ goto retry;
if (ch == '#')
break;
checksum = checksum + ch;
/* Calling Reset does the same as pressing the button */
asm (".global _Reset
- .global _WarmReset
+ .global _WarmReset
_Reset:
_WarmReset:
- mov.l L_sp,r15
- bra _INIT
- nop
- .align 2
+ mov.l L_sp,r15
+ bra _INIT
+ nop
+ .align 2
L_sp: .long _init_stack + 8000");
asm("saveRegisters:
{
asm("
.align 2
- .global _resume
+ .global _resume
_resume:
mov r4,r1
restoreRegisters:
while (count < BUFMAX - 1)
{
ch = getDebugChar ();
- if (ch == '$')
- goto retry;
+ if (ch == '$')
+ goto retry;
if (ch == '#')
break;
checksum = checksum + ch;
_initialize_symfile_mem ()
{
add_cmd ("add-symbol-file-from-memory", class_files,
- add_symbol_file_from_memory_command,
+ add_symbol_file_from_memory_command,
_("Load the symbols out of memory from a "
"dynamically loaded object file.\n"
"Give an expression for the address "
"of the file's shared object file header."),
- &cmdlist);
+ &cmdlist);
/* Want to know of each new inferior so that its vsyscall info can
be extracted. */
/* Record all sections in offsets. */
/* The section_offsets in the objfile are here filled in using
- the BFD index. */
+ the BFD index. */
section_offsets[osp->sectindex] = osp->addr;
}
}
if (bfd_get_file_flags (objfile->obfd) & EXEC_P)
{
/* Executable file -- record its entry point so we'll recognize
- the startup file because it contains the entry point. */
+ the startup file because it contains the entry point. */
ei->entry_point = bfd_get_start_address (objfile->obfd);
ei->entry_point_p = 1;
}
if (mainline)
{
/* We will modify the main symbol table, make sure that all its users
- will be cleaned up if an error occurs during symbol reading. */
+ will be cleaned up if an error occurs during symbol reading. */
defer_clear_users.emplace ((symfile_add_flag) 0);
/* Since no error yet, throw away the old symbol table. */
}
/* Currently we keep symbols from the add-symbol-file command.
- If the user wants to get rid of them, they should do "symbol-file"
- without arguments first. Not sure this is the best behavior
- (PR 2207). */
+ If the user wants to get rid of them, they should do "symbol-file"
+ without arguments first. Not sure this is the best behavior
+ (PR 2207). */
(*objfile->sf->sym_new_init) (objfile);
}
symbol_file_add_from_bfd (bfd *abfd, const char *name,
symfile_add_flags add_flags,
section_addr_info *addrs,
- objfile_flags flags, struct objfile *parent)
+ objfile_flags flags, struct objfile *parent)
{
return symbol_file_add_with_addrs (abfd, name, add_flags, addrs, flags,
parent);
static void print_transfer_performance (struct ui_file *stream,
unsigned long data_count,
unsigned long write_count,
- std::chrono::steady_clock::duration d);
+ std::chrono::steady_clock::duration d);
/* See symfile.h. */
cbdata.load_offset = strtoulst (argv[1], &endptr, 0);
/* If the last word was not a valid number then
- treat it as a file name with spaces in. */
+ treat it as a file name with spaces in. */
if (argv[1] == endptr)
- error (_("Invalid download offset:%s."), argv[1]);
+ error (_("Invalid download offset:%s."), argv[1]);
if (argv[2] != NULL)
error (_("Too many parameters."));
addr = parse_and_eval_address (val);
/* Here we store the section offsets in the order they were
- entered on the command line. Every array element is
- assigned an ascending section index to preserve the above
- order over an unstable sorting algorithm. This dummy
- index is not used for any other purpose.
+ entered on the command line. Every array element is
+ assigned an ascending section index to preserve the above
+ order over an unstable sorting algorithm. This dummy
+ index is not used for any other purpose.
*/
section_addrs.emplace_back (addr, sec, section_addrs.size ());
printf_filtered ("\t%s_addr = %s\n", sec,
gdb::observers::new_objfile.notify (iter);
/* At least one objfile has changed, so we can consider that
- the executable we're debugging has changed too. */
+ the executable we're debugging has changed too. */
gdb::observers::executable_changed.notify ();
}
}
return 0; /* overlay debugging off */
case ovly_auto: /* overlay debugging automatic */
/* Unles there is a gdbarch_overlay_update function,
- there's really nothing useful to do here (can't really go auto). */
+ there's really nothing useful to do here (can't really go auto). */
gdbarch = osect->objfile->arch ();
if (gdbarch_overlay_update_p (gdbarch))
{
if (! novlys_msym.minsym)
{
error (_("Error reading inferior's overlay table: "
- "couldn't find `_novlys' variable\n"
- "in inferior. Use `overlay manual' mode."));
+ "couldn't find `_novlys' variable\n"
+ "in inferior. Use `overlay manual' mode."));
return 0;
}
if (! ovly_table_msym.minsym)
{
error (_("Error reading inferior's overlay table: couldn't find "
- "`_ovly_table' array\n"
- "in inferior. Use `overlay manual' mode."));
+ "`_ovly_table' array\n"
+ "in inferior. Use `overlay manual' mode."));
return 0;
}
= (unsigned int (*)[4]) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
cache_ovly_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_table_msym);
read_target_long_array (cache_ovly_table_base,
- (unsigned int *) cache_ovly_table,
- cache_novlys * 4, word_size, byte_order);
+ (unsigned int *) cache_ovly_table,
+ cache_novlys * 4, word_size, byte_order);
return 1; /* SUCCESS */
}
bfd_byte *
default_symfile_relocate (struct objfile *objfile, asection *sectp,
- bfd_byte *buf)
+ bfd_byte *buf)
{
/* Use sectp->owner instead of objfile->obfd. sectp may point to a
DWO file. */
bfd_byte *
symfile_relocate_debug_section (struct objfile *objfile,
- asection *sectp, bfd_byte *buf)
+ asection *sectp, bfd_byte *buf)
{
gdb_assert (objfile->sf->sym_relocate);
gdb_assert (0 <= which && which <= data->segments.size ());
/* Don't bother computing offsets for sections that aren't
- loaded as part of any segment. */
+ loaded as part of any segment. */
if (! which)
- continue;
+ continue;
/* Use the last SEGMENT_BASES entry as the address of any extra
- segments mentioned in DATA->segment_info. */
+ segments mentioned in DATA->segment_info. */
if (which > num_segment_bases)
- which = num_segment_bases;
+ which = num_segment_bases;
offsets[i] = segment_bases[which - 1] - data->segments[which - 1].base;
}
Show printing of symbol loading messages."), _("\
off == turn all messages off\n\
brief == print messages for the executable,\n\
- and brief messages for shared libraries\n\
+ and brief messages for shared libraries\n\
full == print messages for the executable,\n\
- and messages for each shared library."),
+ and messages for each shared library."),
NULL,
NULL,
&setprintlist, &showprintlist);
strcmp_iw_ordered(x,y) == 0 --> MATCH(x,y) == 0. ORDERED_COMPARE,
if non-null, must be an ordering relation compatible with
strcmp_iw_ordered in the sense that
- strcmp_iw_ordered(x,y) == 0 --> ORDERED_COMPARE(x,y) == 0
+ strcmp_iw_ordered(x,y) == 0 --> ORDERED_COMPARE(x,y) == 0
and
- strcmp_iw_ordered(x,y) <= 0 --> ORDERED_COMPARE(x,y) <= 0
+ strcmp_iw_ordered(x,y) <= 0 --> ORDERED_COMPARE(x,y) <= 0
(allowing strcmp_iw_ordered(x,y) < 0 while ORDERED_COMPARE(x, y) == 0).
CALLBACK returns true to indicate that the scan should continue, or
false to indicate that the scan should be terminated. */
do anything special. */
extern bfd_byte *default_symfile_relocate (struct objfile *objfile,
- asection *sectp, bfd_byte *buf);
+ asection *sectp, bfd_byte *buf);
extern struct symtab *allocate_symtab (struct compunit_symtab *, const char *)
ATTRIBUTE_NONNULL (1);
extern struct objfile *symbol_file_add_from_bfd (bfd *, const char *, symfile_add_flags,
section_addr_info *,
- objfile_flags, struct objfile *parent);
+ objfile_flags, struct objfile *parent);
extern void symbol_file_add_separate (bfd *, const char *, symfile_add_flags,
struct objfile *);
};
extern int dwarf2_has_info (struct objfile *,
- const struct dwarf2_debug_sections *,
+ const struct dwarf2_debug_sections *,
bool = false);
/* Dwarf2 sections that can be accessed by dwarf2_get_section_info. */
};
extern void dwarf2_get_section_info (struct objfile *,
- enum dwarf2_section_enum,
+ enum dwarf2_section_enum,
asection **, const gdb_byte **,
bfd_size_type *);
printf_filtered (" blockvector"
" ((struct blockvector *) %s)\n",
host_address_to_string
- (COMPUNIT_BLOCKVECTOR (cust)));
+ (COMPUNIT_BLOCKVECTOR (cust)));
printf_filtered (" user"
" ((struct compunit_symtab *) %s)\n",
cust->user != nullptr
else if (physname[0] == 't' || physname[0] == 'Q')
{
/* The physname for template and qualified methods already includes
- the class name. */
+ the class name. */
xsnprintf (buf, sizeof (buf), "__%s%s", const_prefix, volatile_prefix);
newname = NULL;
len = 0;
if (language () == language_ada)
{
/* In Ada, we do the symbol lookups using the mangled name, so
- we can save some space by not storing the demangled name. */
+ we can save some space by not storing the demangled name. */
if (!copy_name)
m_name = linkage_name.data ();
else
if (!hash.has_value ())
hash = hash_demangled_name_entry (&entry);
slot = ((struct demangled_name_entry **)
- htab_find_slot_with_hash (per_bfd->demangled_names_hash.get (),
+ htab_find_slot_with_hash (per_bfd->demangled_names_hash.get (),
&entry, *hash, INSERT));
/* The const_cast is safe because the only reason it is already
|| (language () == language_go && (*slot)->demangled == nullptr))
{
/* A 0-terminated copy of the linkage name. Callers must set COPY_NAME
- to true if the string might not be nullterminated. We have to make
- this copy because demangling needs a nullterminated string. */
+ to true if the string might not be nullterminated. We have to make
+ this copy because demangling needs a nullterminated string. */
gdb::string_view linkage_name_copy;
if (copy_name)
{
return (struct block_symbol) {sym, block};
if (language == language_cplus || language == language_fortran)
- {
- struct block_symbol blocksym
+ {
+ struct block_symbol blocksym
= cp_lookup_symbol_imports_or_template (scope, name, block,
domain);
- if (blocksym.symbol != NULL)
- return blocksym;
- }
+ if (blocksym.symbol != NULL)
+ return blocksym;
+ }
if (BLOCK_FUNCTION (block) != NULL && block_inlined_p (block))
break;
for (objfile *objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result
- = lookup_symbol_in_objfile (objfile, block_index, name, domain);
+ = lookup_symbol_in_objfile (objfile, block_index, name, domain);
if (result.symbol != nullptr)
return result;
fatally. */
if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc)
internal_error (__FILE__, __LINE__,
- _("Infinite recursion detected in find_pc_sect_line;"
+ _("Infinite recursion detected in find_pc_sect_line;"
"please file a bug report"));
return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0);
item = l->item; /* Get first line info. */
/* Is this file's first line closer than the first lines of other files?
- If so, record this file, and its first line, as best alternate. */
+ If so, record this file, and its first line, as best alternate. */
if (item->pc > pc && (!alt || item->pc < alt->pc))
alt = item;
prev = item - 1; /* Found a matching item. */
/* At this point, prev points at the line whose start addr is <= pc, and
- item points at the next line. If we ran off the end of the linetable
- (pc >= start of the last line), then prev == item. If pc < start of
- the first line, prev will not be set. */
+ item points at the next line. If we ran off the end of the linetable
+ (pc >= start of the last line), then prev == item. If pc < start of
+ the first line, prev will not be set. */
/* Is this file's best line closer than the best in the other files?
- If so, record this file, and its best line, as best so far. Don't
- save prev if it represents the end of a function (i.e. line number
- 0) instead of a real line. */
+ If so, record this file, and its best line, as best so far. Don't
+ save prev if it represents the end of a function (i.e. line number
+ 0) instead of a real line. */
if (prev && prev->line && (!best || prev->pc > best->pc))
{
if (best_index < 0 || !exact)
{
/* Didn't find an exact match. So we better keep looking for
- another symtab with the same name. In the case of xcoff,
- multiple csects for one source file (produced by IBM's FORTRAN
- compiler) produce multiple symtabs (this is unavoidable
- assuming csects can be at arbitrary places in memory and that
- the GLOBAL_BLOCK of a symtab has a begin and end address). */
+ another symtab with the same name. In the case of xcoff,
+ multiple csects for one source file (produced by IBM's FORTRAN
+ compiler) produce multiple symtabs (this is unavoidable
+ assuming csects can be at arbitrary places in memory and that
+ the GLOBAL_BLOCK of a symtab has a begin and end address). */
/* BEST is the smallest linenumber > LINE so far seen,
- or 0 if none has been seen so far.
- BEST_INDEX and BEST_LINETABLE identify the item for it. */
+ or 0 if none has been seen so far.
+ BEST_INDEX and BEST_LINETABLE identify the item for it. */
int best;
if (best_index >= 0)
else
{
struct bound_minimal_symbol msymbol
- = lookup_minimal_symbol_by_pc_section (sal->pc, sal->section);
+ = lookup_minimal_symbol_by_pc_section (sal->pc, sal->section);
if (msymbol.minsym == NULL)
return;
/* Skip "first line" of function (which is actually its prologue). */
pc += gdbarch_deprecated_function_start_offset (gdbarch);
if (gdbarch_skip_entrypoint_p (gdbarch))
- pc = gdbarch_skip_entrypoint (gdbarch, pc);
+ pc = gdbarch_skip_entrypoint (gdbarch, pc);
if (skip)
pc = gdbarch_skip_prologue_noexcept (gdbarch, pc);
const char *symbol_name_regexp = m_symbol_name_regexp;
/* Make sure spacing is right for C++ operators.
- This is just a courtesy to make the matching less sensitive
- to how many spaces the user leaves between 'operator'
- and <TYPENAME> or <OPERATOR>. */
+ This is just a courtesy to make the matching less sensitive
+ to how many spaces the user leaves between 'operator'
+ and <TYPENAME> or <OPERATOR>. */
const char *opend;
const char *opname = operator_chars (symbol_name_regexp, &opend);
if (*opname)
{
int fix = -1; /* -1 means ok; otherwise number of
- spaces needed. */
+ spaces needed. */
if (isalpha (*opname) || *opname == '_' || *opname == '$')
{
quote_found = '\0';
else if (*p == '\\' && p[1] == quote_found)
/* A backslash followed by the quote character
- doesn't end the string. */
+ doesn't end the string. */
++p;
}
else if (*p == '\'' || *p == '"')
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. */
+ to complete it any other way. */
{
return;
}
quote_found = '\0';
else if (*p == '\\' && p[1] == quote_found)
/* A backslash followed by the quote character
- doesn't end the string. */
+ doesn't end the string. */
++p;
}
else if (*p == '\'' || *p == '"')
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. */
+ to complete it any other way. */
{
return;
}
_("Set a breakpoint for all functions matching REGEXP."));
add_setshow_enum_cmd ("multiple-symbols", no_class,
- multiple_symbols_modes, &multiple_symbols_mode,
- _("\
+ multiple_symbols_modes, &multiple_symbols_mode,
+ _("\
Set how the debugger handles ambiguities in expressions."), _("\
Show how the debugger handles ambiguities in expressions."), _("\
Valid values are \"ask\", \"all\", \"cancel\", and the default is \"all\"."),
- NULL, NULL, &setlist, &showlist);
+ NULL, NULL, &setlist, &showlist);
add_setshow_boolean_cmd ("basenames-may-differ", class_obscure,
&basenames_may_differ, _("\
void compute_and_set_names (gdb::string_view linkage_name, bool copy_name,
struct objfile_per_bfd_storage *per_bfd,
gdb::optional<hashval_t> hash
- = gdb::optional<hashval_t> ());
+ = gdb::optional<hashval_t> ());
/* Name of the symbol. This is a required field. Storage for the
name is allocated on the objfile_obstack for the associated
subclass (SYMBOL_NONE)
{
/* We can't use an initializer list for members of a base class, and
- general_symbol_info needs to stay a POD type. */
+ general_symbol_info needs to stay a POD type. */
m_name = nullptr;
value.ivalue = 0;
language_specific.obstack = nullptr;
ada_mangled = 0;
section = -1;
/* GCC 4.8.5 (on CentOS 7) does not correctly compile class-
- initialization of unions, so we initialize it manually here. */
+ initialization of unions, so we initialize it manually here. */
owner.symtab = nullptr;
}
This is recorded as:
objfile -> foo.c(cu) -> bar.c(cu) -> NULL
- | |
- v v
- foo.c bar.c
- | |
- v v
- foo1.h foo1.h
- | |
- v v
- foo2.h bar.h
- | |
- v v
- NULL NULL
+ | |
+ v v
+ foo.c bar.c
+ | |
+ v v
+ foo1.h foo1.h
+ | |
+ v v
+ foo2.h bar.h
+ | |
+ v v
+ NULL NULL
where "foo.c(cu)" and "bar.c(cu)" are struct compunit_symtab objects,
and the files foo.c, etc. are struct symtab objects. */
private:
/* The kind of symbols are we searching for.
VARIABLES_DOMAIN - Search all symbols, excluding functions, type
- names, and constants (enums).
+ names, and constants (enums).
FUNCTIONS_DOMAIN - Search all functions..
TYPES_DOMAIN - Search all type names.
MODULES_DOMAIN - Search all Fortran modules.
int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT);
cur_byte = (total_len / FLOATFORMAT_CHAR_BIT)
- - ((start + len + excess) / FLOATFORMAT_CHAR_BIT);
+ - ((start + len + excess) / FLOATFORMAT_CHAR_BIT);
cur_bitshift = ((start + len + excess) % FLOATFORMAT_CHAR_BIT)
- - FLOATFORMAT_CHAR_BIT;
+ - FLOATFORMAT_CHAR_BIT;
}
else
{
int excess = FLOATFORMAT_CHAR_BIT - (total_len % FLOATFORMAT_CHAR_BIT);
cur_byte = (total_len / FLOATFORMAT_CHAR_BIT)
- - ((start + len + excess) / FLOATFORMAT_CHAR_BIT);
+ - ((start + len + excess) / FLOATFORMAT_CHAR_BIT);
cur_bitshift = ((start + len + excess) % FLOATFORMAT_CHAR_BIT)
- - FLOATFORMAT_CHAR_BIT;
+ - FLOATFORMAT_CHAR_BIT;
}
else
{
floating-point number of format FMT. */
static std::string
floatformat_printf_format (const struct floatformat *fmt,
- const char *format, char length)
+ const char *format, char length)
{
std::string host_format;
char conversion;
else
{
/* Use the specified format, stripping out the conversion character
- and length modifier, if present. */
+ and length modifier, if present. */
size_t len = strlen (format);
gdb_assert (len > 1);
conversion = format[--len];
mant -= mant_long;
/* If the integer bit is implicit, then we need to discard it.
- If we are discarding a zero, we should be (but are not) creating
- a denormalized number which means adjusting the exponent
- (I think). */
+ If we are discarding a zero, we should be (but are not) creating
+ a denormalized number which means adjusting the exponent
+ (I think). */
if (mant_bits_left == fmt->man_len
&& fmt->intbit == floatformat_intbit_no)
{
mant_long <<= 1;
mant_long &= 0xffffffffL;
- /* If we are processing the top 32 mantissa bits of a doublest
- so as to convert to a float value with implied integer bit,
- we will only be putting 31 of those 32 bits into the
- final value due to the discarding of the top bit. In the
- case of a small float value where the number of mantissa
- bits is less than 32, discarding the top bit does not alter
- the number of bits we will be adding to the result. */
- if (mant_bits == 32)
- mant_bits -= 1;
+ /* If we are processing the top 32 mantissa bits of a doublest
+ so as to convert to a float value with implied integer bit,
+ we will only be putting 31 of those 32 bits into the
+ final value due to the discarding of the top bit. In the
+ case of a small float value where the number of mantissa
+ bits is less than 32, discarding the top bit does not alter
+ the number of bits we will be adding to the result. */
+ if (mant_bits == 32)
+ mant_bits -= 1;
}
if (mant_bits < 32)
mpfr_sub_ui (tmp.val, tmp.val, mant_long, MPFR_RNDZ);
/* If the integer bit is implicit, then we need to discard it.
- If we are discarding a zero, we should be (but are not) creating
- a denormalized number which means adjusting the exponent
- (I think). */
+ If we are discarding a zero, we should be (but are not) creating
+ a denormalized number which means adjusting the exponent
+ (I think). */
if (mant_bits_left == fmt->man_len
&& fmt->intbit == floatformat_intbit_no)
{
mant_long <<= 1;
mant_long &= 0xffffffffL;
- /* If we are processing the top 32 mantissa bits of a doublest
- so as to convert to a float value with implied integer bit,
- we will only be putting 31 of those 32 bits into the
- final value due to the discarding of the top bit. In the
- case of a small float value where the number of mantissa
- bits is less than 32, discarding the top bit does not alter
- the number of bits we will be adding to the result. */
- if (mant_bits == 32)
- mant_bits -= 1;
+ /* If we are processing the top 32 mantissa bits of a doublest
+ so as to convert to a float value with implied integer bit,
+ we will only be putting 31 of those 32 bits into the
+ final value due to the discarding of the top bit. In the
+ case of a small float value where the number of mantissa
+ bits is less than 32, discarding the top bit does not alter
+ the number of bits we will be adding to the result. */
+ if (mant_bits == 32)
+ mant_bits -= 1;
}
if (mant_bits < 32)
for computation to each size of decimal float. */
static void
decimal_from_number (const decNumber *from,
- gdb_byte *to, const struct type *type)
+ gdb_byte *to, const struct type *type)
{
gdb_byte dec[16];
appropriate representation for computation. */
static void
decimal_to_number (const gdb_byte *addr, const struct type *type,
- decNumber *to)
+ decNumber *to)
{
gdb_byte dec[16];
match_endianness (addr, type, dec);
/* Converts a decimal float of LEN bytes to a LONGEST. */
LONGEST
decimal_float_ops::to_longest (const gdb_byte *addr,
- const struct type *type) const
+ const struct type *type) const
{
/* libdecnumber has a function to convert from decimal to integer, but
it doesn't work when the decimal number has a fractional part. */
switch (type->code ())
{
case TYPE_CODE_FLT:
- {
+ {
const struct floatformat *fmt = floatformat_from_type (type);
/* Binary floating-point formats matching a host format. */
/* If the type format matches one of the host floating-point
types, use that type as intermediate format. */
case target_float_ops_kind::host_float:
- {
+ {
static host_float_ops<float> host_float_ops_float;
return &host_float_ops_float;
}
case target_float_ops_kind::host_double:
- {
+ {
static host_float_ops<double> host_float_ops_double;
return &host_float_ops_double;
}
case target_float_ops_kind::host_long_double:
- {
+ {
static host_float_ops<long double> host_float_ops_long_double;
return &host_float_ops_long_double;
}
/* For binary floating-point formats that do not match any host format,
- use mpfr_t as intermediate format to provide precise target-floating
- point emulation. However, if the MPFR library is not available,
- use the largest host floating-point type as intermediate format. */
+ use mpfr_t as intermediate format to provide precise target-floating
+ point emulation. However, if the MPFR library is not available,
+ use the largest host floating-point type as intermediate format. */
case target_float_ops_kind::binary:
- {
+ {
#ifdef HAVE_LIBMPFR
static mpfr_float_ops binary_float_ops;
#else
/* Fetch the load module address for this objfile. */
lm_addr = gdbarch_fetch_tls_load_module_address (gdbarch,
- objfile);
+ objfile);
if (gdbarch_get_thread_local_address_p (gdbarch))
addr = gdbarch_get_thread_local_address (gdbarch, ptid, lm_addr,
addr = target->get_thread_local_address (ptid, lm_addr, offset);
}
/* If an error occurred, print TLS related messages here. Otherwise,
- throw the error to some higher catcher. */
+ throw the error to some higher catcher. */
catch (const gdb_exception &ex)
{
int objfile_is_library = (objfile->flags & OBJF_SHARED);
case TLS_LOAD_MODULE_NOT_FOUND_ERROR:
if (objfile_is_library)
error (_("Cannot find shared library `%s' in dynamic"
- " linker's load module list"), objfile_name (objfile));
+ " linker's load module list"), objfile_name (objfile));
else
error (_("Cannot find executable file `%s' in dynamic"
- " linker's load module list"), objfile_name (objfile));
+ " linker's load module list"), objfile_name (objfile));
break;
case TLS_NOT_ALLOCATED_YET_ERROR:
if (objfile_is_library)
error (_("The inferior has not yet allocated storage for"
- " thread-local variables in\n"
- "the shared library `%s'\n"
- "for %s"),
+ " thread-local variables in\n"
+ "the shared library `%s'\n"
+ "for %s"),
objfile_name (objfile),
target_pid_to_str (ptid).c_str ());
else
error (_("The inferior has not yet allocated storage for"
- " thread-local variables in\n"
- "the executable `%s'\n"
- "for %s"),
+ " thread-local variables in\n"
+ "the executable `%s'\n"
+ "for %s"),
objfile_name (objfile),
target_pid_to_str (ptid).c_str ());
break;
case TLS_GENERIC_ERROR:
if (objfile_is_library)
error (_("Cannot find thread-local storage for %s, "
- "shared library %s:\n%s"),
+ "shared library %s:\n%s"),
target_pid_to_str (ptid).c_str (),
objfile_name (objfile), ex.what ());
else
error (_("Cannot find thread-local storage for %s, "
- "executable file %s:\n%s"),
+ "executable file %s:\n%s"),
target_pid_to_str (ptid).c_str (),
objfile_name (objfile), ex.what ());
break;
break;
/* Don't continue past targets which have all the memory.
- At one time, this code was necessary to read data from
+ At one time, this code was necessary to read data from
executables / shared libraries when data for the requested
addresses weren't available in the core file. But now the
core target handles this case itself. */
{
/* Is this a flash memory region? */
if (m.attrib.mode == MEM_FLASH)
- {
- found_flash_region = true;
- target_flash_erase (m.lo, m.hi - m.lo);
+ {
+ found_flash_region = true;
+ target_flash_erase (m.lo, m.hi - m.lo);
ui_out_emit_tuple tuple_emitter (current_uiout, "erased-regions");
- current_uiout->message (_("Erasing flash memory region at address "));
- current_uiout->field_core_addr ("address", gdbarch, m.lo);
- current_uiout->message (", size = ");
- current_uiout->field_string ("size", hex_string (m.hi - m.lo));
- current_uiout->message ("\n");
- }
+ current_uiout->message (_("Erasing flash memory region at address "));
+ current_uiout->field_core_addr ("address", gdbarch, m.lo);
+ current_uiout->message (", size = ");
+ current_uiout->field_string ("size", hex_string (m.hi - m.lo));
+ current_uiout->message ("\n");
+ }
}
/* Did we do any flash operations? If so, we need to finalize them. */
_("Send a command to the remote monitor (remote targets only)."));
add_cmd ("target-stack", class_maintenance, maintenance_print_target_stack,
- _("Print the name of each layer of the internal target stack."),
- &maintenanceprintlist);
+ _("Print the name of each layer of the internal target stack."),
+ &maintenanceprintlist);
add_setshow_boolean_cmd ("target-async", no_class,
&target_async_permitted_1, _("\
&setlist, &showlist);
add_com ("flash-erase", no_class, flash_erase_command,
- _("Erase all flash memory regions."));
+ _("Erase all flash memory regions."));
add_setshow_boolean_cmd ("auto-connect-native-target", class_support,
&auto_connect_native_target, _("\
/* Main entry point for searching memory. */
extern int target_search_memory (CORE_ADDR start_addr,
- ULONGEST search_space_len,
- const gdb_byte *pattern,
- ULONGEST pattern_len,
- CORE_ADDR *found_addrp);
+ ULONGEST search_space_len,
+ const gdb_byte *pattern,
+ ULONGEST pattern_len,
+ CORE_ADDR *found_addrp);
/* Target file operations. */
val = value_contents (arg);
/* Copy the argument to general registers or the stack in
- register-sized pieces. */
+ register-sized pieces. */
if (argreg < first_arg_on_stack)
{
if (len <= 4)
|| typecode == TYPE_CODE_UNION)
{
/* For a 5-8 byte structure or union in big-endian, the
- first byte occupies byte 3 (the MSB) of the upper (odd)
- register and the remaining bytes fill the decreasingly
- significant bytes. 5-7 byte structures or unions have
- padding in the LSBs of the lower (even) register. */
+ first byte occupies byte 3 (the MSB) of the upper (odd)
+ register and the remaining bytes fill the decreasingly
+ significant bytes. 5-7 byte structures or unions have
+ padding in the LSBs of the lower (even) register. */
if (byte_order == BFD_ENDIAN_BIG)
{
regcache->cooked_write (arg_regs[argreg] + 1, val);
else
{
/* The argument is being passed by value in a pair of
- registers. */
+ registers. */
ULONGEST regval = extract_unsigned_integer (val, len,
byte_order);
/* Base address of register save area. */
CORE_ADDR base = sp
- + 16 /* Skip ABI_SAVE_AREA. */
- + 128 /* Skip SIGINFO. */
- + 40; /* Skip UCONTEXT. */
+ + 16 /* Skip ABI_SAVE_AREA. */
+ + 128 /* Skip SIGINFO. */
+ + 40; /* Skip UCONTEXT. */
/* Address of saved LR register (R56) which holds previous PC. */
CORE_ADDR prev_pc = base + 56 * 8;
trad_frame_set_reg_addr (this_cache, i, base + i * 8);
trad_frame_set_reg_value (this_cache, 64,
- get_frame_memory_unsigned (this_frame, prev_pc, 8));
+ get_frame_memory_unsigned (this_frame, prev_pc, 8));
/* Save a frame ID. */
trad_frame_set_id (this_cache, frame_id_build (base, func));
if (find_pc_partial_function (start_pc, NULL, &func_start, NULL))
{
CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_start);
+ = skip_prologue_using_sal (gdbarch, func_start);
if (post_prologue_pc != 0)
- return std::max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
/* Don't straddle a section boundary. */
within GDB. In all other cases the system call will not be
restarted. */
regcache_cooked_write_unsigned (regcache, TILEGX_FAULTNUM_REGNUM,
- INT_SWINT_1_SIGRETURN);
+ INT_SWINT_1_SIGRETURN);
}
/* 64-bit pattern for a { bpt ; nop } bundle. */
if (regno >= 0 && regno < TILEGX_NUM_EASY_REGS)
return 0;
else if (regno == TILEGX_PC_REGNUM
- || regno == TILEGX_FAULTNUM_REGNUM)
+ || regno == TILEGX_FAULTNUM_REGNUM)
return 0;
else
return 1;
}
/* FIXME: cagney/2002-02-02: The c->type test is pretty dodgy
- while the is_complete_command(cfunc) test is just plain
- bogus. They should both be replaced by a test of the form
- c->strip_trailing_white_space_p. */
+ while the is_complete_command(cfunc) test is just plain
+ bogus. They should both be replaced by a test of the form
+ c->strip_trailing_white_space_p. */
/* NOTE: cagney/2002-02-02: The function.cfunc in the below
- can't be replaced with func. This is because it is the
- cfunc, and not the func, that has the value that the
- is_complete_command hack is testing for. */
+ can't be replaced with func. This is because it is the
+ cfunc, and not the func, that has the value that the
+ is_complete_command hack is testing for. */
/* Clear off trailing whitespace, except for set and complete
- command. */
+ command. */
std::string without_whitespace;
if (arg
&& c->type != set_cmd
if (prompt != NULL)
{
/* Don't use a _filtered function here. It causes the assumed
- character position to be off, since the newline we read from
- the user is not accounted for. */
+ character position to be off, since the newline we read from
+ the user is not accounted for. */
fputs_unfiltered (prompt, gdb_stdout);
gdb_flush (gdb_stdout);
}
ret = rename (local_history_filename.c_str (), history_filename);
saved_errno = errno;
if (ret < 0 && saved_errno != EEXIST)
- warning (_("Could not rename %s to %s: %s"),
+ warning (_("Could not rename %s to %s: %s"),
local_history_filename.c_str (), history_filename,
safe_strerror (saved_errno));
}
gdb::unique_xmalloc_ptr<char> rl;
/* Make sure that all output has been output. Some machines may
- let you get away with leaving out some of the gdb_flush, but
- not all. */
+ let you get away with leaving out some of the gdb_flush, but
+ not all. */
wrap_here ("");
gdb_flush (gdb_stdout);
gdb_flush (gdb_stderr);
"), host_name, target_name);
fprintf_filtered (stream, _("\
- --with-auto-load-dir=%s\n\
- --with-auto-load-safe-path=%s\n\
+ --with-auto-load-dir=%s\n\
+ --with-auto-load-safe-path=%s\n\
"), AUTO_LOAD_DIR, AUTO_LOAD_SAFE_PATH);
#if HAVE_LIBEXPAT
fprintf_filtered (stream, _("\
- --with-expat\n\
+ --with-expat\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-expat\n\
+ --without-expat\n\
"));
#endif
if (GDB_DATADIR[0])
fprintf_filtered (stream, _("\
- --with-gdb-datadir=%s%s\n\
+ --with-gdb-datadir=%s%s\n\
"), GDB_DATADIR, GDB_DATADIR_RELOCATABLE ? " (relocatable)" : "");
#ifdef ICONV_BIN
fprintf_filtered (stream, _("\
- --with-iconv-bin=%s%s\n\
+ --with-iconv-bin=%s%s\n\
"), ICONV_BIN, ICONV_BIN_RELOCATABLE ? " (relocatable)" : "");
#endif
if (JIT_READER_DIR[0])
fprintf_filtered (stream, _("\
- --with-jit-reader-dir=%s%s\n\
+ --with-jit-reader-dir=%s%s\n\
"), JIT_READER_DIR, JIT_READER_DIR_RELOCATABLE ? " (relocatable)" : "");
#if HAVE_LIBUNWIND_IA64_H
fprintf_filtered (stream, _("\
- --with-libunwind-ia64\n\
+ --with-libunwind-ia64\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-libunwind-ia64\n\
+ --without-libunwind-ia64\n\
"));
#endif
#if HAVE_LIBLZMA
fprintf_filtered (stream, _("\
- --with-lzma\n\
+ --with-lzma\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-lzma\n\
+ --without-lzma\n\
"));
#endif
#if HAVE_LIBBABELTRACE
fprintf_filtered (stream, _("\
- --with-babeltrace\n\
+ --with-babeltrace\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-babeltrace\n\
+ --without-babeltrace\n\
"));
#endif
#if HAVE_LIBIPT
fprintf_filtered (stream, _("\
- --with-intel-pt\n\
+ --with-intel-pt\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-intel-pt\n\
+ --without-intel-pt\n\
"));
#endif
#if HAVE_LIBMPFR
fprintf_filtered (stream, _("\
- --with-mpfr\n\
+ --with-mpfr\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-mpfr\n\
+ --without-mpfr\n\
"));
#endif
#if HAVE_LIBXXHASH
fprintf_filtered (stream, _("\
- --with-xxhash\n\
+ --with-xxhash\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-xxhash\n\
+ --without-xxhash\n\
"));
#endif
#ifdef WITH_PYTHON_PATH
fprintf_filtered (stream, _("\
- --with-python=%s%s\n\
+ --with-python=%s%s\n\
"), WITH_PYTHON_PATH, PYTHON_PATH_RELOCATABLE ? " (relocatable)" : "");
#else
fprintf_filtered (stream, _("\
- --without-python\n\
+ --without-python\n\
"));
#endif
#ifdef WITH_PYTHON_LIBDIR
fprintf_filtered (stream, _("\
- --with-python-libdir=%s%s\n\
+ --with-python-libdir=%s%s\n\
"), WITH_PYTHON_LIBDIR, PYTHON_LIBDIR_RELOCATABLE ? " (relocatable)" : "");
#else
fprintf_filtered (stream, _("\
- --without-python-libdir\n\
+ --without-python-libdir\n\
"));
#endif
#if HAVE_LIBDEBUGINFOD
fprintf_filtered (stream, _("\
- --with-debuginfod\n\
+ --with-debuginfod\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-debuginfod\n\
+ --without-debuginfod\n\
"));
#endif
#if HAVE_GUILE
fprintf_filtered (stream, _("\
- --with-guile\n\
+ --with-guile\n\
"));
#else
fprintf_filtered (stream, _("\
- --without-guile\n\
+ --without-guile\n\
"));
#endif
#if HAVE_SOURCE_HIGHLIGHT
fprintf_filtered (stream, _("\
- --enable-source-highlight\n\
+ --enable-source-highlight\n\
"));
#else
fprintf_filtered (stream, _("\
- --disable-source-highlight\n\
+ --disable-source-highlight\n\
"));
#endif
#ifdef RELOC_SRCDIR
fprintf_filtered (stream, _("\
- --with-relocated-sources=%s\n\
+ --with-relocated-sources=%s\n\
"), RELOC_SRCDIR);
#endif
if (DEBUGDIR[0])
fprintf_filtered (stream, _("\
- --with-separate-debug-dir=%s%s\n\
+ --with-separate-debug-dir=%s%s\n\
"), DEBUGDIR, DEBUGDIR_RELOCATABLE ? " (relocatable)" : "");
if (TARGET_SYSTEM_ROOT[0])
fprintf_filtered (stream, _("\
- --with-sysroot=%s%s\n\
+ --with-sysroot=%s%s\n\
"), TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_RELOCATABLE ? " (relocatable)" : "");
if (SYSTEM_GDBINIT[0])
fprintf_filtered (stream, _("\
- --with-system-gdbinit=%s%s\n\
+ --with-system-gdbinit=%s%s\n\
"), SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE ? " (relocatable)" : "");
if (SYSTEM_GDBINIT_DIR[0])
fprintf_filtered (stream, _("\
- --with-system-gdbinit-dir=%s%s\n\
+ --with-system-gdbinit-dir=%s%s\n\
"), SYSTEM_GDBINIT_DIR, SYSTEM_GDBINIT_DIR_RELOCATABLE ? " (relocatable)" : "");
/* We assume "relocatable" will be printed at least once, thus we always
static void
show_interactive_mode (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c,
+ const char *value)
{
if (interactive_mode == AUTO_BOOLEAN_AUTO)
fprintf_filtered (file, "Debugger's interactive mode "
- "is %s (currently %s).\n",
- value, input_interactive_p (current_ui) ? "on" : "off");
+ "is %s (currently %s).\n",
+ value, input_interactive_p (current_ui) ? "on" : "off");
else
fprintf_filtered (file, "Debugger's interactive mode is %s.\n", value);
}
else if (history_filename == nullptr)
{
/* We include the current directory so that if the user changes
- directories the file written will be the same as the one
- that was read. */
+ directories the file written will be the same as the one
+ that was read. */
#ifdef __MSDOS__
/* No leading dots in file names are allowed on MSDOS. */
const char *fname = "_gdb_history";
&setlist, &showlist);
add_setshow_filename_cmd ("data-directory", class_maintenance,
- &staged_gdb_datadir, _("Set GDB's data directory."),
- _("Show GDB's data directory."),
- _("\
+ &staged_gdb_datadir, _("Set GDB's data directory."),
+ _("Show GDB's data directory."),
+ _("\
When set, GDB uses the specified path to search for data files."),
- set_gdb_datadir, show_gdb_datadir,
- &setlist,
- &showlist);
+ set_gdb_datadir, show_gdb_datadir,
+ &setlist,
+ &showlist);
add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
- &interactive_mode, _("\
+ &interactive_mode, _("\
Set whether GDB's standard input is a terminal."), _("\
Show whether GDB's standard input is a terminal."), _("\
If on, GDB assumes that standard input is a terminal. In practice, it\n\
input is not a terminal, and uses the default answer to all queries.\n\
If auto (the default), determine which mode to use based on the standard\n\
input settings."),
- NULL,
- show_interactive_mode,
- &setlist, &showlist);
+ NULL,
+ show_interactive_mode,
+ &setlist, &showlist);
c = add_cmd ("new-ui", class_support, new_ui_command, _("\
Create a new UI.\n\
if (num == -1)
{
if (tpp)
- *tpp = -1;
+ *tpp = -1;
return -1;
}
break;
tfile_read ((gdb_byte *) &data_size, 4);
data_size = (unsigned int) extract_unsigned_integer
- ((gdb_byte *) &data_size, 4,
+ ((gdb_byte *) &data_size, 4,
gdbarch_byte_order (target_gdbarch ()));
offset += 4;
case 'M':
lseek (trace_fd, cur_offset + pos + 8, SEEK_SET);
tfile_read ((gdb_byte *) &mlen, 2);
- mlen = (unsigned short)
- extract_unsigned_integer ((gdb_byte *) &mlen, 2,
- gdbarch_byte_order
- (target_gdbarch ()));
+ mlen = (unsigned short)
+ extract_unsigned_integer ((gdb_byte *) &mlen, 2,
+ gdbarch_byte_order
+ (target_gdbarch ()));
lseek (trace_fd, mlen, SEEK_CUR);
pos += (8 + 2 + mlen);
break;
amt = len;
if (maddr != offset)
- lseek (trace_fd, offset - maddr, SEEK_CUR);
+ lseek (trace_fd, offset - maddr, SEEK_CUR);
tfile_read (readbuf, amt);
*xfered_len = amt;
return TARGET_XFER_OK;
}
{
- bfd_signed_vma length
+ bfd_signed_vma length
= m_memranges[i].end - m_memranges[i].start;
- /* The "%X" conversion specifier expects an unsigned argument,
- so passing -1 (memrange_absolute) to it directly gives you
- "FFFFFFFF" (or more, depending on sizeof (unsigned)).
- Special-case it. */
- if (m_memranges[i].type == memrange_absolute)
- sprintf (end, "M-1,%s,%lX", phex_nz (m_memranges[i].start, 0),
+ /* The "%X" conversion specifier expects an unsigned argument,
+ so passing -1 (memrange_absolute) to it directly gives you
+ "FFFFFFFF" (or more, depending on sizeof (unsigned)).
+ Special-case it. */
+ if (m_memranges[i].type == memrange_absolute)
+ sprintf (end, "M-1,%s,%lX", phex_nz (m_memranges[i].start, 0),
(long) length);
- else
- sprintf (end, "M%X,%s,%lX", m_memranges[i].type,
+ else
+ sprintf (end, "M%X,%s,%lX", m_memranges[i].type,
phex_nz (m_memranges[i].start, 0), (long) length);
}
enum print_what print_what;
/* NOTE: in imitation of the step command, try to determine
- whether we have made a transition from one function to
- another. If so, we'll print the "stack frame" (ie. the new
- function and it's arguments) -- otherwise we'll just show the
- new source line. */
+ whether we have made a transition from one function to
+ another. If so, we'll print the "stack frame" (ie. the new
+ function and it's arguments) -- otherwise we'll just show the
+ new source line. */
if (frame_id_eq (old_frame_id,
get_frame_id (get_current_frame ())))
{ /* 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, "-"))
action_exp = skip_spaces (action_exp);
/* The collection actions to be done while stepping are
- bracketed by the commands "while-stepping" and "end". */
+ bracketed by the commands "while-stepping" and "end". */
if (*action_exp == '#') /* comment line */
continue;
}
/* Scan forward disassembling one instruction at a time until
- the last visible instruction of the window matches the pc.
- We keep the disassembled instructions in the 'lines' window
- and shift it downward (increasing its addresses). */
+ the last visible instruction of the window matches the pc.
+ We keep the disassembled instructions in the 'lines' window
+ and shift it downward (increasing its addresses). */
int pos = max_lines - 1;
if (last_addr < pc)
- do
- {
- pos++;
- if (pos >= max_lines)
- pos = 0;
+ do
+ {
+ pos++;
+ if (pos >= max_lines)
+ pos = 0;
CORE_ADDR old_next_addr = next_addr;
std::vector<tui_asm_line> single_asm_line;
next_addr = tui_disassemble (gdbarch, single_asm_line,
next_addr, 1);
- /* If there are some problems while disassembling exit. */
+ /* If there are some problems while disassembling exit. */
if (next_addr <= old_next_addr)
return pc;
gdb_assert (single_asm_line.size () == 1);
} while (next_addr <= pc);
pos++;
if (pos >= max_lines)
- pos = 0;
+ pos = 0;
new_low = asm_lines[pos].addr;
/* When scrolling backward the addresses should move backward, or at
if (in == rl_point)
{
- getyx (w, c_line, c_pos);
+ getyx (w, c_line, c_pos);
}
if (in == rl_end)
- break;
+ break;
c = (unsigned char) rl_line_buffer[in];
if (CTRL_CHAR (c) || c == RUBOUT)
{
- waddch (w, '^');
- waddch (w, CTRL_CHAR (c) ? UNCTRL (c) : '?');
+ waddch (w, '^');
+ waddch (w, CTRL_CHAR (c) ? UNCTRL (c) : '?');
}
else if (c == '\t')
{
}
else
{
- waddch (w, c);
+ waddch (w, c);
}
if (c == '\n')
TUI_CMD_WIN->start_line = getcury (w);
col = getcurx (w);
if (col < prev_col)
- height++;
+ height++;
prev_col = col;
}
wclrtobot (w);
if (tui_active)
{
/* Restore the terminal setting because another process (shell)
- might have changed it. */
+ might have changed it. */
resetty ();
/* Force a refresh of the screen. */
break;
default:
/* We didn't recognize the character as a control character, so pass it
- through. */
+ through. */
return ch;
}
if (ch == '\n' || ch == '\r')
{
/* When hitting return with an empty input, gdb executes the last
- command. If we emit a newline, this fills up the command window
- with empty lines with gdb prompt at beginning. Instead of that,
- stay on the same line but provide a visual effect to show the
- user we recognized the command. */
+ command. If we emit a newline, this fills up the command window
+ with empty lines with gdb prompt at beginning. Instead of that,
+ stay on the same line but provide a visual effect to show the
+ user we recognized the command. */
if (rl_end == 0 && !gdb_in_secondary_prompt_p (current_ui))
- {
+ {
wmove (w, getcury (w), 0);
- /* Clear the line. This will blink the gdb prompt since
- it will be redrawn at the same line. */
- wclrtoeol (w);
- wrefresh (w);
- napms (20);
- }
+ /* Clear the line. This will blink the gdb prompt since
+ it will be redrawn at the same line. */
+ wclrtoeol (w);
+ wrefresh (w);
+ napms (20);
+ }
else
- {
+ {
/* Move cursor to the end of the command line before emitting the
newline. We need to do so because when ncurses outputs a newline
it truncates any text that appears past the end of the cursor. */
px %= TUI_CMD_WIN->width;
wmove (w, py, px);
tui_putc ('\n');
- }
+ }
}
/* Handle prev/next/up/down here. */
changed with respect to the previous call. */
static void
tui_get_register (struct frame_info *frame,
- struct tui_data_item_window *data,
+ struct tui_data_item_window *data,
int regnum, bool *changedp)
{
if (changedp)
first_line = line_from_reg_element_no (first_element_no);
else
{ /* Calculate the first line from the element number which is in
- the general data content. */
+ the general data content. */
}
if (first_line >= 0)
{
group = reggroup_next (gdbarch, current_group);
if (group == NULL)
- group = reggroup_next (gdbarch, NULL);
+ group = reggroup_next (gdbarch, NULL);
}
return group;
}
The +1 are for a space separator between fields.
The -1 are to take into account the \0 counted by sizeof. */
proc_width = (status_size
- - (target_width + 1)
- - (pid_width + 1)
- - (sizeof (PROC_PREFIX) - 1 + 1)
- - (sizeof (LINE_PREFIX) - 1 + line_width + 1)
- - (sizeof (PC_PREFIX) - 1 + pc_width + 1)
- - (tui_current_key_mode == TUI_SINGLE_KEY_MODE
- ? (sizeof (SINGLE_KEY) - 1 + 1)
- : 0));
+ - (target_width + 1)
+ - (pid_width + 1)
+ - (sizeof (PROC_PREFIX) - 1 + 1)
+ - (sizeof (LINE_PREFIX) - 1 + line_width + 1)
+ - (sizeof (PC_PREFIX) - 1 + pc_width + 1)
+ - (tui_current_key_mode == TUI_SINGLE_KEY_MODE
+ ? (sizeof (SINGLE_KEY) - 1 + 1)
+ : 0));
/* If there is no room to print the function name, try by removing
some fields. */
proc_width += target_width + 1;
target_width = 0;
if (proc_width < MIN_PROC_WIDTH)
- {
- proc_width += pid_width + 1;
- pid_width = 0;
- if (proc_width <= MIN_PROC_WIDTH)
- {
- proc_width += pc_width + sizeof (PC_PREFIX) - 1 + 1;
- pc_width = 0;
- if (proc_width < 0)
- {
- proc_width += line_width + sizeof (LINE_PREFIX) - 1 + 1;
- line_width = 0;
- if (proc_width < 0)
- proc_width = 0;
- }
- }
- }
+ {
+ proc_width += pid_width + 1;
+ pid_width = 0;
+ if (proc_width <= MIN_PROC_WIDTH)
+ {
+ proc_width += pc_width + sizeof (PC_PREFIX) - 1 + 1;
+ pc_width = 0;
+ if (proc_width < 0)
+ {
+ proc_width += line_width + sizeof (LINE_PREFIX) - 1 + 1;
+ line_width = 0;
+ if (proc_width < 0)
+ proc_width = 0;
+ }
+ }
+ }
}
/* Now create the locator line from the string version of the
if (proc_width > 0)
{
if (proc_name.size () > proc_width)
- string.printf ("%s%*.*s* ", PROC_PREFIX,
+ string.printf ("%s%*.*s* ", PROC_PREFIX,
1 - proc_width, proc_width - 1, proc_name.c_str ());
else
- string.printf ("%s%*.*s ", PROC_PREFIX,
+ string.printf ("%s%*.*s ", PROC_PREFIX,
-proc_width, proc_width, proc_name.c_str ());
}
while (table->name)
{
if (name && strcmp (table->name, name) == 0)
- return table;
+ return table;
table++;
}
tui_set_term_width_to (screenwidth);
/* erase + clearok are used instead of a straightforward clear as
- AIX 5.3 does not define clear. */
+ AIX 5.3 does not define clear. */
erase ();
clearok (curscr, TRUE);
tui_apply_current_layout ();
0 /* allow-unknown */, &showlist);
add_com ("refresh", class_tui, tui_refresh_all_command,
- _("Refresh the terminal display."));
+ _("Refresh the terminal display."));
cmd = add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
Set the width (in characters) of tab stops.\n\
if (content_loa.loa == l.loa
&& ((l.loa == LOA_LINE && content_loa.u.line_no == l.u.line_no)
- || (l.loa == LOA_ADDRESS && content_loa.u.addr == l.u.addr)))
- new_state = true;
+ || (l.loa == LOA_ADDRESS && content_loa.u.addr == l.u.addr)))
+ new_state = true;
else
new_state = false;
if (new_state != m_content[i].is_exec_point)
- {
- changed = true;
- m_content[i].is_exec_point = new_state;
- }
+ {
+ changed = true;
+ m_content[i].is_exec_point = new_state;
+ }
i++;
}
if (changed)
line = &m_content[i];
if (current_only && !line->is_exec_point)
- continue;
+ continue;
/* Scan each breakpoint to see if the current line has something to
- do with it. Identify enable/disabled breakpoints as well as
- those that we already hit. */
+ do with it. Identify enable/disabled breakpoints as well as
+ those that we already hit. */
tui_bp_flags mode = 0;
iterate_over_breakpoints ([&] (breakpoint *bp) -> bool
- {
+ {
struct bp_location *loc;
if (bp == being_deleted)
}
}
return false;
- });
+ });
if (line->break_mode != mode)
- {
- line->break_mode = mode;
- need_refresh = true;
- }
+ {
+ line->break_mode = mode;
+ need_refresh = true;
+ }
}
return need_refresh;
}
for (i = 0; tui_commands[i].cmd; i++)
{
if (tui_commands[i].key == key)
- {
- /* Insert the command in the readline buffer.
- Avoid calling the gdb command here since it creates
- a possible recursion on readline if prompt_for_continue
- is called (See PR 9584). The command will also appear
- in the readline history which turns out to be better. */
- rl_insert_text (tui_commands[i].cmd);
- rl_newline (1, '\n');
-
- /* Switch to gdb command mode while executing the command.
- This way the gdb's continue prompty will be displayed. */
- tui_set_key_mode (TUI_ONE_COMMAND_MODE);
- return 0;
- }
+ {
+ /* Insert the command in the readline buffer.
+ Avoid calling the gdb command here since it creates
+ a possible recursion on readline if prompt_for_continue
+ is called (See PR 9584). The command will also appear
+ in the readline history which turns out to be better. */
+ rl_insert_text (tui_commands[i].cmd);
+ rl_newline (1, '\n');
+
+ /* Switch to gdb command mode while executing the command.
+ This way the gdb's continue prompty will be displayed. */
+ tui_set_key_mode (TUI_ONE_COMMAND_MODE);
+ return 0;
+ }
}
return 0;
}
tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
tui_set_key_mode (tui_current_key_mode == TUI_COMMAND_MODE
- ? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE);
+ ? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE);
return 0;
}
{
tui_current_key_mode = mode;
rl_set_keymap (mode == TUI_SINGLE_KEY_MODE
- ? tui_keymap : tui_readline_standard_keymap);
+ ? tui_keymap : tui_readline_standard_keymap);
tui_show_locator_content ();
}
int j;
for (j = 0; tui_commands[j].cmd; j++)
- if (tui_commands[j].key == i)
- break;
+ if (tui_commands[j].key == i)
+ break;
if (tui_commands[j].cmd)
- continue;
+ continue;
rl_bind_key_in_map (i, tui_rl_command_mode, tui_keymap);
}
else
{
/* Save the current gdb setting of the terminal.
- Curses will restore this state when endwin() is called. */
+ Curses will restore this state when endwin() is called. */
def_shell_mode ();
clearok (stdscr, TRUE);
}
{
if (((type->code () == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
&& (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
- real_type = value_rtti_indirect_type (val, &full, &top, &using_enc);
+ real_type = value_rtti_indirect_type (val, &full, &top, &using_enc);
else if (type->code () == TYPE_CODE_STRUCT)
real_type = value_rtti_type (val, &full, &top, &using_enc);
}
printf_filtered ("/* real type = ");
type_print (real_type, "", gdb_stdout, -1);
if (! full)
- printf_filtered (" (incomplete object)");
+ printf_filtered (" (incomplete object)");
printf_filtered (" */\n");
}
uiout->field_signed(), uiout_>field_string() etc. calls when
the formatted message is translatable. E.g.:
- uiout->message (_("\nWatchpoint %pF deleted because the program has "
- "left the block in\n"
- "which its expression is valid.\n"),
- signed_field ("wpnum", b->number));
+ uiout->message (_("\nWatchpoint %pF deleted because the program has "
+ "left the block in\n"
+ "which its expression is valid.\n"),
+ signed_field ("wpnum", b->number));
- '%p[' - output the following text in a specified style.
'%p]' - output the following text in the default style.
We should end up with:
buf: 00001100
- DDDDSSDD (D=dest, S=source)
+ DDDDSSDD (D=dest, S=source)
*/
bits_to_str (expected, dest, 0, len, msb0);
bits_to_str (expected + dest_offset, source, source_offset, nbits, msb0);
static const char valid_mem_map[] = R"(<?xml version="1.0"?>
<!DOCTYPE memory-map
- PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
- "http://sourceware.org/gdb/gdb-memory-map.dtd">
+ PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
+ "http://sourceware.org/gdb/gdb-memory-map.dtd">
<memory-map>
<memory type="ram" start="0" length="4096" />
<memory type="rom" start="65536" length="256" />
abort_with_message (msg);
default:
dejavu = 3;
- /* Newer GLIBC versions put the warn_unused_result attribute
- on write, but this is one of those rare cases where
- ignoring the return value is correct. Casting to (void)
- does not fix this problem. This is the solution suggested
- at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509. */
+ /* Newer GLIBC versions put the warn_unused_result attribute
+ on write, but this is one of those rare cases where
+ ignoring the return value is correct. Casting to (void)
+ does not fix this problem. This is the solution suggested
+ at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509. */
if (write (STDERR_FILENO, msg, sizeof (msg)) != sizeof (msg))
- abort (); /* ARI: abort */
+ abort (); /* ARI: abort */
exit (1);
}
}
if (!confirm || !filtered_printing_initialized ())
quit_p = 1;
else
- quit_p = query (_("%s\nQuit this debugging session? "),
+ quit_p = query (_("%s\nQuit this debugging session? "),
reason.c_str ());
}
else if (problem->should_quit == internal_problem_yes)
#else
if (job_control
/* If there is no terminal switching for this target, then we can't
- possibly get screwed by the lack of job control. */
+ possibly get screwed by the lack of job control. */
|| !target_supports_terminal_ours ())
throw_quit ("Quit");
else
if (answer >= 'a')
answer -= 040;
/* Check answer. For the non-default, the user must specify
- the non-default explicitly. */
+ the non-default explicitly. */
if (answer == not_def_answer)
{
retval = !def_value;
break;
}
/* Otherwise, if a default was specified, the user may either
- specify the required input or have it default by entering
- nothing. */
+ specify the required input or have it default by entering
+ nothing. */
if (answer == def_answer
|| (defchar != '\0' && answer == '\0'))
{
chars_per_line = cols;
/* Readline should have fetched the termcap entry for us.
- Only try to use tgetnum function if rl_get_screen_size
- did not return a useful value. */
+ Only try to use tgetnum function if rl_get_screen_size
+ did not return a useful value. */
if (((rows <= 0) && (tgetnum ((char *) "li") < 0))
/* Also disable paging if inside Emacs. $EMACS was used
before Emacs v25.1, $INSIDE_EMACS is used since then. */
{
wrap_buffer.push_back ('\t');
/* Shifting right by 3 produces the number of tab stops
- we have already passed, and then adding one and
- shifting left 3 advances to the next tab stop. */
+ we have already passed, and then adding one and
+ shifting left 3 advances to the next tab stop. */
chars_printed = ((chars_printed >> 3) + 1) << 3;
lineptr++;
}
if ((s == string || IS_DIR_SEPARATOR (s[-1])
|| s[-1] == DIRNAME_SEPARATOR)
- && (s[from_len] == '\0' || IS_DIR_SEPARATOR (s[from_len])
+ && (s[from_len] == '\0' || IS_DIR_SEPARATOR (s[from_len])
|| s[from_len] == DIRNAME_SEPARATOR))
{
char *string_new;
return 0;
if (fld_type->code () == TYPE_CODE_ARRAY)
- {
+ {
tgt_type = TYPE_TARGET_TYPE (fld_type);
if (v850_type_is_scalar (tgt_type) && TYPE_LENGTH (tgt_type) >= 4)
return 0;
&& TYPE_LENGTH (type->field (0).type ()) == 4)
{
for (i = 1; i < type->num_fields (); ++i)
- {
+ {
fld_type = type->field (0).type ();
if (fld_type->code () == TYPE_CODE_ARRAY)
{
if (type->code () == TYPE_CODE_UNION)
{
for (i = 0; i < type->num_fields (); ++i)
- {
+ {
fld_type = type->field (0).type ();
if (!v850_use_struct_convention (gdbarch, fld_type))
return 0;
}
else if ((insn & 0xffe0) == ((E_SP_REGNUM << 11) | 0x0240))
- /* add <imm>,sp */
+ /* add <imm>,sp */
pi->sp_offset += ((insn & 0x1f) ^ 0x10) - 0x10;
else if (insn == ((E_SP_REGNUM << 11) | 0x0600 | E_SP_REGNUM))
- /* addi <imm>,sp,sp */
+ /* addi <imm>,sp,sp */
pi->sp_offset += insn2;
else if (insn == ((E_FP_REGNUM << 11) | 0x0000 | E_SP_REGNUM))
- /* mov sp,fp */
+ /* mov sp,fp */
pi->uses_fp = 1;
else if (insn == ((E_R12_REGNUM << 11) | 0x0640 | E_R0_REGNUM))
- /* movhi hi(const),r0,r12 */
+ /* movhi hi(const),r0,r12 */
r12_tmp = insn2 << 16;
else if (insn == ((E_R12_REGNUM << 11) | 0x0620 | E_R12_REGNUM))
- /* movea lo(const),r12,r12 */
+ /* movea lo(const),r12,r12 */
r12_tmp += insn2;
else if (insn == ((E_SP_REGNUM << 11) | 0x01c0 | E_R12_REGNUM) && r12_tmp)
- /* add r12,sp */
+ /* add r12,sp */
pi->sp_offset += r12_tmp;
else if (insn == ((E_EP_REGNUM << 11) | 0x0000 | E_SP_REGNUM))
- /* mov sp,ep */
+ /* mov sp,ep */
ep_used = 1;
else if (insn == ((E_EP_REGNUM << 11) | 0x0000 | E_R1_REGNUM))
- /* mov r1,ep */
+ /* mov r1,ep */
ep_used = 0;
else if (((insn & 0x07ff) == (0x0760 | E_SP_REGNUM)
|| (pi->uses_fp
gdb_byte valbuf[v850_reg_size];
if (!v850_type_is_scalar (value_type (*args))
- && gdbarch_tdep (gdbarch)->abi == V850_ABI_GCC
+ && gdbarch_tdep (gdbarch)->abi == V850_ABI_GCC
&& TYPE_LENGTH (value_type (*args)) > E_MAX_RETTYPE_SIZE_IN_REGS)
{
store_unsigned_integer (valbuf, 4, byte_order,
}
if (gdbarch_tdep (gdbarch)->eight_byte_align
- && v850_eight_byte_align_p (value_type (*args)))
- {
+ && v850_eight_byte_align_p (value_type (*args)))
+ {
if (argreg <= E_ARGLAST_REGNUM && (argreg & 1))
argreg++;
else if (stack_offset & 0x4)
if (!cache->uses_fp)
{
/* We didn't find a valid frame, which means that CACHE->base
- currently holds the frame pointer for our calling frame. If
- we're at the start of a function, or somewhere half-way its
- prologue, the function's frame probably hasn't been fully
- setup yet. Try to reconstruct the base address for the stack
- frame by looking at the stack pointer. For truly "frameless"
- functions this might work too. */
+ currently holds the frame pointer for our calling frame. If
+ we're at the start of a function, or somewhere half-way its
+ prologue, the function's frame probably hasn't been fully
+ setup yet. Try to reconstruct the base address for the stack
+ frame by looking at the stack pointer. For truly "frameless"
+ functions this might work too. */
cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
}
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
if (gdbarch_tdep (arches->gdbarch)->e_flags != e_flags
- || gdbarch_tdep (arches->gdbarch)->e_machine != e_machine)
+ || gdbarch_tdep (arches->gdbarch)->e_machine != e_machine)
continue;
return arches->gdbarch;
if (sz == 0)
{
warning (_("Type size unknown, assuming 1. "
- "Try casting to a known type, or void *."));
+ "Try casting to a known type, or void *."));
sz = 1;
}
|| (VALUE_LVAL (array) != lval_memory && array_upper_bound_undefined))
{
if (type_not_associated (array_type))
- error (_("no such vector element (vector not associated)"));
+ error (_("no such vector element (vector not associated)"));
else if (type_not_allocated (array_type))
- error (_("no such vector element (vector not allocated)"));
+ error (_("no such vector element (vector not allocated)"));
else
- error (_("no such vector element"));
+ error (_("no such vector element"));
}
if (is_dynamic_type (elt_type))
static struct value *
value_user_defined_cpp_op (gdb::array_view<value *> args, char *oper,
- int *static_memfuncp, enum noside noside)
+ int *static_memfuncp, enum noside noside)
{
struct symbol *symp = NULL;
struct value *valp = NULL;
find_overload_match (args, oper, BOTH /* could be method */,
- &args[0] /* objp */,
- NULL /* pass NULL symbol since symbol is unknown */,
- &valp, &symp, static_memfuncp, 0, noside);
+ &args[0] /* objp */,
+ NULL /* pass NULL symbol since symbol is unknown */,
+ &valp, &symp, static_memfuncp, 0, noside);
if (valp)
return valp;
if (symp)
{
/* This is a non member function and does not
- expect a reference as its first argument
- rather the explicit structure. */
+ expect a reference as its first argument
+ rather the explicit structure. */
args[0] = value_ind (args[0]);
return value_of_variable (symp, 0);
}
argvec.slice (1, 2 - static_memfuncp));
}
throw_error (NOT_FOUND_ERROR,
- _("member function %s not found"), tstr);
+ _("member function %s not found"), tstr);
}
/* We know that arg1 is a structure, so try to find a unary user
argvec.slice (1, nargs));
}
throw_error (NOT_FOUND_ERROR,
- _("member function %s not found"), tstr);
+ _("member function %s not found"), tstr);
}
\f
if (type1->code () == TYPE_CODE_INT)
{
/* We have a repeat count. Validate the second value and then
- construct a value repeated that many times. */
+ construct a value repeated that many times. */
if (type2->code () == TYPE_CODE_STRING
|| type2->code () == TYPE_CODE_CHAR)
{
case BINOP_BITWISE_XOR:
v = v1 ^ v2;
- break;
-
- case BINOP_EQUAL:
- v = v1 == v2;
- break;
-
- case BINOP_NOTEQUAL:
- v = v1 != v2;
+ break;
+
+ case BINOP_EQUAL:
+ v = v1 == v2;
+ break;
+
+ case BINOP_NOTEQUAL:
+ v = v1 != v2;
break;
default:
break;
case BINOP_EXP:
- v = uinteger_pow (v1, v2_signed);
+ v = uinteger_pow (v1, v2_signed);
break;
case BINOP_REM:
case BINOP_MOD:
/* Knuth 1.2.4, integer only. Note that unlike the C '%' op,
- v1 mod 0 has a defined value, v1. */
+ v1 mod 0 has a defined value, v1. */
if (v2 == 0)
{
v = v1;
v = v1 == v2;
break;
- case BINOP_NOTEQUAL:
- v = v1 != v2;
- break;
+ case BINOP_NOTEQUAL:
+ v = v1 != v2;
+ break;
case BINOP_LESS:
v = v1 < v2;
v = v1 / v2;
else
error (_("Division by zero"));
- break;
+ break;
case BINOP_EXP:
- v = integer_pow (v1, v2);
+ v = integer_pow (v1, v2);
break;
case BINOP_REM:
case BINOP_MOD:
/* Knuth 1.2.4, integer only. Note that unlike the C '%' op,
- X mod 0 has a defined value, X. */
+ X mod 0 has a defined value, X. */
if (v2 == 0)
{
v = v1;
v = v1 == v2;
break;
- case BINOP_NOTEQUAL:
- v = v1 != v2;
- break;
+ case BINOP_NOTEQUAL:
+ v = v1 != v2;
+ break;
case BINOP_LESS:
v = v1 < v2;
for (i = 0; i < len; i++)
{
if (s1[i] < s2[i])
- return -1;
+ return -1;
else if (s1[i] > s2[i])
- return 1;
+ return 1;
else
- continue;
+ continue;
}
if (len1 < len2)
val = allocate_value (type);
for (i = 0; i < high_bound - low_bound + 1; i++)
- {
- tmp = value_complement (value_subscript (arg1, i));
- memcpy (value_contents_writeable (val) + i * TYPE_LENGTH (eltype),
- value_contents_all (tmp), TYPE_LENGTH (eltype));
- }
+ {
+ tmp = value_complement (value_subscript (arg1, i));
+ memcpy (value_contents_writeable (val) + i * TYPE_LENGTH (eltype),
+ value_contents_all (tmp), TYPE_LENGTH (eltype));
+ }
}
else if (type->code () == TYPE_CODE_COMPLEX)
{
if (TYPE_IS_REFERENCE (check_typedef (type)))
{
/* We dereference type; then we recurse and finally
- we generate value of the given reference. Nothing wrong with
+ we generate value of the given reference. Nothing wrong with
that. */
struct type *t1 = check_typedef (type);
struct type *dereftype = check_typedef (TYPE_TARGET_TYPE (t1));
LONGEST longest;
/* When we cast pointers to integers, we mustn't use
- gdbarch_pointer_to_address to find the address the pointer
- represents, as value_as_long would. GDB should evaluate
- expressions just as the compiler would --- and the compiler
- sees a cast as a simple reinterpretation of the pointer's
- bits. */
+ gdbarch_pointer_to_address to find the address the pointer
+ represents, as value_as_long would. GDB should evaluate
+ expressions just as the compiler would --- and the compiler
+ sees a cast as a simple reinterpretation of the pointer's
+ bits. */
if (code2 == TYPE_CODE_PTR)
- longest = extract_unsigned_integer
+ longest = extract_unsigned_integer
(value_contents (arg2), TYPE_LENGTH (type2),
type_byte_order (type2));
else
- longest = value_as_long (arg2);
+ longest = value_as_long (arg2);
return value_from_longest (to_type, convert_to_boolean ?
(LONGEST) (longest ? 1 : 0) : longest);
}
if (is_ref)
result = value_cast (type, value_ref (value_ind (result),
- type->code ()));
+ type->code ()));
return result;
}
const gdb_byte *dest_buffer;
CORE_ADDR changed_addr;
int changed_len;
- gdb_byte buffer[sizeof (LONGEST)];
+ gdb_byte buffer[sizeof (LONGEST)];
if (value_bitsize (toval))
{
struct type *enc_type;
/* We may be pointing to something embedded in a larger object.
- Get the real type of the enclosing object. */
+ Get the real type of the enclosing object. */
enc_type = check_typedef (value_enclosing_type (arg1));
enc_type = TYPE_TARGET_TYPE (enc_type);
ARM. */
/* We should be doing much hairier argument matching (see
- section 13.2 of the ARM), but as a quick kludge, just check
- for the same type code. */
+ section 13.2 of the ARM), but as a quick kludge, just check
+ for the same type code. */
if (t1[i].type ()->code () != value_type (t2[i])->code ())
return i + 1;
}
struct value *v = NULL;
struct type *basetype = check_typedef (TYPE_BASECLASS (type, i));
/* If we are looking for baseclasses, this is what we get when
- we hit them. But it could happen that the base part's member
- name is not yet filled in. */
+ we hit them. But it could happen that the base part's member
+ name is not yet filled in. */
int found_baseclass = (m_looking_for_baseclass
&& TYPE_BASECLASS_NAME (type, i) != NULL
&& (strcmp_iw (m_name,
/* if there are no arguments ...do this... */
/* Try as a field first, because if we succeed, there is less
- work to be done. */
+ work to be done. */
v = search_struct_field (name, *argp, t, 0);
if (v)
return v;
/* C++: If it was not found as a data field, then try to
- return it as a pointer to a method. */
+ return it as a pointer to a method. */
v = search_struct_method (name, argp, args, 0,
static_memfuncp, t);
else if (v == 0)
{
/* See if user tried to invoke data as function. If so, hand it
- back. If it's not callable (i.e., a pointer to function),
- gdb should give an error. */
+ back. If it's not callable (i.e., a pointer to function),
+ gdb should give an error. */
v = search_struct_field (name, *argp, t, 0);
/* If we found an ordinary field, then it is not a method call.
So, treat it as if it were a static member function. */
if (!v)
throw_error (NOT_FOUND_ERROR,
- _("Structure has no component named %s."), name);
+ _("Structure has no component named %s."), name);
return v;
}
value_find_oload_method_list (&temp, name, 0, &methods,
&xmethods, &basetype, &boffset);
/* If this is a method only search, and no methods were found
- the search has failed. */
+ the search has failed. */
if (method == METHOD && methods.empty () && xmethods.empty ())
error (_("Couldn't find method %s%s%s"),
obj_type_name,
const char *qualified_name = NULL;
/* If the overload match is being search for both as a method
- and non member function, the first argument must now be
- dereferenced. */
+ and non member function, the first argument must now be
+ dereferenced. */
if (method == BOTH)
args[0] = value_ind (args[0]);
if (fsym)
- {
- qualified_name = fsym->natural_name ();
+ {
+ qualified_name = fsym->natural_name ();
- /* If we have a function with a C++ name, try to extract just
+ /* If we have a function with a C++ name, try to extract just
the function part. Do not try this for non-functions (e.g.
function pointers). */
- if (qualified_name
- && (check_typedef (SYMBOL_TYPE (fsym))->code ()
+ if (qualified_name
+ && (check_typedef (SYMBOL_TYPE (fsym))->code ()
== TYPE_CODE_FUNC))
- {
+ {
temp_func = cp_func_name (qualified_name);
/* If cp_func_name did not remove anything, the name of the
- symbol did not include scope or argument types - it was
- probably a C-style function. */
+ symbol did not include scope or argument types - it was
+ probably a C-style function. */
if (temp_func != nullptr)
{
if (strcmp (temp_func.get (), qualified_name) == 0)
else
func_name = temp_func.get ();
}
- }
- }
+ }
+ }
else
{
func_name = name;
not a function at all. Just return the same symbol. Do the
same if cp_func_name fails for some reason. */
if (func_name == NULL)
- {
+ {
*symp = fsym;
- return 0;
- }
+ return 0;
+ }
func_oload_champ = find_oload_champ_namespace (args,
- func_name,
- qualified_name,
- &functions,
- &func_badness,
- no_adl);
+ func_name,
+ qualified_name,
+ &functions,
+ &func_badness,
+ no_adl);
if (func_oload_champ >= 0)
func_match_quality = classify_oload_match (func_badness,
/* Did we find a match ? */
if (method_oload_champ == -1 && func_oload_champ == -1)
throw_error (NOT_FOUND_ERROR,
- _("No symbol \"%s\" in current context."),
- name);
+ _("No symbol \"%s\" in current context."),
+ name);
/* If we have found both a method match and a function
match, find out which one is better, and calculate match
if (method_oload_champ >= 0 && func_oload_champ >= 0)
{
switch (compare_badness (func_badness, method_badness))
- {
+ {
case 0: /* Top two contenders are equally good. */
/* FIXME: GDB does not support the general ambiguous case.
All candidates should be collected and presented the
default:
error (_("Internal error: unexpected overload comparison result"));
break;
- }
+ }
}
else
{
}
/* Compare parameter types to supplied argument types. Skip
- THIS for static methods. */
+ THIS for static methods. */
bv = rank_function (parm_types,
args.slice (static_offset));
for (ix = 1; ix <= nargs - static_offset; ix++)
{
/* If this conversion is as bad as INCOMPATIBLE_TYPE_BADNESS
- or worse return INCOMPATIBLE. */
+ or worse return INCOMPATIBLE. */
if (compare_ranks (oload_champ_bv[ix],
- INCOMPATIBLE_TYPE_BADNESS) <= 0)
+ INCOMPATIBLE_TYPE_BADNESS) <= 0)
return INCOMPATIBLE; /* Truly mismatched types. */
/* Otherwise If this conversion is as bad as
- NS_POINTER_CONVERSION_BADNESS or worse return NON_STANDARD. */
+ NS_POINTER_CONVERSION_BADNESS or worse return NON_STANDARD. */
else if (compare_ranks (oload_champ_bv[ix],
- NS_POINTER_CONVERSION_BADNESS) <= 0)
+ NS_POINTER_CONVERSION_BADNESS) <= 0)
worst = NON_STANDARD; /* Non-standard type conversions
needed. */
}
{
if (compare_ranks (rank_one_type (t1->field (start + i).type (),
t2->field (i).type (), NULL),
- EXACT_MATCH_BADNESS) != 0)
+ EXACT_MATCH_BADNESS) != 0)
return 0;
}
{
struct type *t = vt->field (i).type ();
if (types_equal (t, cls))
- {
- if (BASETYPE_VIA_VIRTUAL (vt, i))
- {
+ {
+ if (BASETYPE_VIA_VIRTUAL (vt, i))
+ {
const gdb_byte *adr = value_contents_for_printing (v);
*boffs = baseclass_offset (vt, i, adr, value_offset (v),
value_as_long (v), v);
*isvirt = true;
- }
- else
+ }
+ else
*isvirt = false;
- return true;
- }
+ return true;
+ }
if (get_baseclass_offset (check_typedef (t), cls, v, boffs, isvirt))
- {
+ {
if (*isvirt == false) /* Add non-virtual base offset. */
{
const gdb_byte *adr = value_contents_for_printing (v);
bool isvirt = false;
if (get_baseclass_offset (domain, curtype, v, &boff,
&isvirt))
- mem_offset += boff;
+ mem_offset += boff;
else
- {
- struct type *p = check_typedef (value_type (this_v));
- p = check_typedef (TYPE_TARGET_TYPE (p));
- if (get_baseclass_offset (p, curtype, this_v,
+ {
+ struct type *p = check_typedef (value_type (this_v));
+ p = check_typedef (TYPE_TARGET_TYPE (p));
+ if (get_baseclass_offset (p, curtype, this_v,
&boff, &isvirt))
- mem_offset += boff;
- }
+ mem_offset += boff;
+ }
}
tmp = lookup_pointer_type (TYPE_TARGET_TYPE (type));
result = value_from_pointer (tmp,
{
try
- {
+ {
target = value_ind (v);
- }
+ }
catch (const gdb_exception_error &except)
{
if (except.error == MEMORY_ERROR)
{
/* value_ind threw a memory error. The pointer is NULL or
- contains an uninitialized value: we can't determine any
- type. */
+ contains an uninitialized value: we can't determine any
+ type. */
return NULL;
}
throw;
real_type = make_cv_type (TYPE_CONST (target_type),
TYPE_VOLATILE (target_type), real_type, NULL);
if (TYPE_IS_REFERENCE (type))
- real_type = lookup_reference_type (real_type, type->code ());
+ real_type = lookup_reference_type (real_type, type->code ());
else if (type->code () == TYPE_CODE_PTR)
- real_type = lookup_pointer_type (real_type);
+ real_type = lookup_pointer_type (real_type);
else
- internal_error (__FILE__, __LINE__, _("Unexpected value type."));
+ internal_error (__FILE__, __LINE__, _("Unexpected value type."));
/* Copy qualifiers to the pointer/reference. */
real_type = make_cv_type (TYPE_CONST (type), TYPE_VOLATILE (type),
static void
show_print_array_indexes (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("Printing of array indexes is %s.\n"), value);
}
case TYPE_CODE_UNDEF:
/* This happens (without TYPE_STUB set) on systems which don't use
- dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
- and no complete type for struct foo in that file. */
+ dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
+ and no complete type for struct foo in that file. */
fprintf_styled (stream, metadata_style.style (), _("<incomplete type>"));
break;
/* Take low nibble and bump our pointer "p". */
digits[0] += LOW_NIBBLE (*p);
- if (byte_order == BFD_ENDIAN_BIG)
+ if (byte_order == BFD_ENDIAN_BIG)
p++;
else
p--;
void
maybe_print_array_index (struct type *index_type, LONGEST index,
- struct ui_file *stream,
+ struct ui_file *stream,
const struct value_print_options *options)
{
if (!options->print_array_indexes)
if (get_array_bounds (type, &low_bound, &high_bound))
{
/* The array length should normally be HIGH_BOUND - LOW_BOUND +
- 1. But we have to be a little extra careful, because some
- languages such as Ada allow LOW_BOUND to be greater than
- HIGH_BOUND for empty arrays. In that situation, the array
- length is just zero, not negative! */
+ 1. But we have to be a little extra careful, because some
+ languages such as Ada allow LOW_BOUND to be greater than
+ HIGH_BOUND for empty arrays. In that situation, the array
+ length is just zero, not negative! */
if (low_bound > high_bound)
len = 0;
else
}
wrap_here (n_spaces (2 + 2 * recurse));
maybe_print_array_index (index_type, i + low_bound,
- stream, options);
+ stream, options);
rep1 = i + 1;
reps = 1;
gdb_byte *peekbuf;
/* We didn't find a NUL terminator we were looking for. Attempt
- to peek at the next character. If not successful, or it is not
- a null byte, then force ellipsis to be printed. */
+ to peek at the next character. If not successful, or it is not
+ a null byte, then force ellipsis to be printed. */
peekbuf = (gdb_byte *) alloca (width);
else if ((len >= 0 && err != 0) || (len > bytes_read / width))
{
/* Getting an error when we have a requested length, or fetching less
- than the number of characters actually requested, always make us
- print ellipsis. */
+ than the number of characters actually requested, always make us
+ print ellipsis. */
force_ellipsis = 1;
}
char format);
extern void maybe_print_array_index (struct type *index_type, LONGEST index,
- struct ui_file *stream,
+ struct ui_file *stream,
const struct value_print_options *);
care for (this is a range afterall), we need to check if the
_previous_ range overlaps the I range. E.g.,
- R
- |---|
+ R
+ |---|
|---| |---| |------| ... |--|
0 1 2 N
Then we need to check if the I range overlaps the I range itself.
E.g.,
- R
- |---|
+ R
+ |---|
|---| |---| |-------| ... |--|
0 1 2 N
R
|-...-|
- |--| |---| |------| ... |--|
- 0 1 2 N
+ |--| |---| |------| ... |--|
+ 0 1 2 N
I=0
R
|------------------------|
- |--| |---| |------| ... |--|
- 0 1 2 N
+ |--| |---| |------| ... |--|
+ 0 1 2 N
I=0
PTR + (OFFSET_BITS / TARGET_CHAR_BIT)
to:
PTR + ((OFFSET_BITS + LENGTH_BITS + TARGET_CHAR_BIT - 1)
- / TARGET_CHAR_BIT) */
+ / TARGET_CHAR_BIT) */
static int
memcmp_with_bit_offsets (const gdb_byte *ptr1, size_t offset1_bits,
const gdb_byte *ptr2, size_t offset2_bits,
struct value *
allocate_computed_value (struct type *type,
- const struct lval_funcs *funcs,
- void *closure)
+ const struct lval_funcs *funcs,
+ void *closure)
{
struct value *v = allocate_value_lazy (type);
&& (check_typedef (TYPE_TARGET_TYPE (result))->code ()
== TYPE_CODE_STRUCT)
&& !value_optimized_out (value))
- {
- struct type *real_type;
-
- real_type = value_rtti_indirect_type (value, NULL, NULL, NULL);
- if (real_type)
- {
- if (real_type_found)
- *real_type_found = 1;
- result = real_type;
- }
- }
+ {
+ struct type *real_type;
+
+ real_type = value_rtti_indirect_type (value, NULL, NULL, NULL);
+ if (real_type)
+ {
+ if (real_type_found)
+ *real_type_found = 1;
+ result = real_type;
+ }
+ }
else if (resolve_simple_types)
- {
- if (real_type_found)
- *real_type_found = 1;
- result = value_enclosing_type (value);
- }
+ {
+ if (real_type_found)
+ *real_type_found = 1;
+ result = value_enclosing_type (value);
+ }
}
return result;
const struct lval_funcs *funcs = val->location.computed.funcs;
if (funcs->copy_closure)
- val->location.computed.closure = funcs->copy_closure (val);
+ val->location.computed.closure = funcs->copy_closure (val);
}
return val;
}
const struct lval_funcs *funcs = whole->location.computed.funcs;
if (funcs->copy_closure)
- component->location.computed.closure = funcs->copy_closure (whole);
+ component->location.computed.closure = funcs->copy_closure (whole);
}
/* If type has a dynamic resolved location property
if (num_exp)
{
/* "show values +" should print from the stored position.
- "show values <exp>" should print around value number <exp>. */
+ "show values <exp>" should print around value number <exp>. */
if (num_exp[0] != '+' || num_exp[1] != '\0')
num = parse_and_eval_long (num_exp) - 5;
}
new_data.value = release_value (copy).release ();
/* Internal variables which are created from values with a dynamic
- location don't need the location property of the origin anymore.
- The resolved dynamic location is used prior then any other address
- when accessing the value.
- If we keep it, we would still refer to the origin value.
- Remove the location property in case it exist. */
+ location don't need the location property of the origin anymore.
+ The resolved dynamic location is used prior then any other address
+ when accessing the value.
+ If we keep it, we would still refer to the origin value.
+ Remove the location property in case it exist. */
value_type (new_data.value)->remove_dyn_prop (DYN_PROP_DATA_LOCATION);
break;
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
- whether we want this to be true eventually. */
+ whether we want this to be true eventually. */
return extract_typed_address (valaddr, type);
default:
/* We expect an already resolved data location. */
gdb_assert (PROP_CONST == TYPE_DATA_LOCATION_KIND (type));
/* For dynamic data types defer memory allocation
- until we actual access the value. */
+ until we actual access the value. */
v = allocate_value_lazy (type);
}
else
{
/* Plain old data member */
offset += (TYPE_FIELD_BITPOS (arg_type, fieldno)
- / (HOST_CHAR_BIT * unit_size));
+ / (HOST_CHAR_BIT * unit_size));
/* Lazy register values with offsets are not supported. */
if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
value_addr (*arg1p)));
/* Move the `this' pointer according to the offset.
- VALUE_OFFSET (*arg1p) += offset; */
+ VALUE_OFFSET (*arg1p) += offset; */
}
return v;
if (0 != (fieldval & ~mask))
{
/* FIXME: would like to include fieldval in the message, but
- we don't have a sprintf_longest. */
+ we don't have a sprintf_longest. */
warning (_("Value does not fit in %s bits."), plongest (bitsize));
/* Truncate it, otherwise adjoining fields may be corrupted. */
/* Set COMPONENT's location as appropriate for a component of WHOLE
--- regardless of what kind of lvalue WHOLE is. */
extern void set_value_component_location (struct value *component,
- const struct value *whole);
+ const struct value *whole);
/* While the following fields are per- VALUE .CONTENT .PIECE (i.e., a
single value might have multiple LVALs), this hacked interface is
CORE_ADDR pc;
/* Parse and evaluate the expression, filling in as much of the
- variable's data as possible. */
+ variable's data as possible. */
if (has_stack_frames ())
{
innermost_block_tracker tracker (INNERMOST_BLOCK_FOR_SYMBOLS
| INNERMOST_BLOCK_FOR_REGISTERS);
/* Wrap the call to parse expression, so we can
- return a sensible error. */
+ return a sensible error. */
try
{
var->root->exp = parse_exp_1 (&p, pc, block, 0, &tracker);
var->path_expr = expression;
/* When the frame is different from the current frame,
- we must select the appropriate frame before parsing
- the expression, otherwise the value will not be current.
- Since select_frame is so benign, just call it for all cases. */
+ we must select the appropriate frame before parsing
+ the expression, otherwise the value will not be current.
+ Since select_frame is so benign, just call it for all cases. */
if (var->root->valid_block)
{
/* User could specify explicit FRAME-ADDR which was not found but
}
/* We definitely need to catch errors here.
- If evaluate_expression succeeds we got the value we wanted.
- But if it fails, we still go on with a call to evaluate_type(). */
+ If evaluate_expression succeeds we got the value we wanted.
+ But if it fails, we still go on with a call to evaluate_type(). */
try
{
value = evaluate_expression (var->root->exp.get ());
var->obj_name = objname;
/* If a varobj name is duplicated, the install will fail so
- we must cleanup. */
+ we must cleanup. */
if (!install_variable (var.get ()))
return NULL;
}
value. */
changed = true;
}
- else if (var->value == NULL && value == NULL)
+ else if (var->value == NULL && value == NULL)
/* Equal. */
;
else if (var->value == NULL || value == NULL)
if (varobj_value_has_mutated (v, newobj, new_type))
{
/* The children are no longer valid; delete them now.
- Report the fact that its type changed as well. */
+ Report the fact that its type changed as well. */
varobj_delete (v, 1 /* only_children */);
v->num_children = -1;
v->to = -1;
if (cr == NULL)
{
warning (_("Assertion failed: Could not find "
- "varobj \"%s\" in root list"),
+ "varobj \"%s\" in root list"),
var->obj_name.c_str ());
return;
}
{
/* We need to catch errors here, because if evaluate
- expression fails we want to just return NULL. */
+ expression fails we want to just return NULL. */
try
{
new_val = evaluate_expression (var->root->exp.get ());
|| type->code () == TYPE_CODE_ARRAY)
{
/* The default on VAX is to return structures in static memory.
- Consequently a function must return the address where we can
- find the return value. */
+ Consequently a function must return the address where we can
+ find the return value. */
if (readbuf)
{
ULONGEST numarg;
/* This is a procedure with Stack Argument List. Adjust the
- stack address for the arguments that were pushed onto the
- stack. The return instruction will automatically pop the
- arguments from the stack. */
+ stack address for the arguments that were pushed onto the
+ stack. The return instruction will automatically pop the
+ arguments from the stack. */
numarg = get_frame_memory_unsigned (this_frame, addr, 1);
addr += 4 + numarg * 4;
}
#endif
#define CONTEXT_DEBUGGER_DR CONTEXT_FULL | CONTEXT_FLOATING_POINT \
- | CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS \
- | CONTEXT_EXTENDED_REGISTERS
+ | CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS \
+ | CONTEXT_EXTENDED_REGISTERS
static uintptr_t dr[8];
static int debug_registers_changed;
/* Record the existence of this thread. */
thread_id = current_event.dwThreadId;
windows_add_thread
- (ptid_t (current_event.dwProcessId, current_event.dwThreadId, 0),
+ (ptid_t (current_event.dwProcessId, current_event.dwThreadId, 0),
current_event.u.CreateThread.hThread,
current_event.u.CreateThread.lpThreadLocalBase,
false /* main_thread_p */);
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
/* Add the main thread. */
windows_add_thread
- (ptid_t (current_event.dwProcessId,
+ (ptid_t (current_event.dwProcessId,
current_event.dwThreadId, 0),
current_event.u.CreateProcessInfo.hThread,
current_event.u.CreateProcessInfo.lpThreadLocalBase,
mbstowcs (copy, env[i], len);
equalpos = wcschr (copy, L'=');
if (equalpos)
- *equalpos = L'\0';
+ *equalpos = L'\0';
SetEnvironmentVariableW (copy, NULL);
}
xfree (copy);
#endif
GPA (hm, GetModuleInformation);
GetModuleFileNameEx = (GetModuleFileNameEx_ftype *)
- GetProcAddress (hm, GetModuleFileNameEx_name);
+ GetProcAddress (hm, GetModuleFileNameEx_name);
}
if (!EnumProcessModules || !GetModuleInformation || !GetModuleFileNameEx)
bfd_vma name_va = dir_entry->name_rva;
/* If the name's virtual address is smaller than the section's virtual
- address, there's a problem. */
+ address, there's a problem. */
if (name_va < idata_section_va || name_va >= idata_section_end_va)
{
warning (_("\
++function_count;
/* If the function was compiled with XLC, we may have to add an
- extra line entry later. Reserve space for that. */
+ extra line entry later. Reserve space for that. */
if (ii + 1 < oldLineTb->nitems
&& oldLineTb->item[ii].pc != oldLineTb->item[ii + 1].pc)
extra_lines++;
else if (function_count > 1)
std::sort (fentry, fentry + function_count,
[] (const linetable_entry <e1, const linetable_entry& lte2)
- { return lte1.pc < lte2.pc; });
+ { return lte1.pc < lte2.pc; });
/* Allocate a new line table. */
newLineTb = (struct linetable *)
for (ii = 0; ii < function_count; ++ii)
{
/* If the function was compiled with XLC, we may have to add an
- extra line to cover the function prologue. */
+ extra line to cover the function prologue. */
jj = fentry[ii].line;
if (jj + 1 < oldLineTb->nitems
&& oldLineTb->item[jj].pc != oldLineTb->item[jj + 1].pc)
if (inclDepth)
{
/* In xcoff, we assume include files cannot be nested (not in .c files
- of course, but in corresponding .s files.). */
+ of course, but in corresponding .s files.). */
/* This can happen with old versions of GCC.
- GCC 2.3.3-930426 does not exhibit this on a test case which
- a user said produced the message for him. */
+ GCC 2.3.3-930426 does not exhibit this on a test case which
+ a user said produced the message for him. */
complaint (_("Nested C_BINCL symbols"));
}
++inclDepth;
if (strcmp (inclTable[ii].name, get_last_source_file ()) == 0)
{
- /* The entry in the include table refers to the main source
- file. Add the lines to the main subfile. */
+ /* The entry in the include table refers to the main source
+ file. Add the lines to the main subfile. */
main_source_baseline = inclTable[ii].funStartLine;
enter_line_range
}
/* All the include files' line have been processed at this point. Now,
- enter remaining lines of the main file, if any left. */
+ enter remaining lines of the main file, if any left. */
if (offset < max_offset + 1 - linesz)
{
enter_line_range (&main_subfile, offset, 0, start, end,
lv = main_subfile.line_vector;
/* Line numbers are not necessarily ordered. xlc compilation will
- put static function to the end. */
+ put static function to the end. */
struct subfile *current_subfile = get_current_subfile ();
lineTb = arrange_linetable (lv);
for (ii = 0; ii < inclIndx; ++ii)
{
if (inclTable[ii].subfile != ((struct subfile *) &main_subfile)
- && (inclTable[ii].subfile)->line_vector) /* Useless if!!!
+ && (inclTable[ii].subfile)->line_vector) /* Useless if!!!
FIXMEmgo */
{
struct linetable *lineTb, *lv;
/* Enter a given range of lines into the line vector.
can be called in the following two ways:
enter_line_range (subfile, beginoffset, endoffset,
- startaddr, 0, firstLine) or
+ startaddr, 0, firstLine) or
enter_line_range (subfile, beginoffset, 0,
- startaddr, endaddr, firstLine)
+ startaddr, endaddr, firstLine)
endoffset points to the last line table entry that we should pay
attention to. */
complaint (_("Unexpected symbol continuation"));
/* Return something which points to '\0' and hope the symbol reading
- code does something reasonable. */
+ code does something reasonable. */
retval = "";
}
else if (symbol.n_sclass & 0x80)
complaint (_("Unexpected symbol continuation"));
/* Return something which points to '\0' and hope the symbol reading
- code does something reasonable. */
+ code does something reasonable. */
retval = "";
}
return retval;
/* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */
/* read one symbol into `cs' structure. After processing the
- whole symbol table, only string table will be kept in memory,
- symbol table and debug section of xcoff will be freed. Thus
- we can mark symbols with names in string table as
- `alloced'. */
+ whole symbol table, only string table will be kept in memory,
+ symbol table and debug section of xcoff will be freed. Thus
+ we can mark symbols with names in string table as
+ `alloced'. */
{
int ii;
{
/* A program csect is seen. We have to allocate one
- symbol table for each program csect. Normally gdb
- prefers one symtab for each source file. In case
- of AIX, one source file might include more than one
- [PR] csect, and they don't have to be adjacent in
- terms of the space they occupy in memory. Thus, one
- single source file might get fragmented in the
- memory and gdb's file start and end address
- approach does not work! GCC (and I think xlc) seem
- to put all the code in the unnamed program csect. */
+ symbol table for each program csect. Normally gdb
+ prefers one symtab for each source file. In case
+ of AIX, one source file might include more than one
+ [PR] csect, and they don't have to be adjacent in
+ terms of the space they occupy in memory. Thus, one
+ single source file might get fragmented in the
+ memory and gdb's file start and end address
+ approach does not work! GCC (and I think xlc) seem
+ to put all the code in the unnamed program csect. */
if (last_csect_name)
{
}
/* If this is the very first csect seen,
- basically `__start'. */
+ basically `__start'. */
if (just_started)
{
first_object_file_end
0, cs->c_naux, &main_aux);
/* The value of .ef is the address of epilogue code;
- not useful for gdb. */
+ not useful for gdb. */
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
- contains number of lines to '}' */
+ contains number of lines to '}' */
if (outermost_context_p ())
{ /* We attempted to pop an empty context stack. */
cur_src_end_addr = file_end_addr;
cust = end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
/* When reading symbols for the last C_FILE of the objfile, try
- to make sure that we set pst->compunit_symtab to the symtab for the
- file, not to the _globals_ symtab. I'm not sure whether this
- actually works right or when/if it comes up. */
+ to make sure that we set pst->compunit_symtab to the symtab for the
+ file, not to the _globals_ symtab. I'm not sure whether this
+ actually works right or when/if it comes up. */
if (pst->compunit_symtab == NULL)
pst->compunit_symtab = cust;
end_stabs ();
if (cs->c_secnum < 0)
{
/* The value is a register number, offset within a frame, etc.,
- and does not get relocated. */
+ and does not get relocated. */
off = 0;
sec = -1;
}
if (ISFCN (cs->c_type))
{
/* At this point, we don't know the type of the function. This
- will be patched with the type from its stab entry later on in
- patch_block_stabs (), unless the file was compiled without -g. */
+ will be patched with the type from its stab entry later on in
+ patch_block_stabs (), unless the file was compiled without -g. */
sym->set_linkage_name (SYMNAME_ALLOC (name, symname_alloced));
SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
self->expand_psymtab (objfile);
/* Match with global symbols. This only needs to be done once,
- after all of the symtabs and dependencies have been read in. */
+ after all of the symtabs and dependencies have been read in. */
scan_file_globals (objfile);
}
}
((struct symloc *) subpst->read_symtab_private)->numsyms = 0;
/* We could save slight bits of space by only making one of these,
- shared by the entire set of include files. FIXME-someday. */
+ shared by the entire set of include files. FIXME-someday. */
subpst->dependencies =
objfile->partial_symtabs->allocate_dependencies (1);
subpst->dependencies[0] = pst;
{
/* Throw away this psymtab, it's empty. */
/* Empty psymtabs happen as a result of header files which don't have
- any symbols in them. There can be a lot of them. */
+ any symbols in them. There can be a lot of them. */
objfile->partial_symtabs->discard_psymtab (pst);
if (symbol->n_zeroes)
{
/* If it's exactly E_SYMNMLEN characters long it isn't
- '\0'-terminated. */
+ '\0'-terminated. */
if (symbol->n_name[E_SYMNMLEN - 1] != '\0')
{
/* FIXME: wastes memory for symbols which we don't end up putting
/* Handle the start of a <syscall> element. */
static void
syscall_start_syscall (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element,
+ void *user_data,
std::vector<gdb_xml_value> &attributes)
{
struct syscall_parsing_data *data = (struct syscall_parsing_data *) user_data;
for (const gdb_xml_value &attr : attributes)
{
if (strcmp (attr.name, "name") == 0)
- name = (char *) attr.value.get ();
+ name = (char *) attr.value.get ();
else if (strcmp (attr.name, "number") == 0)
- number = * (ULONGEST *) attr.value.get ();
+ number = * (ULONGEST *) attr.value.get ();
else if (strcmp (attr.name, "alias") == 0)
- alias = (char *) attr.value.get ();
+ alias = (char *) attr.value.get ();
else if (strcmp (attr.name, "groups") == 0)
- groups = (char *) attr.value.get ();
+ groups = (char *) attr.value.get ();
else
- internal_error (__FILE__, __LINE__,
- _("Unknown attribute name '%s'."), attr.name);
+ internal_error (__FILE__, __LINE__,
+ _("Unknown attribute name '%s'."), attr.name);
}
gdb_assert (name);
static const char *
xml_get_syscall_name (struct gdbarch *gdbarch,
- int syscall_number)
+ int syscall_number)
{
struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
tdesc_type_with_fields *t = data->current_type;
/* Older versions of gdb can't handle elided end values.
- Stick with that for now, to help ensure backward compatibility.
+ Stick with that for now, to help ensure backward compatibility.
E.g., If a newer gdbserver is talking to an older gdb. */
if (end == -1)
gdb_xml_error (parser, _("Missing end value"));
int i, regnum = E_1ST_ARG_REGNUM;
for (i = 0; i < len; i += xstormy16_reg_size)
- regcache->raw_write (regnum++, valbuf + i);
+ regcache->raw_write (regnum++, valbuf + i);
}
}
plg_end = xstormy16_analyze_prologue (gdbarch, func_addr, func_end,
&cache, NULL);
if (!cache.uses_fp)
- return plg_end;
+ return plg_end;
/* Found a function. */
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
return 0;
/* Check if we're on a `ret' instruction. Otherwise it's
- too dangerous to proceed. */
+ too dangerous to proceed. */
inst = read_memory_unsigned_integer (addr,
xstormy16_inst_size, byte_order);
if (inst != 0x0003)
xstormy16_inst_size,
byte_order);
inst2 = extract_unsigned_integer (buf + xstormy16_inst_size,
- xstormy16_inst_size,
+ xstormy16_inst_size,
byte_order);
faddr2 = inst2 << 8 | (inst & 0xff);
if (faddr == faddr2)
void **this_cache, int regnum)
{
struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
- this_cache);
+ this_cache);
gdb_assert (regnum >= 0);
if (regnum == E_SP_REGNUM && cache->saved_sp)
XTREG(111,444,32, 4, 4,0x000e,0x0006,-2, 8,0x0100,a14, 0,0,0,0,0,0)
XTREG(112,448,32, 4, 4,0x000f,0x0006,-2, 8,0x0100,a15, 0,0,0,0,0,0)
XTREG(113,452, 4, 4, 4,0x2008,0x0006,-2, 6,0x1010,psintlevel,
- 0,0,&xtensa_mask0,0,0,0)
+ 0,0,&xtensa_mask0,0,0,0)
XTREG(114,456, 1, 4, 4,0x2009,0x0006,-2, 6,0x1010,psum,
- 0,0,&xtensa_mask1,0,0,0)
+ 0,0,&xtensa_mask1,0,0,0)
XTREG(115,460, 1, 4, 4,0x200a,0x0006,-2, 6,0x1010,pswoe,
- 0,0,&xtensa_mask2,0,0,0)
+ 0,0,&xtensa_mask2,0,0,0)
XTREG(116,464, 2, 4, 4,0x200b,0x0006,-2, 6,0x1010,psring,
- 0,0,&xtensa_mask3,0,0,0)
+ 0,0,&xtensa_mask3,0,0,0)
XTREG(117,468, 1, 4, 4,0x200c,0x0006,-2, 6,0x1010,psexcm,
- 0,0,&xtensa_mask4,0,0,0)
+ 0,0,&xtensa_mask4,0,0,0)
XTREG(118,472, 2, 4, 4,0x200d,0x0006,-2, 6,0x1010,pscallinc,
- 0,0,&xtensa_mask5,0,0,0)
+ 0,0,&xtensa_mask5,0,0,0)
XTREG(119,476, 4, 4, 4,0x200e,0x0006,-2, 6,0x1010,psowb,
- 0,0,&xtensa_mask6,0,0,0)
+ 0,0,&xtensa_mask6,0,0,0)
XTREG(120,480,20, 4, 4,0x200f,0x0006,-2, 6,0x1010,litbaddr,
- 0,0,&xtensa_mask7,0,0,0)
+ 0,0,&xtensa_mask7,0,0,0)
XTREG(121,484, 1, 4, 4,0x2010,0x0006,-2, 6,0x1010,litben,
- 0,0,&xtensa_mask8,0,0,0)
+ 0,0,&xtensa_mask8,0,0,0)
XTREG(122,488, 4, 4, 4,0x2015,0x0006,-2, 6,0x1010,dbnum,
- 0,0,&xtensa_mask9,0,0,0)
+ 0,0,&xtensa_mask9,0,0,0)
XTREG(123,492, 8, 4, 4,0x2016,0x0006,-2, 6,0x1010,asid3,
- 0,0,&xtensa_mask10,0,0,0)
+ 0,0,&xtensa_mask10,0,0,0)
XTREG(124,496, 8, 4, 4,0x2017,0x0006,-2, 6,0x1010,asid2,
- 0,0,&xtensa_mask11,0,0,0)
+ 0,0,&xtensa_mask11,0,0,0)
XTREG(125,500, 8, 4, 4,0x2018,0x0006,-2, 6,0x1010,asid1,
- 0,0,&xtensa_mask12,0,0,0)
+ 0,0,&xtensa_mask12,0,0,0)
XTREG(126,504, 2, 4, 4,0x2019,0x0006,-2, 6,0x1010,instpgszid4,
- 0,0,&xtensa_mask13,0,0,0)
+ 0,0,&xtensa_mask13,0,0,0)
XTREG(127,508, 2, 4, 4,0x201a,0x0006,-2, 6,0x1010,datapgszid4,
- 0,0,&xtensa_mask14,0,0,0)
+ 0,0,&xtensa_mask14,0,0,0)
XTREG(128,512,10, 4, 4,0x201b,0x0006,-2, 6,0x1010,ptbase,
- 0,0,&xtensa_mask15,0,0,0)
+ 0,0,&xtensa_mask15,0,0,0)
XTREG_END
};
ps_err_e
ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ lwpid_t lwpid, int idx, void **base)
{
xtensa_elf_gregset_t regs;
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
- svr4_fetch_objfile_link_map);
+ svr4_fetch_objfile_link_map);
}
void _initialize_xtensa_linux_tdep ();
/* Some targets cannot read TIE register files. */
else if (type == xtRegisterTypeTieRegfile)
- {
+ {
/* Use 'fetch' to get register? */
if (flags & xtTargetFlagsUseFetchStore)
{
/* On most targets, we cannot write registers
of type "Unknown" or "Unmapped". */
if (type == xtRegisterTypeUnmapped || type == xtRegisterTypeUnknown)
- {
+ {
if ((flags & xtTargetFlagsNonVisibleRegs) == 0)
{
warning (_("cannot write register %s"),
/* Some targets cannot read TIE register files. */
else if (type == xtRegisterTypeTieRegfile)
- {
+ {
/* Use 'store' to get register? */
if (flags & xtTargetFlagsUseFetchStore)
{
/* We can always write mapped registers. */
else if (type == xtRegisterTypeMapped || type == xtRegisterTypeTieState)
- {
+ {
xtensa_register_write_masked (regcache, reg, buffer);
return;
}
for (ia = start_addr, bt = ia; ia < current_pc ; ia += ilen)
{
if (ia + xtensa_isa_maxlength (isa) > bt)
- {
+ {
ba = ia;
bt = (ba + XTENSA_ISA_BSZ) < current_pc
? ba + XTENSA_ISA_BSZ : current_pc;
{
/* Set A4...A7/A11. */
/* Get the SP of the frame previous to the previous one.
- To achieve this, we have to dereference SP twice. */
+ To achieve this, we have to dereference SP twice. */
sp = (CORE_ADDR) read_memory_integer (sp - 12, 4, byte_order);
sp = (CORE_ADDR) read_memory_integer (sp - 12, 4, byte_order);
sp -= cache->wd.callsize * 4;
/* Convert A-register numbers to AR-register numbers,
if we deal with A-register. */
if (regnum >= gdbarch_tdep (gdbarch)->a0_base
- && regnum <= gdbarch_tdep (gdbarch)->a0_base + 15)
+ && regnum <= gdbarch_tdep (gdbarch)->a0_base + 15)
regnum = arreg_number (gdbarch, regnum, cache->wd.wb);
/* Check, if we deal with AR-register saved on stack. */
gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb);
DEBUGTRACE ("[xtensa_store_return_value] callsize %d wb %d\n",
- callsize, (int) wb);
+ callsize, (int) wb);
}
else
{
(int) sp, (int) return_method, (int) struct_addr);
for (int i = 0; i < nargs; i++)
- {
+ {
struct value *arg = args[i];
struct type *arg_type = check_typedef (value_type (arg));
fprintf_unfiltered (gdb_stdlog, "%2d: %s %3s ", i,
for (ia = start_pc, bt = ia; ia < finish_pc ; ia += ilen)
{
if (ia + xtensa_isa_maxlength (isa) > bt)
- {
+ {
ba = ia;
bt = (ba + XTENSA_ISA_BSZ) < finish_pc
? ba + XTENSA_ISA_BSZ : finish_pc;
/* 3 operands: dst, src1, src2. */
gdb_assert (nods == 3);
if (src[odv[1]].fr_reg == C0_CONST)
- {
+ {
dst[odv[0]].fr_reg = src[odv[2]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[2]].fr_ofs + src[odv[1]].fr_ofs;
}
else if (src[odv[2]].fr_reg == C0_CONST)
- {
+ {
dst[odv[0]].fr_reg = src[odv[1]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[1]].fr_ofs + src[odv[2]].fr_ofs;
}
/* else fall through. */
}
if (src[odv[1]].fr_reg == C0_CONST)
- {
+ {
dst[odv[0]].fr_reg = src[odv[2]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[2]].fr_ofs & src[odv[1]].fr_ofs;
}
else if (src[odv[2]].fr_reg == C0_CONST)
- {
+ {
dst[odv[0]].fr_reg = src[odv[1]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[1]].fr_ofs & src[odv[2]].fr_ofs;
}
/* 3 operands: dst, src1, src2. */
gdb_assert (nods == 3);
if (src[odv[2]].fr_reg == C0_CONST)
- {
+ {
dst[odv[0]].fr_reg = src[odv[1]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[1]].fr_ofs - src[odv[2]].fr_ofs;
}
&& src[odv[0]].fr_reg >= 0 /* Value is from a register. */
&& src[odv[0]].fr_ofs == 0 /* Value hasn't been modified. */
&& src[src[odv[0]].fr_reg].to_stk == C0_NOSTK) /* First time. */
- {
+ {
/* ISA encoding guarantees alignment. But, check it anyway. */
gdb_assert ((odv[2] & 3) == 0);
dst[src[odv[0]].fr_reg].to_stk = src[odv[1]].fr_ofs + odv[2];
for (ia = start, bt = ia; ia < body_pc ; ia += ilen)
{
/* (Re)fill instruction buffer from memory if necessary, but do not
- read memory beyond PC to be sure we stay within text section
+ read memory beyond PC to be sure we stay within text section
(this protection only works if a non-zero pc is supplied). */
if (ia + xtensa_isa_maxlength (isa) > bt)
- {
+ {
ba = ia;
bt = (ba + XTENSA_ISA_BSZ) < body_pc ? ba + XTENSA_ISA_BSZ : body_pc;
if (target_read_memory (ba, ibuf, bt - ba) != 0 )
}
/* Analyze a bundle or a single instruction, using a snapshot of
- the register tracking info as input for the entire bundle so that
+ the register tracking info as input for the entire bundle so that
register changes do not take effect within this bundle. */
for (j = 0; j < nregs; ++j)
rtmp[j] = cache->c0.c0_rt[j];
for (is = 0; is < islots; ++is)
- {
+ {
/* Decode a slot and classify the opcode. */
fail = xtensa_format_get_slot (isa, ifmt, is, ins, slot);
if (body_pc <= pc)
{
/* Prologue analysis was successful up to the PC.
- It includes the cases when PC == START_PC. */
+ It includes the cases when PC == START_PC. */
c0_hasfp = cache->c0.c0_rt[C0_FP].fr_reg == C0_SP;
/* c0_hasfp == true means there is a frame pointer because
we analyzed the prologue and found that cache->c0.c0_rt[C0_FP]
while (insn_num++ < XTENSA_MAX_WINDOW_INTERRUPT_HANDLER_LEN)
{
if (ia + xtensa_isa_maxlength (isa) > bt)
- {
+ {
ba = ia;
bt = (ba + XTENSA_ISA_BSZ);
if (target_read_memory (ba, ibuf, bt - ba) != 0)
+2020-11-02 Simon Marchi <simon.marchi@efficios.com>
+
+ * ax.cc: Fix indentation.
+ * dll.cc: Fix indentation.
+ * inferiors.h: Fix indentation.
+ * linux-low.cc: Fix indentation.
+ * linux-nios2-low.cc: Fix indentation.
+ * linux-ppc-ipa.cc: Fix indentation.
+ * linux-ppc-low.cc: Fix indentation.
+ * linux-x86-low.cc: Fix indentation.
+ * linux-xtensa-low.cc: Fix indentation.
+ * regcache.cc: Fix indentation.
+ * server.cc: Fix indentation.
+ * tracepoint.cc: Fix indentation.
+
2020-10-31 Simon Marchi <simon.marchi@polymtl.ca>
* acinclude.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE +
read_inferior_memory (tem, str, j);
str[j] = 0;
- printf (current_substring, (char *) str);
+ printf (current_substring, (char *) str);
}
break;
{
long long val = args[i];
- printf (current_substring, val);
+ printf (current_substring, val);
break;
}
#else
else
{
/* DLL has been found so remove the entry and free associated
- resources. */
+ resources. */
all_dlls.erase (iter);
dlls_changed = 1;
}
next++;
if (func (*cur))
- return *cur;
+ return *cur;
cur = next;
}
if (event_thread == NULL)
{
/* No single-stepping LWP. Select one at random, out of those
- which have had events. */
+ which have had events. */
event_thread = find_thread_in_random ([&] (thread_info *thread)
{
ps_err_e
ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ lwpid_t lwpid, int idx, void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
#endif
default:
internal_error (__FILE__, __LINE__,
- "unknown ipa tdesc index: %d", idx);
+ "unknown ipa tdesc index: %d", idx);
#ifdef __powerpc64__
return tdesc_powerpc_64l;
#else
else if (__BYTE_ORDER == __BIG_ENDIAN)
{
/* Big-endian values sit at the right end of the buffer. In case of
- registers whose sizes are smaller than sizeof (long), we must use a
- padding to access them correctly. */
+ registers whose sizes are smaller than sizeof (long), we must use a
+ padding to access them correctly. */
int size = register_size (regcache->tdesc, regno);
if (size < sizeof (long))
else if (__BYTE_ORDER == __BIG_ENDIAN)
{
/* Big-endian values sit at the right end of the buffer. In case of
- registers whose sizes are smaller than sizeof (long), we must use a
- padding to access them correctly. */
+ registers whose sizes are smaller than sizeof (long), we must use a
+ padding to access them correctly. */
int size = register_size (regcache->tdesc, regno);
if (size < sizeof (long))
ori reg, reg, <imm[15:0]> */
p += GEN_LIS (p, reg, ((imm >> 48) & 0xffff));
if (((imm >> 32) & 0xffff) != 0)
- p += GEN_ORI (p, reg, reg, ((imm >> 32) & 0xffff));
+ p += GEN_ORI (p, reg, reg, ((imm >> 32) & 0xffff));
p += GEN_RLDICR (p, reg, reg, 32, 31);
if (((imm >> 16) & 0xffff) != 0)
- p += GEN_ORIS (p, reg, reg, ((imm >> 16) & 0xffff));
+ p += GEN_ORIS (p, reg, reg, ((imm >> 16) & 0xffff));
if ((imm & 0xffff) != 0)
- p += GEN_ORI (p, reg, reg, (imm & 0xffff));
+ p += GEN_ORI (p, reg, reg, (imm & 0xffff));
}
return p - buf;
| Expand stack as needed.
|
+-
- | Some padding for minimum stack frame and 16-byte alignment.
- | 16 bytes.
+ | Some padding for minimum stack frame and 16-byte alignment.
+ | 16 bytes.
SP +- Back-chain (SP')
initial frame size
| Expand stack as needed.
|
+-
- | Some padding for minimum stack frame.
- | 112 for ELFv1.
+ | Some padding for minimum stack frame.
+ | 112 for ELFv1.
SP +- Back-chain (SP')
initial frame size
/* Restore registers. */
"ld 31, -8(1) \n"
"ld 30, -16(1) \n"
- /* Restore LR. */
+ /* Restore LR. */
"ld 0, 16(1) \n"
/* Return 0 for no-error. */
"li 3, 0 \n"
if (register_size (regcache->tdesc, 0) == 8)
{
if (is_elfv2_inferior ())
- return &ppc64v2_emit_ops_impl;
+ return &ppc64v2_emit_ops_impl;
else
- return &ppc64v1_emit_ops_impl;
+ return &ppc64v1_emit_ops_impl;
}
#endif
return &ppc_emit_ops_impl;
if (register_size (regcache->tdesc, 0) == 4)
{
void *ptr = ((gdb_byte *) buf
- + i386_regmap[find_regno (regcache->tdesc, "eax")]);
+ + i386_regmap[find_regno (regcache->tdesc, "eax")]);
*(int64_t *) ptr = *(int32_t *) ptr;
}
ps_err_e
ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ lwpid_t lwpid, int idx, void **base)
{
xtensa_elf_gregset_t regs;
if (size > (int) sizeof (ULONGEST))
error (_("That operation is not available on integers of more than"
- "%d bytes."),
- (int) sizeof (ULONGEST));
+ "%d bytes."),
+ (int) sizeof (ULONGEST));
*val = 0;
collect_register (regcache, regnum, val);
}
if (cs.last_status.kind != TARGET_WAITKIND_EXITED
- && cs.last_status.kind != TARGET_WAITKIND_SIGNALLED
+ && cs.last_status.kind != TARGET_WAITKIND_SIGNALLED
&& cs.last_status.kind != TARGET_WAITKIND_NO_RESUMED)
current_thread->last_status = cs.last_status;
disable_async_io ();
if (cs.last_status.kind == TARGET_WAITKIND_EXITED
- || cs.last_status.kind == TARGET_WAITKIND_SIGNALLED)
- target_mourn_inferior (cs.last_ptid);
+ || cs.last_status.kind == TARGET_WAITKIND_SIGNALLED)
+ target_mourn_inferior (cs.last_ptid);
}
}
- If --once was specified, we're done.
- If not in extended-remote mode, and we're no longer
- debugging anything, simply exit: GDB has disconnected
- after processing the last process exit.
+ debugging anything, simply exit: GDB has disconnected
+ after processing the last process exit.
- Otherwise, close the connection and reopen it at the
- top of the loop. */
+ top of the loop. */
if (run_once || (!extended_protocol && !target_running ()))
throw_quit ("Quit");
/* Tell IPA about the correct tdesc. */
if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
target_get_ipa_tdesc_idx ()))
- error ("Error setting ipa_tdesc_idx variable in lib");
+ error ("Error setting ipa_tdesc_idx variable in lib");
}
/* Start out empty. */
+2020-11-02 Simon Marchi <simon.marchi@efficios.com>
+
+ * common-exceptions.h: Fix indentation.
+ * event-loop.cc: Fix indentation.
+ * fileio.cc: Fix indentation.
+ * filestuff.cc: Fix indentation.
+ * gdb-dlfcn.cc: Fix indentation.
+ * gdb_string_view.h: Fix indentation.
+ * job-control.cc: Fix indentation.
+ * signals.cc: Fix indentation.
+
2020-10-31 Simon Marchi <simon.marchi@polymtl.ca>
* common-debug.cc (debug_prefixed_printf): New.
CATCH_SJLJ (e, RETURN_MASK_ERROR)
{
switch (e.reason)
- {
- case RETURN_ERROR: ...
- }
+ {
+ case RETURN_ERROR: ...
+ }
}
END_CATCH_SJLJ
{
#ifdef HAVE_POLL
/* Check to see if poll () is usable. If not, we'll switch to
- use select. This can happen on systems like
- m68k-motorola-sys, `poll' cannot be used to wait for `stdin'.
- On m68k-motorola-sysv, tty's are not stream-based and not
- `poll'able. */
+ use select. This can happen on systems like
+ m68k-motorola-sys, `poll' cannot be used to wait for `stdin'.
+ On m68k-motorola-sysv, tty's are not stream-based and not
+ `poll'able. */
fds.fd = fd;
fds.events = POLLIN;
if (poll (&fds, 1, 0) == 1 && (fds.revents & POLLNVAL))
{
#ifdef HAVE_POLL
/* Create a new poll_fds array by copying every fd's information
- but the one we want to get rid of. */
+ but the one we want to get rid of. */
new_poll_fds = (struct pollfd *)
xmalloc ((gdb_notifier.num_fds - 1) * sizeof (struct pollfd));
switch (error)
{
case EPERM:
- return FILEIO_EPERM;
+ return FILEIO_EPERM;
case ENOENT:
- return FILEIO_ENOENT;
+ return FILEIO_ENOENT;
case EINTR:
- return FILEIO_EINTR;
+ return FILEIO_EINTR;
case EIO:
- return FILEIO_EIO;
+ return FILEIO_EIO;
case EBADF:
- return FILEIO_EBADF;
+ return FILEIO_EBADF;
case EACCES:
- return FILEIO_EACCES;
+ return FILEIO_EACCES;
case EFAULT:
- return FILEIO_EFAULT;
+ return FILEIO_EFAULT;
case EBUSY:
- return FILEIO_EBUSY;
+ return FILEIO_EBUSY;
case EEXIST:
- return FILEIO_EEXIST;
+ return FILEIO_EEXIST;
case ENODEV:
- return FILEIO_ENODEV;
+ return FILEIO_ENODEV;
case ENOTDIR:
- return FILEIO_ENOTDIR;
+ return FILEIO_ENOTDIR;
case EISDIR:
- return FILEIO_EISDIR;
+ return FILEIO_EISDIR;
case EINVAL:
- return FILEIO_EINVAL;
+ return FILEIO_EINVAL;
case ENFILE:
- return FILEIO_ENFILE;
+ return FILEIO_ENFILE;
case EMFILE:
- return FILEIO_EMFILE;
+ return FILEIO_EMFILE;
case EFBIG:
- return FILEIO_EFBIG;
+ return FILEIO_EFBIG;
case ENOSPC:
- return FILEIO_ENOSPC;
+ return FILEIO_ENOSPC;
case ESPIPE:
- return FILEIO_ESPIPE;
+ return FILEIO_ESPIPE;
case EROFS:
- return FILEIO_EROFS;
+ return FILEIO_EROFS;
case ENOSYS:
- return FILEIO_ENOSYS;
+ return FILEIO_ENOSYS;
case ENAMETOOLONG:
- return FILEIO_ENAMETOOLONG;
+ return FILEIO_ENAMETOOLONG;
}
return FILEIO_EUNKNOWN;
}
component_end++;
/* Temporarily replace the slash with a null terminator, so we can create
- the directory up to this component. */
+ the directory up to this component. */
char saved_char = *component_end;
*component_end = '\0';
/* If we get EEXIST and the existing path is a directory, then we're
- happy. If it exists, but it's a regular file and this is not the last
- component, we'll fail at the next component. If this is the last
- component, the caller will fail with ENOTDIR when trying to
- open/create a file under that path. */
+ happy. If it exists, but it's a regular file and this is not the last
+ component, we'll fail at the next component. If this is the last
+ component, the caller will fail with ENOTDIR when trying to
+ open/create a file under that path. */
if (mkdir (start, 0700) != 0)
if (errno != EEXIST)
return false;
dw = GetLastError();
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buffer,
- 0, NULL);
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &buffer,
+ 0, NULL);
error (_("Could not load %s: %s"), filename, (char *) buffer);
}
constexpr basic_string_view(const basic_string_view&) noexcept = default;
template<typename _Allocator>
- basic_string_view(const std::basic_string<_CharT, _Traits,
+ basic_string_view(const std::basic_string<_CharT, _Traits,
_Allocator>& __str) noexcept
- : _M_len{__str.length()}, _M_str{__str.data()}
- { }
+ : _M_len{__str.length()}, _M_str{__str.data()}
+ { }
/*constexpr*/ basic_string_view(const _CharT* __str)
: _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
constexpr basic_string_view(const _CharT* __str, size_type __len)
: _M_len{__len},
- _M_str{__str}
+ _M_str{__str}
{ }
basic_string_view&
// [string.view.ops], string operations:
template<typename _Allocator>
- explicit operator std::basic_string<_CharT, _Traits, _Allocator>() const
- {
+ explicit operator std::basic_string<_CharT, _Traits, _Allocator>() const
+ {
return { this->_M_str, this->_M_len };
}
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator==(basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator==(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator!=(basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator!=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator< (basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator< (basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator> (basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator> (basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator<=(basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator<=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator>=(basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator>=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
/*constexpr*/ bool
operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
+ basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
// basic_string_view typedef names
{
#ifdef HAVE_SETPGID
/* The call setpgid (0, 0) is supposed to work and mean the same
- thing as this, but on Ultrix 4.2A it fails with EPERM (and
- setpgid (getpid (), getpid ()) succeeds). */
+ thing as this, but on Ultrix 4.2A it fails with EPERM (and
+ setpgid (getpid (), getpid ()) succeeds). */
retval = setpgid (getpid (), getpid ());
#else
#ifdef HAVE_SETPGRP
&& oursig <= GDB_SIGNAL_REALTIME_63)
{
/* This block of signals is continuous, and
- GDB_SIGNAL_REALTIME_33 is 33 by definition. */
+ GDB_SIGNAL_REALTIME_33 is 33 by definition. */
retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_33 + 33;
}
else if (oursig == GDB_SIGNAL_REALTIME_32)
{
/* GDB_SIGNAL_REALTIME_32 isn't contiguous with
- GDB_SIGNAL_REALTIME_33. It is 32 by definition. */
+ GDB_SIGNAL_REALTIME_33. It is 32 by definition. */
retsig = 32;
}
else if (oursig >= GDB_SIGNAL_REALTIME_64
&& oursig <= GDB_SIGNAL_REALTIME_127)
{
/* This block of signals is continuous, and
- GDB_SIGNAL_REALTIME_64 is 64 by definition. */
+ GDB_SIGNAL_REALTIME_64 is 64 by definition. */
retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_64 + 64;
}
if (!oursig_ok)
{
/* The user might be trying to do "signal SIGSAK" where this system
- doesn't have SIGSAK. */
+ doesn't have SIGSAK. */
warning (_("Signal %s does not exist on this system."),
gdb_signal_to_name (oursig));
return 0;