#!/usr/bin/env python3 # # Copyright (c) 2021 Facebook, Inc. and its affiliates # # SPDX-License-Identifier: Apache-2.0 import binascii import logging import struct from gdbstubs.gdbstub import GdbStub logger = logging.getLogger("gdbstub") class RegNum(): ZERO = 0 RA = 1 SP = 2 GP = 3 TP = 4 T0 = 5 T1 = 6 T2 = 7 FP = 8 S1 = 9 A0 = 10 A1 = 11 A2 = 12 A3 = 13 A4 = 14 A5 = 15 A6 = 16 A7 = 17 S2 = 18 S3 = 19 S4 = 20 S5 = 21 S6 = 22 S7 = 23 S8 = 24 S9 = 25 S10 = 26 S11 = 27 T3 = 28 T4 = 29 T5 = 30 T6 = 31 PC = 32 class GdbStub_RISC_V(GdbStub): ARCH_DATA_BLK_STRUCT = " unknown value # Send in "xxxxxxxx" length = 8 if self.arch_data_ver == 1 else 16 pkt += b'x' * length idx += 1 self.put_gdb_packet(pkt) def handle_register_single_read_packet(self, pkt): # Mark registers as "". 'p' packets are not sent for the registers # currently handled in this file so we can safely reply "xxxxxxxx" here. length = 8 if self.arch_data_ver == 1 else 16 self.put_gdb_packet(b'x' * length)