From 87ce2a04c53fa7bb4fff50a41e45c0b29af06dae Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 22 Jan 2014 14:17:39 -0800 Subject: New gdbserver option --debug-format=timestamp. * NEWS: Mention it. gdbserver/ * configure.ac (AC_CHECK_FUNCS): Add test for gettimeofday. * configure: Regenerate. * config.in: Regenerate. * Makefile.in (SFILES): Add debug.c. (OBS): Add debug.o. * debug.c: New file. * debug.h: New file. * linux-aarch64-low.c (*): Update all debugging printfs to use debug_printf instead of fprintf. * linux-arm-low.c (*): Ditto. * linux-cris-low.c (*): Ditto. * linux-crisv32-low.c (*): Ditto. * linux-m32r-low.c (*): Ditto. * linux-sparc-low.c (*): Ditto. * linux-x86.c (*): Ditto. * linux-low.c (*): Ditto. (linux_wait_1): Add calls to debug_enter, debug_exit. (linux_wait): Remove redundant debugging printf. (stop_all_lwps): Add calls to debug_enter, debug_exit. (linux_resume, unstop_all_lwps): Ditto. * mem-break.c (*): Update all debugging printfs to use debug_printf instead of fprintf. * remote-utils.c (*): Ditto. * thread-db.c (*): Ditto. * server.c #include , "gdb_vecs.h". (debug_threads): Moved to debug.c. (*): Update all debugging printfs to use debug_printf instead of fprintf. (start_inferior): Replace call to fflush with call to debug_flush. (monitor_show_help): Mention set debug-format. (parse_debug_format_options): New function. (handle_monitor_command): Handle "monitor set debug-format". (gdbserver_usage): Mention --debug-format. (main): Parse --debug-format. * server.h (debug_threads): Declaration moved to debug.h. #include "debug.h". * tracepoint.c (trace_debug_1) [!IN_PROCESS_AGENT]: Add version of trace_debug_1 that uses debug_printf. (tracepoint_look_up_symbols): Update all debugging printfs to use debug_printf instead of fprintf. doc/ * gdb.texinfo (Server): Mention --debug-format=all|none|timestamp. (gdbserver man): Ditto. testsuite/ * gdb.server/server-mon.exp: Add tests for "set debug-format". --- gdb/gdbserver/thread-db.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'gdb/gdbserver/thread-db.c') diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index 8b8f6ce..df06b9d 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -194,7 +194,7 @@ thread_db_create_event (CORE_ADDR where) fatal ("unexpected thread_db->td_ta_event_getmsg_p == NULL"); if (debug_threads) - fprintf (stderr, "Thread creation event.\n"); + debug_printf ("Thread creation event.\n"); /* FIXME: This assumes we don't get another event. In the LinuxThreads implementation, this is safe, @@ -289,8 +289,8 @@ find_one_thread (ptid_t ptid) lwpid, thread_db_err_str (err)); if (debug_threads) - fprintf (stderr, "Found thread %ld (LWP %d)\n", - ti.ti_tid, ti.ti_lid); + debug_printf ("Found thread %ld (LWP %d)\n", + ti.ti_tid, ti.ti_lid); if (lwpid != ti.ti_lid) { @@ -326,8 +326,8 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p) struct lwp_info *lwp; if (debug_threads) - fprintf (stderr, "Attaching to thread %ld (LWP %d)\n", - ti_p->ti_tid, ti_p->ti_lid); + debug_printf ("Attaching to thread %ld (LWP %d)\n", + ti_p->ti_tid, ti_p->ti_lid); linux_attach_lwp (ti_p->ti_lid); lwp = find_lwp_pid (pid_to_ptid (ti_p->ti_lid)); if (lwp == NULL) @@ -432,8 +432,8 @@ thread_db_find_new_threads (void) TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS); if (debug_threads) - fprintf (stderr, "Found %d threads in iteration %d.\n", - new_thread_count, iteration); + debug_printf ("Found %d threads in iteration %d.\n", + new_thread_count, iteration); if (new_thread_count != 0) { @@ -546,7 +546,7 @@ thread_db_load_search (void) if (err != TD_OK) { if (debug_threads) - fprintf (stderr, "td_ta_new(): %s\n", thread_db_err_str (err)); + debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err)); free (tdb); proc->private->thread_db = NULL; return 0; @@ -595,7 +595,7 @@ try_thread_db_load_1 (void *handle) if ((a) == NULL) \ { \ if (debug_threads) \ - fprintf (stderr, "dlsym: %s\n", dlerror ()); \ + debug_printf ("dlsym: %s\n", dlerror ()); \ if (required) \ { \ free (tdb); \ @@ -613,7 +613,7 @@ try_thread_db_load_1 (void *handle) if (err != TD_OK) { if (debug_threads) - fprintf (stderr, "td_ta_new(): %s\n", thread_db_err_str (err)); + debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err)); free (tdb); proc->private->thread_db = NULL; return 0; @@ -663,13 +663,13 @@ try_thread_db_load (const char *library) void *handle; if (debug_threads) - fprintf (stderr, "Trying host libthread_db library: %s.\n", - library); + debug_printf ("Trying host libthread_db library: %s.\n", + library); handle = dlopen (library, RTLD_NOW); if (handle == NULL) { if (debug_threads) - fprintf (stderr, "dlopen failed: %s.\n", dlerror ()); + debug_printf ("dlopen failed: %s.\n", dlerror ()); return 0; } @@ -786,7 +786,7 @@ thread_db_load_search (void) free_char_ptr_vec (dir_vec); if (debug_threads) - fprintf (stderr, "thread_db_load_search returning %d\n", rc); + debug_printf ("thread_db_load_search returning %d\n", rc); return rc; } -- cgit v1.1