@@ -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
@@ -695,7 +693,7 @@ pub fn instruction_hover(
695693 out. push ( HoverItem :: Separator ) ;
696694 out. append ( & mut relocation_hover ( obj, reloc, None ) ) ;
697695 let bytes = obj. symbol_data ( reloc. relocation . target_symbol ) . unwrap_or ( & [ ] ) ;
698- if let Some ( ty) = obj. arch . guess_data_type ( resolved, bytes) {
696+ if let Some ( ty) = obj. arch . guess_ins_data_type ( resolved, bytes) {
699697 let mut literals = display_ins_data_literals ( obj, resolved) ;
700698 literals. retain ( |lit_info| !lit_info. hidden ( Some ( diff_config) ) ) ;
701699 if !literals. is_empty ( ) {
@@ -882,16 +880,17 @@ pub fn display_ins_data_labels(obj: &Object, resolved: ResolvedInstructionRef) -
882880 } ;
883881 let bytes = & data[ reloc. relocation . addend as usize ..] ;
884882 obj. arch
885- . guess_data_type ( resolved, bytes)
883+ . guess_ins_data_type ( resolved, bytes)
886884 . map ( |ty| ty. display_labels ( obj. endianness , bytes) )
887885 . unwrap_or_default ( )
888886}
889887
890- pub fn display_ins_data_literals (
888+ pub fn display_data_literals (
891889 obj : & Object ,
892- resolved : ResolvedInstructionRef ,
890+ resolved : Option < ResolvedInstructionRef > ,
891+ reloc : Option < ResolvedRelocation > ,
893892) -> Vec < LiteralInfo > {
894- let Some ( reloc) = resolved . relocation else {
893+ let Some ( reloc) = reloc else {
895894 return Vec :: new ( ) ;
896895 } ;
897896 if reloc. relocation . addend < 0 || reloc. relocation . addend as u64 >= reloc. symbol . size {
@@ -902,7 +901,14 @@ pub fn display_ins_data_literals(
902901 } ;
903902 let bytes = & data[ reloc. relocation . addend as usize ..] ;
904903 obj. arch
905- . guess_data_type ( resolved, bytes)
904+ . guess_data_type ( resolved, Some ( reloc ) , bytes)
906905 . map ( |ty| ty. display_literals ( obj. endianness , bytes) )
907906 . unwrap_or_default ( )
908907}
908+
909+ pub fn display_ins_data_literals (
910+ obj : & Object ,
911+ resolved : ResolvedInstructionRef ,
912+ ) -> Vec < LiteralInfo > {
913+ display_data_literals ( obj, Some ( resolved) , resolved. relocation )
914+ }
0 commit comments