@@ -346,7 +346,7 @@ pub fn symbol_context(obj: &Object, symbol_index: usize) -> Vec<ContextItem> {
346
346
if symbol. section . is_some ( ) {
347
347
if let Some ( address) = symbol. virtual_address {
348
348
out. push ( ContextItem :: Copy {
349
- value : format ! ( "{:# x}" , address) ,
349
+ value : format ! ( "{:x}" , address) ,
350
350
label : Some ( "virtual address" . to_string ( ) ) ,
351
351
} ) ;
352
352
}
@@ -409,7 +409,7 @@ pub fn symbol_hover(obj: &Object, symbol_index: usize, addend: i64) -> Vec<Hover
409
409
if let Some ( address) = symbol. virtual_address {
410
410
out. push ( HoverItem :: Text {
411
411
label : "Virtual address" . into ( ) ,
412
- value : format ! ( "{:# x}" , address) ,
412
+ value : format ! ( "{:x}" , address) ,
413
413
color : HoverItemColor :: Special ,
414
414
} ) ;
415
415
}
@@ -430,32 +430,34 @@ pub fn relocation_context(
430
430
ins : Option < ResolvedInstructionRef > ,
431
431
) -> Vec < ContextItem > {
432
432
let mut out = Vec :: new ( ) ;
433
+ out. append ( & mut symbol_context ( obj, reloc. relocation . target_symbol ) ) ;
433
434
if let Some ( ins) = ins {
434
- for literal in display_ins_data_literals ( obj, ins) {
435
- out. push ( ContextItem :: Copy { value : literal, label : None } ) ;
435
+ let literals = display_ins_data_literals ( obj, ins) ;
436
+ if !literals. is_empty ( ) {
437
+ out. push ( ContextItem :: Separator ) ;
438
+ for literal in literals {
439
+ out. push ( ContextItem :: Copy { value : literal, label : None } ) ;
440
+ }
436
441
}
437
- out. push ( ContextItem :: Separator ) ;
438
442
}
439
- out. append ( & mut symbol_context ( obj, reloc. relocation . target_symbol ) ) ;
440
443
out
441
444
}
442
445
443
446
pub fn relocation_hover ( obj : & Object , reloc : ResolvedRelocation ) -> Vec < HoverItem > {
444
447
let mut out = Vec :: new ( ) ;
445
448
if let Some ( name) = obj. arch . reloc_name ( reloc. relocation . flags ) {
446
449
out. push ( HoverItem :: Text {
447
- label : "Relocation type " . into ( ) ,
450
+ label : "Relocation" . into ( ) ,
448
451
value : name. to_string ( ) ,
449
452
color : HoverItemColor :: Normal ,
450
453
} ) ;
451
454
} else {
452
455
out. push ( HoverItem :: Text {
453
- label : "Relocation type " . into ( ) ,
456
+ label : "Relocation" . into ( ) ,
454
457
value : format ! ( "<{:?}>" , reloc. relocation. flags) ,
455
458
color : HoverItemColor :: Normal ,
456
459
} ) ;
457
460
}
458
- out. push ( HoverItem :: Separator ) ;
459
461
out. append ( & mut symbol_hover ( obj, reloc. relocation . target_symbol , reloc. relocation . addend ) ) ;
460
462
out
461
463
}
@@ -494,6 +496,7 @@ pub fn instruction_context(
494
496
}
495
497
}
496
498
if let Some ( reloc) = resolved. relocation {
499
+ out. push ( ContextItem :: Separator ) ;
497
500
out. append ( & mut relocation_context ( obj, reloc, Some ( resolved) ) ) ;
498
501
}
499
502
out
@@ -515,7 +518,7 @@ pub fn instruction_hover(
515
518
let offset = resolved. ins_ref . address - resolved. symbol . address ;
516
519
out. push ( HoverItem :: Text {
517
520
label : "Virtual address" . into ( ) ,
518
- value : format ! ( "{:# x}" , virtual_address + offset) ,
521
+ value : format ! ( "{:x}" , virtual_address + offset) ,
519
522
color : HoverItemColor :: Special ,
520
523
} ) ;
521
524
}
@@ -541,15 +544,19 @@ pub fn instruction_hover(
541
544
}
542
545
}
543
546
if let Some ( reloc) = resolved. relocation {
544
- out. append ( & mut relocation_hover ( obj, reloc) ) ;
545
547
out. push ( HoverItem :: Separator ) ;
548
+ out. append ( & mut relocation_hover ( obj, reloc) ) ;
546
549
if let Some ( ty) = obj. arch . guess_data_type ( resolved) {
547
- for literal in display_ins_data_literals ( obj, resolved) {
548
- out. push ( HoverItem :: Text {
549
- label : format ! ( "{}" , ty) ,
550
- value : literal,
551
- color : HoverItemColor :: Normal ,
552
- } ) ;
550
+ let literals = display_ins_data_literals ( obj, resolved) ;
551
+ if !literals. is_empty ( ) {
552
+ out. push ( HoverItem :: Separator ) ;
553
+ for literal in literals {
554
+ out. push ( HoverItem :: Text {
555
+ label : format ! ( "{}" , ty) ,
556
+ value : literal,
557
+ color : HoverItemColor :: Normal ,
558
+ } ) ;
559
+ }
553
560
}
554
561
}
555
562
}
0 commit comments