RFA/patch stabs reader: Recognize language hint in SO stab

Jason Molenda jmolenda@apple.com
Thu Aug 5 20:08:00 GMT 2004


Hi, this follows up to the note I posted to gdb a couple days ago,

http://sources.redhat.com/ml/gdb/2004-08/msg00015.html

The patch below uses the 'desc' 16-bit field in the SO stab's nlist 
record to indicate the language of the compilation unit, akin to the 
DW_AT_language DWARF attribute.  The Sun compiler has used it like this 
for a long time; we even had the language values in 
include/aout/stab_gnu.h but they were not used.  (I added the Fortran90 
value from Mark's e-mail, thanks Mark).

The stabs reader currently checks the filename suffix of the source 
file or header files to detect the type of the language.  My change 
will use the value of the desc field, if present, and will only use the 
filename suffix heuristics if no desc field setting has already been 
seen.

The most potentially controversial part of this patch, I expect, is 
that I needed to add two language codes for languages in use on MacOS X 
-- Objective-C and Objective-C++.  I don't have a way of communicating 
these codes back to Sun, and I don't want to have Sun and gcc using the 
same value for different languages, so I added ObjC/ObjC++ up at value 
50 (the Sun languages range from 1 to 7).  The number 50 was, 
obviously, chosen completely at random.

Eli, I added a table documenting these values to stabs.texinfo.  Do you 
think this is a correct use of a texinfo table?  I am not very 
experienced with texinfo.

Devang Patel will add the compiler support for this once we get 
agreement on the language code values here on the gdb list.

As always, I'm not committed to the particularly names of functions or 
method of implementing this -- I'll incorporate any feedback speedily 
and re-post.

Thanks!

[include/ChangeLog]
004-08-05  Jason Molenda  (jmolenda@apple.com)

         * aout/stab_gnu.h: Update N_SO table with FORTRAN90 addition 
from
         Sun's Stabs Interface Manual (Version 4.0).  Add Objective-C and
         Objective-C++ non-Sun language codes.

[gdb/ChangeLog]
2004-08-05  Jason Molenda  (jmolenda@apple.com)

         * dbxread.c (read_so_stab_language_hint): New function.
         (read_dbx_symtab): Prefer language from SO stab's desc field
         over language based on the suffix of the source filename.
         (start_psymtab): Only use the source filename suffix if the
         language hasn't been already set.
         (process_one_symbol): When expanding psymtab to symtab, use the
         desc field to set the language if it contains anything 
meaningful.

[gdb/doc/ChangeLog]
2004-08-05  Jason Molenda  (jmolenda@apple.com)

         * stabs.texinfo (Paths and Names of the Source Files):  
Document the
         meaning of values in the 'desc' field of a SO stab.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pa.txt
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20040805/f4045010/attachment.txt>


More information about the Gdb-patches mailing list