def bregN(self, regnum): '''The single operand of the DW_OP_bregn operations provides a signed LEB128 offset from the specified register.''' offset = SLEB.decode(self.expression) if offset > 0: self.push('(char *) get_reg(%i) + %#x' % (regnum, offset)) elif offset < 0: self.push('(char *) get_reg(%i) - %#x' % (regnum, abs(offset))) else: self.push('(char *) get_reg(%i)' % (regnum))
def fbreg(self): '''The DW_OP_fbreg operation provides a signed LEB128 offset from the address specified by the location description in the DW_AT_frame_base attribute of the current function. (This is typically a "stack pointer" register plus or minus some offset. On more sophisticated systems it might be a location list that adjusts the offset according to changes in the stack pointer as the PC changes.)''' offset = SLEB.decode(self.expression) if offset > 0: self.push('__adbi_frame__ + %#x' % offset) elif offset < 0: self.push('__adbi_frame__ - %#x' % abs(offset)) else: self.push('__adbi_frame__') self.uses_frame = True
def consts(self): '''The single operand of the DW_OP_consts operation provides a signed LEB128 integer constant.''' val = SLEB.decode(self.expression) self.push('%#x' % val)