@@ -499,18 +499,16 @@ pub fn relocation_context(
499499) -> Vec < ContextItem > {
500500 let mut out = Vec :: new ( ) ;
501501 out. append ( & mut symbol_context ( obj, reloc. relocation . target_symbol ) ) ;
502- if let Some ( ins) = ins {
503- let mut literals = display_ins_data_literals ( obj, ins) ;
504- literals. retain ( |lit_info| !lit_info. hidden ( diff_config) ) ;
505- if !literals. is_empty ( ) {
506- out. push ( ContextItem :: Separator ) ;
507- for lit_info in literals {
508- out. push ( ContextItem :: Copy {
509- value : lit_info. literal ,
510- label : lit_info. label_override ,
511- copy_string : lit_info. copy_string ,
512- } ) ;
513- }
502+ let mut literals = display_data_literals ( obj, ins, Some ( reloc) ) ;
503+ literals. retain ( |lit_info| !lit_info. hidden ( diff_config) ) ;
504+ if !literals. is_empty ( ) {
505+ out. push ( ContextItem :: Separator ) ;
506+ for lit_info in literals {
507+ out. push ( ContextItem :: Copy {
508+ value : lit_info. literal ,
509+ label : lit_info. label_override ,
510+ copy_string : lit_info. copy_string ,
511+ } ) ;
514512 }
515513 }
516514 out
@@ -563,6 +561,7 @@ pub fn data_row_context(obj: &Object, diff_row: &DataDiffRow) -> Vec<ContextItem
563561
564562 let reloc = resolve_relocation ( & obj. symbols , reloc) ;
565563 out. append ( & mut relocation_context ( obj, reloc, None , None ) ) ;
564+ out. push ( ContextItem :: Separator ) ;
566565 }
567566 out
568567}
@@ -695,7 +694,7 @@ pub fn instruction_hover(
695694 out. push ( HoverItem :: Separator ) ;
696695 out. append ( & mut relocation_hover ( obj, reloc, None ) ) ;
697696 let bytes = obj. symbol_data ( reloc. relocation . target_symbol ) . unwrap_or ( & [ ] ) ;
698- if let Some ( ty) = obj. arch . guess_data_type ( resolved, bytes) {
697+ if let Some ( ty) = obj. arch . guess_ins_data_type ( resolved, bytes) {
699698 let mut literals = display_ins_data_literals ( obj, resolved) ;
700699 literals. retain ( |lit_info| !lit_info. hidden ( Some ( diff_config) ) ) ;
701700 if !literals. is_empty ( ) {
@@ -882,16 +881,17 @@ pub fn display_ins_data_labels(obj: &Object, resolved: ResolvedInstructionRef) -
882881 } ;
883882 let bytes = & data[ reloc. relocation . addend as usize ..] ;
884883 obj. arch
885- . guess_data_type ( resolved, bytes)
884+ . guess_ins_data_type ( resolved, bytes)
886885 . map ( |ty| ty. display_labels ( obj. endianness , bytes) )
887886 . unwrap_or_default ( )
888887}
889888
890- pub fn display_ins_data_literals (
889+ pub fn display_data_literals (
891890 obj : & Object ,
892- resolved : ResolvedInstructionRef ,
891+ resolved : Option < ResolvedInstructionRef > ,
892+ reloc : Option < ResolvedRelocation > ,
893893) -> Vec < LiteralInfo > {
894- let Some ( reloc) = resolved . relocation else {
894+ let Some ( reloc) = reloc else {
895895 return Vec :: new ( ) ;
896896 } ;
897897 if reloc. relocation . addend < 0 || reloc. relocation . addend as u64 >= reloc. symbol . size {
@@ -902,7 +902,14 @@ pub fn display_ins_data_literals(
902902 } ;
903903 let bytes = & data[ reloc. relocation . addend as usize ..] ;
904904 obj. arch
905- . guess_data_type ( resolved, bytes)
905+ . guess_data_type ( resolved, Some ( reloc ) , bytes)
906906 . map ( |ty| ty. display_literals ( obj. endianness , bytes) )
907907 . unwrap_or_default ( )
908908}
909+
910+ pub fn display_ins_data_literals (
911+ obj : & Object ,
912+ resolved : ResolvedInstructionRef ,
913+ ) -> Vec < LiteralInfo > {
914+ display_data_literals ( obj, Some ( resolved) , resolved. relocation )
915+ }
0 commit comments