Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "François-Xavier Coudert" <fxcoudert@gmail.com>
To: gdb@sourceware.org
Subject: Re: Another Fortran problem...
Date: Fri, 26 Oct 2007 13:05:00 -0000	[thread overview]
Message-ID: <19c433eb0710260604g53552b55ree7c72b13cb27f62@mail.gmail.com> (raw)
In-Reply-To: <19c433eb0710260339w341f3437u4797445de7bc36d@mail.gmail.com>

> "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


  parent reply	other threads:[~2007-10-26 13:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-10-26 13:14   ` Daniel Jacobowitz
2007-10-26 13:58     ` François-Xavier Coudert
2007-10-26 14:06       ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19c433eb0710260604g53552b55ree7c72b13cb27f62@mail.gmail.com \
    --to=fxcoudert@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox