From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id A2AC8385802C; Tue, 18 Jan 2022 18:45:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2AC8385802C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdbserver: introduce threads_debug_printf, THREADS_SCOPED_DEBUG_ENTER_EXIT X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: c68665c7260985ac8497ccafcea961f4a261c675 X-Git-Newrev: c058728c31684d08da396f1bf50fabaa196dc9d9 Message-Id: <20220118184528.A2AC8385802C@sourceware.org> Date: Tue, 18 Jan 2022 18:45:28 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2022 18:45:28 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc058728c3168= 4d08da396f1bf50fabaa196dc9d9 commit c058728c31684d08da396f1bf50fabaa196dc9d9 Author: Simon Marchi Date: Sun Jan 16 21:27:58 2022 -0500 gdbserver: introduce threads_debug_printf, THREADS_SCOPED_DEBUG_ENTER_E= XIT =20 Add the threads_debug_printf and THREADS_SCOPED_DEBUG_ENTER_EXIT, which use the logging infrastructure from gdbsupport/common-debug.h. Replace all debug_print uses that are predicated by debug_threads with threads_dethreads_debug_printf. Replace uses of the debug_enter and debug_exit macros with THREADS_SCOPED_DEBUG_ENTER_EXIT, which serves essentially the same purpose, but allows showing what comes between the enter and the exit in an indented form. =20 Note that "threads" debug is currently used for a bit of everything in GDBserver, not only threads related stuff. It should ideally be cleaned up and separated logically as is done in GDB, but that's out of the scope of this patch. =20 Change-Id: I2d4546464462cb4c16f7f1168c5cec5a89f2289a Diff: --- gdbserver/ax.cc | 2 +- gdbserver/debug.cc | 24 - gdbserver/debug.h | 31 +- gdbserver/fork-child.cc | 6 +- gdbserver/linux-aarch64-low.cc | 5 +- gdbserver/linux-low.cc | 965 ++++++++++++++++---------------------= ---- gdbserver/linux-s390-low.cc | 5 +- gdbserver/linux-x86-low.cc | 5 +- gdbserver/mem-break.cc | 128 +++--- gdbserver/remote-utils.cc | 8 +- gdbserver/server.cc | 32 +- gdbserver/thread-db.cc | 44 +- gdbserver/tracepoint.cc | 26 +- 13 files changed, 483 insertions(+), 798 deletions(-) diff --git a/gdbserver/ax.cc b/gdbserver/ax.cc index 4f36bc50cab..365bd2195b2 100644 --- a/gdbserver/ax.cc +++ b/gdbserver/ax.cc @@ -39,7 +39,7 @@ ax_vdebug (const char *fmt, ...) #ifdef IN_PROCESS_AGENT fprintf (stderr, PROG "/ax: %s\n", buf); #else - debug_printf (PROG "/ax: %s\n", buf); + threads_debug_printf (PROG "/ax: %s", buf); #endif va_end (ap); } diff --git a/gdbserver/debug.cc b/gdbserver/debug.cc index 372b5577958..8b3e95e65cd 100644 --- a/gdbserver/debug.cc +++ b/gdbserver/debug.cc @@ -110,30 +110,6 @@ debug_flush (void) fflush (debug_file); } =20 -/* Notify the user that the code is entering FUNCTION_NAME. - FUNCTION_NAME is the name of the calling function, or NULL if unknown. - - This is intended to be called via the debug_enter macro. */ - -void -do_debug_enter (const char *function_name) -{ - if (function_name !=3D NULL) - debug_printf (">>>> entering %s\n", function_name); -} - -/* Notify the user that the code is exiting FUNCTION_NAME. - FUNCTION_NAME is the name of the calling function, or NULL if unknown. - - This is intended to be called via the debug_exit macro. */ - -void -do_debug_exit (const char *function_name) -{ - if (function_name !=3D NULL) - debug_printf ("<<<< exiting %s\n", function_name); -} - /* See debug.h. */ =20 ssize_t diff --git a/gdbserver/debug.h b/gdbserver/debug.h index 20cb4e733f2..4220246de79 100644 --- a/gdbserver/debug.h +++ b/gdbserver/debug.h @@ -35,31 +35,22 @@ extern int using_threads; =20 extern bool debug_threads; =20 +/* Print a "threads" debug statement. */ + +#define threads_debug_printf(fmt, ...) \ + debug_prefixed_printf_cond (debug_threads, \ + "threads", fmt, ##__VA_ARGS__) + +/* Print "threads" enter/exit debug statements. */ + +#define THREADS_SCOPED_DEBUG_ENTER_EXIT \ + scoped_debug_enter_exit (debug_threads, "threads") + extern int debug_timestamp; =20 void debug_flush (void); -void do_debug_enter (const char *function_name); -void do_debug_exit (const char *function_name); =20 /* Async signal safe debug output function that calls write directly. */ ssize_t debug_write (const void *buf, size_t nbyte); =20 -/* These macros are for use in major functions that produce a lot of - debugging output. They help identify in the mass of debugging output - when these functions enter and exit. debug_enter is intended to be - called at the start of a function, before any other debugging output. - debug_exit is intended to be called at the end of the same function, - after all debugging output. */ -#ifdef FUNCTION_NAME -#define debug_enter() \ - do { do_debug_enter (FUNCTION_NAME); } while (0) -#define debug_exit() \ - do { do_debug_exit (FUNCTION_NAME); } while (0) -#else -#define debug_enter() \ - do { } while (0) -#define debug_exit() \ - do { } while (0) -#endif - #endif /* GDBSERVER_DEBUG_H */ diff --git a/gdbserver/fork-child.cc b/gdbserver/fork-child.cc index c991ce3a9d3..96dd4d009ab 100644 --- a/gdbserver/fork-child.cc +++ b/gdbserver/fork-child.cc @@ -45,11 +45,7 @@ void prefork_hook (const char *args) { client_state &cs =3D get_client_state (); - if (debug_threads) - { - debug_printf ("args: %s\n", args); - debug_flush (); - } + threads_debug_printf ("args: %s", args); =20 #ifdef SIGTTOU signal (SIGTTOU, SIG_DFL); diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index 10aab52c228..aef69b34525 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -2467,9 +2467,8 @@ emit_ops_insns (const uint32_t *start, int len) { CORE_ADDR buildaddr =3D current_insn_ptr; =20 - if (debug_threads) - debug_printf ("Adding %d instrucions at %s\n", - len, paddress (buildaddr)); + threads_debug_printf ("Adding %d instrucions at %s", + len, paddress (buildaddr)); =20 append_insns (&buildaddr, len, start); current_insn_ptr =3D buildaddr; diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index d7c7336ff1f..9e571a4d771 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -376,8 +376,7 @@ linux_process_target::delete_lwp (lwp_info *lwp) { struct thread_info *thr =3D get_lwp_thread (lwp); =20 - if (debug_threads) - debug_printf ("deleting %ld\n", lwpid_of (thr)); + threads_debug_printf ("deleting %ld", lwpid_of (thr)); =20 remove_thread (thr); =20 @@ -489,13 +488,10 @@ linux_process_target::handle_extended_wait (lwp_info = **orig_event_lwp, =20 ptid =3D ptid_t (new_pid, new_pid); =20 - if (debug_threads) - { - debug_printf ("HEW: Got fork event from LWP %ld, " - "new child is %d\n", - ptid_of (event_thr).lwp (), - ptid.pid ()); - } + threads_debug_printf ("Got fork event from LWP %ld, " + "new child is %d", + ptid_of (event_thr).lwp (), + ptid.pid ()); =20 /* Add the new process to the tables and clone the breakpoint lists of the parent. We need to do this even if the new process @@ -520,8 +516,7 @@ linux_process_target::handle_extended_wait (lwp_info **= orig_event_lwp, if (stopping_threads =3D=3D STOPPING_AND_SUSPENDING_THREADS || event_lwp->bp_reinsert !=3D 0) { - if (debug_threads) - debug_printf ("HEW: leaving child suspended\n"); + threads_debug_printf ("leaving child suspended"); child_lwp->suspended =3D 1; } =20 @@ -586,10 +581,9 @@ linux_process_target::handle_extended_wait (lwp_info *= *orig_event_lwp, return 0; } =20 - if (debug_threads) - debug_printf ("HEW: Got clone event " - "from LWP %ld, new child is LWP %ld\n", - lwpid_of (event_thr), new_pid); + threads_debug_printf + ("Got clone event from LWP %ld, new child is LWP %ld", + lwpid_of (event_thr), new_pid); =20 ptid =3D ptid_t (pid_of (event_thr), new_pid); new_lwp =3D add_lwp (ptid); @@ -652,11 +646,8 @@ linux_process_target::handle_extended_wait (lwp_info *= *orig_event_lwp, ptid_t event_ptid; pid_t event_pid; =20 - if (debug_threads) - { - debug_printf ("HEW: Got exec event from LWP %ld\n", - lwpid_of (event_thr)); - } + threads_debug_printf ("Got exec event from LWP %ld", + lwpid_of (event_thr)); =20 /* Get the event ptid. */ event_ptid =3D ptid_of (event_thr); @@ -720,8 +711,7 @@ linux_process_target::get_pc (lwp_info *lwp) regcache =3D get_thread_regcache (current_thread, 1); pc =3D low_get_pc (regcache); =20 - if (debug_threads) - debug_printf ("pc is 0x%lx\n", (long) pc); + threads_debug_printf ("pc is 0x%lx", (long) pc); =20 return pc; } @@ -737,8 +727,7 @@ linux_process_target::get_syscall_trapinfo (lwp_info *l= wp, int *sysno) regcache =3D get_thread_regcache (current_thread, 1); low_get_syscall_trapinfo (regcache, sysno); =20 - if (debug_threads) - debug_printf ("get_syscall_trapinfo sysno %d\n", *sysno); + threads_debug_printf ("get_syscall_trapinfo sysno %d", *sysno); } =20 void @@ -827,13 +816,9 @@ linux_process_target::save_stop_reason (lwp_info *lwp) =20 if (lwp->stop_reason =3D=3D TARGET_STOPPED_BY_SW_BREAKPOINT) { - if (debug_threads) - { - struct thread_info *thr =3D get_lwp_thread (lwp); - - debug_printf ("CSBB: %s stopped by software breakpoint\n", - target_pid_to_str (ptid_of (thr)).c_str ()); - } + threads_debug_printf + ("%s stopped by software breakpoint", + target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ()); =20 /* Back up the PC if necessary. */ if (pc !=3D sw_breakpoint_pc) @@ -847,35 +832,17 @@ linux_process_target::save_stop_reason (lwp_info *lwp) pc =3D sw_breakpoint_pc; } else if (lwp->stop_reason =3D=3D TARGET_STOPPED_BY_HW_BREAKPOINT) - { - if (debug_threads) - { - struct thread_info *thr =3D get_lwp_thread (lwp); - - debug_printf ("CSBB: %s stopped by hardware breakpoint\n", - target_pid_to_str (ptid_of (thr)).c_str ()); - } - } + threads_debug_printf + ("%s stopped by hardware breakpoint", + target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ()); else if (lwp->stop_reason =3D=3D TARGET_STOPPED_BY_WATCHPOINT) - { - if (debug_threads) - { - struct thread_info *thr =3D get_lwp_thread (lwp); - - debug_printf ("CSBB: %s stopped by hardware watchpoint\n", - target_pid_to_str (ptid_of (thr)).c_str ()); - } - } + threads_debug_printf + ("%s stopped by hardware watchpoint", + target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ()); else if (lwp->stop_reason =3D=3D TARGET_STOPPED_BY_SINGLE_STEP) - { - if (debug_threads) - { - struct thread_info *thr =3D get_lwp_thread (lwp); - - debug_printf ("CSBB: %s stopped by trace\n", - target_pid_to_str (ptid_of (thr)).c_str ()); - } - } + threads_debug_printf + ("%s stopped by trace", + target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ()); =20 lwp->stop_pc =3D pc; return true; @@ -1003,8 +970,7 @@ linux_process_target::attach_lwp (ptid_t ptid) =20 if (linux_proc_pid_is_stopped (lwpid)) { - if (debug_threads) - debug_printf ("Attached to a stopped process\n"); + threads_debug_printf ("Attached to a stopped process"); =20 /* The process is definitely stopped. It is in a job control stop, unless the kernel predates the TASK_STOPPED / @@ -1080,8 +1046,7 @@ attach_proc_task_lwp_callback (ptid_t ptid) int lwpid =3D ptid.lwp (); int err; =20 - if (debug_threads) - debug_printf ("Found new lwp %d\n", lwpid); + threads_debug_printf ("Found new lwp %d", lwpid); =20 err =3D the_linux_target->attach_lwp (ptid); =20 @@ -1091,14 +1056,9 @@ attach_proc_task_lwp_callback (ptid_t ptid) case, confirm the status in /proc/PID/status. */ if (err =3D=3D ESRCH || (err =3D=3D EPERM && linux_proc_pid_is_gone (lwpid))) - { - if (debug_threads) - { - debug_printf ("Cannot attach to lwp %d: " - "thread is gone (%d: %s)\n", - lwpid, err, safe_strerror (err)); - } - } + threads_debug_printf + ("Cannot attach to lwp %d: thread is gone (%d: %s)", + lwpid, err, safe_strerror (err)); else if (err !=3D 0) { std::string reason @@ -1237,9 +1197,9 @@ linux_kill_one_lwp (struct lwp_info *lwp) { int save_errno =3D errno; =20 - debug_printf ("LKL: kill_lwp (SIGKILL) %s, 0, 0 (%s)\n", - target_pid_to_str (ptid_of (thr)).c_str (), - save_errno ? safe_strerror (save_errno) : "OK"); + threads_debug_printf ("kill_lwp (SIGKILL) %s, 0, 0 (%s)", + target_pid_to_str (ptid_of (thr)).c_str (), + save_errno ? safe_strerror (save_errno) : "OK"); } =20 errno =3D 0; @@ -1248,9 +1208,9 @@ linux_kill_one_lwp (struct lwp_info *lwp) { int save_errno =3D errno; =20 - debug_printf ("LKL: PTRACE_KILL %s, 0, 0 (%s)\n", - target_pid_to_str (ptid_of (thr)).c_str (), - save_errno ? safe_strerror (save_errno) : "OK"); + threads_debug_printf ("PTRACE_KILL %s, 0, 0 (%s)", + target_pid_to_str (ptid_of (thr)).c_str (), + save_errno ? safe_strerror (save_errno) : "OK"); } } =20 @@ -1265,8 +1225,7 @@ kill_wait_lwp (struct lwp_info *lwp) int wstat; int res; =20 - if (debug_threads) - debug_printf ("kwl: killing lwp %d, for pid: %d\n", lwpid, pid); + threads_debug_printf ("killing lwp %d, for pid: %d", lwpid, pid); =20 do { @@ -1312,9 +1271,8 @@ kill_one_lwp_callback (thread_info *thread, int pid) =20 if (lwpid_of (thread) =3D=3D pid) { - if (debug_threads) - debug_printf ("lkop: is last of process %s\n", - target_pid_to_str (thread->id).c_str ()); + threads_debug_printf ("is last of process %s", + target_pid_to_str (thread->id).c_str ()); return; } =20 @@ -1340,11 +1298,7 @@ linux_process_target::kill (process_info *process) lwp_info *lwp =3D find_lwp_pid (ptid_t (pid)); =20 if (lwp =3D=3D NULL) - { - if (debug_threads) - debug_printf ("lk_1: cannot find lwp for pid: %d\n", - pid); - } + threads_debug_printf ("cannot find lwp for pid: %d", pid); else kill_wait_lwp (lwp); =20 @@ -1386,19 +1340,17 @@ get_detach_signal (struct thread_info *thread) =20 if (!WIFSTOPPED (status)) { - if (debug_threads) - debug_printf ("GPS: lwp %s hasn't stopped: no pending signal\n", - target_pid_to_str (ptid_of (thread)).c_str ()); + threads_debug_printf ("lwp %s hasn't stopped: no pending signal", + target_pid_to_str (ptid_of (thread)).c_str ()); return 0; } =20 /* Extended wait statuses aren't real SIGTRAPs. */ if (WSTOPSIG (status) =3D=3D SIGTRAP && linux_is_extended_waitstatus (st= atus)) { - if (debug_threads) - debug_printf ("GPS: lwp %s had stopped with extended " - "status: no pending signal\n", - target_pid_to_str (ptid_of (thread)).c_str ()); + threads_debug_printf ("lwp %s had stopped with extended " + "status: no pending signal", + target_pid_to_str (ptid_of (thread)).c_str ()); return 0; } =20 @@ -1406,10 +1358,9 @@ get_detach_signal (struct thread_info *thread) =20 if (cs.program_signals_p && !cs.program_signals[signo]) { - if (debug_threads) - debug_printf ("GPS: lwp %s had signal %s, but it is in nopass state\n", - target_pid_to_str (ptid_of (thread)).c_str (), - gdb_signal_to_string (signo)); + threads_debug_printf ("lwp %s had signal %s, but it is in nopass sta= te", + target_pid_to_str (ptid_of (thread)).c_str (), + gdb_signal_to_string (signo)); return 0; } else if (!cs.program_signals_p @@ -1418,20 +1369,18 @@ get_detach_signal (struct thread_info *thread) SIGTRAP/SIGINT, which is GDB's default. */ && (signo =3D=3D GDB_SIGNAL_TRAP || signo =3D=3D GDB_SIGNAL_INT)) { - if (debug_threads) - debug_printf ("GPS: lwp %s had signal %s, " - "but we don't know if we should pass it. " - "Default to not.\n", - target_pid_to_str (ptid_of (thread)).c_str (), - gdb_signal_to_string (signo)); + threads_debug_printf ("lwp %s had signal %s, " + "but we don't know if we should pass it. " + "Default to not.", + target_pid_to_str (ptid_of (thread)).c_str (), + gdb_signal_to_string (signo)); return 0; } else { - if (debug_threads) - debug_printf ("GPS: lwp %s has pending signal %s: delivering it.\n", - target_pid_to_str (ptid_of (thread)).c_str (), - gdb_signal_to_string (signo)); + threads_debug_printf ("lwp %s has pending signal %s: delivering it", + target_pid_to_str (ptid_of (thread)).c_str (), + gdb_signal_to_string (signo)); =20 return WSTOPSIG (status); } @@ -1447,9 +1396,8 @@ linux_process_target::detach_one_lwp (lwp_info *lwp) /* If there is a pending SIGSTOP, get rid of it. */ if (lwp->stop_expected) { - if (debug_threads) - debug_printf ("Sending SIGCONT to %s\n", - target_pid_to_str (ptid_of (thread)).c_str ()); + threads_debug_printf ("Sending SIGCONT to %s", + target_pid_to_str (ptid_of (thread)).c_str ()); =20 kill_lwp (lwpid_of (thread), SIGCONT); lwp->stop_expected =3D 0; @@ -1509,12 +1457,10 @@ linux_process_target::detach_one_lwp (lwp_info *lwp) safe_strerror (save_errno)); } } - else if (debug_threads) - { - debug_printf ("PTRACE_DETACH (%s, %s, 0) (OK)\n", - target_pid_to_str (ptid_of (thread)).c_str (), - strsignal (sig)); - } + else + threads_debug_printf ("PTRACE_DETACH (%s, %s, 0) (OK)", + target_pid_to_str (ptid_of (thread)).c_str (), + strsignal (sig)); =20 delete_lwp (lwp); } @@ -1645,9 +1591,8 @@ linux_process_target::thread_still_has_status_pending= (thread_info *thread) =20 if (pc !=3D lp->stop_pc) { - if (debug_threads) - debug_printf ("PC of %ld changed\n", - lwpid_of (thread)); + threads_debug_printf ("PC of %ld changed", + lwpid_of (thread)); discard =3D 1; } =20 @@ -1655,25 +1600,22 @@ linux_process_target::thread_still_has_status_pendi= ng (thread_info *thread) else if (lp->stop_reason =3D=3D TARGET_STOPPED_BY_SW_BREAKPOINT && !low_breakpoint_at (pc)) { - if (debug_threads) - debug_printf ("previous SW breakpoint of %ld gone\n", - lwpid_of (thread)); + threads_debug_printf ("previous SW breakpoint of %ld gone", + lwpid_of (thread)); discard =3D 1; } else if (lp->stop_reason =3D=3D TARGET_STOPPED_BY_HW_BREAKPOINT && !hardware_breakpoint_inserted_here (pc)) { - if (debug_threads) - debug_printf ("previous HW breakpoint of %ld gone\n", - lwpid_of (thread)); + threads_debug_printf ("previous HW breakpoint of %ld gone", + lwpid_of (thread)); discard =3D 1; } #endif =20 if (discard) { - if (debug_threads) - debug_printf ("discarding pending breakpoint status\n"); + threads_debug_printf ("discarding pending breakpoint status"); lp->status_pending_p =3D 0; return 0; } @@ -1784,11 +1726,10 @@ linux_process_target::check_zombie_leaders () =20 leader_lp =3D find_lwp_pid (ptid_t (leader_pid)); =20 - if (debug_threads) - debug_printf ("leader_pid=3D%d, leader_lp!=3DNULL=3D%d, " - "num_lwps=3D%d, zombie=3D%d\n", - leader_pid, leader_lp!=3D NULL, num_lwps (leader_pid), - linux_proc_pid_is_zombie (leader_pid)); + threads_debug_printf ("leader_pid=3D%d, leader_lp!=3DNULL=3D%d, " + "num_lwps=3D%d, zombie=3D%d", + leader_pid, leader_lp!=3D NULL, num_lwps (leader_pid), + linux_proc_pid_is_zombie (leader_pid)); =20 if (leader_lp !=3D NULL && !leader_lp->stopped /* Check if there are other threads in the group, as we may @@ -1824,10 +1765,9 @@ linux_process_target::check_zombie_leaders () previous leader did exit voluntarily before some other thread execs). */ =20 - if (debug_threads) - debug_printf ("CZL: Thread group leader %d zombie " - "(it exited, or another thread execd).\n", - leader_pid); + threads_debug_printf ("Thread group leader %d zombie " + "(it exited, or another thread execd).", + leader_pid); =20 delete_lwp (leader_lp); } @@ -1855,13 +1795,10 @@ lwp_suspended_inc (struct lwp_info *lwp) { lwp->suspended++; =20 - if (debug_threads && lwp->suspended > 4) - { - struct thread_info *thread =3D get_lwp_thread (lwp); - - debug_printf ("LWP %ld has a suspiciously high suspend count," - " suspended=3D%d\n", lwpid_of (thread), lwp->suspended); - } + if (lwp->suspended > 4) + threads_debug_printf + ("LWP %ld has a suspiciously high suspend count, suspended=3D%d", + lwpid_of (get_lwp_thread (lwp)), lwp->suspended); } =20 /* Decrement LWP's suspend count. */ @@ -1923,8 +1860,7 @@ handle_tracepoints (struct lwp_info *lwp) =20 if (tpoint_related_event) { - if (debug_threads) - debug_printf ("got a tracepoint event\n"); + threads_debug_printf ("got a tracepoint event"); return 1; } =20 @@ -1967,10 +1903,9 @@ linux_process_target::maybe_move_out_of_jump_pad (lw= p_info *lwp, int *wstat) { struct fast_tpoint_collect_status status; =20 - if (debug_threads) - debug_printf ("Checking whether LWP %ld needs to move out of the " - "jump pad.\n", - lwpid_of (current_thread)); + threads_debug_printf + ("Checking whether LWP %ld needs to move out of the jump pad.", + lwpid_of (current_thread)); =20 fast_tpoint_collect_result r =3D linux_fast_tracepoint_collecting (lwp, &status); @@ -1995,10 +1930,9 @@ linux_process_target::maybe_move_out_of_jump_pad (lw= p_info *lwp, int *wstat) =3D set_breakpoint_at (status.adjusted_insn_addr, NULL); } =20 - if (debug_threads) - debug_printf ("Checking whether LWP %ld needs to move out of " - "the jump pad...it does\n", - lwpid_of (current_thread)); + threads_debug_printf + ("Checking whether LWP %ld needs to move out of the jump pad..." + " it does", lwpid_of (current_thread)); =20 return true; } @@ -2050,9 +1984,9 @@ linux_process_target::maybe_move_out_of_jump_pad (lwp= _info *lwp, int *wstat) =20 if (lwp->exit_jump_pad_bkpt !=3D NULL) { - if (debug_threads) - debug_printf ("Cancelling fast exit-jump-pad: removing bkpt. " - "stopping all threads momentarily.\n"); + threads_debug_printf + ("Cancelling fast exit-jump-pad: removing bkpt." + "stopping all threads momentarily."); =20 stop_all_lwps (1, lwp); =20 @@ -2066,10 +2000,9 @@ linux_process_target::maybe_move_out_of_jump_pad (lw= p_info *lwp, int *wstat) } } =20 - if (debug_threads) - debug_printf ("Checking whether LWP %ld needs to move out of the " - "jump pad...no\n", - lwpid_of (current_thread)); + threads_debug_printf + ("Checking whether LWP %ld needs to move out of the jump pad... no", + lwpid_of (current_thread)); =20 return false; } @@ -2082,17 +2015,15 @@ enqueue_one_deferred_signal (struct lwp_info *lwp, = int *wstat) { struct thread_info *thread =3D get_lwp_thread (lwp); =20 - if (debug_threads) - debug_printf ("Deferring signal %d for LWP %ld.\n", - WSTOPSIG (*wstat), lwpid_of (thread)); + threads_debug_printf ("Deferring signal %d for LWP %ld.", + WSTOPSIG (*wstat), lwpid_of (thread)); =20 if (debug_threads) { for (const auto &sig : lwp->pending_signals_to_report) - debug_printf (" Already queued %d\n", - sig.signal); + threads_debug_printf (" Already queued %d", sig.signal); =20 - debug_printf (" (no more currently queued signals)\n"); + threads_debug_printf (" (no more currently queued signals)"); } =20 /* Don't enqueue non-RT signals if they are already in the deferred @@ -2104,11 +2035,9 @@ enqueue_one_deferred_signal (struct lwp_info *lwp, i= nt *wstat) { if (sig.signal =3D=3D WSTOPSIG (*wstat)) { - if (debug_threads) - debug_printf ("Not requeuing already queued non-RT signal %d" - " for LWP %ld\n", - sig.signal, - lwpid_of (thread)); + threads_debug_printf + ("Not requeuing already queued non-RT signal %d for LWP %ld", + sig.signal, lwpid_of (thread)); return; } } @@ -2139,17 +2068,15 @@ dequeue_one_deferred_signal (struct lwp_info *lwp, = int *wstat) =20 lwp->pending_signals_to_report.pop_front (); =20 - if (debug_threads) - debug_printf ("Reporting deferred signal %d for LWP %ld.\n", - WSTOPSIG (*wstat), lwpid_of (thread)); + threads_debug_printf ("Reporting deferred signal %d for LWP %ld.", + WSTOPSIG (*wstat), lwpid_of (thread)); =20 if (debug_threads) { for (const auto &sig : lwp->pending_signals_to_report) - debug_printf (" Still queued %d\n", - sig.signal); + threads_debug_printf (" Still queued %d", sig.signal); =20 - debug_printf (" (no more queued signals)\n"); + threads_debug_printf (" (no more queued signals)"); } =20 return 1; @@ -2240,11 +2167,8 @@ linux_process_target::filter_event (int lwpid, int w= stat) ptid_t child_ptid; =20 /* A multi-thread exec after we had seen the leader exiting. */ - if (debug_threads) - { - debug_printf ("LLW: Re-adding thread group leader LWP %d" - "after exec.\n", lwpid); - } + threads_debug_printf ("Re-adding thread group leader LWP %d after ex= ec.", + lwpid); =20 child_ptid =3D ptid_t (lwpid, lwpid); child =3D add_lwp (child_ptid); @@ -2273,8 +2197,7 @@ linux_process_target::filter_event (int lwpid, int ws= tat) /* Check if the thread has exited. */ if ((WIFEXITED (wstat) || WIFSIGNALED (wstat))) { - if (debug_threads) - debug_printf ("LLFE: %d exited.\n", lwpid); + threads_debug_printf ("%d exited", lwpid); =20 if (finish_step_over (child)) { @@ -2380,33 +2303,29 @@ linux_process_target::filter_event (int lwpid, int = wstat) if (WIFSTOPPED (wstat) && WSTOPSIG (wstat) =3D=3D SIGSTOP && child->stop_expected) { - if (debug_threads) - debug_printf ("Expected stop.\n"); + threads_debug_printf ("Expected stop."); + child->stop_expected =3D 0; =20 if (thread->last_resume_kind =3D=3D resume_stop) { /* We want to report the stop to the core. Treat the SIGSTOP as a normal event. */ - if (debug_threads) - debug_printf ("LLW: resume_stop SIGSTOP caught for %s.\n", - target_pid_to_str (ptid_of (thread)).c_str ()); + threads_debug_printf ("resume_stop SIGSTOP caught for %s.", + target_pid_to_str (ptid_of (thread)).c_str ()); } else if (stopping_threads !=3D NOT_STOPPING_THREADS) { /* Stopping threads. We don't want this SIGSTOP to end up pending. */ - if (debug_threads) - debug_printf ("LLW: SIGSTOP caught for %s " - "while stopping threads.\n", - target_pid_to_str (ptid_of (thread)).c_str ()); + threads_debug_printf ("SIGSTOP caught for %s while stopping threads.", + target_pid_to_str (ptid_of (thread)).c_str ()); return; } else { /* This is a delayed SIGSTOP. Filter out the event. */ - if (debug_threads) - debug_printf ("LLW: %s %s, 0, 0 (discard delayed SIGSTOP)\n", + threads_debug_printf ("%s %s, 0, 0 (discard delayed SIGSTOP)", child->stepping ? "step" : "continue", target_pid_to_str (ptid_of (thread)).c_str ()); =20 @@ -2449,11 +2368,9 @@ linux_process_target::resume_stopped_resumed_lwps (t= hread_info *thread) if (thread->last_resume_kind =3D=3D resume_step) step =3D maybe_hw_step (thread); =20 - if (debug_threads) - debug_printf ("RSRL: resuming stopped-resumed LWP %s at %s: step=3D%d\n", - target_pid_to_str (ptid_of (thread)).c_str (), - paddress (lp->stop_pc), - step); + threads_debug_printf ("resuming stopped-resumed LWP %s at %s: step= =3D%d", + target_pid_to_str (ptid_of (thread)).c_str (), + paddress (lp->stop_pc), step); =20 resume_one_lwp (lp, step, GDB_SIGNAL_0, NULL); } @@ -2485,9 +2402,10 @@ linux_process_target::wait_for_event_filtered (ptid_= t wait_ptid, }); =20 if (event_thread !=3D NULL) - event_child =3D get_thread_lwp (event_thread); - if (debug_threads && event_thread) - debug_printf ("Got a pending child %ld\n", lwpid_of (event_thread)); + { + event_child =3D get_thread_lwp (event_thread); + threads_debug_printf ("Got a pending child %ld", lwpid_of (event_thread= )); + } } else if (filter_ptid !=3D null_ptid) { @@ -2522,9 +2440,10 @@ linux_process_target::wait_for_event_filtered (ptid_= t wait_ptid, =20 if (event_child !=3D NULL) { - if (debug_threads) - debug_printf ("Got an event from pending child %ld (%04x)\n", - lwpid_of (event_thread), event_child->status_pending); + threads_debug_printf ("Got an event from pending child %ld (%04x)", + lwpid_of (event_thread), + event_child->status_pending); + *wstatp =3D event_child->status_pending; event_child->status_pending_p =3D 0; event_child->status_pending =3D 0; @@ -2566,17 +2485,13 @@ linux_process_target::wait_for_event_filtered (ptid= _t wait_ptid, errno =3D 0; ret =3D my_waitpid (-1, wstatp, options | WNOHANG); =20 - if (debug_threads) - debug_printf ("LWFE: waitpid(-1, ...) returned %d, %s\n", - ret, errno ? safe_strerror (errno) : "ERRNO-OK"); + threads_debug_printf ("waitpid(-1, ...) returned %d, %s", + ret, errno ? safe_strerror (errno) : "ERRNO-OK"); =20 if (ret > 0) { - if (debug_threads) - { - debug_printf ("LLW: waitpid %ld received %s\n", - (long) ret, status_to_str (*wstatp).c_str ()); - } + threads_debug_printf ("waitpid %ld received %s", + (long) ret, status_to_str (*wstatp).c_str ()); =20 /* Filter all events. IOW, leave all events pending. We'll randomly select an event LWP out of all that have events @@ -2629,8 +2544,8 @@ linux_process_target::wait_for_event_filtered (ptid_t= wait_ptid, over 0 (below), as it is more detailed. */ if (find_thread (not_stopped) =3D=3D NULL) { - if (debug_threads) - debug_printf ("LLW: exit (no unwaited-for LWP)\n"); + threads_debug_printf ("exit (no unwaited-for LWP)"); + gdb_sigmask (SIG_SETMASK, &prev_mask, NULL); return -1; } @@ -2638,16 +2553,14 @@ linux_process_target::wait_for_event_filtered (ptid= _t wait_ptid, /* No interesting event to report to the caller. */ if ((options & WNOHANG)) { - if (debug_threads) - debug_printf ("WNOHANG set, no event found\n"); + threads_debug_printf ("WNOHANG set, no event found"); =20 gdb_sigmask (SIG_SETMASK, &prev_mask, NULL); return 0; } =20 /* Block until we get an event reported with SIGCHLD. */ - if (debug_threads) - debug_printf ("sigsuspend'ing\n"); + threads_debug_printf ("sigsuspend'ing"); =20 sigsuspend (&prev_mask); gdb_sigmask (SIG_SETMASK, &prev_mask, NULL); @@ -2694,11 +2607,9 @@ select_event_lwp (struct lwp_info **orig_lp) }); =20 if (event_thread !=3D NULL) - { - if (debug_threads) - debug_printf ("SEL: Select single-step %s\n", - target_pid_to_str (ptid_of (event_thread)).c_str ()); - } + threads_debug_printf + ("Select single-step %s", + target_pid_to_str (ptid_of (event_thread)).c_str ()); } if (event_thread =3D=3D NULL) { @@ -2781,9 +2692,8 @@ linux_process_target::stabilize_threads () =20 if (thread_stuck !=3D NULL) { - if (debug_threads) - debug_printf ("can't stabilize, LWP %ld is stuck in jump pad\n", - lwpid_of (thread_stuck)); + threads_debug_printf ("can't stabilize, LWP %ld is stuck in jump pad= ", + lwpid_of (thread_stuck)); return; } =20 @@ -2837,8 +2747,9 @@ linux_process_target::stabilize_threads () }); =20 if (thread_stuck !=3D NULL) - debug_printf ("couldn't stabilize, LWP %ld got stuck in jump pad\n", - lwpid_of (thread_stuck)); + threads_debug_printf + ("couldn't stabilize, LWP %ld got stuck in jump pad", + lwpid_of (thread_stuck)); } } =20 @@ -2914,6 +2825,8 @@ ptid_t linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus, target_wait_flags target_options) { + THREADS_SCOPED_DEBUG_ENTER_EXIT; + client_state &cs =3D get_client_state (); int w; struct lwp_info *event_child; @@ -2927,11 +2840,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_wa= itstatus *ourstatus, int in_step_range; int any_resumed; =20 - if (debug_threads) - { - debug_enter (); - debug_printf ("wait_1: [%s]\n", target_pid_to_str (ptid).c_str ()); - } + threads_debug_printf ("[%s]", target_pid_to_str (ptid).c_str ()); =20 /* Translate generic target options into linux options. */ options =3D __WALL; @@ -2965,9 +2874,8 @@ linux_process_target::wait_1 (ptid_t ptid, target_wai= tstatus *ourstatus, pid =3D wait_for_event (ptid, &w, options); else { - if (debug_threads) - debug_printf ("step_over_bkpt set [%s], doing a blocking wait\n", - target_pid_to_str (step_over_bkpt).c_str ()); + threads_debug_printf ("step_over_bkpt set [%s], doing a blocking wai= t", + target_pid_to_str (step_over_bkpt).c_str ()); pid =3D wait_for_event (step_over_bkpt, &w, options & ~WNOHANG); } =20 @@ -2975,24 +2883,14 @@ linux_process_target::wait_1 (ptid_t ptid, target_w= aitstatus *ourstatus, { gdb_assert (target_options & TARGET_WNOHANG); =20 - if (debug_threads) - { - debug_printf ("wait_1 ret =3D null_ptid, " - "TARGET_WAITKIND_IGNORE\n"); - debug_exit (); - } + threads_debug_printf ("ret =3D null_ptid, TARGET_WAITKIND_IGNORE"); =20 ourstatus->set_ignore (); return null_ptid; } else if (pid =3D=3D -1) { - if (debug_threads) - { - debug_printf ("wait_1 ret =3D null_ptid, " - "TARGET_WAITKIND_NO_RESUMED\n"); - debug_exit (); - } + threads_debug_printf ("ret =3D null_ptid, TARGET_WAITKIND_NO_RESUMED= "); =20 ourstatus->set_no_resumed (); return null_ptid; @@ -3008,27 +2906,19 @@ linux_process_target::wait_1 (ptid_t ptid, target_w= aitstatus *ourstatus, { ourstatus->set_exited (WEXITSTATUS (w)); =20 - if (debug_threads) - { - debug_printf ("wait_1 ret =3D %s, exited with " - "retcode %d\n", - target_pid_to_str (ptid_of (current_thread)).c_str (), - WEXITSTATUS (w)); - debug_exit (); - } + threads_debug_printf + ("ret =3D %s, exited with retcode %d", + target_pid_to_str (ptid_of (current_thread)).c_str (), + WEXITSTATUS (w)); } else { ourstatus->set_signalled (gdb_signal_from_host (WTERMSIG (w))); =20 - if (debug_threads) - { - debug_printf ("wait_1 ret =3D %s, terminated with " - "signal %d\n", - target_pid_to_str (ptid_of (current_thread)).c_str (), - WTERMSIG (w)); - debug_exit (); - } + threads_debug_printf + ("ret =3D %s, terminated with signal %d", + target_pid_to_str (ptid_of (current_thread)).c_str (), + WTERMSIG (w)); } =20 if (ourstatus->kind () =3D=3D TARGET_WAITKIND_EXITED) @@ -3060,11 +2950,9 @@ linux_process_target::wait_1 (ptid_t ptid, target_wa= itstatus *ourstatus, breakpoint_kind =3D breakpoint_kind_from_current_state (&stop_pc); sw_breakpoint_from_kind (breakpoint_kind, &increment_pc); =20 - if (debug_threads) - { - debug_printf ("step-over for %s executed software breakpoint\n", - target_pid_to_str (ptid_of (current_thread)).c_str ()); - } + threads_debug_printf + ("step-over for %s executed software breakpoint", + target_pid_to_str (ptid_of (current_thread)).c_str ()); =20 if (increment_pc !=3D 0) { @@ -3117,10 +3005,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_wa= itstatus *ourstatus, trace_event =3D handle_tracepoints (event_child); =20 if (bp_explains_trap) - { - if (debug_threads) - debug_printf ("Hit a gdbserver breakpoint.\n"); - } + threads_debug_printf ("Hit a gdbserver breakpoint."); } else { @@ -3141,10 +3026,9 @@ linux_process_target::wait_1 (ptid_t ptid, target_wa= itstatus *ourstatus, && supports_fast_tracepoints () && agent_loaded_p ()) { - if (debug_threads) - debug_printf ("Got signal %d for LWP %ld. Check if we need " - "to defer or adjust it.\n", - WSTOPSIG (w), lwpid_of (current_thread)); + threads_debug_printf ("Got signal %d for LWP %ld. Check if we need " + "to defer or adjust it.", + WSTOPSIG (w), lwpid_of (current_thread)); =20 /* Allow debugging the jump pad itself. */ if (current_thread->last_resume_kind !=3D resume_step @@ -3152,14 +3036,11 @@ linux_process_target::wait_1 (ptid_t ptid, target_w= aitstatus *ourstatus, { enqueue_one_deferred_signal (event_child, &w); =20 - if (debug_threads) - debug_printf ("Signal %d for LWP %ld deferred (in jump pad)\n", - WSTOPSIG (w), lwpid_of (current_thread)); + threads_debug_printf ("Signal %d for LWP %ld deferred (in jump pad)", + WSTOPSIG (w), lwpid_of (current_thread)); =20 resume_one_lwp (event_child, 0, 0, NULL); =20 - if (debug_threads) - debug_exit (); return ignore_event (ourstatus); } } @@ -3167,11 +3048,11 @@ linux_process_target::wait_1 (ptid_t ptid, target_w= aitstatus *ourstatus, if (event_child->collecting_fast_tracepoint !=3D fast_tpoint_collect_result::not_collecting) { - if (debug_threads) - debug_printf ("LWP %ld was trying to move out of the jump pad (%d). " - "Check if we're already there.\n", - lwpid_of (current_thread), - (int) event_child->collecting_fast_tracepoint); + threads_debug_printf + ("LWP %ld was trying to move out of the jump pad (%d). " + "Check if we're already there.", + lwpid_of (current_thread), + (int) event_child->collecting_fast_tracepoint); =20 trace_event =3D 1; =20 @@ -3184,9 +3065,9 @@ linux_process_target::wait_1 (ptid_t ptid, target_wai= tstatus *ourstatus, /* No longer need this breakpoint. */ if (event_child->exit_jump_pad_bkpt !=3D NULL) { - if (debug_threads) - debug_printf ("No longer need exit-jump-pad bkpt; removing it." - "stopping all threads momentarily.\n"); + threads_debug_printf + ("No longer need exit-jump-pad bkpt; removing it." + "stopping all threads momentarily."); =20 /* Other running threads could hit this breakpoint. We don't handle moribund locations like GDB does, @@ -3209,33 +3090,23 @@ linux_process_target::wait_1 (ptid_t ptid, target_w= aitstatus *ourstatus, if (event_child->collecting_fast_tracepoint =3D=3D fast_tpoint_collect_result::not_collecting) { - if (debug_threads) - debug_printf ("fast tracepoint finished " - "collecting successfully.\n"); + threads_debug_printf + ("fast tracepoint finished collecting successfully."); =20 /* We may have a deferred signal to report. */ if (dequeue_one_deferred_signal (event_child, &w)) - { - if (debug_threads) - debug_printf ("dequeued one signal.\n"); - } + threads_debug_printf ("dequeued one signal."); else { - if (debug_threads) - debug_printf ("no deferred signals.\n"); + threads_debug_printf ("no deferred signals."); =20 if (stabilizing_threads) { ourstatus->set_stopped (GDB_SIGNAL_0); =20 - if (debug_threads) - { - debug_printf ("wait_1 ret =3D %s, stopped " - "while stabilizing threads\n", - target_pid_to_str - (ptid_of (current_thread)).c_str ()); - debug_exit (); - } + threads_debug_printf + ("ret =3D %s, stopped while stabilizing threads", + target_pid_to_str (ptid_of (current_thread)).c_str ()); =20 return ptid_of (current_thread); } @@ -3250,16 +3121,11 @@ linux_process_target::wait_1 (ptid_t ptid, target_w= aitstatus *ourstatus, && WSTOPSIG (w) =3D=3D SYSCALL_SIGTRAP && !gdb_catch_this_syscall (event_child)) { - if (debug_threads) - { - debug_printf ("Ignored syscall for LWP %ld.\n", - lwpid_of (current_thread)); - } + threads_debug_printf ("Ignored syscall for LWP %ld.", + lwpid_of (current_thread)); =20 resume_one_lwp (event_child, event_child->stepping, 0, NULL); =20 - if (debug_threads) - debug_exit (); return ignore_event (ourstatus); } =20 @@ -3287,9 +3153,8 @@ linux_process_target::wait_1 (ptid_t ptid, target_wai= tstatus *ourstatus, { siginfo_t info, *info_p; =20 - if (debug_threads) - debug_printf ("Ignored signal %d for LWP %ld.\n", - WSTOPSIG (w), lwpid_of (current_thread)); + threads_debug_printf ("Ignored signal %d for LWP %ld.", + WSTOPSIG (w), lwpid_of (current_thread)); =20 if (ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread), (PTRACE_TYPE_ARG3) 0, &info) =3D=3D 0) @@ -3316,9 +3181,6 @@ linux_process_target::wait_1 (ptid_t ptid, target_wai= tstatus *ourstatus, WSTOPSIG (w), info_p); } =20 - if (debug_threads) - debug_exit (); - return ignore_event (ourstatus); } =20 @@ -3361,20 +3223,20 @@ linux_process_target::wait_1 (ptid_t ptid, target_w= aitstatus *ourstatus, shouldn't know about. */ if (!report_to_gdb) { - if (debug_threads) - { - if (bp_explains_trap) - debug_printf ("Hit a gdbserver breakpoint.\n"); - if (step_over_finished) - debug_printf ("Step-over finished.\n"); - if (trace_event) - debug_printf ("Tracepoint event.\n"); - if (lwp_in_step_range (event_child)) - debug_printf ("Range stepping pc 0x%s [0x%s, 0x%s).\n", - paddress (event_child->stop_pc), - paddress (event_child->step_range_start), - paddress (event_child->step_range_end)); - } + if (bp_explains_trap) + threads_debug_printf ("Hit a gdbserver breakpoint."); + + if (step_over_finished) + threads_debug_printf ("Step-over finished."); + + if (trace_event) + threads_debug_printf ("Tracepoint event."); + + if (lwp_in_step_range (event_child)) + threads_debug_printf ("Range stepping pc 0x%s [0x%s, 0x%s).", + paddress (event_child->stop_pc), + paddress (event_child->step_range_start), + paddress (event_child->step_range_end)); =20 /* We're not reporting this breakpoint to GDB, so apply the decr_pc_after_break adjustment to the inferior's regcache @@ -3410,36 +3272,36 @@ linux_process_target::wait_1 (ptid_t ptid, target_w= aitstatus *ourstatus, } } =20 - if (debug_threads) - debug_printf ("proceeding all threads.\n"); - proceed_all_lwps (); + threads_debug_printf ("proceeding all threads."); =20 - if (debug_threads) - debug_exit (); + proceed_all_lwps (); =20 return ignore_event (ourstatus); } =20 - if (debug_threads) - { - if (event_child->waitstatus.kind () !=3D TARGET_WAITKIND_IGNORE) - debug_printf ("LWP %ld: extended event with waitstatus %s\n", - lwpid_of (get_lwp_thread (event_child)), - event_child->waitstatus.to_string ().c_str ()); - if (current_thread->last_resume_kind =3D=3D resume_step) - { - if (event_child->step_range_start =3D=3D event_child->step_range_end) - debug_printf ("GDB wanted to single-step, reporting event.\n"); - else if (!lwp_in_step_range (event_child)) - debug_printf ("Out of step range, reporting event.\n"); - } - if (event_child->stop_reason =3D=3D TARGET_STOPPED_BY_WATCHPOINT) - debug_printf ("Stopped by watchpoint.\n"); - else if (gdb_breakpoint_here (event_child->stop_pc)) - debug_printf ("Stopped by GDB breakpoint.\n"); - if (debug_threads) - debug_printf ("Hit a non-gdbserver trap event.\n"); - } + if (debug_threads) + { + if (event_child->waitstatus.kind () !=3D TARGET_WAITKIND_IGNORE) + threads_debug_printf ("LWP %ld: extended event with waitstatus %s", + lwpid_of (get_lwp_thread (event_child)), + event_child->waitstatus.to_string ().c_str ()); + + if (current_thread->last_resume_kind =3D=3D resume_step) + { + if (event_child->step_range_start =3D=3D event_child->step_range_end) + threads_debug_printf + ("GDB wanted to single-step, reporting event."); + else if (!lwp_in_step_range (event_child)) + threads_debug_printf ("Out of step range, reporting event."); + } + + if (event_child->stop_reason =3D=3D TARGET_STOPPED_BY_WATCHPOINT) + threads_debug_printf ("Stopped by watchpoint."); + else if (gdb_breakpoint_here (event_child->stop_pc)) + threads_debug_printf ("Stopped by GDB breakpoint."); + } + + threads_debug_printf ("Hit a non-gdbserver trap event."); =20 /* Alright, we're going to report a stop. */ =20 @@ -3630,13 +3492,9 @@ linux_process_target::wait_1 (ptid_t ptid, target_wa= itstatus *ourstatus, =20 gdb_assert (step_over_bkpt =3D=3D null_ptid); =20 - if (debug_threads) - { - debug_printf ("wait_1 ret =3D %s, %d, %d\n", - target_pid_to_str (ptid_of (current_thread)).c_str (), - ourstatus->kind (), ourstatus->sig ()); - debug_exit (); - } + threads_debug_printf ("ret =3D %s, %d, %d", + target_pid_to_str (ptid_of (current_thread)).c_str (), + ourstatus->kind (), ourstatus->sig ()); =20 if (ourstatus->kind () =3D=3D TARGET_WAITKIND_EXITED) return filter_exit_event (event_child, ourstatus); @@ -3736,14 +3594,12 @@ send_sigstop (struct lwp_info *lwp) send another. */ if (lwp->stop_expected) { - if (debug_threads) - debug_printf ("Have pending sigstop for lwp %d\n", pid); + threads_debug_printf ("Have pending sigstop for lwp %d", pid); =20 return; } =20 - if (debug_threads) - debug_printf ("Sending sigstop to lwp %d\n", pid); + threads_debug_printf ("Sending sigstop to lwp %d", pid); =20 lwp->stop_expected =3D 1; kill_lwp (pid, SIGSTOP); @@ -3828,8 +3684,7 @@ linux_process_target::wait_for_sigstop () =20 scoped_restore_current_thread restore_thread; =20 - if (debug_threads) - debug_printf ("wait_for_sigstop: pulling events\n"); + threads_debug_printf ("pulling events"); =20 /* Passing NULL_PTID as filter indicates we want all events to be left pending. Eventually this returns when there are no @@ -3841,8 +3696,7 @@ linux_process_target::wait_for_sigstop () return; else { - if (debug_threads) - debug_printf ("Previously current thread died.\n"); + threads_debug_printf ("Previously current thread died."); =20 /* We can't change the current inferior behind GDB's back, otherwise, a subsequent command may apply to the wrong @@ -3901,19 +3755,16 @@ linux_process_target::move_out_of_jump_pad (thread_= info *thread) && thread->last_resume_kind !=3D resume_step && maybe_move_out_of_jump_pad (lwp, wstat)) { - if (debug_threads) - debug_printf ("LWP %ld needs stabilizing (in jump pad)\n", - lwpid_of (thread)); + threads_debug_printf ("LWP %ld needs stabilizing (in jump pad)", + lwpid_of (thread)); =20 if (wstat) { lwp->status_pending_p =3D 0; enqueue_one_deferred_signal (lwp, wstat); =20 - if (debug_threads) - debug_printf ("Signal %d for LWP %ld deferred " - "(in jump pad)\n", - WSTOPSIG (*wstat), lwpid_of (thread)); + threads_debug_printf ("Signal %d for LWP %ld deferred (in jump pad", + WSTOPSIG (*wstat), lwpid_of (thread)); } =20 resume_one_lwp (lwp, 0, 0, NULL); @@ -3939,16 +3790,13 @@ linux_process_target::stop_all_lwps (int suspend, l= wp_info *except) /* Should not be called recursively. */ gdb_assert (stopping_threads =3D=3D NOT_STOPPING_THREADS); =20 - if (debug_threads) - { - debug_enter (); - debug_printf ("stop_all_lwps (%s, except=3D%s)\n", - suspend ? "stop-and-suspend" : "stop", - (except !=3D NULL - ? target_pid_to_str - (ptid_of (get_lwp_thread (except))).c_str () - : "none")); - } + THREADS_SCOPED_DEBUG_ENTER_EXIT; + + threads_debug_printf + ("%s, except=3D%s", suspend ? "stop-and-suspend" : "stop", + (except !=3D NULL + ? target_pid_to_str (ptid_of (get_lwp_thread (except))).c_str () + : "none")); =20 stopping_threads =3D (suspend ? STOPPING_AND_SUSPENDING_THREADS @@ -3968,12 +3816,7 @@ linux_process_target::stop_all_lwps (int suspend, lw= p_info *except) wait_for_sigstop (); stopping_threads =3D NOT_STOPPING_THREADS; =20 - if (debug_threads) - { - debug_printf ("stop_all_lwps done, setting stopping_threads " - "back to !stopping\n"); - debug_exit (); - } + threads_debug_printf ("setting stopping_threads back to !stopping"); } =20 /* Enqueue one signal in the chain of signals which need to be @@ -4019,10 +3862,7 @@ linux_process_target::single_step (lwp_info* lwp) step =3D 0; } else - { - if (debug_threads) - debug_printf ("stepping is not implemented on this target"); - } + threads_debug_printf ("stepping is not implemented on this target"); =20 return step; } @@ -4092,11 +3932,10 @@ linux_process_target::resume_one_lwp_throw (lwp_inf= o *lwp, int step, =20 if (lwp->status_pending_p) { - if (debug_threads) - debug_printf ("Not resuming lwp %ld (%s, stop %s);" - " has pending status\n", - lwpid_of (thread), step ? "step" : "continue", - lwp->stop_expected ? "expected" : "not expected"); + threads_debug_printf + ("Not resuming lwp %ld (%s, stop %s); has pending status", + lwpid_of (thread), step ? "step" : "continue", + lwp->stop_expected ? "expected" : "not expected"); return; } =20 @@ -4115,9 +3954,8 @@ linux_process_target::resume_one_lwp_throw (lwp_info = *lwp, int step, worthwhile just to solve this one, however. */ if (lwp->bp_reinsert !=3D 0) { - if (debug_threads) - debug_printf (" pending reinsert at 0x%s\n", - paddress (lwp->bp_reinsert)); + threads_debug_printf (" pending reinsert at 0x%s", + paddress (lwp->bp_reinsert)); =20 if (supports_hardware_single_step ()) { @@ -4135,18 +3973,15 @@ linux_process_target::resume_one_lwp_throw (lwp_inf= o *lwp, int step, } =20 if (fast_tp_collecting =3D=3D fast_tpoint_collect_result::before_insn) - { - if (debug_threads) - debug_printf ("lwp %ld wants to get out of fast tracepoint jump pad" - " (exit-jump-pad-bkpt)\n", - lwpid_of (thread)); - } + threads_debug_printf + ("lwp %ld wants to get out of fast tracepoint jump pad " + "(exit-jump-pad-bkpt)", lwpid_of (thread)); + else if (fast_tp_collecting =3D=3D fast_tpoint_collect_result::at_insn) { - if (debug_threads) - debug_printf ("lwp %ld wants to get out of fast tracepoint jump pad" - " single-stepping\n", - lwpid_of (thread)); + threads_debug_printf + ("lwp %ld wants to get out of fast tracepoint jump pad single-stepping", + lwpid_of (thread)); =20 if (supports_hardware_single_step ()) step =3D 1; @@ -4168,9 +4003,9 @@ linux_process_target::resume_one_lwp_throw (lwp_info = *lwp, int step, enhancement. */ if (thread->while_stepping !=3D NULL) { - if (debug_threads) - debug_printf ("lwp %ld has a while-stepping action -> forcing step.\n", - lwpid_of (thread)); + threads_debug_printf + ("lwp %ld has a while-stepping action -> forcing step.", + lwpid_of (thread)); =20 step =3D single_step (lwp); } @@ -4181,11 +4016,8 @@ linux_process_target::resume_one_lwp_throw (lwp_info= *lwp, int step, =20 lwp->stop_pc =3D low_get_pc (regcache); =20 - if (debug_threads) - { - debug_printf (" %s from pc 0x%lx\n", step ? "step" : "continue", - (long) lwp->stop_pc); - } + threads_debug_printf (" %s from pc 0x%lx", step ? "step" : "continu= e", + (long) lwp->stop_pc); } =20 /* If we have pending signals, consume one if it can be delivered to @@ -4202,10 +4034,9 @@ linux_process_target::resume_one_lwp_throw (lwp_info= *lwp, int step, lwp->pending_signals.pop_front (); } =20 - if (debug_threads) - debug_printf ("Resuming lwp %ld (%s, signal %d, stop %s)\n", - lwpid_of (thread), step ? "step" : "continue", signal, - lwp->stop_expected ? "expected" : "not expected"); + threads_debug_printf ("Resuming lwp %ld (%s, signal %d, stop %s)", + lwpid_of (thread), step ? "step" : "continue", signal, + lwp->stop_expected ? "expected" : "not expected"); =20 low_prepare_to_resume (lwp); =20 @@ -4319,13 +4150,11 @@ linux_set_resume_request (thread_info *thread, thre= ad_resume *resume, size_t n) if (resume[ndx].kind =3D=3D resume_stop && thread->last_resume_kind =3D=3D resume_stop) { - if (debug_threads) - debug_printf ("already %s LWP %ld at GDB's request\n", - (thread->last_status.kind () - =3D=3D TARGET_WAITKIND_STOPPED) - ? "stopped" - : "stopping", - lwpid_of (thread)); + threads_debug_printf + ("already %s LWP %ld at GDB's request", + (thread->last_status.kind () =3D=3D TARGET_WAITKIND_STOPPED + ? "stopped" : "stopping"), + lwpid_of (thread)); =20 continue; } @@ -4335,13 +4164,11 @@ linux_set_resume_request (thread_info *thread, thre= ad_resume *resume, size_t n) if (resume[ndx].kind !=3D resume_stop && thread->last_resume_kind !=3D resume_stop) { - if (debug_threads) - debug_printf ("already %s LWP %ld at GDB's request\n", - (thread->last_resume_kind - =3D=3D resume_step) - ? "stepping" - : "continuing", - lwpid_of (thread)); + threads_debug_printf + ("already %s LWP %ld at GDB's request", + (thread->last_resume_kind =3D=3D resume_step + ? "stepping" : "continuing"), + lwpid_of (thread)); continue; } =20 @@ -4355,9 +4182,9 @@ linux_set_resume_request (thread_info *thread, thread= _resume *resume, size_t n) && (rel->waitstatus.kind () =3D=3D TARGET_WAITKIND_FORKED || rel->waitstatus.kind () =3D=3D TARGET_WAITKIND_VFORKED)) { - if (debug_threads) - debug_printf ("not resuming LWP %ld: has queued stop reply\n", - lwpid_of (thread)); + threads_debug_printf + ("not resuming LWP %ld: has queued stop reply", + lwpid_of (thread)); continue; } } @@ -4368,9 +4195,9 @@ linux_set_resume_request (thread_info *thread, thread= _resume *resume, size_t n) (wildcard) resume request. */ if (in_queued_stop_replies (thread->id)) { - if (debug_threads) - debug_printf ("not resuming LWP %ld: has queued stop reply\n", - lwpid_of (thread)); + threads_debug_printf + ("not resuming LWP %ld: has queued stop reply", + lwpid_of (thread)); continue; } =20 @@ -4389,11 +4216,11 @@ linux_set_resume_request (thread_info *thread, thre= ad_resume *resume, size_t n) { lwp->status_pending_p =3D 1; =20 - if (debug_threads) - debug_printf ("Dequeueing deferred signal %d for LWP %ld, " - "leaving status pending.\n", - WSTOPSIG (lwp->status_pending), - lwpid_of (thread)); + threads_debug_printf + ("Dequeueing deferred signal %d for LWP %ld, " + "leaving status pending.", + WSTOPSIG (lwp->status_pending), + lwpid_of (thread)); } =20 return; @@ -4434,18 +4261,16 @@ linux_process_target::thread_needs_step_over (threa= d_info *thread) =20 if (!lwp->stopped) { - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? Ignoring, not stopped\n", - lwpid_of (thread)); + threads_debug_printf ("Need step over [LWP %ld]? Ignoring, not stopp= ed", + lwpid_of (thread)); return false; } =20 if (thread->last_resume_kind =3D=3D resume_stop) { - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? Ignoring, should remain" - " stopped\n", - lwpid_of (thread)); + threads_debug_printf + ("Need step over [LWP %ld]? Ignoring, should remain stopped", + lwpid_of (thread)); return false; } =20 @@ -4453,18 +4278,16 @@ linux_process_target::thread_needs_step_over (threa= d_info *thread) =20 if (lwp->suspended) { - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? Ignoring, suspended\n", - lwpid_of (thread)); + threads_debug_printf ("Need step over [LWP %ld]? Ignoring, suspended= ", + lwpid_of (thread)); return false; } =20 if (lwp->status_pending_p) { - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? Ignoring, has pending" - " status.\n", - lwpid_of (thread)); + threads_debug_printf + ("Need step over [LWP %ld]? Ignoring, has pending status.", + lwpid_of (thread)); return false; } =20 @@ -4479,11 +4302,10 @@ linux_process_target::thread_needs_step_over (threa= d_info *thread) command, or poked thread's registers herself. */ if (pc !=3D lwp->stop_pc) { - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? Cancelling, PC was changed. " - "Old stop_pc was 0x%s, PC is now 0x%s\n", - lwpid_of (thread), - paddress (lwp->stop_pc), paddress (pc)); + threads_debug_printf + ("Need step over [LWP %ld]? Cancelling, PC was changed. " + "Old stop_pc was 0x%s, PC is now 0x%s", lwpid_of (thread), + paddress (lwp->stop_pc), paddress (pc)); return false; } =20 @@ -4493,10 +4315,9 @@ linux_process_target::thread_needs_step_over (thread= _info *thread) && !lwp->pending_signals.empty () && lwp_signal_can_be_delivered (lwp)) { - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? Ignoring, has pending" - " signals.\n", - lwpid_of (thread)); + threads_debug_printf + ("Need step over [LWP %ld]? Ignoring, has pending signals.", + lwpid_of (thread)); =20 return false; } @@ -4514,19 +4335,17 @@ linux_process_target::thread_needs_step_over (threa= d_info *thread) && gdb_condition_true_at_breakpoint (pc) && gdb_no_commands_at_breakpoint (pc)) { - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? yes, but found" - " GDB breakpoint at 0x%s; skipping step over\n", - lwpid_of (thread), paddress (pc)); + threads_debug_printf ("Need step over [LWP %ld]? yes, but found" + " GDB breakpoint at 0x%s; skipping step over", + lwpid_of (thread), paddress (pc)); =20 return false; } else { - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? yes, " - "found breakpoint at 0x%s\n", - lwpid_of (thread), paddress (pc)); + threads_debug_printf ("Need step over [LWP %ld]? yes, " + "found breakpoint at 0x%s", + lwpid_of (thread), paddress (pc)); =20 /* We've found an lwp that needs stepping over --- return 1 so that find_thread stops looking. */ @@ -4534,10 +4353,9 @@ linux_process_target::thread_needs_step_over (thread= _info *thread) } } =20 - if (debug_threads) - debug_printf ("Need step over [LWP %ld]? No, no breakpoint found" - " at 0x%s\n", - lwpid_of (thread), paddress (pc)); + threads_debug_printf + ("Need step over [LWP %ld]? No, no breakpoint found at 0x%s", + lwpid_of (thread), paddress (pc)); =20 return false; } @@ -4548,9 +4366,8 @@ linux_process_target::start_step_over (lwp_info *lwp) struct thread_info *thread =3D get_lwp_thread (lwp); CORE_ADDR pc; =20 - if (debug_threads) - debug_printf ("Starting step-over on LWP %ld. Stopping all threads\n", - lwpid_of (thread)); + threads_debug_printf ("Starting step-over on LWP %ld. Stopping all thre= ads", + lwpid_of (thread)); =20 stop_all_lwps (1, lwp); =20 @@ -4561,8 +4378,7 @@ linux_process_target::start_step_over (lwp_info *lwp) lwp->suspended); } =20 - if (debug_threads) - debug_printf ("Done stopping all threads for step-over.\n"); + threads_debug_printf ("Done stopping all threads for step-over."); =20 /* Note, we should always reach here with an already adjusted PC, either by GDB (if we're resuming due to GDB's request), or by our @@ -4595,8 +4411,7 @@ linux_process_target::finish_step_over (lwp_info *lwp) { scoped_restore_current_thread restore_thread; =20 - if (debug_threads) - debug_printf ("Finished step over.\n"); + threads_debug_printf ("Finished step over."); =20 switch_to_thread (get_lwp_thread (lwp)); =20 @@ -4634,8 +4449,7 @@ linux_process_target::complete_ongoing_step_over () int wstat; int ret; =20 - if (debug_threads) - debug_printf ("detach: step over in progress, finish it first\n"); + threads_debug_printf ("detach: step over in progress, finish it firs= t"); =20 /* Passing NULL_PTID as filter indicates we want all events to be left pending. Eventually this returns when there are no @@ -4659,19 +4473,15 @@ linux_process_target::complete_ongoing_step_over () thread_info *thread =3D get_lwp_thread (lwp); if (thread->last_resume_kind !=3D resume_step) { - if (debug_threads) - debug_printf ("detach: discard step-over SIGTRAP\n"); + threads_debug_printf ("detach: discard step-over SIGTRAP"); =20 lwp->status_pending_p =3D 0; lwp->status_pending =3D 0; resume_one_lwp (lwp, lwp->stepping, 0, NULL); } else - { - if (debug_threads) - debug_printf ("detach: resume_step, " - "not discarding step-over SIGTRAP\n"); - } + threads_debug_printf + ("detach: resume_step, not discarding step-over SIGTRAP"); } } step_over_bkpt =3D null_ptid; @@ -4691,13 +4501,12 @@ linux_process_target::resume_one_thread (thread_inf= o *thread, =20 if (lwp->resume->kind =3D=3D resume_stop) { - if (debug_threads) - debug_printf ("resume_stop request for LWP %ld\n", lwpid_of (thread)); + threads_debug_printf ("resume_stop request for LWP %ld", + lwpid_of (thread)); =20 if (!lwp->stopped) { - if (debug_threads) - debug_printf ("stopping LWP %ld\n", lwpid_of (thread)); + threads_debug_printf ("stopping LWP %ld", lwpid_of (thread)); =20 /* Stop the thread, and wait for the event asynchronously, through the event loop. */ @@ -4705,9 +4514,7 @@ linux_process_target::resume_one_thread (thread_info = *thread, } else { - if (debug_threads) - debug_printf ("already stopped LWP %ld\n", - lwpid_of (thread)); + threads_debug_printf ("already stopped LWP %ld", lwpid_of (thread)); =20 /* The LWP may have been stopped in an internal event that was not meant to be notified back to GDB (e.g., gdbserver @@ -4769,16 +4576,12 @@ linux_process_target::resume_one_thread (thread_inf= o *thread, =20 if (!leave_pending) { - if (debug_threads) - debug_printf ("resuming LWP %ld\n", lwpid_of (thread)); + threads_debug_printf ("resuming LWP %ld", lwpid_of (thread)); =20 proceed_one_lwp (thread, NULL); } else - { - if (debug_threads) - debug_printf ("leaving LWP %ld stopped\n", lwpid_of (thread)); - } + threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread)); =20 thread->last_status.set_ignore (); lwp->resume =3D NULL; @@ -4789,11 +4592,7 @@ linux_process_target::resume (thread_resume *resume_= info, size_t n) { struct thread_info *need_step_over =3D NULL; =20 - if (debug_threads) - { - debug_enter (); - debug_printf ("linux_resume:\n"); - } + THREADS_SCOPED_DEBUG_ENTER_EXIT; =20 for_each_thread ([&] (thread_info *thread) { @@ -4827,16 +4626,13 @@ linux_process_target::resume (thread_resume *resume= _info, size_t n) =20 bool leave_all_stopped =3D (need_step_over !=3D NULL || any_pending); =20 - if (debug_threads) - { - if (need_step_over !=3D NULL) - debug_printf ("Not resuming all, need step over\n"); - else if (any_pending) - debug_printf ("Not resuming, all-stop and found " - "an LWP with pending status\n"); - else - debug_printf ("Resuming, no pending status or step over needed\n"); - } + if (need_step_over !=3D NULL) + threads_debug_printf ("Not resuming all, need step over"); + else if (any_pending) + threads_debug_printf ("Not resuming, all-stop and found " + "an LWP with pending status"); + else + threads_debug_printf ("Resuming, no pending status or step over needed= "); =20 /* Even if we're leaving threads stopped, queue all signals we'd otherwise deliver. */ @@ -4848,12 +4644,6 @@ linux_process_target::resume (thread_resume *resume_= info, size_t n) if (need_step_over) start_step_over (get_thread_lwp (need_step_over)); =20 - if (debug_threads) - { - debug_printf ("linux_resume done\n"); - debug_exit (); - } - /* We may have events that were pending that can/should be sent to the client now. Trigger a linux_wait call. */ if (target_is_async_p ()) @@ -4869,30 +4659,26 @@ linux_process_target::proceed_one_lwp (thread_info = *thread, lwp_info *except) if (lwp =3D=3D except) return; =20 - if (debug_threads) - debug_printf ("proceed_one_lwp: lwp %ld\n", lwpid_of (thread)); + threads_debug_printf ("lwp %ld", lwpid_of (thread)); =20 if (!lwp->stopped) { - if (debug_threads) - debug_printf (" LWP %ld already running\n", lwpid_of (thread)); + threads_debug_printf (" LWP %ld already running", lwpid_of (thread= )); return; } =20 if (thread->last_resume_kind =3D=3D resume_stop && thread->last_status.kind () !=3D TARGET_WAITKIND_IGNORE) { - if (debug_threads) - debug_printf (" client wants LWP to remain %ld stopped\n", - lwpid_of (thread)); + threads_debug_printf (" client wants LWP to remain %ld stopped", + lwpid_of (thread)); return; } =20 if (lwp->status_pending_p) { - if (debug_threads) - debug_printf (" LWP %ld has pending status, leaving stopped\n", - lwpid_of (thread)); + threads_debug_printf (" LWP %ld has pending status, leaving stoppe= d", + lwpid_of (thread)); return; } =20 @@ -4900,8 +4686,7 @@ linux_process_target::proceed_one_lwp (thread_info *t= hread, lwp_info *except) =20 if (lwp->suspended) { - if (debug_threads) - debug_printf (" LWP %ld is suspended\n", lwpid_of (thread)); + threads_debug_printf (" LWP %ld is suspended", lwpid_of (thread)); return; } =20 @@ -4920,19 +4705,17 @@ linux_process_target::proceed_one_lwp (thread_info = *thread, lwp_info *except) another one here. Note that if the LWP already has a SIGSTOP pending, this is a no-op. */ =20 - if (debug_threads) - debug_printf ("Client wants LWP %ld to stop. " - "Making sure it has a SIGSTOP pending\n", - lwpid_of (thread)); + threads_debug_printf + ("Client wants LWP %ld to stop. Making sure it has a SIGSTOP pending", + lwpid_of (thread)); =20 send_sigstop (lwp); } =20 if (thread->last_resume_kind =3D=3D resume_step) { - if (debug_threads) - debug_printf (" stepping LWP %ld, client wants it stepping\n", - lwpid_of (thread)); + threads_debug_printf (" stepping LWP %ld, client wants it stepping= ", + lwpid_of (thread)); =20 /* If resume_step is requested by GDB, install single-step breakpoints when the thread is about to be actually resumed if @@ -4945,9 +4728,8 @@ linux_process_target::proceed_one_lwp (thread_info *t= hread, lwp_info *except) } else if (lwp->bp_reinsert !=3D 0) { - if (debug_threads) - debug_printf (" stepping LWP %ld, reinsert set\n", - lwpid_of (thread)); + threads_debug_printf (" stepping LWP %ld, reinsert set", + lwpid_of (thread)); =20 step =3D maybe_hw_step (thread); } @@ -4990,18 +4772,15 @@ linux_process_target::proceed_all_lwps () =20 if (need_step_over !=3D NULL) { - if (debug_threads) - debug_printf ("proceed_all_lwps: found " - "thread %ld needing a step-over\n", - lwpid_of (need_step_over)); + threads_debug_printf ("found thread %ld needing a step-over", + lwpid_of (need_step_over)); =20 start_step_over (get_thread_lwp (need_step_over)); return; } } =20 - if (debug_threads) - debug_printf ("Proceeding, no step-over needed\n"); + threads_debug_printf ("Proceeding, no step-over needed"); =20 for_each_thread ([this] (thread_info *thread) { @@ -5012,15 +4791,13 @@ linux_process_target::proceed_all_lwps () void linux_process_target::unstop_all_lwps (int unsuspend, lwp_info *except) { - if (debug_threads) - { - debug_enter (); - if (except) - debug_printf ("unstopping all lwps, except=3D(LWP %ld)\n", - lwpid_of (get_lwp_thread (except))); - else - debug_printf ("unstopping all lwps\n"); - } + THREADS_SCOPED_DEBUG_ENTER_EXIT; + + if (except) + threads_debug_printf ("except=3D(LWP %ld)", + lwpid_of (get_lwp_thread (except))); + else + threads_debug_printf ("except=3Dnullptr"); =20 if (unsuspend) for_each_thread ([&] (thread_info *thread) @@ -5032,12 +4809,6 @@ linux_process_target::unstop_all_lwps (int unsuspend= , lwp_info *except) { proceed_one_lwp (thread, except); }); - - if (debug_threads) - { - debug_printf ("unstop_all_lwps done\n"); - debug_exit (); - } } =20 =20 @@ -5622,8 +5393,8 @@ linux_process_target::write_memory (CORE_ADDR memaddr, } *p =3D '\0'; =20 - debug_printf ("Writing %s to 0x%08lx in process %d\n", - str, (long) memaddr, pid); + threads_debug_printf ("Writing %s to 0x%08lx in process %d", + str, (long) memaddr, pid); } =20 /* Fill start and end extra bytes of buffer with existing memory data. = */ @@ -5967,10 +5738,9 @@ linux_process_target::qxfer_siginfo (const char *ann= ex, =20 pid =3D lwpid_of (current_thread); =20 - if (debug_threads) - debug_printf ("%s siginfo for lwp %d.\n", - readbuf !=3D NULL ? "Reading" : "Writing", - pid); + threads_debug_printf ("%s siginfo for lwp %d.", + readbuf !=3D NULL ? "Reading" : "Writing", + pid); =20 if (offset >=3D sizeof (siginfo)) return -1; @@ -6040,9 +5810,8 @@ linux_process_target::async (bool enable) { bool previous =3D target_is_async_p (); =20 - if (debug_threads) - debug_printf ("linux_async (%d), previous=3D%d\n", - enable, previous); + threads_debug_printf ("async (%d), previous=3D%d", + enable, previous); =20 if (previous !=3D enable) { @@ -7129,8 +6898,7 @@ linux_get_pc_32bit (struct regcache *regcache) uint32_t pc; =20 collect_register_by_name (regcache, "pc", &pc); - if (debug_threads) - debug_printf ("stop pc is 0x%" PRIx32 "\n", pc); + threads_debug_printf ("stop pc is 0x%" PRIx32, pc); return pc; } =20 @@ -7154,8 +6922,7 @@ linux_get_pc_64bit (struct regcache *regcache) uint64_t pc; =20 collect_register_by_name (regcache, "pc", &pc); - if (debug_threads) - debug_printf ("stop pc is 0x%" PRIx64 "\n", pc); + threads_debug_printf ("stop pc is 0x%" PRIx64, pc); return pc; } =20 diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index c1a8c18f13b..5adc2807057 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -1503,9 +1503,8 @@ add_insns (const unsigned char *start, int len) { CORE_ADDR buildaddr =3D current_insn_ptr; =20 - if (debug_threads) - debug_printf ("Adding %d bytes of insn at %s\n", - len, paddress (buildaddr)); + threads_debug_printf ("Adding %d bytes of insn at %s", + len, paddress (buildaddr)); =20 append_insns (&buildaddr, len, start); current_insn_ptr =3D buildaddr; diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 171f21c7997..d2b55f6f0d2 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -1628,9 +1628,8 @@ add_insns (unsigned char *start, int len) { CORE_ADDR buildaddr =3D current_insn_ptr; =20 - if (debug_threads) - debug_printf ("Adding %d bytes of insn at %s\n", - len, paddress (buildaddr)); + threads_debug_printf ("Adding %d bytes of insn at %s", + len, paddress (buildaddr)); =20 append_insns (&buildaddr, len, start); current_insn_ptr =3D buildaddr; diff --git a/gdbserver/mem-break.cc b/gdbserver/mem-break.cc index 87d025c9b5c..5f5cdb18797 100644 --- a/gdbserver/mem-break.cc +++ b/gdbserver/mem-break.cc @@ -371,10 +371,9 @@ insert_memory_breakpoint (struct raw_breakpoint *bp) err =3D read_inferior_memory (bp->pc, buf, bp_size (bp)); if (err !=3D 0) { - if (debug_threads) - debug_printf ("Failed to read shadow memory of" - " breakpoint at 0x%s (%s).\n", - paddress (bp->pc), safe_strerror (err)); + threads_debug_printf ("Failed to read shadow memory of" + " breakpoint at 0x%s (%s).", + paddress (bp->pc), safe_strerror (err)); } else { @@ -383,11 +382,8 @@ insert_memory_breakpoint (struct raw_breakpoint *bp) err =3D the_target->write_memory (bp->pc, bp_opcode (bp), bp_size (bp)); if (err !=3D 0) - { - if (debug_threads) - debug_printf ("Failed to insert breakpoint at 0x%s (%s).\n", - paddress (bp->pc), safe_strerror (err)); - } + threads_debug_printf ("Failed to insert breakpoint at 0x%s (%s).", + paddress (bp->pc), safe_strerror (err)); } return err !=3D 0 ? -1 : 0; } @@ -411,12 +407,10 @@ remove_memory_breakpoint (struct raw_breakpoint *bp) memcpy (buf, bp->old_data, bp_size (bp)); err =3D target_write_memory (bp->pc, buf, bp_size (bp)); if (err !=3D 0) - { - if (debug_threads) - debug_printf ("Failed to uninsert raw breakpoint " - "at 0x%s (%s) while deleting it.\n", - paddress (bp->pc), safe_strerror (err)); - } + threads_debug_printf ("Failed to uninsert raw breakpoint " + "at 0x%s (%s) while deleting it.", + paddress (bp->pc), safe_strerror (err)); + return err !=3D 0 ? -1 : 0; } =20 @@ -438,9 +432,9 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_AD= DR where, int kind, { /* A different kind than previously seen. The previous breakpoint must be gone then. */ - if (debug_threads) - debug_printf ("Inconsistent breakpoint kind? Was %d, now %d.\n", - bp->kind, kind); + threads_debug_printf + ("Inconsistent breakpoint kind? Was %d, now %d.", + bp->kind, kind); bp->inserted =3D -1; bp =3D NULL; } @@ -463,9 +457,8 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_AD= DR where, int kind, *err =3D the_target->insert_point (bp->raw_type, bp->pc, bp->kind, b= p); if (*err !=3D 0) { - if (debug_threads) - debug_printf ("Failed to insert breakpoint at 0x%s (%d).\n", - paddress (where), *err); + threads_debug_printf ("Failed to insert breakpoint at 0x%s (%d).", + paddress (where), *err); =20 return NULL; } @@ -594,10 +587,10 @@ delete_fast_tracepoint_jump (struct fast_tracepoint_j= ump *todel) /* Something went wrong, relink the jump. */ *bp_link =3D prev_bp_link; =20 - if (debug_threads) - debug_printf ("Failed to uninsert fast tracepoint jump " - "at 0x%s (%s) while deleting it.\n", - paddress (bp->pc), safe_strerror (ret)); + threads_debug_printf + ("Failed to uninsert fast tracepoint jump " + "at 0x%s (%s) while deleting it.", + paddress (bp->pc), safe_strerror (ret)); return ret; } =20 @@ -657,10 +650,9 @@ set_fast_tracepoint_jump (CORE_ADDR where, err =3D read_inferior_memory (where, buf, length); if (err !=3D 0) { - if (debug_threads) - debug_printf ("Failed to read shadow memory of" - " fast tracepoint at 0x%s (%s).\n", - paddress (where), safe_strerror (err)); + threads_debug_printf ("Failed to read shadow memory of" + " fast tracepoint at 0x%s (%s).", + paddress (where), safe_strerror (err)); free (jp); return NULL; } @@ -682,9 +674,9 @@ set_fast_tracepoint_jump (CORE_ADDR where, err =3D target_write_memory (where, buf, length); if (err !=3D 0) { - if (debug_threads) - debug_printf ("Failed to insert fast tracepoint jump at 0x%s (%s).\n", - paddress (where), safe_strerror (err)); + threads_debug_printf + ("Failed to insert fast tracepoint jump at 0x%s (%s).", + paddress (where), safe_strerror (err)); =20 /* Unlink it. */ proc->fast_tracepoint_jumps =3D jp->next; @@ -707,10 +699,9 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc) { /* This can happen when we remove all breakpoints while handling a step-over. */ - if (debug_threads) - debug_printf ("Could not find fast tracepoint jump at 0x%s " - "in list (uninserting).\n", - paddress (pc)); + threads_debug_printf ("Could not find fast tracepoint jump at 0x%s " + "in list (uninserting).", + paddress (pc)); return; } =20 @@ -736,10 +727,9 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc) { jp->inserted =3D 1; =20 - if (debug_threads) - debug_printf ("Failed to uninsert fast tracepoint jump at" - " 0x%s (%s).\n", - paddress (pc), safe_strerror (err)); + threads_debug_printf ("Failed to uninsert fast tracepoint jump at" + " 0x%s (%s).", + paddress (pc), safe_strerror (err)); } } } @@ -756,10 +746,9 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where) { /* This can happen when we remove breakpoints when a tracepoint hit causes a tracing stop, while handling a step-over. */ - if (debug_threads) - debug_printf ("Could not find fast tracepoint jump at 0x%s " - "in list (reinserting).\n", - paddress (where)); + threads_debug_printf ("Could not find fast tracepoint jump at 0x%s " + "in list (reinserting).", + paddress (where)); return; } =20 @@ -783,10 +772,9 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where) { jp->inserted =3D 0; =20 - if (debug_threads) - debug_printf ("Failed to reinsert fast tracepoint jump at" - " 0x%s (%s).\n", - paddress (where), safe_strerror (err)); + threads_debug_printf ("Failed to reinsert fast tracepoint jump at" + " 0x%s (%s).", + paddress (where), safe_strerror (err)); } } =20 @@ -897,10 +885,9 @@ delete_raw_breakpoint (struct process_info *proc, stru= ct raw_breakpoint *todel) /* Something went wrong, relink the breakpoint. */ *bp_link =3D prev_bp_link; =20 - if (debug_threads) - debug_printf ("Failed to uninsert raw breakpoint " - "at 0x%s while deleting it.\n", - paddress (bp->pc)); + threads_debug_printf ("Failed to uninsert raw breakpoint " + "at 0x%s while deleting it.", + paddress (bp->pc)); return ret; } } @@ -1404,10 +1391,9 @@ gdb_no_commands_at_breakpoint_z_type (char z_type, C= ORE_ADDR addr) if (bp =3D=3D NULL) return 1; =20 - if (debug_threads) - debug_printf ("at 0x%s, type Z%c, bp command_list is 0x%s\n", - paddress (addr), z_type, - phex_nz ((uintptr_t) bp->command_list, 0)); + threads_debug_printf ("at 0x%s, type Z%c, bp command_list is 0x%s", + paddress (addr), z_type, + phex_nz ((uintptr_t) bp->command_list, 0)); return (bp->command_list =3D=3D NULL); } =20 @@ -1521,9 +1507,8 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp) { if (bp->inserted < 0) { - if (debug_threads) - debug_printf ("Breakpoint at %s is marked insert-disabled.\n", - paddress (bp->pc)); + threads_debug_printf ("Breakpoint at %s is marked insert-disabled.", + paddress (bp->pc)); } else if (bp->inserted > 0) { @@ -1536,9 +1521,8 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp) { bp->inserted =3D 1; =20 - if (debug_threads) - debug_printf ("Failed to uninsert raw breakpoint at 0x%s.\n", - paddress (bp->pc)); + threads_debug_printf ("Failed to uninsert raw breakpoint at 0x%s.", + paddress (bp->pc)); } } } @@ -1565,10 +1549,9 @@ uninsert_breakpoints_at (CORE_ADDR pc) { /* This can happen when we remove all breakpoints while handling a step-over. */ - if (debug_threads) - debug_printf ("Could not find breakpoint at 0x%s " - "in list (uninserting).\n", - paddress (pc)); + threads_debug_printf ("Could not find breakpoint at 0x%s " + "in list (uninserting).", + paddress (pc)); } } =20 @@ -1622,9 +1605,9 @@ reinsert_raw_breakpoint (struct raw_breakpoint *bp) err =3D the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp); if (err =3D=3D 0) bp->inserted =3D 1; - else if (debug_threads) - debug_printf ("Failed to reinsert breakpoint at 0x%s (%d).\n", - paddress (bp->pc), err); + else + threads_debug_printf ("Failed to reinsert breakpoint at 0x%s (%d).", + paddress (bp->pc), err); } =20 void @@ -1648,10 +1631,9 @@ reinsert_breakpoints_at (CORE_ADDR pc) { /* This can happen when we remove all breakpoints while handling a step-over. */ - if (debug_threads) - debug_printf ("Could not find raw breakpoint at 0x%s " - "in list (reinserting).\n", - paddress (pc)); + threads_debug_printf ("Could not find raw breakpoint at 0x%s " + "in list (reinserting).", + paddress (pc)); } } =20 diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc index 0faf5a91f2b..8cd8f527105 100644 --- a/gdbserver/remote-utils.cc +++ b/gdbserver/remote-utils.cc @@ -144,8 +144,7 @@ handle_accept_event (int err, gdb_client_data client_da= ta) struct sockaddr_storage sockaddr; socklen_t len =3D sizeof (sockaddr); =20 - if (debug_threads) - debug_printf ("handling possible accept event\n"); + threads_debug_printf ("handling possible accept event"); =20 remote_desc =3D accept (listen_desc, (struct sockaddr *) &sockaddr, &len= ); if (remote_desc =3D=3D -1) @@ -1084,9 +1083,8 @@ void prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &sta= tus) { client_state &cs =3D get_client_state (); - if (debug_threads) - debug_printf ("Writing resume reply for %s:%d\n", - target_pid_to_str (ptid).c_str (), status.kind ()); + threads_debug_printf ("Writing resume reply for %s:%d", + target_pid_to_str (ptid).c_str (), status.kind ()); =20 switch (status.kind ()) { diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 021c7adc308..02b09e50da7 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -1228,8 +1228,7 @@ handle_detach (char *own_buf) pass signals down without informing GDB. */ if (!non_stop) { - if (debug_threads) - debug_printf ("Forcing non-stop mode\n"); + threads_debug_printf ("Forcing non-stop mode"); =20 non_stop =3D true; the_target->start_non_stop (true); @@ -3336,10 +3335,10 @@ queue_stop_reply_callback (thread_info *thread) { if (target_thread_stopped (thread)) { - if (debug_threads) - debug_printf ("Reporting thread %s as already stopped with %s\n", - target_pid_to_str (thread->id).c_str (), - thread->last_status.to_string ().c_str ()); + threads_debug_printf + ("Reporting thread %s as already stopped with %s", + target_pid_to_str (thread->id).c_str (), + thread->last_status.to_string ().c_str ()); =20 gdb_assert (thread->last_status.kind () !=3D TARGET_WAITKIND_IGNORE); =20 @@ -4183,16 +4182,14 @@ process_point_options (struct gdb_breakpoint *bp, c= onst char **packet) if (*dataptr =3D=3D 'X') { /* Conditional expression. */ - if (debug_threads) - debug_printf ("Found breakpoint condition.\n"); + threads_debug_printf ("Found breakpoint condition."); if (!add_breakpoint_condition (bp, &dataptr)) dataptr =3D strchrnul (dataptr, ';'); } else if (startswith (dataptr, "cmds:")) { dataptr +=3D strlen ("cmds:"); - if (debug_threads) - debug_printf ("Found breakpoint commands %s.\n", dataptr); + threads_debug_printf ("Found breakpoint commands %s.", dataptr); persist =3D (*dataptr =3D=3D '1'); dataptr +=3D 2; if (add_breakpoint_commands (bp, &dataptr, persist)) @@ -4576,8 +4573,7 @@ process_serial_event (void) void handle_serial_event (int err, gdb_client_data client_data) { - if (debug_threads) - debug_printf ("handling possible serial event\n"); + threads_debug_printf ("handling possible serial event"); =20 /* Really handle it. */ if (process_serial_event () < 0) @@ -4610,8 +4606,7 @@ void handle_target_event (int err, gdb_client_data client_data) { client_state &cs =3D get_client_state (); - if (debug_threads) - debug_printf ("handling possible target event\n"); + threads_debug_printf ("handling possible target event"); =20 cs.last_ptid =3D mywait (minus_one_ptid, &cs.last_status, TARGET_WNOHANG, 1); @@ -4663,11 +4658,10 @@ handle_target_event (int err, gdb_client_data clien= t_data) inferior, as if it wasn't being traced. */ enum gdb_signal signal; =20 - if (debug_threads) - debug_printf ("GDB not connected; forwarding event %d for" - " [%s]\n", - (int) cs.last_status.kind (), - target_pid_to_str (cs.last_ptid).c_str ()); + threads_debug_printf ("GDB not connected; forwarding event %d for" + " [%s]", + (int) cs.last_status.kind (), + target_pid_to_str (cs.last_ptid).c_str ()); =20 if (cs.last_status.kind () =3D=3D TARGET_WAITKIND_STOPPED) signal =3D cs.last_status.sig (); diff --git a/gdbserver/thread-db.cc b/gdbserver/thread-db.cc index 62ce23ce037..6e0e2228a5f 100644 --- a/gdbserver/thread-db.cc +++ b/gdbserver/thread-db.cc @@ -184,9 +184,8 @@ find_one_thread (ptid_t ptid) error ("Cannot get thread info for LWP %d: %s", lwpid, thread_db_err_str (err)); =20 - if (debug_threads) - debug_printf ("Found thread %ld (LWP %d)\n", - (unsigned long) ti.ti_tid, ti.ti_lid); + threads_debug_printf ("Found thread %ld (LWP %d)", + (unsigned long) ti.ti_tid, ti.ti_lid); =20 if (lwpid !=3D ti.ti_lid) { @@ -218,9 +217,8 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t= *ti_p) struct lwp_info *lwp; int err; =20 - if (debug_threads) - debug_printf ("Attaching to thread %ld (LWP %d)\n", - (unsigned long) ti_p->ti_tid, ti_p->ti_lid); + threads_debug_printf ("Attaching to thread %ld (LWP %d)", + (unsigned long) ti_p->ti_tid, ti_p->ti_lid); err =3D the_linux_target->attach_lwp (ptid); if (err !=3D 0) { @@ -283,10 +281,9 @@ find_new_threads_callback (const td_thrhandle_t *th_p,= void *data) thread that previously exited and was joined. (glibc marks terminated and joined threads with kernel thread ID -1. See glibc PR17707. */ - if (debug_threads) - debug_printf ("thread_db: skipping exited and " - "joined thread (0x%lx)\n", - (unsigned long) ti.ti_tid); + threads_debug_printf ("thread_db: skipping exited and " + "joined thread (0x%lx)", + (unsigned long) ti.ti_tid); return 0; } =20 @@ -333,9 +330,8 @@ thread_db_find_new_threads (void) TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS); - if (debug_threads) - debug_printf ("Found %d threads in iteration %d.\n", - new_thread_count, iteration); + threads_debug_printf ("Found %d threads in iteration %d.", + new_thread_count, iteration); =20 if (new_thread_count !=3D 0) { @@ -492,8 +488,7 @@ thread_db_load_search (void) err =3D tdb->td_ta_new_p (&tdb->proc_handle, &tdb->thread_agent); if (err !=3D TD_OK) { - if (debug_threads) - debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err)); + threads_debug_printf ("td_ta_new(): %s", thread_db_err_str (err)); free (tdb); proc->priv->thread_db =3D NULL; return 0; @@ -535,8 +530,7 @@ try_thread_db_load_1 (void *handle) { \ if ((a) =3D=3D NULL) \ { \ - if (debug_threads) \ - debug_printf ("dlsym: %s\n", dlerror ()); \ + threads_debug_printf ("dlsym: %s", dlerror ()); \ if (required) \ { \ free (tdb); \ @@ -556,8 +550,7 @@ try_thread_db_load_1 (void *handle) err =3D tdb->td_ta_new_p (&tdb->proc_handle, &tdb->thread_agent); if (err !=3D TD_OK) { - if (debug_threads) - debug_printf ("td_ta_new(): %s\n", thread_db_err_str (err)); + threads_debug_printf ("td_ta_new(): %s", thread_db_err_str (err)); free (tdb); proc->priv->thread_db =3D NULL; return 0; @@ -601,14 +594,12 @@ try_thread_db_load (const char *library) { void *handle; =20 - if (debug_threads) - debug_printf ("Trying host libthread_db library: %s.\n", - library); + threads_debug_printf ("Trying host libthread_db library: %s.", + library); handle =3D dlopen (library, RTLD_NOW); if (handle =3D=3D NULL) { - if (debug_threads) - debug_printf ("dlopen failed: %s.\n", dlerror ()); + threads_debug_printf ("dlopen failed: %s.", dlerror ()); return 0; } =20 @@ -623,7 +614,7 @@ try_thread_db_load (const char *library) const char *const libpath =3D dladdr_to_soname (td_init); =20 if (libpath !=3D NULL) - debug_printf ("Host %s resolved to: %s.\n", library, libpath); + threads_debug_printf ("Host %s resolved to: %s.", library, libpath); } } #endif @@ -722,8 +713,7 @@ thread_db_load_search (void) } } =20 - if (debug_threads) - debug_printf ("thread_db_load_search returning %d\n", rc); + threads_debug_printf ("thread_db_load_search returning %d", rc); return rc; } =20 diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index 0136f6e2347..5459dc34cbb 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -87,11 +87,7 @@ trace_vdebug (const char *fmt, ...) =20 #define trace_debug(fmt, args...) \ do { \ - if (debug_threads) \ - { \ - debug_printf ((fmt), ##args); \ - debug_printf ("\n"); \ - } \ + threads_debug_printf ((fmt), ##args); \ } while (0) =20 #endif @@ -324,8 +320,7 @@ tracepoint_look_up_symbols (void) =20 if (look_up_one_symbol (symbol_list[i].name, addrp, 1) =3D=3D 0) { - if (debug_threads) - debug_printf ("symbol `%s' not found\n", symbol_list[i].name); + threads_debug_printf ("symbol `%s' not found", symbol_list[i].name); return; } } @@ -4519,15 +4514,14 @@ handle_tracepoint_bkpts (struct thread_info *tinfo,= CORE_ADDR stop_pc) ipa_expr_eval_result, paddress (ipa_error_tracepoint)); =20 - if (debug_threads) - { - if (ipa_trace_buffer_is_full) - trace_debug ("lib stopped due to full buffer."); - if (ipa_stopping_tracepoint) - trace_debug ("lib stopped due to tpoint"); - if (ipa_error_tracepoint) - trace_debug ("lib stopped due to error"); - } + if (ipa_trace_buffer_is_full) + trace_debug ("lib stopped due to full buffer."); + + if (ipa_stopping_tracepoint) + trace_debug ("lib stopped due to tpoint"); + + if (ipa_error_tracepoint) + trace_debug ("lib stopped due to error"); =20 if (ipa_stopping_tracepoint !=3D 0) {