@@ -47,6 +47,86 @@ impl<T> Store<T> {
4747 pub fn edit_breakpoints < ' a > ( & ' a mut self ) -> Option < BreakpointEdit < ' a > > {
4848 self . as_store_opaque ( ) . edit_breakpoints ( )
4949 }
50+
51+ /// Get a vector of all Instances held in the Store, for debug
52+ /// purposes.
53+ ///
54+ /// Guest debugging must be enabled for this accessor to return
55+ /// any instances. If it is not, an empty vector is returend.
56+ pub fn debug_all_instances ( & mut self ) -> Vec < Instance > {
57+ self . as_store_opaque ( ) . debug_all_instances ( )
58+ }
59+
60+ /// Get a vector of all Modules held in the Store, for debug
61+ /// purposes.
62+ ///
63+ /// Guest debugging must be enabled for this accessor to return
64+ /// any modules. If it is not, an empty vector is returend.
65+ pub fn debug_all_modules ( & mut self ) -> Vec < Module > {
66+ self . as_store_opaque ( ) . debug_all_modules ( )
67+ }
68+ }
69+
70+ impl < ' a , T > StoreContextMut < ' a , T > {
71+ /// Provide a frame handle for all activations, in order from
72+ /// innermost (most recently called) to outermost on the stack.
73+ ///
74+ /// See [`Store::debug_exit_frames`] for more details.
75+ pub fn debug_exit_frames ( & mut self ) -> impl Iterator < Item = FrameHandle > {
76+ self . 0 . as_store_opaque ( ) . debug_exit_frames ( )
77+ }
78+
79+ /// Start an edit session to update breakpoints.
80+ pub fn edit_breakpoints ( self ) -> Option < BreakpointEdit < ' a > > {
81+ self . 0 . as_store_opaque ( ) . edit_breakpoints ( )
82+ }
83+
84+ /// Get a vector of all Instances held in the Store, for debug
85+ /// purposes.
86+ ///
87+ /// See [`Store::debug_all_instances`] for more details.
88+ pub fn debug_all_instances ( self ) -> Vec < Instance > {
89+ self . 0 . as_store_opaque ( ) . debug_all_instances ( )
90+ }
91+
92+ /// Get a vector of all Modules held in the Store, for debug
93+ /// purposes.
94+ ///
95+ /// See [`Store::debug_all_modules`] for more details.
96+ pub fn debug_all_modules ( self ) -> Vec < Module > {
97+ self . 0 . as_store_opaque ( ) . debug_all_modules ( )
98+ }
99+ }
100+
101+ impl < ' a , T > Caller < ' a , T > {
102+ /// Provide a frame handle for all activations, in order from
103+ /// innermost (most recently called) to outermost on the stack.
104+ ///
105+ /// See [`Store::debug_exit_frames`] for more details.
106+ pub fn debug_exit_frames ( & mut self ) -> impl Iterator < Item = FrameHandle > {
107+ self . store . 0 . as_store_opaque ( ) . debug_exit_frames ( )
108+ }
109+
110+ /// Start an edit session to update breakpoints.
111+ pub fn edit_breakpoints < ' b > ( & ' b mut self ) -> Option < BreakpointEdit < ' b > > {
112+ self . store . 0 . as_store_opaque ( ) . edit_breakpoints ( )
113+ }
114+
115+ /// Get a vector of all Instances held in the Store, for debug
116+ /// purposes.
117+ ///
118+ /// See [`Store::debug_all_instances`] for more details.
119+ pub fn debug_all_instances ( & mut self ) -> Vec < Instance > {
120+ self . store . 0 . as_store_opaque ( ) . debug_all_instances ( )
121+ }
122+
123+ /// Get a vector of all Modules held in the Store, for debug
124+ /// purposes.
125+ ///
126+ /// See [`Store::debug_all_modules`] for more details.
127+ pub fn debug_all_modules ( & mut self ) -> Vec < Module > {
128+ self . store . 0 . as_store_opaque ( ) . debug_all_modules ( )
129+ }
50130}
51131
52132impl StoreOpaque {
@@ -72,30 +152,21 @@ impl StoreOpaque {
72152 let ( breakpoints, registry) = self . breakpoints_and_registry_mut ( ) ;
73153 Some ( breakpoints. edit ( registry) )
74154 }
75- }
76155
77- impl < ' a , T > StoreContextMut < ' a , T > {
78- /// Provide a frame handle for all activations, in order from
79- /// innermost (most recently called) to outermost on the stack.
80- ///
81- /// See [`Store::debug_exit_frames`] for more details.
82- pub fn debug_exit_frames ( & mut self ) -> impl Iterator < Item = FrameHandle > {
83- self . 0 . as_store_opaque ( ) . debug_exit_frames ( )
84- }
156+ fn debug_all_instances ( & mut self ) -> Vec < Instance > {
157+ if !self . engine ( ) . tunables ( ) . debug_guest {
158+ return vec ! [ ] ;
159+ }
85160
86- /// Start an edit session to update breakpoints.
87- pub fn edit_breakpoints ( self ) -> Option < BreakpointEdit < ' a > > {
88- self . 0 . as_store_opaque ( ) . edit_breakpoints ( )
161+ self . all_instances ( ) . collect ( )
89162 }
90- }
91163
92- impl < ' a , T > Caller < ' a , T > {
93- /// Provide a frame handle for all activations, in order from
94- /// innermost (most recently called) to outermost on the stack.
95- ///
96- /// See [`Store::debug_exit_frames`] for more details.
97- pub fn debug_exit_frames ( & mut self ) -> impl Iterator < Item = FrameHandle > {
98- self . store . 0 . as_store_opaque ( ) . debug_exit_frames ( )
164+ fn debug_all_modules ( & self ) -> Vec < Module > {
165+ if !self . engine ( ) . tunables ( ) . debug_guest {
166+ return vec ! [ ] ;
167+ }
168+
169+ self . modules ( ) . all_modules ( ) . cloned ( ) . collect ( )
99170 }
100171}
101172
0 commit comments