This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/5] libthread_db: debug output should go to gdb_stdlog
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 17 Dec 2014 13:45:06 +0000
- Subject: Re: [PATCH 1/5] libthread_db: debug output should go to gdb_stdlog
- Authentication-results: sourceware.org; auth=none
- References: <1418748834-27545-1-git-send-email-palves at redhat dot com> <1418748834-27545-2-git-send-email-palves at redhat dot com> <871tnyu2k7 dot fsf at codesourcery dot com>
On 12/17/2014 08:02 AM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> 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