drgn/libdrgn/arch_aarch64_defs.py
Omar Sandoval 222680b47a Add StackFrame.sp
We have some generic helpers that we'd like to add (for example, #210)
that need to know the stack pointer of a frame. These shouldn't need to
hard-code register names for different architectures. Add a generic
shortcut, StackFrame.sp.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
2022-11-22 18:47:16 -08:00

25 lines
855 B
Python

# Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: LGPL-2.1-or-later
REGISTERS = [
*[DrgnRegister(f"x{i}") for i in range(29)],
DrgnRegister(["x29", "fp"]),
DrgnRegister(["x30", "lr"]),
DrgnRegister("sp"),
DrgnRegister("pstate"),
]
REGISTER_LAYOUT = [
DrgnRegisterLayout("ra_sign_state", size=8, dwarf_number=34),
DrgnRegisterLayout("sp", size=8, dwarf_number=31),
# Callee-saved registers.
*[DrgnRegisterLayout(f"x{i}", size=8, dwarf_number=i) for i in range(19, 31)],
# Caller-saved registers.
*[DrgnRegisterLayout(f"x{i}", size=8, dwarf_number=i) for i in range(19)],
# This pc register is only used for interrupted frames.
DrgnRegisterLayout("pc", size=8, dwarf_number=32),
DrgnRegisterLayout("pstate", size=8, dwarf_number=None),
]
STACK_POINTER_REGISTER = "sp"