From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9825 invoked by alias); 3 Aug 2004 21:46:21 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 9816 invoked from network); 3 Aug 2004 21:46:20 -0000 Received: from unknown (HELO mail-out3.apple.com) (17.254.13.22) by sourceware.org with SMTP; 3 Aug 2004 21:46:20 -0000 Received: from mailgate1.apple.com (a17-128-100-225.apple.com [17.128.100.225]) by mail-out3.apple.com (8.12.11/8.12.11) with ESMTP id i73LlWZx000948 for ; Tue, 3 Aug 2004 14:47:32 -0700 (PDT) Received: from relay3.apple.com (relay3.apple.com) by mailgate1.apple.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Tue, 3 Aug 2004 14:46:19 -0700 Received: from [17.201.22.21] (moleja.apple.com [17.201.22.21]) by relay3.apple.com (8.12.11/8.12.11) with ESMTP id i73Lk31x029662 for ; Tue, 3 Aug 2004 14:46:03 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v670) Content-Transfer-Encoding: 7bit Message-Id: <810EE7BD-E596-11D8-8435-000A9569836A@apple.com> Content-Type: text/plain; charset=US-ASCII; format=flowed To: gdb@sources.redhat.com From: Jason Molenda 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 X-SW-Source: 2004-08/txt/msg00015.txt.bz2 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