This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Another 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.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]