libthread_db: debug output should go to gdb_stdlog
Some debug output in linux-thread-db.c was being sent to gdb_stdout, and some to gdb_stderr, while the right place to send debug output to is gdb_stdlog. gdb/ 2015-01-09 Pedro Alves <palves@redhat.com> * linux-thread-db.c (thread_db_find_new_threads_silently) (try_thread_db_load_1, try_thread_db_load, thread_db_load_search) (find_new_threads_once): Print debug output on gdb_stdlog.
This commit is contained in:
parent
60b3033e6e
commit
883ed13e4a
|
@ -1,3 +1,9 @@
|
|||
2015-01-09 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* linux-thread-db.c (thread_db_find_new_threads_silently)
|
||||
(try_thread_db_load_1, try_thread_db_load, thread_db_load_search)
|
||||
(find_new_threads_once): Print debug output on gdb_stdlog.
|
||||
|
||||
2015-01-09 Chen Gang <gang.chen.5i5j@gmail.com>
|
||||
Pedro Alves <palves@redhat.com>
|
||||
|
||||
|
|
|
@ -671,7 +671,7 @@ thread_db_find_new_threads_silently (ptid_t ptid)
|
|||
if (except.reason < 0)
|
||||
{
|
||||
if (libthread_db_debug)
|
||||
exception_fprintf (gdb_stderr, except,
|
||||
exception_fprintf (gdb_stdlog, except,
|
||||
"Warning: thread_db_find_new_threads_silently: ");
|
||||
|
||||
/* There is a bug fixed between nptl 2.6.1 and 2.7 by
|
||||
|
@ -753,7 +753,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
|
|||
if (err != TD_OK)
|
||||
{
|
||||
if (libthread_db_debug)
|
||||
printf_unfiltered (_("td_ta_new failed: %s\n"),
|
||||
fprintf_unfiltered (gdb_stdlog, _("td_ta_new failed: %s\n"),
|
||||
thread_db_err_str (err));
|
||||
else
|
||||
switch (err)
|
||||
|
@ -812,15 +812,21 @@ try_thread_db_load_1 (struct thread_db_info *info)
|
|||
|
||||
printf_unfiltered (_("[Thread debugging using libthread_db enabled]\n"));
|
||||
|
||||
if (libthread_db_debug || *libthread_db_search_path)
|
||||
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;
|
||||
|
||||
printf_unfiltered (_("Using host libthread_db library \"%s\".\n"),
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
@ -846,7 +852,8 @@ try_thread_db_load (const char *library, int check_auto_load_safe)
|
|||
struct thread_db_info *info;
|
||||
|
||||
if (libthread_db_debug)
|
||||
printf_unfiltered (_("Trying host libthread_db library: %s.\n"),
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
_("Trying host libthread_db library: %s.\n"),
|
||||
library);
|
||||
|
||||
if (check_auto_load_safe)
|
||||
|
@ -856,7 +863,8 @@ try_thread_db_load (const char *library, int check_auto_load_safe)
|
|||
/* Do not print warnings by file_is_auto_load_safe if the library does
|
||||
not exist at this place. */
|
||||
if (libthread_db_debug)
|
||||
printf_unfiltered (_("open failed: %s.\n"), safe_strerror (errno));
|
||||
fprintf_unfiltered (gdb_stdlog, _("open failed: %s.\n"),
|
||||
safe_strerror (errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -871,7 +879,7 @@ try_thread_db_load (const char *library, int check_auto_load_safe)
|
|||
if (handle == NULL)
|
||||
{
|
||||
if (libthread_db_debug)
|
||||
printf_unfiltered (_("dlopen failed: %s.\n"), dlerror ());
|
||||
fprintf_unfiltered (gdb_stdlog, _("dlopen failed: %s.\n"), dlerror ());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -885,7 +893,7 @@ try_thread_db_load (const char *library, int check_auto_load_safe)
|
|||
const char *const libpath = dladdr_to_soname (td_init);
|
||||
|
||||
if (libpath != NULL)
|
||||
printf_unfiltered (_("Host %s resolved to: %s.\n"),
|
||||
fprintf_unfiltered (gdb_stdlog, _("Host %s resolved to: %s.\n"),
|
||||
library, libpath);
|
||||
}
|
||||
}
|
||||
|
@ -1076,7 +1084,8 @@ thread_db_load_search (void)
|
|||
|
||||
do_cleanups (cleanups);
|
||||
if (libthread_db_debug)
|
||||
printf_unfiltered (_("thread_db_load_search returning %d\n"), rc);
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
_("thread_db_load_search returning %d\n"), rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -1683,10 +1692,11 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
|
|||
if (libthread_db_debug)
|
||||
{
|
||||
if (except.reason < 0)
|
||||
exception_fprintf (gdb_stderr, except,
|
||||
exception_fprintf (gdb_stdlog, except,
|
||||
"Warning: find_new_threads_once: ");
|
||||
|
||||
printf_filtered (_("Found %d new threads in iteration %d.\n"),
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
_("Found %d new threads in iteration %d.\n"),
|
||||
data.new_threads, iteration);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue