@@ -105,6 +105,9 @@ def run(self):
105105 killed = False
106106
107107 def __hexstr (value : int , nibbles : int = 0 ) -> str :
108+ """Encode a value into a hex string.
109+ """
110+
108111 length = (nibbles or self .ql .arch .bits // 4 ) // 2
109112 byteorder = 'little' if self .ql .arch .endian == QL_ENDIAN .EL else 'big'
110113
@@ -233,14 +236,16 @@ def handle_c(subcmd: str) -> Reply:
233236
234237
235238 def handle_g (subcmd : str ) -> Reply :
236- # TODO: several obsolete regs cause arm to have a gap just before cpsr. the nonexistant regs
237- # are represented as None entries just to make sure cpsr stays at index 25. however, it is
238- # not clear whether its value should follow a series of 'x' (for the non-existant regs) or
239- # not. the original code suggests not (perhaps because fpa is not specified as an xml feature..?)
239+ # NOTE: in the past the 'g' reply packet for arm included the f0-f7 and fps registers between pc
240+ # and cpsr, which placed cpsr at index (regnum) 25. as the f-registers became obsolete the cpsr
241+ # index decreased. in order to maintain backward compatibility with older gdb versions, the gap
242+ # between pc and cpsr that used to represent the f-registers (96 bits each + 32 bits for fps) is
243+ # filled with unknown reg values.
244+ #
245+ # gdb clients that follow the xml definitions no longer need these placeholders, as registers
246+ # indices are flexible and may be defined arbitrarily though xml.
240247 #
241- # non-existant regs are f0-f7 (96 bits each) and fps (32 bits).
242248 # see: ./xml/arm/arm-fpa.xml
243- # see: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/arch/arm.h;h=fa589fd0582c0add627a068e6f4947a909c45e86;hb=HEAD#l127
244249
245250 return '' .join (__get_reg_value (* entry ) for entry in self .regsmap )
246251
0 commit comments