def __init__(self): Analyzer.__init__(self) # definition of inner variables self.mode = 0 # definition of error spring list self.error_list = [ -1002, -1003, -1004, -1005, -1006, -1102, -1103, -1104, -1105, -1303, -1304, -1603, -1604, -1605, -1606, -1607, -1703, -1704, -1705, -1706 ] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -2201, None), # T22.0.0 EOSeq -> missing second operand (self.immediate_op_analyzer, None, 1000, self.imm_operand), # T22.0.1 immediate operand (self.register_analyzer, ',', 1000, self.error_spring, # T22.0.2a single register 1, self.error_spring, # T22.0.2b maybe shifted reg -2202, self.error_spring)], # T22.0.2c NEVER happens -2203), # T22.0.3 unrecognizable second operand 1: # parsing shift mode ([(None, None, -2204, None), # T22.1.0 EOSeq -> missing shift mode (' ', None, 1, None), # T22.1.1 skip spaces (self.ent0, ' ', -2205, None, # T22.1.2a missing info after shift mode 2, self.catch_mode, # T22.1.2b continue parsing shift info -2206, None)], # T22.1.2c missing space after shift mode -2206), # T22.1.3 unrecognized shift mode 2: # parsing shift info ([(None, None, -2205, None), # T22.2.0 EOSeq -> missing info after shift mode (self.register_analyzer, None, 1000, self.reg_shifting), # T22.2.1 parse reg-based shift (self.immediate_sr_analyzer, None, 1000, self.imm_shifting)], # T22.2.2 parse imm-based shift -2207) # T22.2.3 wrong info after shift mode (NEVER happens) }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [ -1002, -1003, -1004, -1005, -1102, -1103, -1104, -1105, -1302, -1303, -1304, -1603, -1604, -1605, -1606, -1607, -1703, -1704, -1705, -1706, -2204, -2205, -2207 ] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -2301, None), # T23.0.0 EOSeq -> missing operands (self.register_analyzer, ',', -2302, self.error_spring, # T23.0.1a only destination reg 1, self.catch_dest, # T23.0.1b dest reg, continue -2309, self.error_spring)], # T23.0.1c NEVER happens -2303), # T23.0.2 unrecognizable destination register 1: # parsing source operand (source 1 or source 2) ([(None, None, -2304, None), # T23.1.0 EOSeq -> missing source operands (self.op2_analyzer, None, 1000, self.catch_source2), # T23.1.1 parse imm-based shift (self.register_analyzer, ',', 1000, self.catch_source2, # T23.1.2a only one source reg 2, self.catch_source1, # T23.1.2b source 1, continue -2305, None)], # T23.1.2c NEVER happens -2306), # T23.1.3 unrecognized source operand 2: # parsing second source operand ([(None, None, -2307, None), # T23.2.0 EOSeq -> missing second operand (NEVER happens) (self.op2_analyzer, None, 1000, self.catch_source2)], # T23.2.1 parse second op -2308) # T23.2.2 wrong text after second register }
def __init__(self): Analyzer.__init__(self) self.add_source_callback(self.__map_callback) self.header = 2 #number of entries to jump ahead self.config_to_pdcp = dict( ) #dict mapping from logical channel to pdcp packets self.config_to_rlc = dict( ) #dict mapping from logical channel to rlc packets self.latency_blocks = list() #list of unmapped blocks from PDSCH logs self.unmapped_pdcp_rlc = list() self.mapped_all = list() #(pdcp, rlc, mac transport block, mac delay) self.last_ordered_packet = dict() self.not_ordered_packet = dict() self.last_round_complete = dict() self.last_packet_processed = dict() self.updated_SN = dict() self.cell_id = dict( ) # cell_name -> idx Keep index for each type of cell self.idx = 0 # current recorded cell idx self.failed_harq = [0] * 8 * 3 * 2 self.mac_delays = list() self.kpi = list() self.discarded_packets_stat = { "pdcp": 0, "mac": 0, "rlc": 0, "mapped_pdcp_rlc": 0, "mapped_pdcp_rlc_mac": 0, "latency_block": 0 }
def __init__(self): Analyzer.__init__(self) # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -3001, None), # T30.0.0 EOSeq -> missing instruction condition (self.ent0, None, 1000, None)], # T30.0.1 positive detection -3002) # T30.0.2 unrecognizable condition }
def __init__(self): Analyzer.__init__(self) # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -1301, None), # T13.0.0 EOSeq -> missing register error (' ', None, 0, None), # T13.0.1 white spaces -> keep state ('r', None, 1, None), # T13.0.2 possibly a register -> go to 1 (self.ent0, None, 1000, None)], # T13.0.3 known reg alias -1302), # T13.0.4 unknown register identifier 1: # parse numeric register identifier ([(None, None, -1303, None), # T13.1.0 EOSeq -> missing register number (self.dec_number_analyzer, None, 1000, self.check_error)], # T13.1.1 maybe good reg number -1304) # T13.1.2 wrong reg number }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [-1301, -1302, -1303, -1304] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -3201, None), # T32.0.0 EOSeq -> missing multiplication instruction (' ', None, 0, None), # T32.0.1 skip leading spaces (self.ent0, ' ', -3202, None, # T32.0.2a missing multiplication operands 3, self.get_opcode, # T32.0.2b inst + ' ', go to 3 1, self.get_opcode)], # T32.0.2c inst + something else, go to 1 -3203), # T32.0.3 unrecognizable multiplication instruction 1: # check for condition ([(None, None, -3204, None), # T32.1.0 EOSeq -> wrong text after instruction (NEVER happens) (self.instcond_analyzer, ' ', -3202, None, # T32.1.1a missing multiplication operands 3, self.catch_cond, # T32.1.1b inst + cond + ' ', go to 3 2, self.catch_cond), # T32.1.1c inst + cond + something (maybe 's') ('s', ' ', -3202, None, # T32.1.2a missing multiplication operands 3, self.catch_setflags, # T32.1.2b inst + 's' + ' ', go to 3 -3205, None)], # T32.1.2c found other text after 's' -3204), # T32.1.3 wrong text after instruction 2: # check for 's' ([(None, None, -3205, None), # T32.2.0 EOSeq -> missing space after inst. (NEVER happens) ('s', ' ', -3202, None, # T32.2.1a missing multiplication operands 3, self.catch_setflags, # T32.2.1b inst + 's' + ' ', go to 3 -3205, None)], # T32.2.1c found other text after 's' -3205), # T32.2.2 wrong text after instruction 3: # parsing first register ([(None, None, -3202, None), # T32.3.0 EOSeq -> missing multiplication operands (self.reg_analyzer, ',', -3202, self.error_spring, # T32.3.1a missing mult. operands 4, self.catch_reg, # T32.3.1b reg1 + ',', go to 4 -3206, self.error_spring)], # T32.3.1c wrong text after register -3206), # T32.3.2 unrecognized multiplication operands (NEVER happens) 4: # parsing second register ([(None, None, -3202, None), # T32.4.0 EOSeq -> missing multiplication operands (self.reg_analyzer, ',', -3202, self.error_spring, # T32.4.1a missing mult. operands 5, self.catch_reg, # T32.4.1b reg2 + ',', go to 5 -3206, self.error_spring)], # T32.4.1c wrong text after register -3206), # T32.4.2 unrecognized multiplication operands (NEVER happens) 5: # parsing third register ([(None, None, -3202, None), # T32.5.0 EOSeq -> missing multiplication operands (self.reg_analyzer, ',', -3202, self.catch_reg3, # T32.5.1a catch three mult. operands 6, self.catch_reg, # T32.5.1b reg3 + ',', go to 6 -3206, self.error_spring)], # T32.5.1c wrong text after register -3206), # T32.5.2 unrecognized multiplication operands (NEVER happens) 6: # parsing fourth register ([(None, None, -3202, None), # T32.6.0 EOSeq -> missing multiplication operands (self.reg_analyzer, None, 1000, self.catch_reg)], # T32.6.1 reg4 -3206) # T32.6.2 unrecognized multiplication operands (NEVER happens) }
def __init__(self): Analyzer.__init__(self) # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -2001, None), # T20.0.0 EOSeq -> missing hex error (' ', None, 0, None), # T20.0.1 white spaces -> keep state ('0x', None, 1, None)], # T20.0.2 possibly hex address -> go to 1 -2001), # T20.0.3 missing initial hex address error 1: # parse hexadecimal address ([(None, None, -2002, None), # T20.1.0 EOSeq -> wrong hex number (self.hex_number_analyzer, ' ', -2003, None, # T20.1.1a EOSeq after address 1000, self.check_error, # T20.1.1b catched address -2003, None)], # T20.1.1c missing space after address -2003) # T20.1.2 wrong hex number }
def __init__(self): Analyzer.__init__(self) self.next_address = 0x8000 # definition of error spring list self.error_list = [-1002, -1003, -1004, -1005, -1006, -1102, -1103, -1104, -1105, -1202, -1203, -1204, -1301, -1302, -1303, -1304, -1403, -1502, -1503, -1504, -1603, -1604, -1605, -1606, -1607, -1702, -1703, -1704, -1705, -1706, -2002, -2003, -2004, -2102, -2103, -2104, -2105, -2106, -2107, -2204, -2205, -2207, -2302, -2303, -2304, -2306, -2308, -2310, -2311, -2402, -2403, -2404, -2405, -2406, -2407, -2408, -2409, -2410, -2411, -2412, -2502, -2503, -2504, -2505, -2506, -2510, -2511, -2512, -2513, -3102, -3104, -3105, -3202, -3204, -3205, -3207, -3208, -3302, -3304, -3305, -3307, -3308, -3403, -3404, -3405, -3406, -3407, -3408, -3409, -3410, -3502, -3504, -3505 ] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -4001, None), # T40.0.0 EOSeq -> missing hex address (' ', None, 0, None), # T40.0.1 skip initial spaces ('>', ' ', -4003, None, # T40.0.2a found '>' at end of seqence 2, self.implicit_address, # T40.0.2b found '> ', stack address and go to 2 -4003, None), # t40.0.2c found '>' followed by strange char (self.address_analyzer, None, 1, self.error_spring)], # T40.0.3 get the address -4002), # T40.0.4 wrong initial hex address 1: # decoder state after hex address ([(None, None, -4004, None), # T40.1.0 EOSeq -> missing info (self.data_analyzer, None, 1000, self.stack_info), # T40.1.1 get the data (self.instdat_analyzer, None, 1000, self.stack_info), # T40.1.2 get data instr. (self.instmul_analyzer, None, 1000, self.stack_info), # T40.1.3 get multiply instr. (self.instjmp_analyzer, None, 1000, self.stack_info), # T40.1.4 get branch instr. (self.instmem_analyzer, None, 1000, self.stack_info), # T40.1.5 get mem transfer instr. (self.instmsc_analyzer, None, 1000, self.stack_info)], # T40.1.6 get miscellanea instr. -4005), # T40.1.7 unrecognized instruction or directive 2: # decoder state after '>' symbol ([(None, None, -4004, None), # T40.2.0 EOSeq -> missing info (self.data_analyzer, None, 1000, self.stack_info), # T40.2.1 get the data (self.instdat_analyzer, None, 1000, self.stack_info), # T40.2.2 get data instr. (self.instmul_analyzer, None, 1000, self.stack_info), # T40.2.3 get multiply instr. (self.instjmp_analyzer, None, 1000, self.stack_info), # T40.2.4 get branch instr. (self.instmem_analyzer, None, 1000, self.stack_info), # T40.2.5 get mem transfer instr. (self.instmsc_analyzer, None, 1000, self.stack_info)], # T40.2.6 get miscellanea instr. -4005) # T40.2.7 unrecognized instruction or directive }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [-1002, -1003, -1004, -1005, -1006, -1303, -1304] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -2501, None), # T25.0.0 EOSeq -> missing address (' ', None, 0, None), # T25.0.1 skip spaces ('[', None, 1, None)], # T25.0.2 detection of '[' -2502), # T25.0.3 failed to detect '[' 1: # parsing Rn (base register) ([(None, None, -2503, None), # T25.1.0 EOSeq -> missing Rn (self.register_analyzer, ',]', -2504, self.error_spring, # T25.1.1a missing ']' 2, self.catch_base, # T25.1.1b found Rn + ',' 7, self.catch_base, # T25.1.1c found Rn + ']' -2599, self.error_spring)], # T25.1.1d NEVER happens -2503), # T25.1.2 unrecognizable base register 2: # parsing displacement ([(None, None, -2505, None), # T25.2.0 EOSeq -> missing offset or reg displacement (' ', None, 2, None), # T25.2.1 skip spaces ('+', None, 3, None), # T25.2.2 positive displacement, got to 3 ('-', None, 3, self.neg_displ), # T25.2.3 negative displacement, set U=1 and go to 3 ('#', None, 4, None), # T25.2.4 start of immediate displacement (self.register_analyzer, ',]', -2504, self.error_spring, # T25.2.5a missing ']' -2513, self.error_spring, # T25.2.5b forbid scaled reg 7, self.reg_displ, # T25.2.5c register displ. -2599, self.error_spring)], # T25.2.5d NEVER happens -2506), # T25.2.6 unrecognized displacement 3: # parsing reg displacement after '+' or '-' ([(None, None, -2505, None), # T25.3.0 EOSeq -> missing offset or reg displacement (self.register_analyzer, ',]', -2504, self.error_spring, # T25.3.1a missing ']' -2513, self.error_spring, # T25.3.1b scaled reg. displ 7, self.reg_displ, # T25.3.1c register displ. -2599, self.error_spring)], # T25.3.1d NEVER happens -2506), # T25.3.2 unrecognized reg displacement 4: # parsing immediate displacement after '#' ([(None, None, -2505, None), # T25.4.0 EOSeq -> missing offset or reg displacement (self.number_analyzer, ']', -2504, self.error_spring, # T25.4.1a missing ']' 7, self.imm_displ, # T25.4.1b immediate displ. -2599, self.error_spring)], # T25.4.1c NEVER happens -2506), # T25.4.2 unrecognized immediate displacement 7: # check EOSeq ([(None, None, 1000, None), # T25.7.0 EOSeq -> complete addressing mode 2 (offset variant) (' ', None, 7, None)], # T25.7.1 trim trailing spaces -2510) # T25.7.2 error: post and pre-indexing currently not supported }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [-1302, -1303, -1304] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -1401, None), # T14.0.0 EOSeq -> missing register id error (' ', None, 0, None), # T14.0.1 white spaces -> keep state (self.register_analyzer, '-', 1000, self.encode_one, # T14.0.2a single register 1, self.encode_one, # T14.0.2b range list -1402, self.error_spring)], # T14.0.2c rubish after register -1402), # T14.0.3 unknown register identifier 1: # parse second register identifier ([(None, None, -1403, None), # T14.1.0 EOSeq -> missing second register in a range list (self.register_analyzer, None, 1000, self.encode_range)], # T14.1.1 encode binary reg list -1402) # T14.1.2 wrong second register identifier }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [-1302, -1303, -1304, -1402, -1403] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -1501, None), # T15.0.0 EOSeq -> missing register list error (' ', None, 0, None), # T15.0.1 skip leading spaces ('{', None, 1, None)], # T15.0.2 opening '{' detected, go to 1 -1502), # T15.0.3 missing opening '{' 1: # parse reg list ([(None, None, -1503, None), # T15.1.0 EOSeq -> missing registers (self.reg_bits_analyzer, ',}', -1503, self.error_spring, # T15.1.1a unclosed reg list 1, self.encode_list, # T15.1.1b comma separated list 1000, self.encode_list, # T15.1.1c closed reg list -1599, self.error_spring)], # T15.1.1d (NEVER happens) -1504) # T15.1.2 rubbish after register list }
def __init__(self): Analyzer.__init__(self) # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -1101, None), # T11.0.0 EOSeq -> missing char error (' ', None, 0, None), # T11.0.1 white spaces -> keep state ('\'', None, 1, None)], # T11.0.2 char starting quote -> go to 1 -1101), # T11.0.3 missing char error error 1: # parsing one char in single quotes ([(None, None, -1101, None), # T11.1.0 EOSeq -> missing char error ('\'', None, -1102, None), # T11.1.1 empty single quotes (self.char_range_analyzer, None, 2, None)], # T11.1.2 store one character -> go to 2 -1103), # T11.1.3 invalid character error 2: # parsing end of single quotes ([(None, None, -1104, None), # T11.2.0 EOSeq -> unclosed char definition ('\'', None, 1000, None)], # T11.2.1 successful char capture -1105) # T11.2.2 use of single quote for more than one character }
def __init__(self): Analyzer.__init__(self) # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -1201, None), # T12.0.0 EOSeq -> missing string error (' ', None, 0, None), # T12.0.1 white spaces -> keep state ('\"', None, 1, None)], # T12.0.2 string starting quote -> go to 1 -1201), # T12.0.3 missing string error 1: # parsing one char in single quotes ([(None, None, -1201, None), # T12.1.0 EOSeq -> missing string error ('\"', None, -1202, None), # T12.1.1 empty string error (self.char_range_analyzer, None, 2, None)], # T12.1.2 store one character -> go to 2 -1203), # T12.1.3 invalid character error 2: # parsing characters in a string, ended with double quotes ([(None, None, -1204, None), # T12.2.0 EOSeq -> unclosed string error ('\"', None, 1000, None), # T12.2.1 successful string capture (self.char_range_analyzer, None, 2, None)], # T12.2.2 store one character -> keep state -1203) # T12.2.3 invalid character error }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [-1002, -1003, -1004, -1005, -1006, -1102, -1103, -1104, -1105] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -1701, None), # T17.0.0 EOSeq -> missing immediate error (' ', None, 0, None), # T17.0.1 white spaces -> keep state ('#', None, 1, None)], # T17.0.2 immediate prefix -> go to 1 -1702), # T16.0.3 missing '#' error 1: # parsing next binary digits ([(None, None, -1703, None), # T17.1.0 EOSeq -> missing value after '#' (' ', None, -1704, None), # T17.1.1 unexpected space after '# (self.number_analyzer, None, 2, self.check_error)], # T16.1.2 parse number -1705), # T17.1.3 unrecognizable info after '#' 2: # ensure end of sequence ([(None, None, 1000, None)], # T17.2.0 EOSeq -> right catch -1707) # T17.2.1 unexpected data after immediate value (NEVER happens) }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [-1302, -1303, -1304, -1403, -1502, -1503, -1504] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -3501, None), # T35.0.0 EOSeq -> missing miscellanea inst. (' ', None, 0, None), # T35.0.1 skip leading spaces (self.ent0, ' ', -3502, None, # T35.0.2a missing 'push'/'pop' list 2, self.get_opcode, # T32.0.2b inst + ' ', go to 2 1, self.get_opcode), # T32.0.2c inst + something else, go to 1 (self.ent1, ' ', -3502, None, # T35.0.3a missing 'clz' operands 4, self.get_opcode, # T32.0.3b inst + ' ', go to 4 3, self.get_opcode)], # T32.0.3c inst + something else, go to 3 -3503), # T35.0.4 unrecognizable miscellanea instruction 1: # check for condition ([(None, None, -3599, None), # T35.1.0 EOSeq -> wrong text after instruction (NEVER happens) (self.instcond_analyzer, ' ', -3502, None, # T35.1.1a missing 'push'/'pop' list 2, self.catch_cond, # T35.1.1b 'push'/'pop' + cond + ' ', goto 3 -3504, self.catch_cond)], # T35.1.1c inst + cond + something (error) -3504), # T32.1.3 wrong text after instruction 2: # get the register list ([(None, None, -3502, None), # T35.2.0 EOSeq -> missing 'push'/'pop' list (self.reglist_analyzer, None, 1000, self.catch_reglist)], # T35.2.1 get the reg list -3599), # T35.2.2 wrong text after instruction (NEVER happens) 3: # check for condition ([(None, None, -3599, None), # T35.3.0 EOSeq -> wrong text after instruction (NEVER happens) (self.instcond_analyzer, ' ', -3502, None, # T35.3.1a missing 'clz' list 4, self.catch_cond, # T35.3.1b 'clz' + cond + ' ', go to 4 -3504, self.catch_cond)], # T35.3.1c 'clz' + cond + something (error) -3504), # T32.3.2 wrong text after instruction 4: # parsing first register ([(None, None, -3502, None), # T35.4.0 EOSeq -> missing first reg (self.reg_analyzer, ',', -3502, self.error_spring, # T35.4.1a missing operands 5, self.catch_reg, # T35.4.1b Rd + ',', go to 5 -3505, self.error_spring)], # T35.4.1c wrong text after Rd -3599), # T35.4.2 unrecognized operands (NEVER happens) 5: # parsing second register ([(None, None, -3502, None), # T35.5.0 EOSeq -> missing second reg (self.reg_analyzer, None, 1000, self.catch_reg)], # T35.5.1 Rm -3505) # T35.5.2 unrecognized operands }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [-1002, -1003, -1004, -1005, -1006, -1301, -1302, -1303, -1304] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -3301, None), # T33.0.0 EOSeq -> missing branch instruction (' ', None, 0, None), # T33.0.1 skip leading spaces (self.ent0, ' ', -3302, None, # T33.0.2a missing branch offset 3, self.get_opcode, # T33.0.2b 'blo'/'bls'/'blt'/'ble'+ ' ', go to 3 -3303, self.get_opcode), # T33.0.2c 'blo'/'bls'/'blt'/'ble' + unexpected (self.ent1, ' ', -3304, None, # T33.0.3a missing branch reg 4, self.get_opcode, # T33.0.3b 'bx'/'blx' + ' ', go to 4 2, self.get_opcode), # T33.0.3c 'bx'/'blx' + extra text, go to 2 (self.ent2, ' ', -3302, None, # T33.0.4a missing branch offset 3, self.get_opcode, # T33.0.4b 'b'/'bl' + ' ', go to 3 1, self.get_opcode)], # T33.0.4c 'b'/'bl' + extra text, go to 1 -3303), # T33.0.5 unrecognizable branch instruction 1: # check for condition in 'b'/'bl' ([(None, None, -3302, None), # T33.1.0 EOSeq -> missing branch offset (NEVER happens) (self.instcond_analyzer, ' ', -3302, None, # T33.1.1a missing branch offset 3, self.catch_cond, # T33.1.1b 'b'/'bl' + cond + ' ', go to 3 -3303, self.catch_cond)], # T33.1.1c 'b'/'bl' + cond + unexpected text -3303), # T33.1.2 wrong text after instruction 2: # check for condition in 'bx'/'blx' ([(None, None, -3304, None), # T33.2.0 EOSeq -> missing branch register (NEVER happens) (self.instcond_analyzer, ' ', -3302, None, # T33.2.1a missing branch offset 4, self.catch_cond, # T33.2.1b 'bx'/'blx' + cond + ' ', go to 4 -3303, self.catch_cond)], # T33.2.1c 'bx'/'blx' + cond + unexpected text -3303), # T33.2.2 wrong text after instruction 3: # parsing branch offset ([(None, None, -3302, None), # T33.3.0 EOSeq -> missing branch offset (self.num_analyzer, None, 1000, self.catch_offset)], # T33.3.1 branch offset -3305), # T33.3.2 unrecognized branch offset 4: # parsing branch register ([(None, None, -3304, None), # T33.4.0 EOSeq -> missing branch register (self.reg_analyzer, None, 1000, self.catch_reg)], # T33.4.1 branch reg -3306) # T33.4.2 unrecognized branch register (NEVER happens) }
def __init__(self): Analyzer.__init__(self) # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -1001, None), # T10.0.0 EOSeq -> missing number error (' ', None, 0, None), # T10.0.1 white spaces -> keep state ('0b', None, 1, None), # T10.0.2 binary prefix -> go to 1 ('0x', None, 2, None), # T10.0.3 hexadecimal prefix -> go to 2 ('0', None, 3, None), # T10.0.4 possibly octal prefix -> go to 3 ('-', None, 4, None), # T10.0.5 negative decimal prefix -> go to 4 ('+', None, 6, None), # T10.0.6 positive decimal prefix -> go to 6 (self.dec_range_detector, None, 5, None)], # T10.0.7 decimal digit -> go to 5 -1001), # T10.0.8 missing number error 1: # parsing next binary digits ([(None, None, -1002, None), # T10.1.0 EOSeq -> malformed number error (self.bin_number_analyzer, None, 1000, self.check_limits)], # T10.1.1 -1002), # T10.1.2 2: # parsing next hexadecimal digits ([(None, None, -1005, None), # T10.2.0 EOSeq -> malformed number error (self.hex_number_analyzer, None, 1000, self.check_limits)], # T10.2.1 -1005), # T10.2.2 3: # parsing next octal digits ([(None, None, 1000, self.insert_zero), # T10.3.0 EOSeq -> keep first octal digit (self.oct_number_analyzer, None, 1000, self.check_limits)], # T10.3.1 -1003), # T10.3.2 4: # parsing next decimal digits (negative number) ([(None, None, -1004, None), # T10.4.0 EOSeq -> malformed number error (self.dec_number_analyzer, None, 1000, self.invert_number)], # T10.4.1 decimal digit -> invert value -1004), # T10.4.2 malformed number error 5: # parsing next decimal digits ([(None, None, 1000, None), # T10.5.0 EOSeq -> NEVER followed (T10.0.6 don't advance pos) (self.dec_number_analyzer, None, 1000, self.check_limits)], # T10.5.1 -1004), # T10.5.2 malformed number error 6: # parsing next decimal digits ([(None, None, -1004, None), # T10.5.0 EOSeq -> malformed number error (self.dec_number_analyzer, None, 1000, self.check_limits)], # T10.5.1 -1004), # T10.5.2 malformed number error }
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [ -1002, -1003, -1004, -1005, -1102, -1103, -1104, -1105, -1302, -1303, -1304, -1603, -1604, -1605, -1606, -1607, -1703, -1704, -1705, -1706, -2204, -2205, -2207, -2302, -2303, -2304, -2306, -2308, -2310, -2311 ] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -3101, None), # T31.0.0 EOSeq -> missing instruction (' ', None, 0, None), # T31.0.1 skip leading spaces (self.ent0, ' ', -3102, None, # T31.0.2a missing data operands 3, self.get_opcode, # T31.0.2b inst + ' ', go to 3 1, self.get_opcode)], # T31.0.2c inst + something else, go to 1 -3103), # T31.0.3 unrecognizable data instruction 1: # check for condition ([(None, None, -3104, None), # T31.1.0 EOSeq -> wrong text after instruction (NEVER happens) (self.instcond_analyzer, ' ', -3102, None, # T31.1.1a missing data operands 3, self.catch_cond, # T31.1.1b inst + cond + ' ', go to 3 2, self.catch_cond), # T31.1.1c inst + cond + something (maybe 's') ('s', ' ', -3102, None, # T31.1.2a missing data operands 3, self.catch_setflags, # T31.1.2b inst + 's' + ' ', go to 3 -3105, None)], # T31.1.2c found other text after 's' -3104), # T31.1.3 wrong text after instruction 2: # check for 's' ([(None, None, -3105, None), # T31.2.0 EOSeq -> missing space after inst. (NEVER happens) ('s', ' ', -3102, None, # T31.2.1a missing data operands 3, self.catch_setflags, # T31.2.1b inst + 's' + ' ', go to 3 -3105, None)], # T31.2.1c found other text after 's' -3105), # T31.2.3 wrong text after instruction 3: # parsing operands ([(None, None, -3102, None), # T31.3.0 EOSeq -> missing data operands (self.opdat_analyzer, None, 1000, self.catch_operands)], # T31.3.1 get the operands -3106) # T31.3.2 unrecognized data operands (NEVER happens) }
def __init__(self): Analyzer.__init__(self) # definition of inner variables self.mode = 0 # definition of error spring list self.error_list = [ -1002, -1003, -1004, -1005, -1006, -1303, -1304, -1702, -1703, -1704, -1705, -1706 ] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -2401, None), # T24.0.0 EOSeq -> missing address (' ', None, 0, None), # T24.0.1 skip spaces ('[', None, 1, None)], # T24.0.2 detection of '[' -2402), # T24.0.3 failed to detect '[' 1: # parsing Rn (base register) ([(None, None, -2403, None), # T24.1.0 EOSeq -> missing Rn (self.register_analyzer, ',]', -2404, self.error_spring, # T24.1.1a missing ']' 2, self.catch_base, # T24.1.1b found Rn + ',' 7, self.catch_base, # T24.1.1c found Rn + ']' -2499, self.error_spring)], # T24.1.1d NEVER happens -2403), # T24.1.2 unrecognizable base register 2: # parsing displacement ([(None, None, -2405, None), # T24.2.0 EOSeq -> missing offset or reg displacement (' ', None, 2, None), # T24.2.1 skip spaces ('+', None, 3, None), # T24.2.2 positive displacement, got to 3 ('-', None, 3, self.neg_displ), # T24.2.3 negative displacement, set U=1 and go to 3 ('#', None, 4, None), # T24.2.4 start of immediate displacement (self.register_analyzer, ',]', -2404, self.error_spring, # T24.2.5a missing ']' 5, self.reg_displ, # T24.2.5b scaled reg. displ 7, self.reg_displ, # T24.2.5c register displ. -2499, self.error_spring)], # T24.2.5d NEVER happens -2406), # T24.2.6 unrecognized displacement 3: # parsing reg displacement after '+' or '-' ([(None, None, -2405, None), # T24.3.0 EOSeq -> missing offset or reg displacement (self.register_analyzer, ',]', -2404, self.error_spring, # T24.3.1a missing ']' 5, self.reg_displ, # T24.3.1b scaled reg. displ 7, self.reg_displ, # T24.3.1c register displ. -2499, self.error_spring)], # T24.3.1d NEVER happens -2406), # T24.3.2 unrecognized reg displacement 4: # parsing immediate displacement after '#' ([(None, None, -2405, None), # T24.4.0 EOSeq -> missing offset or reg displacement (self.number_analyzer, ']', -2404, self.error_spring, # T24.4.1a missing ']' 7, self.imm_displ, # T24.4.1b immediate displ. -2499, self.error_spring)], # T24.4.1c NEVER happens -2406), # T24.4.2 unrecognized immediate displacement 5: # parsing scaling shift mode ([(None, None, -2407, None), # T24.5.0 EOSeq -> missing shift mode (' ', None, 5, None), # T24.5.1 skip spaces (self.ent0, ' ', -2408, None, # T24.5.2a missing info after shift mode 6, self.catch_mode, # T24.5.2b continue parsing shift info -2409, None)], # T24.5.2c missing space after shift mode -2409), # T24.5.3 unrecognized shift mode 6: # parsing shift info ([(None, None, -2408, None), # T24.6.0 EOSeq -> missing info after shift mode (self.immediate_sr_analyzer, ']', -2404, self.error_spring, # T24.6.1a missing ']' 7, self.imm_shifting, # T24.6.1b immediate shift -2499, self.error_spring)], # T24.6.1c NEVER happens -2409), # T24.6.2 wrong info after shift mode 7: # check EOSeq ([(None, None, 1000, None), # T24.7.0 EOSeq -> complete addressing mode 2 (offset variant) (' ', None, 7, None)], # T24.7.1 trim trailing spaces -2410) # T24.7.2 error: post and pre-indexing currently not supported }
def __init__(self): Analyzer.__init__(self) # definition of inner variables self.mode = 0 # definition of error spring list self.error_list = [-1002, -1003, -1004, -1005, -1006, -1302, -1303, -1304, -1403, -1502, -1503, -1504, -1702, -1703, -1704, -1705, -1706, -2402, -2403, -2404, -2405, -2406, -2407, -2408, -2409, -2410, -2411, -2412, -2502, -2503, -2504, -2505, -2506, -2510, -2511, -2512, -2513] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -3401, None), # T34.0.0 EOSeq -> missing inst. (' ', None, 0, None), # T34.0.1 skip leading spaces (self.ent0, None, 1, self.get_mode)], # T34.0.2 starting inst., go to 1 -3402), # T34.0.3 unrecognizable memory transfer inst. 1: # check for memory transfer type ([(None, None, -3402, None), # T34.1.0 EOSeq -> missing inst. continuation ('r', None, 2, None), # T34.1.1 go to 'r' subgraph ('s', None, 8, self.check_ldmode), # T34.1.2 if load, go to 's' subgraph ('m', None, 13, None)], # T34.1.3 go to 'm' subgraph -3402), # T34.1.4 unrecognizable memory transfer inst. 2: # check for word or unsigned byte memory transfer ([(None, None, -3403, None), # T34.2.0 EOSeq -> missing space after memory transfer inst. (' ', None, 5, self.set_ldstw), # T34.2.1 it is 'ldr' or 'str' ('b', None, 3, None), # T34.2.2 maybe 'ldrb' (self.instcond_analyzer, None, 4, self.catch_cond), # T34.2.3 inst. + cond, go to 4 ('h', None, 9, self.set_ldsth), # T34.2.4 maybe 'ldrh' ('s', None, 10, self.check_ldmode)], # T34.2.5 if load, go to 's' (no cond.) -3404), # T34.2.6 wrong text after memory transfer inst. 3: # check for 'ldrb'/'strb' completion ([(None, None, -3403, None), # T34.3.0 EOSeq -> missing space after memory transfer inst. (' ', None, 5, self.set_ldstw)], # T34.3.1 it is 'ldrb' or 'strb' -3404), # T34.3.2 wrong text after memory transfer inst. 4: # check for instruction completion after condition ([(None, None, -3403, None), # T34.4.0 EOSeq -> missing space after memory transfer inst. (' ', None, 5, self.set_ldstw), # T34.4.1 it is 'ldr' or 'str' ('b', None, 3, None), # T34.4.2 maybe 'ldrb' ('h', None, 9, self.set_ldsth), # T34.4.3 maybe 'ldrh' ('s', None, 10, self.check_ldmode)], # T34.4.4 if load, go to 's' subgraph -3404), # T34.4.5 wrong text after memory transfer inst. 5: # check for Rd ([(None, None, -3405, None), # T34.5.0 EOSeq -> missing destination reg in memory transfer (self.reg_analyzer, ',', -3406, self.error_spring, # T34.5.1a missing ',' 6, self.catch_rd, # T34.5.1b catch destination reg. -3499, self.error_spring)], # T34.5.1c NEVER happens -3499), # T34.5.2 wrong text after memory transfer inst. (NEVER happens) 6: # check for word or unsigned byte memory transfer ending ([(None, None, -3407, None), # T34.6.0 EOSeq -> missing info after memory transfer inst. (' ', None, 6, None), # T34.6.1 skip spaces ('=', None, 7, self.check_ldr), # T34.6.2 maybe relative PC laoding (self.opldst2_analyzer, None, 1000, self.catch_am)], # T34.6.3 catch addressing mode -3499), # T34.6.4 wrong text after memory transfer inst. (NEVER happens) 7: # check for number to be assigned using relative PC displacement ([(None, None, -3410, None), # T34.7.0 EOSeq -> missing number for load with relative pc (' ', None, 7, None), # T34.7.1 skip spaces (self.num_analyzer, None, 1000, self.set_relpc)], # T34.7.2 relative PC addressing mode -3410), # T34.7.3 wrong number for load with relative pc 8: # check for load signed halfword or signed byte memory transfer ([(None, None, -3404, None), # T34.8.0 EOSeq -> wrong memory transfer inst. (self.instcond_analyzer, None, 10, self.catch_cond), # T34.8.1 inst. + cond, go to 10 (self.ent1, None, 9, self.set_ldsth)], # T34.8.2 maybe 'ldsh' or 'ldsb' -3404), # T34.8.3 wrong text after memory transfer inst. 9: # check for 'ldrh'/'strh'/'ldsh'/'ldsb'/'ldrsh'/'ldrsb' completion ([(None, None, -3403, None), # T34.9.0 EOSeq -> missing space after memory transfer inst. (' ', None, 11, None)], # T34.9.1 it is 'ldrb' or 'strb' -3404), # T34.9.2 wrong text after memory transfer inst. 10: # check for instruction completion after condition ([(None, None, -3404, None), # T34.10.0 EOSeq -> wrong memory transfer inst. (self.ent1, None, 9, self.set_ldsth)], # T34.10.1 maybe 'ldsh'/'ldrsh'/'ldsb'/'ldrsb' -3404), # T34.10.2 wrong memory transfer inst. 11: # check for Rd ([(None, None, -3405, None), # T34.11.0 EOSeq -> missing destination reg in memory transfer (self.reg_analyzer, ',', -3406, self.error_spring, # T34.11.1a missing ',' 12, self.catch_rd, # T34.11.1b catch destination reg. -3499, self.error_spring)], # T34.11.1c NEVER happens -3499), # T34.11.2 wrong text after mem. transfer inst. (NEVER happens) 12: # check for signed byte or halfword memory transfer ending ([(None, None, -3407, None), # T34.12.0 EOSeq -> missing info after memory transfer inst. (self.opldst3_analyzer, None, 1000, self.catch_am)], # T34.12.1 catch addressing mode -3499), # T34.12.2 wrong text after mem. transfer inst. (NEVER happens) 13: # check for multiple register memory transfer ([(None, None, -3404, None), # T34.13.0 EOSeq -> wrong memory transfer inst. (self.instcond_analyzer, None, 14, self.catch_cond), # T34.13.1 inst. + cond, go to 14 (self.ent2, None, 15, self.set_ldstm)], # T34.13.2 maybe 'ldm__' or 'stm__' -3404), # T34.13.3 wrong text after memory transfer inst. 14: # check for instruction completion after condition ([(None, None, -3404, None), # T34.14.0 EOSeq -> wrong memory transfer inst. (self.ent2, None, 15, self.set_ldstm)], # T34.14.1 maybe 'ldm<cond>__'/'stm<cond>__' -3404), # T34.14.2 wrong memory transfer inst. 15: # check for 'ldm<cond>__'/'stm<cond>__' completion ([(None, None, -3403, None), # T34.15.0 EOSeq -> missing space after memory transfer inst. (' ', None, 16, None)], # T34.15.1 it is multiple reg memory inst. -3404), # T34.15.2 wrong text after memory transfer inst. 16: # check for Rn ([(None, None, -3405, None), # T34.16.0 EOSeq -> missing destination reg in memory transfer (self.reg_analyzer, ',!', -3406, self.error_spring, # T34.16.1a missing ',' 18, self.catch_rd, # T34.16.1b catch Rn, 17, self.catch_rd, # T34.16.1c catch Rn! -3499, self.error_spring)], # T34.16.1d NEVER happens -3499), # T34.16.2 wrong text after mem transfer inst. (NEVER happens) 17: # check for ',' after Rn! ([(None, None, -3406, None), # T34.17.0 EOSeq -> missing ',' after Rn! (' ', None, 17, None), # T34.17.1 skip spaces (',', None, 18, self.set_wreg)], # T34.17.2 positive -3404), # T34.17.3 wrong text after memory transfer inst. 18: # check for multiple memory transfer ending ([(None, None, -3407, None), # T34.18.0 EOSeq -> missing info after memory transfer inst. (self.reglist_analyzer, None, 1000, self.catch_am)], # T34.18.1 catch addressing mode -3499), # T34.18.2 wrong text after mem. transfer inst. (NEVER happens) }
def __init__(self, rlow, rhigh): Analyzer.__init__(self) self.rlow = rlow self.rhigh = rhigh
def __init__(self): Analyzer.__init__(self) # definition of error spring list self.error_list = [ -1002, -1003, -1004, -1005, -1006, -1102, -1103, -1104, -1105, -1202, -1203, -1204 ] # definition of the (instance) parsing graph self.graph = {0: # initial state ([(None, None, -2101, None), # T21.0.0 EOSeq -> missing data directive error (' ', None, 0, None), # T21.0.1 white spaces -> keep state ('.', None, 1, None)], # T21.0.2 '.' prefix -> go to 1 -2101), # T21.0.3 missing '.' error 1: # decoder state ([(None, None, -2101, None), # T21.1.0 EOSeq -> missing data directive error ('byte', ' ', -2102, None, # T21.1.1a EOSeq after '.byte' 2, self.stack_size, # T21.1.1b '.byte ' -> go to 2 -2103, None), # T21.1.1c missing space after '.byte' ('hword', ' ', -2102, None, # T21.1.2a EOSeq after '.hword' 3, self.stack_size, # T21.1.2b '.hword ' -> go to 3 -2103, None), # T21.1.2c missing space after '.hword' ('word', ' ', -2102, None, # T21.1.3a EOSeq after '.word' 4, self.stack_size, # T21.1.3b '.word ' -> go to 4 -2103, None), # T21.1.3c missing space after '.word' ('ascii', ' ', -2102, None, # T21.1.4a EOSeq after '.ascii' 5, self.stack_size, # T21.1.4b '.ascii ' -> go to 5 -2103, None), # T21.1.4c missing space after '.ascii' ('asciz', ' ', -2102, None, # T21.1.5a EOSeq after '.asciz' 6, self.stack_size, # T21.1.5b '.asciz ' -> go to 6 -2103, None)], # T21.1.5c missing space after '.asciz' -2104), # T21.1.6 unknown data directive 2: # parsing bytes ([(None, None, -2102, None), # T21.2.0 EOSeq -> missing bytes (self.number_analyzer, ',', 1000, self.stack_byte, # T21.2.1a last number 2, self.stack_byte, # T21.2.1b intermediate number -1002, self.error_spring), # T21.2.1c wrong digit (self.char_analyzer, ',', 1000, self.stack_chars, # T21.2.2a last char 2, self.stack_chars, # T21.2.2b intermediate char -2105, None)], # T21.2.2c unexpected separator -2106), # T21.2.3 non-recognizable info 3: # parsing halfwords ([(None, None, -2102, None), # T21.3.0 EOSeq -> missing halfwords (self.number_analyzer, ',', 1000, self.stack_hword, # T21.3.1a last number 3, self.stack_hword, # T21.3.1b intermediate number -1002, self.error_spring)], # T21.3.1c wrong digit -2106), # T21.3.2 non-recognizable info 4: # parsing words ([(None, None, -2102, None), # T21.4.0 EOSeq -> missing words (self.number_analyzer, ',', 1000, self.stack_word, # T21.4.1a last number 4, self.stack_word, # T21.4.1b intermediate number -1002, self.error_spring)], # T21.4.1c wrong digit -2106), # T21.4.2 non-recognizable info 5: # parsing string characters ([(None, None, -2102, None), # T21.5.0 EOSeq -> missing strings (self.char_analyzer, ',', 1000, self.stack_chars, # T21.5.1a last char 5, self.stack_chars, # T21.5.1b intermediate char -2105, self.error_spring), # T21.5.1c unexpected separator (self.string_analyzer, ',', 1000, self.stack_chars, # T21.5.2a last string 5, self.stack_chars, # T21.5.2b intermediate string -2105, self.error_spring)], # T21.5.2c unexpected separator -2106), # T21.5.3 non-recognizable info 6: # parsing string characters, append a '\0' ([(None, None, -2102, None), # T21.6.0 EOSeq -> missing strings (self.char_analyzer, ',', 1000, self.stack_chars_0, # T21.6.1a last char 6, self.stack_chars_0, # T21.6.1b intermediate char -2105, self.error_spring), # T21.6.1c unexpected separator (self.string_analyzer, ',', 1000, self.stack_chars_0, # T21.6.2a last string 6, self.stack_chars_0, # T21.6.2b intermediate string -2105, self.error_spring)], # T21.6.2c unexpected separator -2106) # T21.6.3 non-recognizable info }
def __init__(self, radix): Analyzer.__init__(self) self.radix = radix