From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 986 invoked by alias); 17 Dec 2014 13:45:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 936 invoked by uid 89); 17 Dec 2014 13:45:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 17 Dec 2014 13:45:11 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBHDj8JP018151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Dec 2014 08:45:08 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBHDj6Kx004961; Wed, 17 Dec 2014 08:45:07 -0500 Message-ID: <549188E2.5000907@redhat.com> Date: Wed, 17 Dec 2014 13:45:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH 1/5] libthread_db: debug output should go to gdb_stdlog References: <1418748834-27545-1-git-send-email-palves@redhat.com> <1418748834-27545-2-git-send-email-palves@redhat.com> <871tnyu2k7.fsf@codesourcery.com> In-Reply-To: <871tnyu2k7.fsf@codesourcery.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-12/txt/msg00483.txt.bz2 On 12/17/2014 08:02 AM, Yao Qi wrote: > Pedro Alves writes: > >> if (libthread_db_debug || *libthread_db_search_path) >> { >> + struct ui_file *file; >> const char *library; >> >> library = dladdr_to_soname (*info->td_ta_new_p); >> if (library == NULL) >> library = LIBTHREAD_DB_SO; >> >> - printf_unfiltered (_("Using host libthread_db library \"%s\".\n"), >> - library); >> + file = *libthread_db_search_path != '\0' ? gdb_stdout : gdb_stdlog; > > Nit: why don't we check libthread_db_debug instead? like: > > file = libthread_db_debug ? gdb_stdlog : gdb_stdout; Let me answer that by adding a comment. Does this make it clearer? if (*libthread_db_search_path || libthread_db_debug) { struct ui_file *file; const char *library; library = dladdr_to_soname (*info->td_ta_new_p); if (library == NULL) library = LIBTHREAD_DB_SO; /* If we'd print this to gdb_stdout when debug output is disabled, still print it to gdb_stdout if debug output is enabled. User visible output should not depend on debug settings. */ file = *libthread_db_search_path != '\0' ? gdb_stdout : gdb_stdlog; fprintf_unfiltered (file, _("Using host libthread_db library \"%s\".\n"), library); } Thanks, Pedro Alves