Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jason Molenda <jmolenda@apple.com>
To: gdb@sources.redhat.com
Subject: Recording a file's language in the SO stab? (anyone have Sun's compiler handy?)
Date: Tue, 03 Aug 2004 21:46:00 -0000	[thread overview]
Message-ID: <810EE7BD-E596-11D8-8435-000A9569836A@apple.com> (raw)

We've got a bunch of customers with big bunches of code that are 
written in e.g. C++ but whose files end in ".c".  With stabs, gdb uses 
the source filename extension to set the language, so these developers 
usually have lots of problems.  Luckily, fixing this is not hard.

The SO stab entry doesn't use the "desc" part of its nlist structure 
for anything.  That's 16 bits of joyful emptiness, and I want to 
appropriate it to record the source language.

It looks like Sun did something similar; stabs.texi says

> @findex N_SO
> Before any other stabs occur, there must be a stab specifying the 
> source
> file.  This information is contained in a symbol of stab type
> @code{N_SO}; the string field contains the name of the file.  The
> value of the symbol is the start address of the portion of the
> text section corresponding to that file.
>
> With the Sun Solaris2 compiler, the desc field contains a
> source-language code.
> @c Do the debuggers use it?  What are the codes? -djm


That's the real design question -- how to decide what numbers correlate 
to what languages.  If anyone has access to the Sun compiler, I'd 
really like to find out what numbers they issue for C/C++ if they're 
really doing this.  Otherwise I'll be picking numbers at random.

I've already done a quick implementation of this in our gdb and in the 
FSF top of tree sources - it's not especially complicated.  I added a 
language enum to the partial_symtab structure to record it so it was 
easy to pick up in set_initial_language() when we only have psymtabs 
read in.  That's probably not necessary to work but it didn't seem like 
such a bad idea.

Anyway, I wanted to bounce this off the group to see if there are any 
reactions.  We can add this as an Apple Local change in our gcc/gdb but 
I hate to extend the debug format on our fork if we can avoid it at 
all.


Jason


             reply	other threads:[~2004-08-03 21:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-03 21:46 Jason Molenda [this message]
2004-08-04  7:10 ` Mark Kettenis
2004-08-04 16:51   ` Jim Blandy

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=810EE7BD-E596-11D8-8435-000A9569836A@apple.com \
    --to=jmolenda@apple.com \
    --cc=gdb@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