File sem.py
has 1788 lines of code (exceeds 250 allowed). Consider refactoring. Open
from builtins import range
from future.utils import viewitems, viewvalues
from miasm.expression.expression import *
from miasm.expression.simplifications import expr_simp
Function st_ld_r
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def st_ld_r(ir, instr, a, a2, b, store=False, size=32, s_ext=False, z_ext=False):
e = []
wb = False
postinc = False
b = b.ptr
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function do_it_block
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def do_it_block(self, loc, index, block, assignments, gen_pc_updt):
instr = block.lines[index]
it_hints, it_cond = self.parse_itt(instr)
cond_num = cond_dct_inv[it_cond.name]
cond_eq = tab_cond[cond_num]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function st_ld_m
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=False):
e = []
wb = False
dst = None
if isinstance(a, ExprOp) and a.op == 'wback':
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _shift_rotate_tpl
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _shift_rotate_tpl(ir, instr, dst, shift_operation, setflags=False, is_not=False, onlyCarry=False):
"""
Template to generate a shift/rotate
A temporary basic block is generated to handle 0-shift
@dst: destination
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function add_asmblock_to_ircfg
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_asmblock_to_ircfg(self, block, ircfg, gen_pc_updt=False):
"""
Add a native block to the current IR
@block: native assembly block
@gen_pc_updt: insert PC update effects between instructions
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function st_ld_r
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def st_ld_r(ir, instr, a, a2, b, store=False, size=32, s_ext=False, z_ext=False):
Function mrc
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def mrc(ir, insr, arg1, arg2, arg3, arg4, arg5, arg6):
Function mcr
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def mcr(ir, insr, arg1, arg2, arg3, arg4, arg5, arg6):
Function _shift_rotate_tpl
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _shift_rotate_tpl(ir, instr, dst, shift_operation, setflags=False, is_not=False, onlyCarry=False):
Function st_ld_m
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def st_ld_m(ir, instr, a, b, store=False, postinc=False, updown=False):
Function smlabt
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def smlabt(ir, instr, a, b, c, d):
Function mls
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def mls(ir, instr, a, b, c, d):
Function umlal
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def umlal(ir, instr, a, b, c, d):
Function smlal
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def smlal(ir, instr, a, b, c, d):
Function smlatt
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def smlatt(ir, instr, a, b, c, d):
Function smlabb
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def smlabb(ir, instr, a, b, c, d):
Function smlatb
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def smlatb(ir, instr, a, b, c, d):
Function umull
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def umull(ir, instr, a, b, c, d):
Function ubfx
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ubfx(ir, instr, a, b, c, d):
Function mla
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def mla(ir, instr, a, b, c, d):
Function mlas
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def mlas(ir, instr, a, b, c, d):
Function smull
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def smull(ir, instr, a, b, c, d):
Function orrs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def orrs(ir, instr, a, b, c=None):
Function bfc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def bfc(ir, instr, a, b, c):
Function pkhtb
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def pkhtb(ir, instr, arg1, arg2, arg3):
Function lsrs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def lsrs(ir, instr, a, b, c=None):
Function smulw
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def smulw(ir, instr, a, b, c):
Function sel
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sel(ir, instr, a, b, c):
Function sbcs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sbcs(ir, instr, a, b, c=None):
Function orr
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def orr(ir, instr, a, b, c=None):
Function rsb
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def rsb(ir, instr, a, b, c=None):
Function l_strd
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def l_strd(ir, instr, a, b, c=None):
Function uxtab
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def uxtab(ir, instr, a, b, c):
Function asrs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def asrs(ir, instr, a, b, c=None):
Function smul
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def smul(ir, instr, a, b, c):
Function sbc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sbc(ir, instr, a, b, c=None):
Function l_cmp
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def l_cmp(ir, instr, a, b, c=None):
Function asr
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def asr(ir, instr, a, b, c=None):
Function lsl
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def lsl(ir, instr, a, b, c=None):
Function adc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def adc(ir, instr, a, b, c=None):
Function eor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def eor(ir, instr, a, b, c=None):
Function eors
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def eors(ir, instr, a, b, c=None):
Function rscs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def rscs(ir, instr, a, b, c=None):
Function bics
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def bics(ir, instr, a, b, c=None):
Function do_it_block
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def do_it_block(self, loc, index, block, assignments, gen_pc_updt):
Function sdiv
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sdiv(ir, instr, a, b, c=None):
Function ldrd
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ldrd(ir, instr, a, b, c=None):
Function muls
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def muls(ir, instr, a, b, c=None):
Function uxtah
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def uxtah(ir, instr, a, b, c):
Function sub
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sub(ir, instr, a, b, c=None):
Function bic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def bic(ir, instr, a, b, c=None):
Function pkhbt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def pkhbt(ir, instr, arg1, arg2, arg3):
Function add_condition_expr
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_condition_expr(ir, instr, cond, instr_ir, extra_ir):
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add(ir, instr, a, b, c=None):
Function rsbs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def rsbs(ir, instr, a, b, c=None):
Function rsc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def rsc(ir, instr, a, b, c=None):
Function cmn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def cmn(ir, instr, a, b, c=None):
Function lsr
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def lsr(ir, instr, a, b, c=None):
Function subs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def subs(ir, instr, a, b, c=None):
Function teq
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def teq(ir, instr, a, b, c=None):
Function udiv
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def udiv(ir, instr, a, b, c=None):
Function lsls
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def lsls(ir, instr, a, b, c=None):
Function l_and
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def l_and(ir, instr, a, b, c=None):
Function orn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def orn(ir, instr, a, b, c=None):
Function mul
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def mul(ir, instr, a, b, c=None):
Function uadd8
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def uadd8(ir, instr, a, b, c):
Function mod_pc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def mod_pc(self, instr, instr_ir, extra_ir):
# fix PC (+4 for thumb)
pc_fixed = {self.pc: ExprInt(instr.offset + 4, 32)}
for i, expr in enumerate(instr_ir):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function mod_pc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def mod_pc(self, instr, instr_ir, extra_ir):
# fix PC (+8 for arm)
pc_fixed = {self.pc: ExprInt(instr.offset + 8, 32)}
for i, expr in enumerate(instr_ir):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function l_and
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def l_and(ir, instr, a, b, c=None):
setflags = (instr.name == 'ANDS') and a != PC
if c is None:
b, c = a, b
if c.is_op():
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function add_condition_expr
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_condition_expr(ir, instr, cond, instr_ir, extra_ir):
if cond == COND_AL:
return instr_ir, extra_ir
if not cond in tab_cond:
raise ValueError('unknown condition %r' % cond)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"