#!/usr/bin/env python3 # # Copyright (c) 2022 Huawei Technologies SASU # # SPDX-License-Identifier: Apache-2.0 import binascii import logging import struct from gdbstubs.gdbstub import GdbStub logger = logging.getLogger("gdbstub") class RegNum(): X0 = 0 # X0-X29 - 30 GP registers X1 = 1 X2 = 2 X3 = 3 X4 = 4 X5 = 5 X6 = 6 X7 = 7 X8 = 8 X9 = 9 X10 = 10 X11 = 11 X12 = 12 X13 = 13 X14 = 14 X15 = 15 X16 = 16 X17 = 17 X18 = 18 X19 = 19 X20 = 20 X21 = 21 X22 = 22 X23 = 23 X24 = 24 X25 = 25 X26 = 26 X27 = 27 X28 = 28 X29 = 29 # Frame pointer register LR = 30 # X30 Link Register(LR) SP_EL0 = 31 # Stack pointer EL0 (SP_EL0) PC = 32 # Program Counter (PC) class GdbStub_ARM64(GdbStub): ARCH_DATA_BLK_STRUCT = " unknown value # Send in "xxxxxxxx" pkt += b'x' * 16 idx += 1 self.put_gdb_packet(pkt) def handle_register_single_read_packet(self, pkt): # Mark registers as "". # 'p' packets are usually used for registers # other than the general ones (e.g. eax, ebx) # so we can safely reply "xxxxxxxx" here. self.put_gdb_packet(b'x' * 16)