@@ -3,12 +3,13 @@ use elsa::sync::FrozenVec;
3
3
use gimli:: { CieOrFde , Dwarf , EhFrame , EndianSlice , RunTimeEndian , UnwindSection } ;
4
4
use object:: { File , FileKind , Object , ObjectSection , ReadRef } ;
5
5
use std:: io:: Cursor ;
6
+ use std:: sync:: Arc ;
6
7
use yoke:: Yoke ;
7
8
use yoke_derive:: Yokeable ;
8
9
9
10
use crate :: dwarf:: Addr2lineContextData ;
10
11
use crate :: error:: Error ;
11
- use crate :: shared:: { FileAndPathHelper , FileContents , FileContentsWrapper , FileLocation } ;
12
+ use crate :: shared:: { FileAndPathHelper , FileContents , FileContentsWrapper } ;
12
13
use crate :: symbol_map:: SymbolMap ;
13
14
use crate :: symbol_map_object:: {
14
15
AddDwoAndMakeDwarf , ObjectSymbolMap , ObjectSymbolMapInner , ObjectSymbolMapOuter ,
@@ -17,28 +18,23 @@ use crate::symbol_map_object::{
17
18
} ;
18
19
use crate :: { debug_id_for_object, ElfBuildId } ;
19
20
20
- pub async fn load_symbol_map_for_elf < T , FL , H > (
21
- file_location : FL ,
22
- file_contents : FileContentsWrapper < T > ,
21
+ pub async fn load_symbol_map_for_elf < H : FileAndPathHelper > (
22
+ file_location : H :: FL ,
23
+ file_contents : FileContentsWrapper < H :: F > ,
23
24
file_kind : FileKind ,
24
- helper : & H ,
25
- ) -> Result < SymbolMap < FL , T > , Error >
26
- where
27
- T : FileContents + ' static ,
28
- H : FileAndPathHelper < F = T , FL = FL > ,
29
- FL : FileLocation ,
30
- {
25
+ helper : Arc < H > ,
26
+ ) -> Result < SymbolMap < H > , Error > {
31
27
let elf_file =
32
28
File :: parse ( & file_contents) . map_err ( |e| Error :: ObjectParseError ( file_kind, e) ) ?;
33
29
34
30
if let Some ( symbol_map) =
35
- try_to_get_symbol_map_from_debug_link ( & file_location, & elf_file, file_kind, helper) . await
31
+ try_to_get_symbol_map_from_debug_link ( & file_location, & elf_file, file_kind, & * helper) . await
36
32
{
37
33
return Ok ( symbol_map) ;
38
34
}
39
35
40
36
if let Some ( supplementary_file) =
41
- try_to_load_supplementary_file ( & file_location, & elf_file, helper) . await
37
+ try_to_load_supplementary_file ( & file_location, & elf_file, & * helper) . await
42
38
{
43
39
let owner = ElfSymbolMapDataAndObjects :: new (
44
40
file_contents,
47
43
None ,
48
44
) ?;
49
45
let symbol_map = ObjectSymbolMap :: new ( owner) ?;
50
- return Ok ( SymbolMap :: new_without ( file_location, Box :: new ( symbol_map) ) ) ;
46
+ return Ok ( SymbolMap :: new_plain ( file_location, Box :: new ( symbol_map) ) ) ;
51
47
}
52
48
53
49
// If this file has a .gnu_debugdata section, use the uncompressed object from that section instead.
@@ -59,20 +55,22 @@ where
59
55
60
56
let owner = ElfSymbolMapDataAndObjects :: new ( file_contents, None , file_kind, None ) ?;
61
57
let symbol_map = ObjectSymbolMapWithDwoSupport :: new ( owner) ?;
62
- Ok ( SymbolMap :: new_with ( file_location, Box :: new ( symbol_map) ) )
58
+ Ok ( SymbolMap :: new_with (
59
+ file_location,
60
+ Box :: new ( symbol_map) ,
61
+ helper,
62
+ ) )
63
63
}
64
64
65
- async fn try_to_get_symbol_map_from_debug_link < ' data , H , R , FL , FC > (
66
- original_file_location : & FL ,
65
+ async fn try_to_get_symbol_map_from_debug_link < ' data , H , R > (
66
+ original_file_location : & H :: FL ,
67
67
elf_file : & File < ' data , R > ,
68
68
file_kind : FileKind ,
69
69
helper : & H ,
70
- ) -> Option < SymbolMap < FL , FC > >
70
+ ) -> Option < SymbolMap < H > >
71
71
where
72
- H : FileAndPathHelper < FL = FL , F = FC > ,
73
72
R : ReadRef < ' data > ,
74
- FL : FileLocation ,
75
- FC : FileContents + ' static ,
73
+ H : FileAndPathHelper ,
76
74
{
77
75
let ( name, crc) = elf_file. gnu_debuglink ( ) . ok ( ) . flatten ( ) ?;
78
76
let debug_id = debug_id_for_object ( elf_file) ?;
@@ -99,18 +97,16 @@ where
99
97
None
100
98
}
101
99
102
- async fn get_symbol_map_for_debug_link_candidate < H , FL , FC > (
103
- original_file_location : & FL ,
104
- path : & FL ,
100
+ async fn get_symbol_map_for_debug_link_candidate < H > (
101
+ original_file_location : & H :: FL ,
102
+ path : & H :: FL ,
105
103
debug_id : DebugId ,
106
104
expected_crc : u32 ,
107
105
file_kind : FileKind ,
108
106
helper : & H ,
109
- ) -> Result < SymbolMap < FL , FC > , Error >
107
+ ) -> Result < SymbolMap < H > , Error >
110
108
where
111
- H : FileAndPathHelper < FL = FL , F = FC > ,
112
- FL : FileLocation ,
113
- FC : FileContents + ' static ,
109
+ H : FileAndPathHelper ,
114
110
{
115
111
let file_contents = helper
116
112
. load_file ( path. clone ( ) )
@@ -125,7 +121,7 @@ where
125
121
126
122
let owner = ElfSymbolMapDataAndObjects :: new ( file_contents, None , file_kind, Some ( debug_id) ) ?;
127
123
let symbol_map = ObjectSymbolMap :: new ( owner) ?;
128
- Ok ( SymbolMap :: new_without (
124
+ Ok ( SymbolMap :: new_plain (
129
125
original_file_location. clone ( ) ,
130
126
Box :: new ( symbol_map) ,
131
127
) )
@@ -268,11 +264,11 @@ where
268
264
None
269
265
}
270
266
271
- fn try_get_symbol_map_from_mini_debug_info < ' data , R : ReadRef < ' data > , FL : FileLocation , FC > (
267
+ fn try_get_symbol_map_from_mini_debug_info < ' data , R : ReadRef < ' data > , H : FileAndPathHelper > (
272
268
elf_file : & File < ' data , R > ,
273
269
file_kind : FileKind ,
274
- debug_file_location : & FL ,
275
- ) -> Option < SymbolMap < FL , FC > > {
270
+ debug_file_location : & H :: FL ,
271
+ ) -> Option < SymbolMap < H > > {
276
272
let debugdata = elf_file. section_by_name ( ".gnu_debugdata" ) ?;
277
273
let data = debugdata. data ( ) . ok ( ) ?;
278
274
let mut cursor = Cursor :: new ( data) ;
@@ -281,7 +277,7 @@ fn try_get_symbol_map_from_mini_debug_info<'data, R: ReadRef<'data>, FL: FileLoc
281
277
let file_contents = FileContentsWrapper :: new ( objdata) ;
282
278
let owner = ElfSymbolMapDataAndObjects :: new ( file_contents, None , file_kind, None ) . ok ( ) ?;
283
279
let symbol_map = ObjectSymbolMap :: new ( owner) . ok ( ) ?;
284
- Some ( SymbolMap :: new_without (
280
+ Some ( SymbolMap :: new_plain (
285
281
debug_file_location. clone ( ) ,
286
282
Box :: new ( symbol_map) ,
287
283
) )
0 commit comments