@@ -65,73 +65,6 @@ rust_crate_cache::c_sym::get_val() {
65
65
return val;
66
66
}
67
67
68
-
69
-
70
- rust_crate_cache::rust_sym::rust_sym (rust_dom *dom,
71
- rust_crate const *curr_crate,
72
- c_sym *crate_sym,
73
- char const **path)
74
- : val(0 ),
75
- crate_sym(crate_sym),
76
- dom(dom)
77
- {
78
- crate_sym->ref ();
79
- typedef rust_crate_reader::die die;
80
- rust_crate const *crate = (rust_crate*)crate_sym->get_val ();
81
- if (!crate) {
82
- DLOG_ERR (dom, cache, " failed to resolve symbol, null crate symbol" );
83
- return ;
84
- }
85
- rust_crate_reader rdr (dom, crate);
86
- bool found_root = false ;
87
- bool found_leaf = false ;
88
- for (die d = rdr.dies .first_die ();
89
- !(found_root || d.is_null ());
90
- d = d.next_sibling ()) {
91
-
92
- die t1 = d;
93
- die t2 = d;
94
- for (char const **c = crate_rel (curr_crate, path);
95
- (*c
96
- && !t1.is_null ()
97
- && t1.find_child_by_name (crate_rel (curr_crate, *c), t2));
98
- ++c, t1=t2) {
99
- DLOG (dom, dwarf, " matched die <0x%" PRIxPTR
100
- " >, child '%s' = die<0x%" PRIxPTR " >" ,
101
- t1.off , crate_rel (curr_crate, *c), t2.off );
102
- found_root = found_root || true ;
103
- if (!*(c+1 ) && t2.find_num_attr (DW_AT_low_pc, val)) {
104
- DLOG (dom, dwarf, " found relative address: 0x%" PRIxPTR, val);
105
- DLOG (dom, dwarf, " plus image-base 0x%" PRIxPTR,
106
- crate->get_image_base ());
107
- val += crate->get_image_base ();
108
- found_leaf = true ;
109
- break ;
110
- }
111
- }
112
- if (found_root || found_leaf)
113
- break ;
114
- }
115
- if (found_leaf) {
116
- DLOG (dom, cache, " resolved symbol to 0x%" PRIxPTR, val);
117
- } else {
118
- DLOG_ERR (dom, cache, " failed to resolve symbol" );
119
- }
120
- }
121
-
122
- rust_crate_cache::rust_sym::~rust_sym () {
123
- DLOG (dom, cache,
124
- " ~rust_crate_cache::rust_sym(0x%" PRIxPTR " )" , val);
125
- crate_sym->deref ();
126
- }
127
-
128
- uintptr_t
129
- rust_crate_cache::rust_sym::get_val () {
130
- return val;
131
- }
132
-
133
-
134
-
135
68
static inline void
136
69
adjust_disp (uintptr_t &disp, const void *oldp, const void *newp)
137
70
{
@@ -180,33 +113,20 @@ rust_crate_cache::get_type_desc(size_t size,
180
113
181
114
rust_crate_cache::rust_crate_cache (rust_dom *dom,
182
115
rust_crate const *crate)
183
- : rust_syms((rust_sym**)
184
- dom->calloc(sizeof (rust_sym*) * crate->n_rust_syms)),
185
- c_syms((c_sym**) dom->calloc(sizeof (c_sym*) * crate->n_c_syms)),
116
+ : c_syms((c_sym**) dom->calloc(sizeof (c_sym*) * crate->n_c_syms)),
186
117
libs((lib**) dom->calloc(sizeof (lib*) * crate->n_libs)),
187
118
type_descs(NULL ),
188
119
crate(crate),
189
120
dom(dom),
190
121
idx(0 )
191
122
{
192
- I (dom, rust_syms);
193
123
I (dom, c_syms);
194
124
I (dom, libs);
195
125
}
196
126
197
127
void
198
128
rust_crate_cache::flush () {
199
129
DLOG (dom, cache, " rust_crate_cache::flush()" );
200
- for (size_t i = 0 ; i < crate->n_rust_syms ; ++i) {
201
- rust_sym *s = rust_syms[i];
202
- if (s) {
203
- DLOG (dom, cache,
204
- " rust_crate_cache::flush() deref rust_sym %"
205
- PRIdPTR " (rc=%" PRIdPTR " )" , i, s->ref_count );
206
- s->deref ();
207
- }
208
- rust_syms[i] = NULL ;
209
- }
210
130
211
131
for (size_t i = 0 ; i < crate->n_c_syms ; ++i) {
212
132
c_sym *s = c_syms[i];
@@ -240,7 +160,6 @@ rust_crate_cache::flush() {
240
160
rust_crate_cache::~rust_crate_cache ()
241
161
{
242
162
flush ();
243
- dom->free (rust_syms);
244
163
dom->free (c_syms);
245
164
dom->free (libs);
246
165
}
0 commit comments