@@ -784,14 +784,15 @@ pub struct BreakpointRecord {
784784pub struct DbReplay {
785785 pub db : Box < Db > ,
786786 pub step_id : StepId ,
787+ pub call_key : CallKey ,
787788 pub breakpoint_list : Vec < HashMap < usize , BreakpointRecord > > ,
788789}
789790
790791impl DbReplay {
791792 pub fn new ( db : Box < Db > ) -> DbReplay {
792793 let mut breakpoint_list: Vec < HashMap < usize , BreakpointRecord > > = Default :: default ( ) ;
793794 breakpoint_list. resize_with ( db. paths . len ( ) , HashMap :: new) ;
794- DbReplay { db, step_id : StepId ( 0 ) , breakpoint_list }
795+ DbReplay { db, step_id : StepId ( 0 ) , call_key : CallKey ( 0 ) , breakpoint_list }
795796 }
796797
797798 pub fn step_id_jump ( & mut self , step_id : StepId ) {
@@ -925,6 +926,7 @@ impl Replay for DbReplay {
925926 fn load_location ( & mut self , expr_loader : & mut ExprLoader ) -> Result < Location , Box < dyn Error > > {
926927 info ! ( "load_location: db replay" ) ;
927928 let call_key = self . db . call_key_for_step ( self . step_id ) ;
929+ self . call_key = call_key;
928930 Ok ( self . db . load_location ( self . step_id , call_key, expr_loader) )
929931 }
930932
@@ -999,6 +1001,27 @@ impl Replay for DbReplay {
9991001 Ok ( locals)
10001002 }
10011003
1004+ fn load_value ( & mut self , expression : & str ) -> Result < ValueRecord , Box < dyn Error > > {
1005+ // TODO: a more optimal way: cache a hashmap? or change structure?
1006+ // or again start directly loading available values matching all expressions in the same time?:
1007+ // taking a set of expressions: probably best(maybe add an additional load_values)
1008+ for variable in & self . db . variables [ self . step_id ] {
1009+ if self . db . variable_names [ variable. variable_id ] == expression {
1010+ return Ok ( variable. value . clone ( ) )
1011+ }
1012+ }
1013+ return Err ( format ! ( "variable {expression} not found on this step" ) . into ( ) )
1014+ }
1015+
1016+ fn load_return_value ( & mut self ) -> Result < ValueRecord , Box < dyn Error > > {
1017+ // assumes self.load_location() has been ran, and that we have the current call key
1018+ Ok ( self . db . calls [ self . call_key ] . return_value . clone ( ) )
1019+ }
1020+
1021+ fn load_step_events ( & mut self , step_id : StepId , exact : bool ) -> Vec < DbRecordEvent > {
1022+ self . db . load_step_events ( step_id, exact)
1023+ }
1024+
10021025 fn jump_to ( & mut self , step_id : StepId ) -> Result < bool , Box < dyn Error > > {
10031026 self . step_id = step_id;
10041027 Ok ( true )
0 commit comments