about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--example/expression/access_c.py5
-rw-r--r--example/samples/human.S22
2 files changed, 22 insertions, 5 deletions
diff --git a/example/expression/access_c.py b/example/expression/access_c.py
index 7255e23a..48da53ff 100644
--- a/example/expression/access_c.py
+++ b/example/expression/access_c.py
@@ -2,7 +2,7 @@ import sys
 
 from miasm2.analysis.machine import Machine
 from miasm2.analysis.binary import Container
-from miasm2.expression.expression import ExprOp, ExprCompose, ExprId
+from miasm2.expression.expression import ExprOp, ExprCompose, ExprId, ExprInt
 from miasm2.analysis.depgraph import DependencyGraph
 
 from miasm2.arch.x86.ctype import CTypeAMD64_unk
@@ -170,7 +170,8 @@ open('graph_irflow.dot', 'w').write(ir_arch_a.graph.dot())
 ptr_llhuman = types_mngr.get_objc(CTypePtr(CTypeStruct('ll_human')))
 arg0 = ExprId('ptr', 64)
 ctx = {ir_arch_a.arch.regs.RDI: arg0}
-expr_types = {arg0.name: ptr_llhuman}
+expr_types = {arg0: (ptr_llhuman,),
+              ExprInt(0x8A, 64): (ptr_llhuman,)}
 
 mychandler = MyCHandler(types_mngr, expr_types)
 
diff --git a/example/samples/human.S b/example/samples/human.S
index 750aa5b7..6cdeab0f 100644
--- a/example/samples/human.S
+++ b/example/samples/human.S
@@ -1,11 +1,11 @@
 	;;  Walk a human link list and print its information
 main:
 	TEST       RDI, RDI
-	JZ         end
+	JZ         next
 
 	PUSH       RBX
 	MOV        RBX, RDI
-loop:
+loop_arg:
 	LEA        RSI, QWORD PTR [RBX+0x10]
 	LEA        RDI, QWORD PTR [name-_+RIP]
 	XOR        EAX, EAX
@@ -23,9 +23,23 @@ loop:
 
 	MOV        RBX, QWORD PTR [RBX]
 	TEST       RBX, RBX
-	JNZ        loop
+	JNZ        loop_arg
 
 	POP        RBX
+next:
+
+
+	LEA        RBX, QWORD PTR [struct_human_ptr-_+RIP]
+loop_global:
+	CMP        RBX, 0
+	JZ         end
+
+	LEA        RSI, QWORD PTR [RBX+0x10]
+	LEA        RDI, QWORD PTR [name-_+RIP]
+	XOR        EAX, EAX
+	CALL       printf
+	MOV        RBX, QWORD PTR [RBX]
+	JMP        loop_global
 end:
 	RET
 
@@ -39,3 +53,5 @@ height:
 .string "Height: %d\n"
 name:
 .string "Name: %s\n"
+struct_human_ptr:
+.dword 0xdead, 0xcafe