@@ -4,11 +4,11 @@ use crate::decision::assignment_model::model_varnode_iterator::ModelVarNodeItera
44use crackers:: synthesis:: assignment_model:: AssignmentModel ;
55use jingle:: modeling:: { ModeledBlock , ModelingContext , State } ;
66use jingle:: python:: modeled_block:: PythonModeledBlock ;
7- use jingle:: python:: resolved_varnode:: PythonResolvedVarNode ;
7+ use jingle:: python:: resolved_varnode:: { PythonResolvedVarNode , PythonResolvedVarNodeInner } ;
88use jingle:: python:: state:: PythonState ;
99use jingle:: python:: varode_iterator:: VarNodeIterator ;
1010use jingle:: python:: z3:: ast:: { TryFromPythonZ3 , TryIntoPythonZ3 } ;
11- use jingle:: sleigh:: { SpaceType , VarNode , VarNodeDisplay } ;
11+ use jingle:: sleigh:: { ArchInfoProvider , SpaceType } ;
1212use jingle:: varnode:: { ResolvedIndirectVarNode , ResolvedVarnode } ;
1313use pyo3:: exceptions:: PyRuntimeError ;
1414use pyo3:: { Py , PyAny , PyResult , pyclass, pymethods} ;
@@ -28,23 +28,29 @@ impl PythonAssignmentModel {
2828 vn : PythonResolvedVarNode ,
2929 completion : bool ,
3030 ) -> Option < ( String , BV ) > {
31- match vn {
32- PythonResolvedVarNode :: Direct ( a) => {
33- let bv = state. read_varnode ( & VarNode :: from ( a . clone ( ) ) ) . ok ( ) ?;
31+ match vn. inner {
32+ PythonResolvedVarNodeInner :: Direct ( a) => {
33+ let bv = state. read_varnode ( a . inner ( ) ) . ok ( ) ?;
3434 let val = self . inner . model ( ) . eval ( & bv, completion) ?;
3535 Some ( ( format ! ( "{a}" ) , val) )
3636 }
37- PythonResolvedVarNode :: Indirect ( i) => {
38- let pointer_value = self . inner . model ( ) . eval ( & i. inner . pointer , completion) ?;
39- let space_name = i. inner . pointer_space_info . name . clone ( ) ;
40- let access_size = i. inner . access_size_bytes ;
37+ PythonResolvedVarNodeInner :: Indirect ( i) => {
38+ let info = i. info ( ) ;
39+ let i = i. inner ( ) ;
40+ let pointer_value = self . inner . model ( ) . eval ( & i. pointer , completion) ?;
41+ let space_name = info
42+ . get_space_info ( i. pointer_space_idx )
43+ . unwrap ( )
44+ . name
45+ . clone ( ) ;
46+ let access_size = i. access_size_bytes ;
4147 let pointed_value = self . inner . model ( ) . eval (
4248 & state
4349 . read_resolved ( & ResolvedVarnode :: Indirect ( ResolvedIndirectVarNode {
44- access_size_bytes : i. inner . access_size_bytes ,
45- pointer_location : i. inner . pointer_location ,
46- pointer : i. inner . pointer ,
47- pointer_space_idx : i. inner . pointer_space_info . index ,
50+ access_size_bytes : i. access_size_bytes ,
51+ pointer_location : i. pointer_location . clone ( ) ,
52+ pointer : i. pointer . clone ( ) ,
53+ pointer_space_idx : i. pointer_space_idx ,
4854 } ) )
4955 . ok ( ) ?,
5056 completion,
@@ -100,8 +106,15 @@ impl PythonAssignmentModel {
100106 . flat_map ( |g| g. get_input_vns ( ) . ok ( ) )
101107 . flatten ( )
102108 . filter ( |a| {
103- if let PythonResolvedVarNode :: Direct ( VarNodeDisplay :: Raw ( r) ) = a {
104- r. space_info . _type == SpaceType :: IPTR_PROCESSOR
109+ if let PythonResolvedVarNode {
110+ inner : PythonResolvedVarNodeInner :: Direct ( a) ,
111+ } = a
112+ {
113+ a. info ( )
114+ . get_space_info ( a. inner ( ) . space_index )
115+ . unwrap ( )
116+ . _type
117+ == SpaceType :: IPTR_PROCESSOR
105118 } else {
106119 true
107120 }
@@ -116,8 +129,15 @@ impl PythonAssignmentModel {
116129 . flat_map ( |g| g. get_output_vns ( ) . ok ( ) )
117130 . flatten ( )
118131 . filter ( |a| {
119- if let PythonResolvedVarNode :: Direct ( VarNodeDisplay :: Raw ( r) ) = a {
120- r. space_info . _type == SpaceType :: IPTR_PROCESSOR
132+ if let PythonResolvedVarNode {
133+ inner : PythonResolvedVarNodeInner :: Direct ( a) ,
134+ } = a
135+ {
136+ a. info ( )
137+ . get_space_info ( a. inner ( ) . space_index )
138+ . unwrap ( )
139+ . _type
140+ == SpaceType :: IPTR_PROCESSOR
121141 } else {
122142 true
123143 }
0 commit comments