From patchwork Tue Mar 22 10:55:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 87891 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]) by ozlabs.org (Postfix) with SMTP id A22B0B6F1E for ; Tue, 22 Mar 2011 22:00:20 +1100 (EST) Received: (qmail 2362 invoked by alias); 22 Mar 2011 11:00:14 -0000 Received: (qmail 2307 invoked by uid 22791); 22 Mar 2011 11:00:12 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_CP X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Mar 2011 11:00:02 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 4071ECB02F0 for ; Tue, 22 Mar 2011 12:00:00 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g+bSdHaEDigu for ; Tue, 22 Mar 2011 11:59:57 +0100 (CET) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 05998CB021A for ; Tue, 22 Mar 2011 11:59:53 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix annoying gcov filename handling Date: Tue, 22 Mar 2011 11:55:02 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201103221155.03019.ebotcazou@adacore.com> 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 Hi, this is a repost of http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01389.html to fix the annoying gcov filename handling whereby doing gcov path/to/file.gcda doesn't work since gcov drops the path and, therefore, doesn't find the file. Tested on i586-suse-linux, OK for the mainline? 2011-03-22 Tristan Gingold Eric Botcazou * gcov.c (create_file_names): If no object directory is specified, keep the directory of the file. Index: gcov.c =================================================================== --- gcov.c (revision 171210) +++ gcov.c (working copy) @@ -644,13 +644,12 @@ release_structures (void) } } -/* Generate the names of the graph and data files. If OBJECT_DIRECTORY - is not specified, these are looked for in the current directory, - and named from the basename of the FILE_NAME sans extension. If - OBJECT_DIRECTORY is specified and is a directory, the files are in - that directory, but named from the basename of the FILE_NAME, sans - extension. Otherwise OBJECT_DIRECTORY is taken to be the name of - the object *file*, and the data files are named from that. */ +/* Generate the names of the graph and data files. If OBJECT_DIRECTORY + is not specified, these are named from FILE_NAME sans extension. If + OBJECT_DIRECTORY is specified and is a directory, the files are in that + directory, but named from the basename of the FILE_NAME, sans extension. + Otherwise OBJECT_DIRECTORY is taken to be the name of the object *file* + and the data files are named from that. */ static void create_file_names (const char *file_name) @@ -685,8 +684,8 @@ create_file_names (const char *file_name else { name = XNEWVEC (char, length + 1); - name[0] = 0; - base = 1; + strcpy (name, file_name); + base = 0; } if (base)