value);
}
+#define fbsd_lwp_debug_printf(fmt, ...) \
+ debug_prefixed_printf_cond (debug_fbsd_lwp, "fbsd-lwp", fmt, ##__VA_ARGS__)
+
+#define fbsd_nat_debug_printf(fmt, ...) \
+ debug_prefixed_printf_cond (debug_fbsd_nat, "fbsd-nat", fmt, ##__VA_ARGS__)
+
+
/*
FreeBSD's first thread support was via a "reentrant" version of libc
(libc_r) that first shipped in 2.2.7. This library multiplexed all
if (pl.pl_flags & PL_FLAG_EXITED)
continue;
#endif
- if (debug_fbsd_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "FLWP: adding thread for LWP %u\n",
- lwps[i]);
+ fbsd_lwp_debug_printf ("adding thread for LWP %u", lwps[i]);
add_thread (target, ptid);
}
}
return;
#endif
- if (debug_fbsd_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n",
- ptid.pid (), ptid.lwp (),
- ptid.tid ());
+ fbsd_lwp_debug_printf ("ptid (%d, %ld, %ld)", ptid.pid (), ptid.lwp (),
+ ptid.tid ());
if (ptid.lwp_p ())
{
/* If ptid is a specific LWP, suspend all other LWPs in the process. */
breakpoint. */
if (pl.pl_siginfo.si_code == TRAP_TRACE)
{
- if (debug_fbsd_nat)
- fprintf_unfiltered (gdb_stdlog,
- "FNAT: trace trap for LWP %ld\n", ptid.lwp ());
+ fbsd_nat_debug_printf ("trace trap for LWP %ld", ptid.lwp ());
return true;
}
struct gdbarch *gdbarch = regcache->arch ();
int decr_pc = gdbarch_decr_pc_after_break (gdbarch);
- if (debug_fbsd_nat)
- fprintf_unfiltered (gdb_stdlog,
- "FNAT: sw breakpoint trap for LWP %ld\n",
- ptid.lwp ());
+ fbsd_nat_debug_printf ("sw breakpoint trap for LWP %ld", ptid.lwp ());
if (decr_pc != 0)
{
CORE_ADDR pc;
if (debug_fbsd_nat)
{
- fprintf_unfiltered (gdb_stdlog,
- "FNAT: stop for LWP %u event %d flags %#x\n",
- pl.pl_lwpid, pl.pl_event, pl.pl_flags);
+ fbsd_nat_debug_printf ("stop for LWP %u event %d flags %#x",
+ pl.pl_lwpid, pl.pl_event, pl.pl_flags);
if (pl.pl_flags & PL_FLAG_SI)
- fprintf_unfiltered (gdb_stdlog,
- "FNAT: si_signo %u si_code %u\n",
- pl.pl_siginfo.si_signo,
- pl.pl_siginfo.si_code);
+ fbsd_nat_debug_printf ("si_signo %u si_code %u",
+ pl.pl_siginfo.si_signo,
+ pl.pl_siginfo.si_code);
}
#ifdef PT_LWP_EVENTS
thread_info *thr = find_thread_ptid (this, wptid);
if (thr != nullptr)
{
- if (debug_fbsd_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "FLWP: deleting thread for LWP %u\n",
- pl.pl_lwpid);
+ fbsd_lwp_debug_printf ("deleting thread for LWP %u",
+ pl.pl_lwpid);
if (print_thread_events)
printf_unfiltered (_("[%s exited]\n"),
target_pid_to_str (wptid).c_str ());
event. */
if (in_thread_list (this, ptid_t (pid)))
{
- if (debug_fbsd_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "FLWP: using LWP %u for first thread\n",
- pl.pl_lwpid);
+ fbsd_lwp_debug_printf ("using LWP %u for first thread",
+ pl.pl_lwpid);
thread_change_ptid (this, ptid_t (pid), wptid);
}
BORN events for an already-known LWP. */
if (!in_thread_list (this, wptid))
{
- if (debug_fbsd_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "FLWP: adding thread for LWP %u\n",
- pl.pl_lwpid);
+ fbsd_lwp_debug_printf ("adding thread for LWP %u",
+ pl.pl_lwpid);
add_thread (this, wptid);
}
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;