@@ -74,19 +74,6 @@ impl FunctionViewState {
7474 }
7575}
7676
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-
9077fn ins_hover_ui (
9178 ui : & mut egui:: Ui ,
9279 obj : & ObjInfo ,
@@ -132,29 +119,17 @@ fn ins_hover_ui(
132119 }
133120
134121 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-
147122 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) ,
151126 _ => "" . to_string ( ) ,
152127 } ;
153128 ui. colored_label (
154129 appearance. highlight_color ,
155- format ! ( "Name: {}{}" , target. name, addend_str) ,
130+ format ! ( "Name: {}{}" , reloc . target. name, addend_str) ,
156131 ) ;
157- if let Some ( orig_section_index) = target. orig_section_index {
132+ if let Some ( orig_section_index) = reloc . target . orig_section_index {
158133 if let Some ( section) =
159134 obj. sections . iter ( ) . find ( |s| s. orig_index == orig_section_index)
160135 {
@@ -165,12 +140,15 @@ fn ins_hover_ui(
165140 }
166141 ui. colored_label (
167142 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) ,
169148 ) ;
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 {
172150 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 ..] )
174152 } ) {
175153 ui. colored_label ( appearance. highlight_color , s) ;
176154 }
0 commit comments