@@ -77,6 +77,7 @@ impl Mapping {
77
77
// only borrow `map` and `stash` and we're preserving them below.
78
78
cx : unsafe { core:: mem:: transmute :: < Context < ' _ > , Context < ' static > > ( cx) } ,
79
79
_map : map,
80
+ _map_sup : None ,
80
81
_stash : stash,
81
82
} )
82
83
}
@@ -90,13 +91,44 @@ impl Mapping {
90
91
// TODO: check crc
91
92
}
92
93
94
+ // Try to locate a supplementary object file.
95
+ let tmp_stash = Stash :: new ( ) ;
96
+ if let Some ( section) = object. section ( & tmp_stash, ".gnu_debugaltlink" ) {
97
+ if let Some ( len) = section. iter ( ) . position ( |x| * x == 0 ) {
98
+ let filename = & section[ ..len] ;
99
+ let build_id_sup = & section[ len + 1 ..] ;
100
+ if let Some ( path_sup) = locate_debuglink ( path, filename) {
101
+ if let Some ( map_sup) = super :: mmap ( & path_sup) {
102
+ if let Some ( sup) = Object :: parse ( & map_sup) {
103
+ if sup. build_id ( ) == Some ( build_id_sup) {
104
+ let stash = Stash :: new ( ) ;
105
+ let cx = Context :: new_sup ( & stash, object, sup) ?;
106
+ return Some ( Mapping {
107
+ // Convert to 'static lifetimes since the symbols should
108
+ // only borrow `map`, `map_sup`, and `stash` and we're
109
+ // preserving them below.
110
+ cx : unsafe {
111
+ core:: mem:: transmute :: < Context < ' _ > , Context < ' static > > ( cx)
112
+ } ,
113
+ _map : map,
114
+ _map_sup : Some ( map_sup) ,
115
+ _stash : stash,
116
+ } ) ;
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+
93
124
let stash = Stash :: new ( ) ;
94
125
let cx = Context :: new ( & stash, object) ?;
95
126
Some ( Mapping {
96
127
// Convert to 'static lifetimes since the symbols should
97
128
// only borrow `map` and `stash` and we're preserving them below.
98
129
cx : unsafe { core:: mem:: transmute :: < Context < ' _ > , Context < ' static > > ( cx) } ,
99
130
_map : map,
131
+ _map_sup : None ,
100
132
_stash : stash,
101
133
} )
102
134
}
0 commit comments