aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-03-24 18:31:51 +0000
committerPedro Alves <palves@redhat.com>2015-03-24 18:31:51 +0000
commit2bf6fb9d85394f90abb3e21ee037a732b6e4c983 (patch)
tree786dd76d884241d2ce534fa73a559aa446342a3d /gdb
parent283a99589a0780a3b1fc011885b630bd9223ebba (diff)
downloadgdb-2bf6fb9d85394f90abb3e21ee037a732b6e4c983.zip
gdb-2bf6fb9d85394f90abb3e21ee037a732b6e4c983.tar.gz
gdb-2bf6fb9d85394f90abb3e21ee037a732b6e4c983.tar.bz2
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 <palves@redhat.com> * 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 <palves@redhat.com> * 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/gdbserver/ChangeLog7
-rw-r--r--gdb/gdbserver/linux-low.c30
-rw-r--r--gdb/linux-nat.c49
4 files changed, 73 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 43dda55..fc65c603 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2015-03-24 Pedro Alves <palves@redhat.com>
+
+ * 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.
+
2015-03-24 Joel Brobecker <brobecker@adacore.com>
* gdbtypes.h (struct dynamic_prop_list) <prop>: Remove
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 <palves@redhat.com>
+
+ * 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 <gbenson@redhat.com>
* 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;
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 803bdf6..660dc8f 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1799,16 +1799,16 @@ linux_nat_resume (struct target_ops *ops,
if (resume_many)
iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
- linux_resume_one_lwp (lp, step, signo);
-
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: %s %s, %s (resume event thread)\n",
step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
- target_pid_to_str (ptid),
+ target_pid_to_str (lp->ptid),
(signo != GDB_SIGNAL_0
? strsignal (gdb_signal_to_host (signo)) : "0"));
+ linux_resume_one_lwp (lp, step, signo);
+
if (target_can_async_p ())
target_async (inferior_event_handler, 0);
}
@@ -2618,7 +2618,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
- "SWC: Delayed SIGSTOP caught for %s.\n",
+ "SWC: Expected SIGSTOP caught for %s.\n",
target_pid_to_str (lp->ptid));
/* Reset SIGNALLED only after the stop_wait_callback call
@@ -2795,8 +2795,8 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
- "CSBB: Push back software "
- "breakpoint for %s\n",
+ "CSBB: %s stopped by software "
+ "breakpoint\n",
target_pid_to_str (lp->ptid));
/* Back up the PC if necessary. */
@@ -2811,14 +2811,21 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
- "CSBB: Push back hardware "
- "breakpoint/watchpoint for %s\n",
+ "CSBB: %s stopped by hardware "
+ "breakpoint/watchpoint\n",
target_pid_to_str (lp->ptid));
lp->stop_pc = pc;
lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
return 1;
}
+ else if (siginfo.si_code == TRAP_TRACE)
+ {
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog,
+ "CSBB: %s stopped by trace\n",
+ target_pid_to_str (lp->ptid));
+ }
}
}
#else
@@ -2830,7 +2837,7 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
breakpoint instruction. */
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
- "CB: Push back software breakpoint for %s\n",
+ "CSBB: %s stopped by software breakpoint\n",
target_pid_to_str (lp->ptid));
/* Back up the PC if necessary. */
@@ -2846,7 +2853,7 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
- "CB: Push back hardware breakpoint for %s\n",
+ "CSBB: stopped by hardware breakpoint %s\n",
target_pid_to_str (lp->ptid));
lp->stop_pc = pc;
@@ -3206,28 +3213,28 @@ linux_nat_filter_event (int lwpid, int status)
if (lp->signalled
&& WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
{
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: Delayed SIGSTOP caught for %s.\n",
- target_pid_to_str (lp->ptid));
-
lp->signalled = 0;
- if (lp->last_resume_kind != resume_stop)
+ if (lp->last_resume_kind == resume_stop)
{
- /* This is a delayed SIGSTOP. */
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: resume_stop SIGSTOP caught for %s.\n",
+ target_pid_to_str (lp->ptid));
+ }
+ else
+ {
+ /* This is a delayed SIGSTOP. Filter out the event. */
- linux_resume_one_lwp (lp, lp->step, GDB_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
- "LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
+ "LLW: %s %s, 0, 0 (discard delayed SIGSTOP)\n",
lp->step ?
"PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid));
+ linux_resume_one_lwp (lp, lp->step, GDB_SIGNAL_0);
gdb_assert (lp->resumed);
-
- /* Discard the event. */
return NULL;
}
}