From 2bf6fb9d85394f90abb3e21ee037a732b6e4c983 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 24 Mar 2015 18:31:51 +0000 Subject: Debug output tweaks in the Linux target backends This adds/tweaks a few debug logs I found useful recently. gdb/gdbserver/ChangeLog: 2015-03-24 Pedro Alves * linux-low.c (check_stopped_by_breakpoint): Tweak debug log output. Also dump TRAP_TRACE. (linux_low_filter_event): In debug output, distinguish a resume_stop SIGSTOP from a delayed SIGSTOP. gdb/ChangeLog: 2015-03-24 Pedro Alves * linux-nat.c (linux_nat_resume): Output debug logs before trying to resume the event lwp. Use the lwp's ptid instead of the passed in (maybe wildcard) ptid. (stop_wait_callback): Tweak debug log output. (check_stopped_by_breakpoint): Tweak debug log output. Also dump TRAP_TRACE. (linux_nat_filter_event): In debug output, distinguish a resume_stop SIGSTOP from a delayed SIGSTOP. Output debug logs before trying to resume the lwp. --- gdb/gdbserver/ChangeLog | 7 +++++++ gdb/gdbserver/linux-low.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) (limited to 'gdb/gdbserver') diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index d9bc729..396abcb 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2015-03-24 Pedro Alves + + * linux-low.c (check_stopped_by_breakpoint): Tweak debug log + output. Also dump TRAP_TRACE. + (linux_low_filter_event): In debug output, distinguish a + resume_stop SIGSTOP from a delayed SIGSTOP. + 2015-03-24 Gary Benson * linux-x86-low.c (x86_linux_new_thread): Moved to diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 4743f7b..e4c5420 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -562,7 +562,7 @@ check_stopped_by_breakpoint (struct lwp_info *lwp) { struct thread_info *thr = get_lwp_thread (lwp); - debug_printf ("CSBB: Push back software breakpoint for %s\n", + debug_printf ("CSBB: %s stopped by software breakpoint\n", target_pid_to_str (ptid_of (thr))); } @@ -585,8 +585,8 @@ check_stopped_by_breakpoint (struct lwp_info *lwp) { struct thread_info *thr = get_lwp_thread (lwp); - debug_printf ("CSBB: Push back hardware " - "breakpoint/watchpoint for %s\n", + debug_printf ("CSBB: %s stopped by hardware " + "breakpoint/watchpoint\n", target_pid_to_str (ptid_of (thr))); } @@ -595,6 +595,16 @@ check_stopped_by_breakpoint (struct lwp_info *lwp) current_thread = saved_thread; return 1; } + else if (siginfo.si_code == TRAP_TRACE) + { + if (debug_threads) + { + struct thread_info *thr = get_lwp_thread (lwp); + + debug_printf ("CSBB: %s stopped by trace\n", + target_pid_to_str (ptid_of (thr))); + } + } } } #else @@ -2059,16 +2069,28 @@ linux_low_filter_event (int lwpid, int wstat) { /* 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))); } else if (stopping_threads != 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))); return NULL; } else { - /* Filter out the event. */ + /* This is a delayed SIGSTOP. Filter out the event. */ + if (debug_threads) + debug_printf ("LLW: %s %s, 0, 0 (discard delayed SIGSTOP)\n", + child->stepping ? "step" : "continue", + target_pid_to_str (ptid_of (thread))); + linux_resume_one_lwp (child, child->stepping, 0, NULL); return NULL; } -- cgit v1.1