From patchwork Mon Jan 5 20:41:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 4511 Received: (qmail 13917 invoked by alias); 5 Jan 2015 20:41:58 -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 13904 invoked by uid 89); 5 Jan 2015 20:41:57 -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-ob0-f201.google.com Received: from mail-ob0-f201.google.com (HELO mail-ob0-f201.google.com) (209.85.214.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 05 Jan 2015 20:41:55 +0000 Received: by mail-ob0-f201.google.com with SMTP id nt9so9170370obb.0 for ; Mon, 05 Jan 2015 12:41:53 -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:to:subject:date:message-id:mime-version :content-type; bh=/HFZz9CjmKGWW7syZELL/4awQxgJgDD/lyxL/GXwd0E=; b=VCVuARvoiNyMK480A+HK2cErlJDweKRty+E/9ipXw2p+e0QA1ikRdh3HSbKGiAOiBp RSDcNiuf3VdFC1R86blq1CxjeccreuSS1EFutoIuh/tiqQhPmXY8fF0WTVFltWpy6Jwn 6WqKBfM4rBVKa37wDQ66BsD/8w7d3YFzhcvXX04DxD+f4uEn91S7oOtT4WZ5DMG+0cVO AOW49zCw7mfav1b2musscoChcNHoESjBP6aOAhlGo77W6tdRdgwgNUPqfS/MkCi37Aoq Jx+F20HXiVNVv9OVHmT4jJ/4otstsoAA5xhIYkpZdt15LireA4jPik9xM9xgP1J88Vpq A+sg== X-Gm-Message-State: ALoCoQnlzn/FFIfTNpozb1z0nnFKc0n3/d43HzaMWV+ecZd3mTOnVsDhqxJFn8Rrnr0Hvsh44AEx X-Received: by 10.50.164.164 with SMTP id yr4mr12004843igb.2.1420490513433; Mon, 05 Jan 2015 12:41:53 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id r4si3248605qca.0.2015.01.05.12.41.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jan 2015 12:41:53 -0800 (PST) Received: from ruffy.mtv.corp.google.com ([172.17.128.44]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTPS id XUAw0qU1.1; Mon, 05 Jan 2015 12:41:53 -0800 From: Doug Evans To: gdb-patches@sourceware.org, eliz@gnu.org Subject: [PATCH] "info source" now includes producer string Date: Mon, 05 Jan 2015 12:41:52 -0800 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. This is something I've wanted for awhile. bash$ g++ -g -Og hello.cc -o hello bash$ gdb hello (gdb) start (gdb) info source Current source file is hello.cc Compilation directory is /home/dje Located in /home/dje/hello.cc Contains 8 lines. Source language is c++. Producer is GNU C++ 4.8.2 -mtune=generic -march=x86-64 -g -Og -fstack-protector. Compiled with DWARF 2 debugging format. Does not include preprocessor macro info. (gdb) Regression tested on amd64-linux. 2015-01-05 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 9a668c4..ebcc0e3 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -113,6 +113,9 @@ VAX running Ultrix vax-*-ultrix* and "assf"), have been removed. Use the "sharedlibrary" command, or its alias "share", instead. +* The "info source" command now displays the producer string if it was + present in the debug info. + *** Changes in GDB 7.8 * New command line options 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"); } diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f4d7132..b22f644 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -16279,6 +16279,8 @@ 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, +@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