* Another Fortran problem...
@ 2007-10-26 10:39 François-Xavier Coudert
2007-10-26 12:03 ` Daniel Jacobowitz
2007-10-26 13:05 ` François-Xavier Coudert
0 siblings, 2 replies; 6+ messages in thread
From: François-Xavier Coudert @ 2007-10-26 10:39 UTC (permalink / raw)
To: gdb
[-- Attachment #1: Type: text/plain, Size: 1614 bytes --]
Hi all,
I take as an example a Fortran source file containing en empty
subroutine and an empty program:
$ cat a.f90
subroutine foo
end subroutine foo
program bar
end
When I compile it with gfortran and load it into gdb, I can't set
breakpoints on "foo", but only on "foo_" (which is the mangled name).
I was looking into why gfortran doesn't emit the necessary debug info,
but I think it actually does. The relevant output from readelf says:
<1><19c>: Abbrev Number: 2 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : foo
DW_AT_decl_file : 1
DW_AT_decl_line : 1
DW_AT_MIPS_linkage_name: foo_
DW_AT_low_pc : 0x4005fc
DW_AT_high_pc : 0x400602
DW_AT_frame_base : 0 (location list)
Now, what I don't understand is when I compile it with the Intel
compiler, it's possible to set breakpoints on "foo" as well as "foo_",
even though the debug info seems similar:
<1><187>: Abbrev Number: 3 (DW_TAG_subprogram)
DW_AT_decl_line : 1
DW_AT_decl_column : 12
DW_AT_decl_file : 1
DW_AT_inline : 0 (not inlined)
DW_AT_accessibility: 1 (public)
DW_AT_type : <17f>
DW_AT_prototyped : 0
DW_AT_name : foo
DW_AT_low_pc : 0x4028f0
DW_AT_high_pc : 0x4028f6
DW_AT_external : 1
Is "DW_AT_MIPS_linkage_name: foo_" the reason for this difference?
Should DW_AT_MIPS_linkage_name actually be emitted or is this wrong?
Thanks for your help,
FX
PS: please find attached the complete readelf output for both
compilers, I case more information is needed.
[-- Attachment #2: gfortran.txt --]
[-- Type: text/plain, Size: 18019 bytes --]
The section .debug_info contains:
Compilation Unit @ offset 0x0:
Length: 127
Version: 2
Abbrev Offset: 0
Pointer Size: 8
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0
DW_AT_low_pc : 0x400510
DW_AT_high_pc : 0x40053b
DW_AT_name : ../sysdeps/x86_64/elf/start.S
DW_AT_comp_dir : /tmp/buildd/glibc-2.3.6.ds1/build-tree/glibc-2.3.6/csu
DW_AT_producer : GNU AS 2.17
DW_AT_language : 32769 (MIPS assembler)
Compilation Unit @ offset 0x83:
Length: 142
Version: 2
Abbrev Offset: 21
Pointer Size: 8
<0><8e>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0x7e
DW_AT_name : /tmp/buildd/glibc-2.3.6.ds1/build-tree/amd64-libc/csu/crti.S
DW_AT_comp_dir : /tmp/buildd/glibc-2.3.6.ds1/build-tree/glibc-2.3.6/csu
DW_AT_producer : GNU AS 2.17
DW_AT_language : 32769 (MIPS assembler)
Compilation Unit @ offset 0x115:
Length: 197
Version: 2
Abbrev Offset: 37
Pointer Size: 8
<0><120>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_producer : GNU F95 4.3.0 20071018 (experimental) [trunk revision 129463]
DW_AT_language : 14 (Fortran 95)
DW_AT_name : z.f90
DW_AT_comp_dir : /home/fxcoudert/devel/debug2/irun
DW_AT_low_pc : 0x4005fc
DW_AT_high_pc : 0x400617
DW_AT_stmt_list : 0x11b
<1><19c>: Abbrev Number: 2 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : foo
DW_AT_decl_file : 1
DW_AT_decl_line : 1
DW_AT_MIPS_linkage_name: foo_
DW_AT_low_pc : 0x4005fc
DW_AT_high_pc : 0x400602
DW_AT_frame_base : 0 (location list)
<1><1bd>: Abbrev Number: 3 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : MAIN__
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_low_pc : 0x400602
DW_AT_high_pc : 0x400617
DW_AT_frame_base : 0x4c (location list)
DW_AT_calling_convention: 2 (program)
Compilation Unit @ offset 0x1de:
Length: 773
Version: 2
Abbrev Offset: 100
Pointer Size: 8
<0><1e9>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_producer : (indirect string, offset: 0x3a): GNU C 4.3.0 20071018 (experimental) [trunk revision 129463]
DW_AT_language : 1 (ANSI C)
DW_AT_name : (indirect string, offset: 0x76): ../../../../trunk2/libgfortran/fmain.c
DW_AT_comp_dir : (indirect string, offset: 0x220): /home/fxcoudert/devel/debug2/ibin/x86_64-unknown-linux-gnu/libgfortran
DW_AT_low_pc : 0x400620
DW_AT_high_pc : 0x40065d
DW_AT_stmt_list : 0x154
<1><20b>: Abbrev Number: 2 (DW_TAG_typedef)
DW_AT_name : (indirect string, offset: 0x1f): size_t
DW_AT_decl_file : 3
DW_AT_decl_line : 214
DW_AT_type : <216>
<1><216>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 8
DW_AT_encoding : 7 (unsigned)
DW_AT_name : (indirect string, offset: 0x196): long unsigned int
<1><21d>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 1
DW_AT_encoding : 8 (unsigned char)
DW_AT_name : (indirect string, offset: 0x124): unsigned char
<1><224>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 2
DW_AT_encoding : 7 (unsigned)
DW_AT_name : (indirect string, offset: 0xf1): short unsigned int
<1><22b>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 4
DW_AT_encoding : 7 (unsigned)
DW_AT_name : (indirect string, offset: 0x19b): unsigned int
<1><232>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 1
DW_AT_encoding : 6 (signed char)
DW_AT_name : (indirect string, offset: 0x126): signed char
<1><239>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 2
DW_AT_encoding : 5 (signed)
DW_AT_name : (indirect string, offset: 0x132): short int
<1><240>: Abbrev Number: 4 (DW_TAG_base_type)
DW_AT_byte_size : 4
DW_AT_encoding : 5 (signed)
DW_AT_name : int
<1><247>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 8
DW_AT_encoding : 5 (signed)
DW_AT_name : (indirect string, offset: 0x211): long int
<1><24e>: Abbrev Number: 5 (DW_TAG_base_type)
DW_AT_byte_size : 8
DW_AT_encoding : 7 (unsigned)
<1><251>: Abbrev Number: 6 (DW_TAG_pointer_type)
DW_AT_byte_size : 8
DW_AT_type : <257>
<1><257>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 1
DW_AT_encoding : 6 (signed char)
DW_AT_name : (indirect string, offset: 0x12d): char
<1><25e>: Abbrev Number: 6 (DW_TAG_pointer_type)
DW_AT_byte_size : 8
DW_AT_type : <264>
<1><264>: Abbrev Number: 7 (DW_TAG_const_type)
DW_AT_type : <257>
<1><269>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 4
DW_AT_encoding : 4 (float)
DW_AT_name : (indirect string, offset: 0x1d9): float
<1><270>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 8
DW_AT_encoding : 4 (float)
DW_AT_name : (indirect string, offset: 0x15e): double
<1><277>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 8
DW_AT_encoding : 7 (unsigned)
DW_AT_name : (indirect string, offset: 0x191): long long unsigned int
<1><27e>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 8
DW_AT_encoding : 5 (signed)
DW_AT_name : (indirect string, offset: 0x20c): long long int
<1><285>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 16
DW_AT_encoding : 5 (signed)
DW_AT_name : (indirect string, offset: 0x16a): __int128_t
<1><28c>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 16
DW_AT_encoding : 7 (unsigned)
DW_AT_name : (indirect string, offset: 0x1a8): __uint128_t
<1><293>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 8
DW_AT_encoding : 3 (complex float)
DW_AT_name : (indirect string, offset: 0x1d1): complex float
<1><29a>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 16
DW_AT_encoding : 3 (complex float)
DW_AT_name : (indirect string, offset: 0x27f): complex double
<1><2a1>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 16
DW_AT_encoding : 4 (float)
DW_AT_name : (indirect string, offset: 0x159): long double
<1><2a8>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_byte_size : 32
DW_AT_encoding : 3 (complex float)
DW_AT_name : (indirect string, offset: 0x151): complex long double
<1><2af>: Abbrev Number: 8 (DW_TAG_structure_type)
DW_AT_byte_size : 64
DW_AT_decl_file : 2
DW_AT_decl_line : 318
DW_AT_sibling : <38b>
<2><2b8>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x0): stdin_unit
DW_AT_decl_file : 2
DW_AT_decl_line : 319
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
<2><2c7>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x2bb): stdout_unit
DW_AT_decl_file : 2
DW_AT_decl_line : 319
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 4 (DW_OP_plus_uconst: 4)
<2><2d6>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x2af): stderr_unit
DW_AT_decl_file : 2
DW_AT_decl_line : 319
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8)
<2><2e5>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x1b4): optional_plus
DW_AT_decl_file : 2
DW_AT_decl_line : 319
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12)
<2><2f4>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x21a): locus
DW_AT_decl_file : 2
DW_AT_decl_line : 320
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 10 (DW_OP_plus_uconst: 16)
<2><303>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x267): separator_len
DW_AT_decl_file : 2
DW_AT_decl_line : 322
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 14 (DW_OP_plus_uconst: 20)
<2><312>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x275): separator
DW_AT_decl_file : 2
DW_AT_decl_line : 323
DW_AT_type : <25e>
DW_AT_data_member_location: 2 byte block: 23 18 (DW_OP_plus_uconst: 24)
<2><321>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x2cf): use_stderr
DW_AT_decl_file : 2
DW_AT_decl_line : 325
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 20 (DW_OP_plus_uconst: 32)
<2><330>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x1c2): all_unbuffered
DW_AT_decl_file : 2
DW_AT_decl_line : 325
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 24 (DW_OP_plus_uconst: 36)
<2><33f>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x1df): unbuffered_preconnected
DW_AT_decl_file : 2
DW_AT_decl_line : 325
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 28 (DW_OP_plus_uconst: 40)
<2><34e>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x104): default_recl
DW_AT_decl_file : 2
DW_AT_decl_line : 325
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 2c (DW_OP_plus_uconst: 44)
<2><35d>: Abbrev Number: 10 (DW_TAG_member)
DW_AT_name : fpe
DW_AT_decl_file : 2
DW_AT_decl_line : 326
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 30 (DW_OP_plus_uconst: 48)
<2><36c>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x26): dump_core
DW_AT_decl_file : 2
DW_AT_decl_line : 326
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 34 (DW_OP_plus_uconst: 52)
<2><37b>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x30): backtrace
DW_AT_decl_file : 2
DW_AT_decl_line : 326
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 38 (DW_OP_plus_uconst: 56)
<1><38b>: Abbrev Number: 11 (DW_TAG_typedef)
DW_AT_name : (indirect string, offset: 0x17d): options_t
DW_AT_decl_file : 2
DW_AT_decl_line : 328
DW_AT_type : <2af>
<1><397>: Abbrev Number: 8 (DW_TAG_structure_type)
DW_AT_byte_size : 48
DW_AT_decl_file : 2
DW_AT_decl_line : 340
DW_AT_sibling : <437>
<2><3a0>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x11b): warn_std
DW_AT_decl_file : 2
DW_AT_decl_line : 341
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
<2><3af>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x187): allow_std
DW_AT_decl_file : 2
DW_AT_decl_line : 342
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 4 (DW_OP_plus_uconst: 4)
<2><3be>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0xe8): pedantic
DW_AT_decl_file : 2
DW_AT_decl_line : 343
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8)
<2><3cd>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x2c7): convert
DW_AT_decl_file : 2
DW_AT_decl_line : 344
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12)
<2><3dc>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x26): dump_core
DW_AT_decl_file : 2
DW_AT_decl_line : 345
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 10 (DW_OP_plus_uconst: 16)
<2><3eb>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x30): backtrace
DW_AT_decl_file : 2
DW_AT_decl_line : 346
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 14 (DW_OP_plus_uconst: 20)
<2><3fa>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x111): sign_zero
DW_AT_decl_file : 2
DW_AT_decl_line : 347
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 18 (DW_OP_plus_uconst: 24)
<2><409>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x9d): record_marker
DW_AT_decl_file : 2
DW_AT_decl_line : 348
DW_AT_type : <20b>
DW_AT_data_member_location: 2 byte block: 23 20 (DW_OP_plus_uconst: 32)
<2><418>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0x13c): max_subrecord_length
DW_AT_decl_file : 2
DW_AT_decl_line : 349
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 28 (DW_OP_plus_uconst: 40)
<2><427>: Abbrev Number: 9 (DW_TAG_member)
DW_AT_name : (indirect string, offset: 0xbf): bounds_check
DW_AT_decl_file : 2
DW_AT_decl_line : 350
DW_AT_type : <240>
DW_AT_data_member_location: 2 byte block: 23 2c (DW_OP_plus_uconst: 44)
<1><437>: Abbrev Number: 11 (DW_TAG_typedef)
DW_AT_name : (indirect string, offset: 0x175): compile_options_t
DW_AT_decl_file : 2
DW_AT_decl_line : 352
DW_AT_type : <397>
<1><443>: Abbrev Number: 12 (DW_TAG_subprogram)
DW_AT_external : 1
DW_AT_name : (indirect string, offset: 0x165): main
DW_AT_decl_file : 1
DW_AT_decl_line : 11
DW_AT_prototyped : 1
DW_AT_type : <240>
DW_AT_low_pc : 0x400620
DW_AT_high_pc : 0x40065d
DW_AT_frame_base : 0x98 (location list)
DW_AT_sibling : <487>
<2><468>: Abbrev Number: 13 (DW_TAG_formal_parameter)
DW_AT_name : (indirect string, offset: 0x1f7): argc
DW_AT_decl_file : 1
DW_AT_decl_line : 10
DW_AT_type : <240>
DW_AT_location : 0xd0 (location list)
<2><477>: Abbrev Number: 13 (DW_TAG_formal_parameter)
DW_AT_name : (indirect string, offset: 0x28e): argv
DW_AT_decl_file : 1
DW_AT_decl_line : 10
DW_AT_type : <487>
DW_AT_location : 0x106 (location list)
<1><487>: Abbrev Number: 6 (DW_TAG_pointer_type)
DW_AT_byte_size : 8
DW_AT_type : <251>
<1><48d>: Abbrev Number: 14 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0xd8): l8_to_l4_offset
DW_AT_decl_file : 2
DW_AT_decl_line : 234
DW_AT_MIPS_linkage_name: (indirect string, offset: 0xcc): *_gfortrani_l8_to_l4_offset
DW_AT_type : <240>
DW_AT_external : 1
DW_AT_declaration : 1
<1><49e>: Abbrev Number: 15 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0x2a7): options
DW_AT_decl_file : 2
DW_AT_decl_line : 331
DW_AT_MIPS_linkage_name: (indirect string, offset: 0xb): *_gfortrani_options
DW_AT_type : <38b>
DW_AT_external : 1
DW_AT_declaration : 1
<1><4b0>: Abbrev Number: 15 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0x29f): compile_options
DW_AT_decl_file : 2
DW_AT_decl_line : 355
DW_AT_MIPS_linkage_name: (indirect string, offset: 0x293): *_gfortrani_compile_options
DW_AT_type : <437>
DW_AT_external : 1
DW_AT_declaration : 1
<1><4c2>: Abbrev Number: 15 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0x207): line
DW_AT_decl_file : 2
DW_AT_decl_line : 389
DW_AT_MIPS_linkage_name: (indirect string, offset: 0x1fc): *_gfortran_line
DW_AT_type : <22b>
DW_AT_external : 1
DW_AT_declaration : 1
<1><4d4>: Abbrev Number: 15 (DW_TAG_variable)
DW_AT_name : (indirect string, offset: 0xb6): filename
DW_AT_decl_file : 2
DW_AT_decl_line : 392
DW_AT_MIPS_linkage_name: (indirect string, offset: 0xab): *_gfortran_filename
DW_AT_type : <251>
DW_AT_external : 1
DW_AT_declaration : 1
Compilation Unit @ offset 0x4e7:
Length: 142
Version: 2
Abbrev Offset: 316
Pointer Size: 8
<0><4f2>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0x201
DW_AT_name : /tmp/buildd/glibc-2.3.6.ds1/build-tree/amd64-libc/csu/crtn.S
DW_AT_comp_dir : /tmp/buildd/glibc-2.3.6.ds1/build-tree/glibc-2.3.6/csu
DW_AT_producer : GNU AS 2.17
DW_AT_language : 32769 (MIPS assembler)
[-- Attachment #3: intel.txt --]
[-- Type: text/plain, Size: 2895 bytes --]
The section .debug_info contains:
Compilation Unit @ offset 0x0:
Length: 127
Version: 2
Abbrev Offset: 0
Pointer Size: 8
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0
DW_AT_low_pc : 0x402800
DW_AT_high_pc : 0x40282b
DW_AT_name : ../sysdeps/x86_64/elf/start.S
DW_AT_comp_dir : /tmp/buildd/glibc-2.3.6.ds1/build-tree/glibc-2.3.6/csu
DW_AT_producer : GNU AS 2.17
DW_AT_language : 32769 (MIPS assembler)
Compilation Unit @ offset 0x83:
Length: 142
Version: 2
Abbrev Offset: 21
Pointer Size: 8
<0><8e>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0x7e
DW_AT_name : /tmp/buildd/glibc-2.3.6.ds1/build-tree/amd64-libc/csu/crti.S
DW_AT_comp_dir : /tmp/buildd/glibc-2.3.6.ds1/build-tree/glibc-2.3.6/csu
DW_AT_producer : GNU AS 2.17
DW_AT_language : 32769 (MIPS assembler)
Compilation Unit @ offset 0x115:
Length: 179
Version: 2
Abbrev Offset: 37
Pointer Size: 8
<0><120>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_comp_dir : /home/fxcoudert/devel/debug2/irun
DW_AT_language : 14 (Fortran 95)
DW_AT_name : z.f90
DW_AT_producer : Intel (R) Fortran Compiler Fixes RangesRelative
DW_AT_stmt_list : 0x11b
<1><17f>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_byte_size : 0
DW_AT_encoding : 5 (signed)
DW_AT_name : void
<1><187>: Abbrev Number: 3 (DW_TAG_subprogram)
DW_AT_decl_line : 1
DW_AT_decl_column : 12
DW_AT_decl_file : 1
DW_AT_inline : 0 (not inlined)
DW_AT_accessibility: 1 (public)
DW_AT_type : <17f>
DW_AT_prototyped : 0
DW_AT_name : foo
DW_AT_low_pc : 0x4028f0
DW_AT_high_pc : 0x4028f6
DW_AT_external : 1
<1><1a7>: Abbrev Number: 4 (DW_TAG_subprogram)
DW_AT_decl_line : 4
DW_AT_decl_column : 9
DW_AT_decl_file : 1
DW_AT_calling_convention: 2 (program)
DW_AT_inline : 0 (not inlined)
DW_AT_accessibility: 1 (public)
DW_AT_type : <17f>
DW_AT_prototyped : 0
DW_AT_name : bar
DW_AT_low_pc : 0x4028f6
DW_AT_high_pc : 0x402910
DW_AT_external : 1
Compilation Unit @ offset 0x1cc:
Length: 142
Version: 2
Abbrev Offset: 120
Pointer Size: 8
<0><1d7>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list : 0x15f
DW_AT_name : /tmp/buildd/glibc-2.3.6.ds1/build-tree/amd64-libc/csu/crtn.S
DW_AT_comp_dir : /tmp/buildd/glibc-2.3.6.ds1/build-tree/glibc-2.3.6/csu
DW_AT_producer : GNU AS 2.17
DW_AT_language : 32769 (MIPS assembler)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another Fortran problem...
2007-10-26 10:39 Another Fortran problem François-Xavier Coudert
@ 2007-10-26 12:03 ` Daniel Jacobowitz
2007-10-26 13:05 ` François-Xavier Coudert
1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-10-26 12:03 UTC (permalink / raw)
To: gdb
On Fri, Oct 26, 2007 at 11:39:11AM +0100, Fran?ois-Xavier Coudert wrote:
> Is "DW_AT_MIPS_linkage_name: foo_" the reason for this difference?
Yes.
> Should DW_AT_MIPS_linkage_name actually be emitted or is this wrong?
I'm not sure. I was just looking at this problem; I have some
in-progress patches that remove GDB's use of DW_AT_MIPS_linkage_name,
and I was very surprised when they fixed a recent gnats PR about
a similar Fortran problem.
"foo_" is really the linkage name, so if gfortran wants to emit
DW_AT_MIPS_linkage_name then that's the value it should have. But
GDB doesn't have a demangler for Fortran mangled names so
it ends up stuck with the mangled name.
What sort of mangling does gfortran do? Should we be able to demangle
it? Or just ignore linkage names for Fortran?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another Fortran problem...
2007-10-26 10:39 Another Fortran problem François-Xavier Coudert
2007-10-26 12:03 ` Daniel Jacobowitz
@ 2007-10-26 13:05 ` François-Xavier Coudert
2007-10-26 13:14 ` Daniel Jacobowitz
1 sibling, 1 reply; 6+ messages in thread
From: François-Xavier Coudert @ 2007-10-26 13:05 UTC (permalink / raw)
To: gdb
> "foo_" is really the linkage name, so if gfortran wants to emit
> DW_AT_MIPS_linkage_name then that's the value it should have. But
> GDB doesn't have a demangler for Fortran mangled names so
> it ends up stuck with the mangled name.
I've looked into GCC, and it emits DW_AT_MIPS_linkage_name every time
it sees a function with a linkage name different from its source name.
The Fortran mangling scheme depends on the compiler and compiler
options used, so I don't think a demangler is possible. Even for a
given compiler with default options, Fortran 2003 made it possible to
specifiy arbitrary linkage names to procedures. A subroutine declared
like that:
subroutine foo() bind(c,name="bar")
will have the following
DW_AT_name : foo
DW_AT_MIPS_linkage_name: bar
Moreover, it's possible to give two procedures identical names, with
different linkage names:
$ cat u.f90
subroutine foo() bind(c,name="bar")
end subroutine foo
$ cat v.f90
subroutine foo() bind(c,name="gee")
end subroutine foo
end
$ gfortran u.f90 v.f90
$ readelf -wi ./a.out | egrep '(foo|bar|gee)'
DW_AT_name : foo
DW_AT_MIPS_linkage_name: bar
DW_AT_name : foo
DW_AT_MIPS_linkage_name: gee
What I would consider the best behaviour for gdb is that it considers
both source names and linkage names, and in case of an ambiguity
1. between a source name and a linkage name, go for the linkage name
2. between two source names, ask the user to specify the linkage
name of one of them
Of course, I don't know how hard it would be to implement this behaviour.
FX
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another Fortran problem...
2007-10-26 13:05 ` François-Xavier Coudert
@ 2007-10-26 13:14 ` Daniel Jacobowitz
2007-10-26 13:58 ` François-Xavier Coudert
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-10-26 13:14 UTC (permalink / raw)
To: gdb
On Fri, Oct 26, 2007 at 02:04:56PM +0100, Fran?ois-Xavier Coudert wrote:
> What I would consider the best behaviour for gdb is that it considers
> both source names and linkage names, and in case of an ambiguity
> 1. between a source name and a linkage name, go for the linkage name
> 2. between two source names, ask the user to specify the linkage
> name of one of them
>
> Of course, I don't know how hard it would be to implement this behaviour.
Somewhat impractical. I think we would be best off ignoring linkage
names for Fortran, or else GCC not emitting them... I don't know
which. Won't they generally match the names in the ELF symbol table?
In that case they are not particularly useful for definitions.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another Fortran problem...
2007-10-26 13:14 ` Daniel Jacobowitz
@ 2007-10-26 13:58 ` François-Xavier Coudert
2007-10-26 14:06 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: François-Xavier Coudert @ 2007-10-26 13:58 UTC (permalink / raw)
To: gdb
> Somewhat impractical. I think we would be best off ignoring linkage
> names for Fortran, or else GCC not emitting them... I don't know
> which. Won't they generally match the names in the ELF symbol table?
Yes, they probably will. Don't they serve any other useful purpose?
(not emitting them in GCC fixes the problem)
FX
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another Fortran problem...
2007-10-26 13:58 ` François-Xavier Coudert
@ 2007-10-26 14:06 ` Daniel Jacobowitz
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-10-26 14:06 UTC (permalink / raw)
To: gdb
On Fri, Oct 26, 2007 at 02:58:35PM +0100, Fran?ois-Xavier Coudert wrote:
> > Somewhat impractical. I think we would be best off ignoring linkage
> > names for Fortran, or else GCC not emitting them... I don't know
> > which. Won't they generally match the names in the ELF symbol table?
>
> Yes, they probably will. Don't they serve any other useful purpose?
> (not emitting them in GCC fixes the problem)
I'm not sure. In C++ we use them to extract namespace and class
hierarchy information, which was only represented in DWARF relatively
recently (circa 3.3). They should be unnecessary now in most cases
and other compilers do not admit them.
I can see how they could be useful for non-defining declarations, in
case the definition was in an object without debugging information.
Let's give it a day or two in case anyone else has comments, but I
don't think DW_AT_MIPS_linkage_name has any benefit for Fortran
support. In that case, we can change GCC HEAD not to emit them and
GDB not to use them.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-10-26 14:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-26 10:39 Another Fortran problem François-Xavier Coudert
2007-10-26 12:03 ` Daniel Jacobowitz
2007-10-26 13:05 ` François-Xavier Coudert
2007-10-26 13:14 ` Daniel Jacobowitz
2007-10-26 13:58 ` François-Xavier Coudert
2007-10-26 14:06 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).