From patchwork Sat Jan 31 18:46:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 4857 Received: (qmail 12486 invoked by alias); 31 Jan 2015 18:46:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 12468 invoked by uid 89); 31 Jan 2015 18:46:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ie0-f201.google.com Received: from mail-ie0-f201.google.com (HELO mail-ie0-f201.google.com) (209.85.223.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 31 Jan 2015 18:46:43 +0000 Received: by mail-ie0-f201.google.com with SMTP id rd18so13120661iec.0 for ; Sat, 31 Jan 2015 10:46:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:cc:subject:in-reply-to :references; bh=lasBqZ7Zq+PfZJ9F7Wp/1LWnxh7vcE8f/o4v8tcbfn4=; b=SVGCoUV3sVPvc3u22kNVaWwTFZx6cBOWqhNdNNTpPws+Bunc9t9MeUlwS9AoYJ2gTD fBuIhtOo8+Cd6GIIF3Eu0Je8F+ZHZ/y7bpV+z8ZDb34unoAC2AV5yHXjJoDZE2TlnH+1 v6/w215rZrGNdueJ1eaQ1Gw4JVjFd0F2PuWMqT60opAJaGMRX4ZmdAqMUxMmbW2epWJf v0yUgfxlv1x3OpAuXEDptIK3JOITBu4NoVJmwfBt6UV6S0R+BzbstOwPw7lDyL3v83IW SnFCHkRKvTTYbPtk86sLMSk7i5Jc+WyKywgauDsr410sNs+2/x5KX1/F78+6cvSEZ9SI tdJg== X-Gm-Message-State: ALoCoQkoOx96d/OAq9kHOY3n2KjOsPFQVcP5j+J9/vHDK5TPQ4pTNcPVI88QOs44XjaUZZbBaf45GNQLRYbTfrq3kCq6O1+hMkYEc4ZOwciMEshp6p+HooXSOFCOJKIOrbMvu5zjtz2xNKRxrTYHTukqHROFj4DPHHreVqKY/x2cfe6G4Jt2CEE= X-Received: by 10.42.100.77 with SMTP id z13mr10443023icn.10.1422730001511; Sat, 31 Jan 2015 10:46:41 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id v10si2360767qcf.3.2015.01.31.10.46.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Jan 2015 10:46:41 -0800 (PST) Received: from ruffy2.mtv.corp.google.com ([172.17.128.107]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id rgcTiAFt.1; Sat, 31 Jan 2015 10:46:41 -0800 From: Doug Evans MIME-Version: 1.0 Message-ID: <21709.8975.854197.667552@ruffy2.mtv.corp.google.com> Date: Sat, 31 Jan 2015 10:46:39 -0800 To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] "info source" now includes producer string In-Reply-To: <8361ck8tzx.fsf@gnu.org> References: <838uhh7y0t.fsf@gnu.org> <8361ck8tzx.fsf@gnu.org> X-IsSubscribed: yes Eli Zaretskii writes: > > Date: Mon, 5 Jan 2015 16:28:20 -0800 > > From: Doug Evans > > Cc: gdb-patches > > > > >> +* The "info source" command now displays the producer string if it was > > >> + present in the debug info. > > > > > > I wonder whether we should replace "producer" with something less > > > abstract. Would "compilation command line" be accurate enough? > > > > The producer string can be anything, it's whatever the compiler > > decides, so I'm really hesitant to be specific here (and "command > > line" is too specific for me), because often it will be wrong. > > We can always say "e.g." or "such as". That would at least describe > the most frequent use cases. We don't have to be 110% accurate here, > just clear enough to convey the intent. Here is what I committed. 2015-01-30 Doug Evans * NEWS: "info source" command now display producer string if present. * source.c (source_info): Print producer string if present. doc/ * gdb.texinfo (Symbols) : Output now contains producer string if present. diff --git a/gdb/NEWS b/gdb/NEWS index bd85967..2fca5f2 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,6 +3,10 @@ *** Changes since GDB 7.9 +* The "info source" command now displays the producer string if it was + present in the debug info. This typically includes the compiler version + and may include things like its command line arguments. + * Python Scripting ** gdb.Objfile objects have a new attribute "username", diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 277df25..2e58a53 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -16300,6 +16300,9 @@ its length, in lines, @item which programming language it is written in, @item +if the debug information provides it, the program that compiled the file +(which may include, e.g., the compiler version and command line arguments), +@item whether the executable includes debugging information for that file, and if so, what format the information is in (e.g., STABS, Dwarf 2, etc.), and @item diff --git a/gdb/source.c b/gdb/source.c index 574d9fa..49c9d83 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -654,12 +654,15 @@ static void source_info (char *ignore, int from_tty) { struct symtab *s = current_source_symtab; + struct compunit_symtab *cust; if (!s) { printf_filtered (_("No current source file.\n")); return; } + + cust = SYMTAB_COMPUNIT (s); printf_filtered (_("Current source file is %s\n"), s->filename); if (SYMTAB_DIRNAME (s) != NULL) printf_filtered (_("Compilation directory is %s\n"), SYMTAB_DIRNAME (s)); @@ -670,10 +673,13 @@ source_info (char *ignore, int from_tty) s->nlines == 1 ? "" : "s"); printf_filtered (_("Source language is %s.\n"), language_str (s->language)); + printf_filtered (_("Producer is %s.\n"), + COMPUNIT_PRODUCER (cust) != NULL + ? COMPUNIT_PRODUCER (cust) : _("unknown")); printf_filtered (_("Compiled with %s debugging format.\n"), - COMPUNIT_DEBUGFORMAT (SYMTAB_COMPUNIT (s))); + COMPUNIT_DEBUGFORMAT (cust)); printf_filtered (_("%s preprocessor macro info.\n"), - COMPUNIT_MACRO_TABLE (SYMTAB_COMPUNIT (s)) != NULL + COMPUNIT_MACRO_TABLE (cust) != NULL ? "Includes" : "Does not include"); }