mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-24 10:03:05 +00:00
222680b47a
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>
25 lines
855 B
Python
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"
|