From patchwork Wed Apr 10 13:25:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Senthil Kumar Selvaraj X-Patchwork-Id: 235394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 6141D2C00AA for ; Wed, 10 Apr 2013 23:25:32 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=fvK2doy6DMbyxwNgg9/e7OOLAy6Xapvrd+rvIr+7J+5zdaDy/Z 77SnWlQHT4ZdzWlxV1j5dgvFOFBdUX5kmAc3A7N7U0SMC/O9a154RiOYpuH44w9v M1jEtB6yVwPMI4uMTk1kNs3BpExW13vWt7X5as4rFYQcSeFVI0GWL3fNg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=Ltbw1aIHwCfjbpNNAky83wDhJ54=; b=m8j4EHEj6LlC0OHgWyG/ ybQhJcI05Km5/b6iB9LsDNCKiqY7d0YRveRpLpkJExRhUGRdvBAdmJAVACN14DII 7Tk27bvt9UzXdSdDmKb3Sv0gLJRuTmBVGPDUfqgx84an/KNN4NqLui3xkXT7moDM hY1ku7BxOx+Xfy/Aid97/jw= Received: (qmail 19628 invoked by alias); 10 Apr 2013 13:25:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 19619 invoked by uid 89); 10 Apr 2013 13:25:25 -0000 X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_GD autolearn=ham version=3.3.1 Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.243) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 10 Apr 2013 13:25:24 +0000 Received: from apsmtp01.atmel.com (10.168.254.31) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server id 14.2.318.4; Wed, 10 Apr 2013 15:25:13 +0200 Received: from PENCHT02.corp.atmel.com (10.168.5.162) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server (TLS) id 14.2.318.1; Wed, 10 Apr 2013 21:25:11 +0800 Received: from atmel.com (10.168.5.13) by cas-ap.atmel.com (10.168.5.162) with Microsoft SMTP Server (TLS) id 14.2.318.1; Wed, 10 Apr 2013 21:25:07 +0800 Date: Wed, 10 Apr 2013 18:55:10 +0530 From: Senthil Kumar Selvaraj To: CC: Subject: [Patch] Add -gdwarf option to make gcc generate DWARF with the default version Message-ID: <20130410132502.GA28317@atmel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, This patch adds a -gdwarf option to make gcc generate DWARF with the default version (currently 4). A bunch of tests in the dejagnu dwarf test suite fail right now if gcc is configured/built with support for multiple debugging formats and DWARF is not the default. The failing tests don't explicitly specify -gdwarf- but check for DWARF data. The tests need a way to ask gcc to generate the latest DWARF version supported. Instead of hardcoding a specific version, adding this option allows the tests to run against the latest supported DWARF version. Version specific DWARF tests can of course use the -gdwarf- option. There was a discussion on this in the mailing list previously (see http://gcc.gnu.org/ml/gcc/2013-04/msg00007.html and http://gcc.gnu.org/ml/gcc/2013-03/msg00271.html) and Jason was ok with a modified version of the patch. The patch merely forwards control to gdwarf- option handling, setting value to the Init value set in common.opt for gdwarf-. In addition, it raises an error if the user specifies a version with the option. If ok, could someone apply please (I don't have commit access) ? Once comitted, I'll send another patch for the failing tests with the -gdwarf option added to dg-options. Regards Senthil gcc/ChangeLog 2013-04-10 Senthil Kumar Selvaraj Jason Merrill diff --git gcc/common.opt gcc/common.opt index e02e7ed..e3645c3 100644 --- gcc/common.opt +++ gcc/common.opt @@ -2308,9 +2308,13 @@ Common JoinedOrMissing Generate debug information in default format gcoff -Common JoinedOrMissing Negative(gdwarf-) +Common JoinedOrMissing Negative(gdwarf) Generate debug information in COFF format +gdwarf +Common JoinedOrMissing UInteger Negative(gdwarf-) +Generate debug information in the default DWARF version format + gdwarf- Common Joined UInteger Var(dwarf_version) Init(4) Negative(gstabs) Generate debug information in DWARF v2 (or later) format diff --git gcc/opts.c gcc/opts.c index 45b12fe..f96ed16 100644 --- gcc/opts.c +++ gcc/opts.c @@ -1699,6 +1699,18 @@ common_handle_option (struct gcc_options *opts, set_debug_level (SDB_DEBUG, false, arg, opts, opts_set, loc); break; + case OPT_gdwarf: + if (arg && strlen(arg) != 0) + { + error_at (loc, "%<-gdwarf%s%> is ambiguous; " + "use %<-gdwarf-%s%> for DWARF version " + "or %<-gdwarf -g%s%> for debug level", arg, arg, arg); + break; + } + else + { + value = opts->x_dwarf_version; + } case OPT_gdwarf_: if (value < 2 || value > 4) error_at (loc, "dwarf version %d is not supported", value);