|
|
|
@ -721,6 +721,13 @@ show_fbsd_nat_debug (struct ui_file *file, int from_tty, |
|
|
|
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 |
|
|
|
@ -893,10 +900,7 @@ fbsd_add_threads (fbsd_nat_target *target, pid_t pid) |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1037,11 +1041,8 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) |
|
|
|
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. */ |
|
|
|
@ -1129,9 +1130,7 @@ fbsd_handle_debug_trap (fbsd_nat_target *target, ptid_t ptid, |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1142,10 +1141,7 @@ fbsd_handle_debug_trap (fbsd_nat_target *target, ptid_t ptid, |
|
|
|
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; |
|
|
|
@ -1195,14 +1191,12 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, |
|
|
|
|
|
|
|
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 |
|
|
|
@ -1215,10 +1209,8 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, |
|
|
|
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 ()); |
|
|
|
@ -1238,10 +1230,8 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1254,10 +1244,8 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, |
|
|
|
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; |
|
|
|
|