@@ -330,7 +330,7 @@ coff_is_function_symbol (const b_coff_internal_symbol *isym)
330
330
331
331
static int
332
332
coff_initialize_syminfo (struct backtrace_state * state ,
333
- uintptr_t base_address ,
333
+ uintptr_t base_address , int is_64 ,
334
334
const b_coff_section_header * sects , size_t sects_num ,
335
335
const b_coff_external_symbol * syms , size_t syms_size ,
336
336
const unsigned char * strtab , size_t strtab_size ,
@@ -426,9 +426,12 @@ coff_initialize_syminfo (struct backtrace_state *state,
426
426
else
427
427
name = isym .name ;
428
428
429
- /* Strip leading '_'. */
430
- if (name [0 ] == '_' )
431
- name ++ ;
429
+ if (!is_64 )
430
+ {
431
+ /* Strip leading '_'. */
432
+ if (name [0 ] == '_' )
433
+ name ++ ;
434
+ }
432
435
433
436
/* Symbol value is section relative, so we need to read the address
434
437
of its section. */
@@ -605,6 +608,7 @@ coff_add (struct backtrace_state *state, int descriptor,
605
608
off_t max_offset ;
606
609
struct backtrace_view debug_view ;
607
610
int debug_view_valid ;
611
+ int is_64 ;
608
612
uintptr_t image_base ;
609
613
struct dwarf_sections dwarf_sections ;
610
614
@@ -680,12 +684,16 @@ coff_add (struct backtrace_state *state, int descriptor,
680
684
sects = (const b_coff_section_header * )
681
685
(sects_view .data + fhdr .size_of_optional_header );
682
686
687
+ is_64 = 0 ;
683
688
if (fhdr .size_of_optional_header > sizeof (* opt_hdr ))
684
689
{
685
690
if (opt_hdr -> magic == PE_MAGIC )
686
691
image_base = opt_hdr -> u .pe .image_base ;
687
692
else if (opt_hdr -> magic == PEP_MAGIC )
688
- image_base = opt_hdr -> u .pep .image_base ;
693
+ {
694
+ image_base = opt_hdr -> u .pep .image_base ;
695
+ is_64 = 1 ;
696
+ }
689
697
else
690
698
{
691
699
error_callback (data , "bad magic in PE optional header" , 0 );
@@ -778,7 +786,7 @@ coff_add (struct backtrace_state *state, int descriptor,
778
786
if (sdata == NULL )
779
787
goto fail ;
780
788
781
- if (!coff_initialize_syminfo (state , image_base ,
789
+ if (!coff_initialize_syminfo (state , image_base , is_64 ,
782
790
sects , sects_num ,
783
791
syms_view .data , syms_size ,
784
792
str_view .data , str_size ,
0 commit comments