@@ -74,19 +74,6 @@ impl FunctionViewState {
74
74
}
75
75
}
76
76
77
- fn find_symbol_matching_fake_symbol_in_sections (
78
- fake_symbol : & ObjSymbol ,
79
- sections : & [ ObjSection ] ,
80
- ) -> Option < ObjSymbol > {
81
- let orig_section_index = fake_symbol. orig_section_index ?;
82
- let section = sections. iter ( ) . find ( |s| s. orig_index == orig_section_index) ?;
83
- let real_symbol = section
84
- . symbols
85
- . iter ( )
86
- . find ( |s| s. size > 0 && ( s. address ..s. address + s. size ) . contains ( & fake_symbol. address ) ) ?;
87
- Some ( real_symbol. clone ( ) )
88
- }
89
-
90
77
fn ins_hover_ui (
91
78
ui : & mut egui:: Ui ,
92
79
obj : & ObjInfo ,
@@ -132,29 +119,17 @@ fn ins_hover_ui(
132
119
}
133
120
134
121
if let Some ( reloc) = ins. reloc . as_ref ( ) . or ( ins. fake_pool_reloc . as_ref ( ) ) {
135
- let mut target = reloc. target . clone ( ) ;
136
- let mut addend = reloc. addend ;
137
- if target. size == 0 && target. name . is_empty ( ) {
138
- // Fake target symbol we added as a placeholder. We need to find the real one.
139
- if let Some ( real_target) =
140
- find_symbol_matching_fake_symbol_in_sections ( & target, & obj. sections )
141
- {
142
- target = real_target;
143
- addend = ( reloc. target . address - target. address ) as i64 ;
144
- }
145
- }
146
-
147
122
ui. label ( format ! ( "Relocation type: {}" , obj. arch. display_reloc( reloc. flags) ) ) ;
148
- let addend_str = match addend. cmp ( & 0i64 ) {
149
- Ordering :: Greater => format ! ( "+{:x}" , addend) ,
150
- Ordering :: Less => format ! ( "-{:x}" , -addend) ,
123
+ let addend_str = match reloc . addend . cmp ( & 0i64 ) {
124
+ Ordering :: Greater => format ! ( "+{:x}" , reloc . addend) ,
125
+ Ordering :: Less => format ! ( "-{:x}" , -reloc . addend) ,
151
126
_ => "" . to_string ( ) ,
152
127
} ;
153
128
ui. colored_label (
154
129
appearance. highlight_color ,
155
- format ! ( "Name: {}{}" , target. name, addend_str) ,
130
+ format ! ( "Name: {}{}" , reloc . target. name, addend_str) ,
156
131
) ;
157
- if let Some ( orig_section_index) = target. orig_section_index {
132
+ if let Some ( orig_section_index) = reloc . target . orig_section_index {
158
133
if let Some ( section) =
159
134
obj. sections . iter ( ) . find ( |s| s. orig_index == orig_section_index)
160
135
{
@@ -165,12 +140,15 @@ fn ins_hover_ui(
165
140
}
166
141
ui. colored_label (
167
142
appearance. highlight_color ,
168
- format ! ( "Address: {:x}{}" , target. address, addend_str) ,
143
+ format ! ( "Address: {:x}{}" , reloc. target. address, addend_str) ,
144
+ ) ;
145
+ ui. colored_label (
146
+ appearance. highlight_color ,
147
+ format ! ( "Size: {:x}" , reloc. target. size) ,
169
148
) ;
170
- ui. colored_label ( appearance. highlight_color , format ! ( "Size: {:x}" , target. size) ) ;
171
- if addend >= 0 && target. bytes . len ( ) > addend as usize {
149
+ if reloc. addend >= 0 && reloc. target . bytes . len ( ) > reloc. addend as usize {
172
150
if let Some ( s) = obj. arch . guess_data_type ( ins) . and_then ( |ty| {
173
- obj. arch . display_data_type ( ty, & target. bytes [ addend as usize ..] )
151
+ obj. arch . display_data_type ( ty, & reloc . target . bytes [ reloc . addend as usize ..] )
174
152
} ) {
175
153
ui. colored_label ( appearance. highlight_color , s) ;
176
154
}
0 commit comments