1
+ use core:: any:: Any ;
2
+
1
3
use egui:: ScrollArea ;
2
- use objdiff_core:: {
3
- arch:: ppc:: ExceptionInfo ,
4
- obj:: { Object , Symbol } ,
5
- } ;
4
+ use objdiff_core:: { arch:: ppc:: ExceptionInfo , obj:: Object } ;
6
5
7
6
use crate :: views:: { appearance:: Appearance , function_diff:: FunctionDiffContext } ;
8
7
@@ -26,19 +25,19 @@ fn decode_extab(extab: &ExceptionInfo) -> String {
26
25
text
27
26
}
28
27
29
- fn find_extab_entry < ' a > ( _obj : & ' a Object , _symbol : & Symbol ) -> Option < & ' a ExceptionInfo > {
30
- // TODO
31
- // obj. arch. ppc().and_then(|ppc| ppc.extab_for_symbol(symbol) )
32
- None
28
+ fn find_extab_entry ( obj : & Object , symbol_index : usize ) -> Option < & ExceptionInfo > {
29
+ ( obj . arch . as_ref ( ) as & dyn Any )
30
+ . downcast_ref :: < objdiff_core :: arch:: ppc:: ArchPpc > ( )
31
+ . and_then ( |ppc| ppc . extab_for_symbol ( symbol_index ) )
33
32
}
34
33
35
34
fn extab_text_ui (
36
35
ui : & mut egui:: Ui ,
37
36
ctx : FunctionDiffContext < ' _ > ,
38
- symbol : & Symbol ,
37
+ symbol_index : usize ,
39
38
appearance : & Appearance ,
40
39
) -> Option < ( ) > {
41
- if let Some ( extab_entry) = find_extab_entry ( ctx. obj , symbol ) {
40
+ if let Some ( extab_entry) = find_extab_entry ( ctx. obj , symbol_index ) {
42
41
let text = decode_extab ( extab_entry) ;
43
42
ui. colored_label ( appearance. replace_color , & text) ;
44
43
return Some ( ( ) ) ;
@@ -58,10 +57,8 @@ pub(crate) fn extab_ui(
58
57
ui. style_mut ( ) . override_text_style = Some ( egui:: TextStyle :: Monospace ) ;
59
58
ui. style_mut ( ) . wrap_mode = Some ( egui:: TextWrapMode :: Extend ) ;
60
59
61
- if let Some ( symbol) =
62
- ctx. symbol_ref . and_then ( |symbol_ref| ctx. obj . symbols . get ( symbol_ref) )
63
- {
64
- extab_text_ui ( ui, ctx, symbol, appearance) ;
60
+ if let Some ( symbol_index) = ctx. symbol_ref {
61
+ extab_text_ui ( ui, ctx, symbol_index, appearance) ;
65
62
}
66
63
} ) ;
67
64
} ) ;
0 commit comments