From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17432 invoked by alias); 26 Oct 2007 13:05:03 -0000 Received: (qmail 17407 invoked by uid 22791); 26 Oct 2007 13:05:00 -0000 X-Spam-Check-By: sourceware.org Received: from wx-out-0506.google.com (HELO wx-out-0506.google.com) (66.249.82.235) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 26 Oct 2007 13:04:58 +0000 Received: by wx-out-0506.google.com with SMTP id s7so782250wxc for ; Fri, 26 Oct 2007 06:04:56 -0700 (PDT) Received: by 10.70.19.20 with SMTP id 20mr4935193wxs.1193403896561; Fri, 26 Oct 2007 06:04:56 -0700 (PDT) Received: by 10.70.15.17 with HTTP; Fri, 26 Oct 2007 06:04:56 -0700 (PDT) Message-ID: <19c433eb0710260604g53552b55ree7c72b13cb27f62@mail.gmail.com> Date: Fri, 26 Oct 2007 13:05:00 -0000 From: "=?ISO-8859-1?Q?Fran=E7ois-Xavier_Coudert?=" To: gdb@sourceware.org Subject: Re: Another Fortran problem... In-Reply-To: <19c433eb0710260339w341f3437u4797445de7bc36d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <19c433eb0710260339w341f3437u4797445de7bc36d@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00265.txt.bz2 > "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