Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@ACT-Europe.FR>
To: gcc@gcc.gnu.org
Cc: gdb-patches@sources.redhat.com
Subject: .n suffixes for function names in stabs debug info (GCC 3.1-based compiler)
Date: Thu, 11 Apr 2002 09:19:00 -0000	[thread overview]
Message-ID: <20020411181942.H29472@act-europe.fr> (raw)

The code that triggered this question was written in Ada but I
reproduced it using a small C program. This C example may seem a bit
unusual, but the root problem occurs quite often in usual situation when
writting code in Ada, for instance when using overloading, or nested
functions.

Here is a small program:
<<
int
main (void)
{
  void inside (void) {}
  return 0;
}
>>

When compiled using the following command:
% gcc -gstabs+ -S hello.c

GCC generates the following stabs for inside():
<<
.stabs  "inside.0:f(1,1)=(1,1),inside.0,main",36,0,4,inside.0
               ^^
               ||
>>

This is happening on my x86-linux machine, but I suspect this to be
target independent.

This ".0" suffix, which was not generated with GCC-2 backends,
is causing problems to GDB:

<<
(gdb) b inside
Function "inside" not defined.
(gdb) b inside.0 <<----  Argh, need to give the name with the (right!) suffix
Breakpoint 1 at 0x8048579: file hello.c, line 4.
>>

Do you think that GCC is right in putting these suffixes in the function
name? I see several options:
   (1) GCC is not right, and the suffix should not be there,
       GDB will be fine again
   (2) GCC is right, and GDB should just strip these suffixes while
       reading the stabs information. Disambiguation should be
       done by other means (eg. a multiple choice question)
   (3) GCC is right, and GDB should is right too. The C user need to
       supply the full function name, including the suffix (not
       appealing at all for the Ada users)

The Stabs reference manual is not very acurate on this issue. The
example given in section "Nested procedures" seem to indicate that
(1) is the right answer:
      .stabs "baz:f1,baz,bar",36,0,0,_baz.15
But is not quite clear on this particular issue.
One side-effect of this approach is that the function name in the stabs
information becomes different from the name stored in the symbols table.
But should the name stored in the symbol table also contain this suffix?

If it turns out that (1) is the correct answer, I'll be happy to work on
a fix and discuss it on gcc-patches.
-- 
Joel


             reply	other threads:[~2002-04-11 16:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-11  9:19 Joel Brobecker [this message]
2002-04-11 12:04 ` Daniel Jacobowitz
2002-04-12  1:28   ` Joel Brobecker
2002-04-12  1:43   ` Joel Brobecker
2002-04-12  7:34     ` Daniel Jacobowitz
2002-04-16  6:06       ` Daniel Berlin

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=20020411181942.H29472@act-europe.fr \
    --to=brobecker@act-europe.fr \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    /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