diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2021-12-06 22:53:58 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2021-12-06 22:53:58 +0100 |
| commit | 990df9a9fcb5ae6f1142f49865404e42ec01439c (patch) | |
| tree | 3d1f3c95500b7d17a8389a5075aa2ca9d414d6fa | |
| parent | 0cd2cad02dd1b300d61bdc985b09de65f92261b4 (diff) | |
| download | focaccia-miasm-990df9a9fcb5ae6f1142f49865404e42ec01439c.tar.gz focaccia-miasm-990df9a9fcb5ae6f1142f49865404e42ec01439c.zip | |
Fix html; Add reg test
| -rw-r--r-- | miasm/arch/aarch64/arch.py | 2 | ||||
| -rw-r--r-- | miasm/arch/arm/arch.py | 8 | ||||
| -rw-r--r-- | test/arch/aarch64/arch.py | 1 | ||||
| -rw-r--r-- | test/arch/arm/arch.py | 2 | ||||
| -rw-r--r-- | test/arch/mips32/arch.py | 1 | ||||
| -rw-r--r-- | test/arch/msp430/arch.py | 1 | ||||
| -rw-r--r-- | test/arch/ppc32/arch.py | 1 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 1 |
8 files changed, 13 insertions, 4 deletions
diff --git a/miasm/arch/aarch64/arch.py b/miasm/arch/aarch64/arch.py index 050aa638..f05a0a15 100644 --- a/miasm/arch/aarch64/arch.py +++ b/miasm/arch/aarch64/arch.py @@ -420,7 +420,7 @@ class instruction_aarch64(instruction): else: return "[%s]" % color_expr_html(expr.args[0], loc_db) elif isinstance(expr, m2_expr.ExprOp) and expr.op == 'segm': - arg = color_expr_html(expr.args[1], loc_db) + arg = expr.args[1] if isinstance(arg, m2_expr.ExprId): arg = str(arg) elif arg.op == 'LSL' and int(arg.args[1]) == 0: diff --git a/miasm/arch/arm/arch.py b/miasm/arch/arm/arch.py index affa9866..7b07387c 100644 --- a/miasm/arch/arm/arch.py +++ b/miasm/arch/arm/arch.py @@ -481,7 +481,7 @@ class instruction_arm(instruction): else: r, s = expr.args[0].args if isinstance(s, ExprOp) and s.op in expr2shift_dct: - s = ' '.join( + s_html = ' '.join( str(x) for x in ( color_expr_html(s.args[0], loc_db), @@ -489,14 +489,16 @@ class instruction_arm(instruction): color_expr_html(s.args[1], loc_db) ) ) + else: + s_html = color_expr_html(s, loc_db) if isinstance(expr, ExprOp) and expr.op == 'postinc': o = '[%s]' % color_expr_html(r, loc_db) if s and not (isinstance(s, ExprInt) and int(s) == 0): - o += ', %s' % color_expr_html(s, loc_db) + o += ', %s' % s_html else: if s and not (isinstance(s, ExprInt) and int(s) == 0): - o = '[%s, %s]' % (color_expr_html(r, loc_db), color_expr_html(s, loc_db)) + o = '[%s, %s]' % (color_expr_html(r, loc_db), s_html) else: o = '[%s]' % color_expr_html(r, loc_db) diff --git a/test/arch/aarch64/arch.py b/test/arch/aarch64/arch.py index a693b0f0..57ec9b14 100644 --- a/test/arch/aarch64/arch.py +++ b/test/arch/aarch64/arch.py @@ -1870,4 +1870,5 @@ for s, l in reg_tests_aarch64[:]: print([x for x in a]) print(repr(b)) assert(b in a) + print(l.to_html()) diff --git a/test/arch/arm/arch.py b/test/arch/arm/arch.py index 740655da..42e80772 100644 --- a/test/arch/arm/arch.py +++ b/test/arch/arm/arch.py @@ -261,6 +261,7 @@ for s, l in reg_tests_arm: print([x for x in a]) print(repr(b)) assert(b in a) + print(l.to_html()) reg_tests_armt = [ ("0006ff5c LSLS R2, R0, 0x1A", @@ -733,6 +734,7 @@ for s, l in reg_tests_armt: print([x for x in a]) print(repr(b)) assert(b in a) + print(l.to_html()) print('TEST time', time.time() - ts) diff --git a/test/arch/mips32/arch.py b/test/arch/mips32/arch.py index de6d4547..0509f033 100644 --- a/test/arch/mips32/arch.py +++ b/test/arch/mips32/arch.py @@ -274,3 +274,4 @@ for s, l in reg_tests_mips32: print([x for x in a]) print(repr(b)) assert(b in a) + print(l.to_html()) diff --git a/test/arch/msp430/arch.py b/test/arch/msp430/arch.py index bc38c363..133b8b55 100644 --- a/test/arch/msp430/arch.py +++ b/test/arch/msp430/arch.py @@ -104,3 +104,4 @@ for s, l in reg_tests_msp: print([x for x in a]) print(repr(b)) assert(b in a) + print(l.to_html()) diff --git a/test/arch/ppc32/arch.py b/test/arch/ppc32/arch.py index 13c69c73..f5503330 100644 --- a/test/arch/ppc32/arch.py +++ b/test/arch/ppc32/arch.py @@ -114,6 +114,7 @@ for mode, s, l, in reg_tests: a = mn_ppc.asm(l) print('asm result %s' % [x for x in a]) print(repr(b)) + print(l.to_html()) print('test re dis') for x in a: diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index 55694dfe..22cfcf39 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -3153,6 +3153,7 @@ for mode, s, l, in reg_tests: a = mn_x86.asm(l) print('asm result', [x for x in a]) print(repr(b)) + print(l.to_html()) for x in a: print("BYTES", repr(x)) |