binutils-gdb/gdb/aarch64-ravenscar-thread.c

196 lines
5.5 KiB
C
Raw Normal View History

/* Ravenscar Aarch64 target support.
Copyright (C) 2017-2019 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
Sort includes for files gdb/[a-f]*.[chyl]. This patch sorts the include files for the files [a-f]*.[chyl]. The patch was written by a script. Tested by the buildbot. I will follow up with patches to sort the remaining files, by sorting a subset, testing them, and then checking them in. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> * ft32-tdep.c: Sort headers. * frv-tdep.c: Sort headers. * frv-linux-tdep.c: Sort headers. * frame.c: Sort headers. * frame-unwind.c: Sort headers. * frame-base.c: Sort headers. * fork-child.c: Sort headers. * findvar.c: Sort headers. * findcmd.c: Sort headers. * filesystem.c: Sort headers. * filename-seen-cache.h: Sort headers. * filename-seen-cache.c: Sort headers. * fbsd-tdep.c: Sort headers. * fbsd-nat.h: Sort headers. * fbsd-nat.c: Sort headers. * f-valprint.c: Sort headers. * f-typeprint.c: Sort headers. * f-lang.c: Sort headers. * extension.h: Sort headers. * extension.c: Sort headers. * extension-priv.h: Sort headers. * expprint.c: Sort headers. * exec.h: Sort headers. * exec.c: Sort headers. * exceptions.c: Sort headers. * event-top.c: Sort headers. * event-loop.c: Sort headers. * eval.c: Sort headers. * elfread.c: Sort headers. * dwarf2read.h: Sort headers. * dwarf2read.c: Sort headers. * dwarf2loc.c: Sort headers. * dwarf2expr.h: Sort headers. * dwarf2expr.c: Sort headers. * dwarf2-frame.c: Sort headers. * dwarf2-frame-tailcall.c: Sort headers. * dwarf-index-write.h: Sort headers. * dwarf-index-write.c: Sort headers. * dwarf-index-common.c: Sort headers. * dwarf-index-cache.h: Sort headers. * dwarf-index-cache.c: Sort headers. * dummy-frame.c: Sort headers. * dtrace-probe.c: Sort headers. * disasm.h: Sort headers. * disasm.c: Sort headers. * disasm-selftests.c: Sort headers. * dictionary.c: Sort headers. * dicos-tdep.c: Sort headers. * demangle.c: Sort headers. * dcache.h: Sort headers. * dcache.c: Sort headers. * darwin-nat.h: Sort headers. * darwin-nat.c: Sort headers. * darwin-nat-info.c: Sort headers. * d-valprint.c: Sort headers. * d-namespace.c: Sort headers. * d-lang.c: Sort headers. * ctf.c: Sort headers. * csky-tdep.c: Sort headers. * csky-linux-tdep.c: Sort headers. * cris-tdep.c: Sort headers. * cris-linux-tdep.c: Sort headers. * cp-valprint.c: Sort headers. * cp-support.c: Sort headers. * cp-namespace.c: Sort headers. * cp-abi.c: Sort headers. * corelow.c: Sort headers. * corefile.c: Sort headers. * continuations.c: Sort headers. * completer.h: Sort headers. * completer.c: Sort headers. * complaints.c: Sort headers. * coffread.c: Sort headers. * coff-pe-read.c: Sort headers. * cli-out.h: Sort headers. * cli-out.c: Sort headers. * charset.c: Sort headers. * c-varobj.c: Sort headers. * c-valprint.c: Sort headers. * c-typeprint.c: Sort headers. * c-lang.c: Sort headers. * buildsym.c: Sort headers. * buildsym-legacy.c: Sort headers. * build-id.h: Sort headers. * build-id.c: Sort headers. * btrace.c: Sort headers. * bsd-uthread.c: Sort headers. * breakpoint.h: Sort headers. * breakpoint.c: Sort headers. * break-catch-throw.c: Sort headers. * break-catch-syscall.c: Sort headers. * break-catch-sig.c: Sort headers. * blockframe.c: Sort headers. * block.c: Sort headers. * bfin-tdep.c: Sort headers. * bfin-linux-tdep.c: Sort headers. * bfd-target.c: Sort headers. * bcache.c: Sort headers. * ax-general.c: Sort headers. * ax-gdb.h: Sort headers. * ax-gdb.c: Sort headers. * avr-tdep.c: Sort headers. * auxv.c: Sort headers. * auto-load.c: Sort headers. * arm-wince-tdep.c: Sort headers. * arm-tdep.c: Sort headers. * arm-symbian-tdep.c: Sort headers. * arm-pikeos-tdep.c: Sort headers. * arm-obsd-tdep.c: Sort headers. * arm-nbsd-tdep.c: Sort headers. * arm-nbsd-nat.c: Sort headers. * arm-linux-tdep.c: Sort headers. * arm-linux-nat.c: Sort headers. * arm-fbsd-tdep.c: Sort headers. * arm-fbsd-nat.c: Sort headers. * arm-bsd-tdep.c: Sort headers. * arch-utils.c: Sort headers. * arc-tdep.c: Sort headers. * arc-newlib-tdep.c: Sort headers. * annotate.h: Sort headers. * annotate.c: Sort headers. * amd64-windows-tdep.c: Sort headers. * amd64-windows-nat.c: Sort headers. * amd64-tdep.c: Sort headers. * amd64-sol2-tdep.c: Sort headers. * amd64-obsd-tdep.c: Sort headers. * amd64-obsd-nat.c: Sort headers. * amd64-nbsd-tdep.c: Sort headers. * amd64-nbsd-nat.c: Sort headers. * amd64-nat.c: Sort headers. * amd64-linux-tdep.c: Sort headers. * amd64-linux-nat.c: Sort headers. * amd64-fbsd-tdep.c: Sort headers. * amd64-fbsd-nat.c: Sort headers. * amd64-dicos-tdep.c: Sort headers. * amd64-darwin-tdep.c: Sort headers. * amd64-bsd-nat.c: Sort headers. * alpha-tdep.c: Sort headers. * alpha-obsd-tdep.c: Sort headers. * alpha-nbsd-tdep.c: Sort headers. * alpha-mdebug-tdep.c: Sort headers. * alpha-linux-tdep.c: Sort headers. * alpha-linux-nat.c: Sort headers. * alpha-bsd-tdep.c: Sort headers. * alpha-bsd-nat.c: Sort headers. * aix-thread.c: Sort headers. * agent.c: Sort headers. * addrmap.c: Sort headers. * ada-varobj.c: Sort headers. * ada-valprint.c: Sort headers. * ada-typeprint.c: Sort headers. * ada-tasks.c: Sort headers. * ada-lang.c: Sort headers. * aarch64-tdep.c: Sort headers. * aarch64-ravenscar-thread.c: Sort headers. * aarch64-newlib-tdep.c: Sort headers. * aarch64-linux-tdep.c: Sort headers. * aarch64-linux-nat.c: Sort headers. * aarch64-fbsd-tdep.c: Sort headers. * aarch64-fbsd-nat.c: Sort headers. * aarch32-linux-nat.c: Sort headers.
2019-04-03 04:04:24 +02:00
#include "gdbcore.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "regcache.h"
#include "aarch64-tdep.h"
#include "inferior.h"
#include "ravenscar-thread.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "aarch64-ravenscar-thread.h"
Don't include gdbarch.h from defs.h I touched symtab.h and was surprised to see how many files were rebuilt. I looked into it a bit, and found that defs.h includes gdbarch.h, which in turn includes many things. gdbarch.h is only needed by a minority ofthe files in gdb, so this patch removes the include from defs.h and updates the fallout. I did "wc -l" on the files in build/gdb/.deps; this patch reduces the line count from 139935 to 137030; so there are definitely future build-time savings here. Note that while I configured with --enable-targets=all, it's possible that some *-nat.c file needs an update. I could not test all of these. The buildbot caught a few problems along these lines. gdb/ChangeLog 2019-07-10 Tom Tromey <tom@tromey.com> * defs.h: Don't include gdbarch.h. * aarch64-ravenscar-thread.c, aarch64-tdep.c, alpha-bsd-tdep.h, alpha-linux-tdep.c, alpha-mdebug-tdep.c, arch-utils.h, arm-tdep.h, ax-general.c, btrace.c, buildsym-legacy.c, buildsym.h, c-lang.c, cli/cli-decode.h, cli/cli-dump.c, cli/cli-script.h, cli/cli-style.h, coff-pe-read.h, compile/compile-c-support.c, compile/compile-cplus.h, compile/compile-loc2c.c, corefile.c, cp-valprint.c, cris-linux-tdep.c, ctf.c, d-lang.c, d-namespace.c, dcache.c, dicos-tdep.c, dictionary.c, disasm-selftests.c, dummy-frame.c, dummy-frame.h, dwarf2-frame-tailcall.c, dwarf2expr.c, expression.h, f-lang.c, frame-base.c, frame-unwind.c, frv-linux-tdep.c, gdbarch-selftests.c, gdbtypes.h, go-lang.c, hppa-nbsd-tdep.c, hppa-obsd-tdep.c, i386-dicos-tdep.c, i386-tdep.h, ia64-vms-tdep.c, interps.h, language.c, linux-record.c, location.h, m2-lang.c, m32r-linux-tdep.c, mem-break.c, memattr.c, mn10300-linux-tdep.c, nios2-linux-tdep.c, objfiles.h, opencl-lang.c, or1k-linux-tdep.c, p-lang.c, parser-defs.h, ppc-tdep.h, probe.h, python/py-record-btrace.c, record-btrace.c, record.h, regcache-dump.c, regcache.h, riscv-fbsd-tdep.c, riscv-linux-tdep.c, rust-exp.y, sh-linux-tdep.c, sh-nbsd-tdep.c, source-cache.c, sparc-nbsd-tdep.c, sparc-obsd-tdep.c, sparc-ravenscar-thread.c, sparc64-fbsd-tdep.c, std-regs.c, target-descriptions.h, target-float.c, tic6x-linux-tdep.c, tilegx-linux-tdep.c, top.c, tracefile.c, trad-frame.c, type-stack.h, ui-style.c, utils.c, utils.h, valarith.c, valprint.c, varobj.c, x86-tdep.c, xml-support.h, xtensa-linux-tdep.c, cli/cli-cmds.h: Update. * s390-linux-nat.c, procfs.c, inf-ptrace.c: Likewise.
2019-06-09 23:21:02 +02:00
#include "gdbarch.h"
#define NO_OFFSET -1
/* See aarch64-tdep.h for register numbers. */
static const int aarch64_context_offsets[] =
{
/* X0 - X28 */
NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
NO_OFFSET, NO_OFFSET, NO_OFFSET, 0,
8, 16, 24, 32,
40, 48, 56, 64,
72,
/* FP, LR, SP, PC, CPSR */
/* Note that as task switch is synchronous, PC is in fact the LR here */
80, 88, 96, 88,
NO_OFFSET,
/* Q0 - Q31 */
112, 128, 144, 160,
176, 192, 208, 224,
240, 256, 272, 288,
304, 320, 336, 352,
368, 384, 400, 416,
432, 448, 464, 480,
496, 512, 528, 544,
560, 576, 592, 608,
/* FPSR, FPCR */
104, 108,
/* FPU Saved field */
624
};
/* The register layout info. */
struct ravenscar_reg_info
{
/* A table providing the offset relative to the context structure
where each register is saved. */
const int *context_offsets;
/* The number of elements in the context_offsets table above. */
int context_offsets_size;
};
/* supply register REGNUM, which has been saved on REGISTER_ADDR, to the
regcache. */
static void
supply_register_at_address (struct regcache *regcache, int regnum,
CORE_ADDR register_addr)
{
struct gdbarch *gdbarch = regcache->arch ();
int buf_size = register_size (gdbarch, regnum);
gdb_byte *buf;
buf = (gdb_byte *) alloca (buf_size);
read_memory (register_addr, buf, buf_size);
regcache->raw_supply (regnum, buf);
}
/* Return true if, for a non-running thread, REGNUM has been saved on the
Thread_Descriptor. */
static int
register_in_thread_descriptor_p (const struct ravenscar_reg_info *reg_info,
int regnum)
{
/* Check FPU registers */
return (regnum < reg_info->context_offsets_size
&& reg_info->context_offsets[regnum] != NO_OFFSET);
}
/* to_fetch_registers when inferior_ptid is different from the running
thread. */
static void
aarch64_ravenscar_generic_fetch_registers
(const struct ravenscar_reg_info *reg_info,
struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
const int num_regs = gdbarch_num_regs (gdbarch);
int current_regnum;
CORE_ADDR current_address;
CORE_ADDR thread_descriptor_address;
/* The tid is the thread_id field, which is a pointer to the thread. */
thread_descriptor_address = (CORE_ADDR) inferior_ptid.tid ();
/* Read registers. */
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);
}
}
}
/* to_store_registers when inferior_ptid is different from the running
thread. */
static void
aarch64_ravenscar_generic_store_registers
(const struct ravenscar_reg_info *reg_info,
struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
int buf_size = register_size (gdbarch, regnum);
gdb_byte buf[buf_size];
ULONGEST register_address;
if (register_in_thread_descriptor_p (reg_info, regnum))
register_address
= inferior_ptid.tid () + reg_info->context_offsets [regnum];
else
return;
regcache->raw_collect (regnum, buf);
write_memory (register_address,
buf,
buf_size);
}
/* The ravenscar_reg_info for most Aarch64 targets. */
static const struct ravenscar_reg_info aarch64_reg_info =
{
aarch64_context_offsets,
ARRAY_SIZE (aarch64_context_offsets),
};
C++-ify ravenscar_arch_ops This turns ravenscar_arch_ops into an abstract base class and updates all the places where it is used. This is an improvement because it avoids any possibility of forgetting to set one of the function pointers. It also makes clear that these functions aren't intended to be changed dynamically. This version of the patch removes the prepare_to_store method, as it is unused, and it is easy enough to add if it is ever needed. gdb/ChangeLog 2019-02-15 Tom Tromey <tromey@adacore.com> * sparc-ravenscar-thread.c (struct sparc_ravenscar_ops): Derive from ravenscar_arch_ops. (sparc_ravenscar_ops::fetch_registers) (sparc_ravenscar_ops::store_registers): Now methods. (sparc_ravenscar_prepare_to_store): Remove. (sparc_ravenscar_ops): Redefine. * ravenscar-thread.h (struct ravenscar_arch_ops): Add virtual methods and destructor. Remove members. * ravenscar-thread.c (ravenscar_thread_target::fetch_registers) (ravenscar_thread_target::store_registers) (ravenscar_thread_target::prepare_to_store): Update. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_prepare_to_store): Remove. (struct ppc_ravenscar_powerpc_ops): Derive from ravenscar_arch_ops. (ppc_ravenscar_powerpc_ops::fetch_registers) (ppc_ravenscar_powerpc_ops::store_registers): Now methods. (ppc_ravenscar_powerpc_ops): Redefine. (struct ppc_ravenscar_e500_ops): Derive from ravenscar_arch_ops. (ppc_ravenscar_e500_ops::fetch_registers) (ppc_ravenscar_e500_ops::store_registers): Now methods. (ppc_ravenscar_e500_ops): Redefine. * aarch64-ravenscar-thread.c (aarch64_ravenscar_generic_prepare_to_store): Remove. (struct aarch64_ravenscar_ops): Derive from ravenscar_arch_ops. (aarch64_ravenscar_fetch_registers) (aarch64_ravenscar_store_registers): Now methods. (aarch64_ravenscar_ops): Redefine.
2019-02-05 11:08:02 +01:00
struct aarch64_ravenscar_ops : public ravenscar_arch_ops
{
C++-ify ravenscar_arch_ops This turns ravenscar_arch_ops into an abstract base class and updates all the places where it is used. This is an improvement because it avoids any possibility of forgetting to set one of the function pointers. It also makes clear that these functions aren't intended to be changed dynamically. This version of the patch removes the prepare_to_store method, as it is unused, and it is easy enough to add if it is ever needed. gdb/ChangeLog 2019-02-15 Tom Tromey <tromey@adacore.com> * sparc-ravenscar-thread.c (struct sparc_ravenscar_ops): Derive from ravenscar_arch_ops. (sparc_ravenscar_ops::fetch_registers) (sparc_ravenscar_ops::store_registers): Now methods. (sparc_ravenscar_prepare_to_store): Remove. (sparc_ravenscar_ops): Redefine. * ravenscar-thread.h (struct ravenscar_arch_ops): Add virtual methods and destructor. Remove members. * ravenscar-thread.c (ravenscar_thread_target::fetch_registers) (ravenscar_thread_target::store_registers) (ravenscar_thread_target::prepare_to_store): Update. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_prepare_to_store): Remove. (struct ppc_ravenscar_powerpc_ops): Derive from ravenscar_arch_ops. (ppc_ravenscar_powerpc_ops::fetch_registers) (ppc_ravenscar_powerpc_ops::store_registers): Now methods. (ppc_ravenscar_powerpc_ops): Redefine. (struct ppc_ravenscar_e500_ops): Derive from ravenscar_arch_ops. (ppc_ravenscar_e500_ops::fetch_registers) (ppc_ravenscar_e500_ops::store_registers): Now methods. (ppc_ravenscar_e500_ops): Redefine. * aarch64-ravenscar-thread.c (aarch64_ravenscar_generic_prepare_to_store): Remove. (struct aarch64_ravenscar_ops): Derive from ravenscar_arch_ops. (aarch64_ravenscar_fetch_registers) (aarch64_ravenscar_store_registers): Now methods. (aarch64_ravenscar_ops): Redefine.
2019-02-05 11:08:02 +01:00
void fetch_registers (struct regcache *regcache, int regnum) override
{
aarch64_ravenscar_generic_fetch_registers
(&aarch64_reg_info, regcache, regnum);
}
void store_registers (struct regcache *regcache, int regnum) override
{
aarch64_ravenscar_generic_store_registers
(&aarch64_reg_info, regcache, regnum);
}
};
/* The ravenscar_arch_ops vector for most Aarch64 targets. */
C++-ify ravenscar_arch_ops This turns ravenscar_arch_ops into an abstract base class and updates all the places where it is used. This is an improvement because it avoids any possibility of forgetting to set one of the function pointers. It also makes clear that these functions aren't intended to be changed dynamically. This version of the patch removes the prepare_to_store method, as it is unused, and it is easy enough to add if it is ever needed. gdb/ChangeLog 2019-02-15 Tom Tromey <tromey@adacore.com> * sparc-ravenscar-thread.c (struct sparc_ravenscar_ops): Derive from ravenscar_arch_ops. (sparc_ravenscar_ops::fetch_registers) (sparc_ravenscar_ops::store_registers): Now methods. (sparc_ravenscar_prepare_to_store): Remove. (sparc_ravenscar_ops): Redefine. * ravenscar-thread.h (struct ravenscar_arch_ops): Add virtual methods and destructor. Remove members. * ravenscar-thread.c (ravenscar_thread_target::fetch_registers) (ravenscar_thread_target::store_registers) (ravenscar_thread_target::prepare_to_store): Update. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_prepare_to_store): Remove. (struct ppc_ravenscar_powerpc_ops): Derive from ravenscar_arch_ops. (ppc_ravenscar_powerpc_ops::fetch_registers) (ppc_ravenscar_powerpc_ops::store_registers): Now methods. (ppc_ravenscar_powerpc_ops): Redefine. (struct ppc_ravenscar_e500_ops): Derive from ravenscar_arch_ops. (ppc_ravenscar_e500_ops::fetch_registers) (ppc_ravenscar_e500_ops::store_registers): Now methods. (ppc_ravenscar_e500_ops): Redefine. * aarch64-ravenscar-thread.c (aarch64_ravenscar_generic_prepare_to_store): Remove. (struct aarch64_ravenscar_ops): Derive from ravenscar_arch_ops. (aarch64_ravenscar_fetch_registers) (aarch64_ravenscar_store_registers): Now methods. (aarch64_ravenscar_ops): Redefine.
2019-02-05 11:08:02 +01:00
static struct aarch64_ravenscar_ops aarch64_ravenscar_ops;
/* Register aarch64_ravenscar_ops in GDBARCH. */
void
register_aarch64_ravenscar_ops (struct gdbarch *gdbarch)
{
set_gdbarch_ravenscar_ops (gdbarch, &aarch64_ravenscar_ops);
}