mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-22 09:13:06 +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
977 B
Python
25 lines
977 B
Python
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
REGISTERS = [
|
|
*[DrgnRegister(f"r{i}") for i in range(32)],
|
|
DrgnRegister("lr"),
|
|
*[DrgnRegister(f"cr{i}") for i in range(8)],
|
|
]
|
|
|
|
# There are two conflicting definitions of DWARF register numbers after 63. The
|
|
# original definition appears to be "64-bit PowerPC ELF Application Binary
|
|
# Interface Supplement" [1]. The GNU toolchain instead uses its own that was
|
|
# later codified in "Power Architecture 64-Bit ELF V2 ABI Specification" [2].
|
|
# We use the latter.
|
|
#
|
|
# 1: https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html
|
|
# 2: https://openpowerfoundation.org/specifications/64bitelfabi/
|
|
REGISTER_LAYOUT = [
|
|
DrgnRegisterLayout("lr", size=8, dwarf_number=65),
|
|
*[DrgnRegisterLayout(f"r{i}", size=8, dwarf_number=i) for i in range(32)],
|
|
*[DrgnRegisterLayout(f"cr{i}", size=8, dwarf_number=68 + i) for i in range(8)],
|
|
]
|
|
|
|
STACK_POINTER_REGISTER = "r1"
|