@@ -46,7 +46,7 @@ struct ObjectRecord {
4646
4747pub struct DwarfUnwinder {
4848 cfi : Vec < ObjectRecord > ,
49- ctx : Option < UninitializedUnwindContext < EhFrame < StaticReader > , StaticReader > > ,
49+ ctx : UninitializedUnwindContext < StaticReader > ,
5050}
5151
5252impl Default for DwarfUnwinder {
@@ -77,7 +77,7 @@ impl Default for DwarfUnwinder {
7777
7878 DwarfUnwinder {
7979 cfi,
80- ctx : Some ( UninitializedUnwindContext :: new ( ) ) ,
80+ ctx : UninitializedUnwindContext :: new ( ) ,
8181 }
8282 }
8383}
@@ -96,28 +96,26 @@ struct UnwindInfo<R: Reader> {
9696 personality : Option < Pointer > ,
9797 lsda : Option < Pointer > ,
9898 initial_address : u64 ,
99- ctx : UninitializedUnwindContext < EhFrame < StaticReader > , StaticReader > ,
10099}
101100
102101impl ObjectRecord {
103- fn unwind_info_for_address ( & self ,
104- ctx : UninitializedUnwindContext < EhFrame < StaticReader > , StaticReader > ,
105- address : u64 ) -> gimli:: Result < UnwindInfo < StaticReader > > {
102+ fn unwind_info_for_address (
103+ & self ,
104+ ctx : & mut UninitializedUnwindContext < StaticReader > ,
105+ address : u64 ,
106+ ) -> gimli:: Result < UnwindInfo < StaticReader > > {
106107 let & ObjectRecord {
107108 ref eh_frame_hdr,
108- eh_frame : ref sel ,
109+ ref eh_frame ,
109110 ref bases,
110111 ..
111112 } = self ;
112113
113114 let fde = eh_frame_hdr. table ( ) . unwrap ( )
114- . lookup_and_parse ( address, bases, sel. clone ( ) , |offset| sel. cie_from_offset ( bases, offset) ) ?;
115-
115+ . fde_for_address ( eh_frame, bases, address, EhFrame :: cie_from_offset) ?;
116116 let mut result_row = None ;
117- let mut ctx = ctx. initialize ( fde. cie ( ) ) . unwrap ( ) ;
118-
119117 {
120- let mut table = UnwindTable :: new ( & mut ctx, & fde) ;
118+ let mut table = UnwindTable :: new ( eh_frame , bases , ctx, & fde) ? ;
121119 while let Some ( row) = table. next_row ( ) ? {
122120 if row. contains ( address) {
123121 result_row = Some ( row. clone ( ) ) ;
@@ -129,7 +127,6 @@ impl ObjectRecord {
129127 match result_row {
130128 Some ( row) => Ok ( UnwindInfo {
131129 row,
132- ctx : ctx. reset ( ) ,
133130 personality : fde. personality ( ) ,
134131 lsda : fde. lsda ( ) ,
135132 initial_address : fde. initial_address ( ) ,
@@ -198,9 +195,7 @@ impl<'a> FallibleIterator for StackFrames<'a> {
198195
199196 let rec = self . unwinder . cfi . iter ( ) . filter ( |x| x. er . text . contains ( caller) ) . next ( ) . ok_or ( gimli:: Error :: NoUnwindInfoForAddress ) ?;
200197
201- let ctx = self . unwinder . ctx . take ( ) . unwrap_or_else ( UninitializedUnwindContext :: new) ;
202- let UnwindInfo { row, personality, lsda, initial_address, ctx } = rec. unwind_info_for_address ( ctx, caller) ?;
203- self . unwinder . ctx = Some ( ctx) ;
198+ let UnwindInfo { row, personality, lsda, initial_address } = rec. unwind_info_for_address ( & mut self . unwinder . ctx , caller) ?;
204199
205200 trace ! ( "ok: {:?} (0x{:x} - 0x{:x})" , row. cfa( ) , row. start_address( ) , row. end_address( ) ) ;
206201 let cfa = match * row. cfa ( ) {
0 commit comments