aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/gnu-nat.c10
-rw-r--r--gdb/infrun.c78
-rw-r--r--gdb/target/waitstatus.c3
4 files changed, 31 insertions, 72 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f3f30b1..ce9c573 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2019-04-01 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * infrun.c (stop_all_threads): If debug_infrun, always
+ trace the wait status after wait_one, using
+ target_waitstatus_to_string and target_pid_to_str.
+ (handle_inferior_event): Replace various trace of
+ wait status kind by a single trace.
+ * gdb/gnu-nat.c (gnu_nat_target::wait): Replace local
+ wait status kind image by target_waitstatus_to_string.
+ * target/waitstatus.c (target_waitstatus_to_string): Fix
+ obsolete comment.
+
2019-04-01 Tom Tromey <tromey@adacore.com>
PR symtab/23331:
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index c1fafed..654a652 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -1647,15 +1647,9 @@ rewait:
inf_update_suspends (inf);
}
- inf_debug (inf, "returning ptid = %s, status = %s (%d)",
+ inf_debug (inf, "returning ptid = %s, %s",
target_pid_to_str (ptid).c_str (),
- status->kind == TARGET_WAITKIND_EXITED ? "EXITED"
- : status->kind == TARGET_WAITKIND_STOPPED ? "STOPPED"
- : status->kind == TARGET_WAITKIND_SIGNALLED ? "SIGNALLED"
- : status->kind == TARGET_WAITKIND_LOADED ? "LOADED"
- : status->kind == TARGET_WAITKIND_SPURIOUS ? "SPURIOUS"
- : "?",
- status->value.integer);
+ target_waitstatus_to_string (&status).c_str ());
return ptid;
}
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 0cfa2d6..2826741 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4358,24 +4358,21 @@ stop_all_threads (void)
pass = -1;
event_ptid = wait_one (&ws);
-
- if (ws.kind == TARGET_WAITKIND_NO_RESUMED)
+ if (debug_infrun)
{
- /* All resumed threads exited. */
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: stop_all_threads %s %s\n",
+ target_waitstatus_to_string (&ws).c_str (),
+ target_pid_to_str (event_ptid).c_str ());
}
- else if (ws.kind == TARGET_WAITKIND_THREAD_EXITED
- || ws.kind == TARGET_WAITKIND_EXITED
- || ws.kind == TARGET_WAITKIND_SIGNALLED)
- {
- if (debug_infrun)
- {
- ptid_t ptid = ptid_t (ws.value.integer);
- fprintf_unfiltered (gdb_stdlog,
- "infrun: %s exited while "
- "stopping threads\n",
- target_pid_to_str (ptid).c_str ());
- }
+ if (ws.kind == TARGET_WAITKIND_NO_RESUMED
+ || ws.kind == TARGET_WAITKIND_THREAD_EXITED
+ || ws.kind == TARGET_WAITKIND_EXITED
+ || ws.kind == TARGET_WAITKIND_SIGNALLED)
+ {
+ /* All resumed threads exited
+ or one thread/process exited/signalled. */
}
else
{
@@ -4604,6 +4601,10 @@ handle_inferior_event (struct execution_control_state *ecs)
enum stop_kind stop_soon;
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog, "infrun: handle_inferior_event %s\n",
+ target_waitstatus_to_string (&ecs->ws).c_str ());
+
if (ecs->ws.kind == TARGET_WAITKIND_IGNORE)
{
/* We had an event in the inferior, but we are not interested in
@@ -4615,16 +4616,12 @@ handle_inferior_event (struct execution_control_state *ecs)
not stopped, and we are ignoring the event. Another possible
circumstance is any event which the lower level knows will be
reported multiple times without an intervening resume. */
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_IGNORE\n");
prepare_to_wait (ecs);
return;
}
if (ecs->ws.kind == TARGET_WAITKIND_THREAD_EXITED)
{
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_THREAD_EXITED\n");
prepare_to_wait (ecs);
return;
}
@@ -4643,9 +4640,6 @@ handle_inferior_event (struct execution_control_state *ecs)
{
/* No unwaited-for children left. IOW, all resumed children
have exited. */
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_NO_RESUMED\n");
-
stop_print_frame = 0;
stop_waiting (ecs);
return;
@@ -4738,8 +4732,6 @@ handle_inferior_event (struct execution_control_state *ecs)
switch (ecs->ws.kind)
{
case TARGET_WAITKIND_LOADED:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_LOADED\n");
context_switch (ecs);
/* Ignore gracefully during startup of the inferior, as it might
be the shell which has just loaded some objects, otherwise
@@ -4817,8 +4809,6 @@ handle_inferior_event (struct execution_control_state *ecs)
_("unhandled stop_soon: %d"), (int) stop_soon);
case TARGET_WAITKIND_SPURIOUS:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SPURIOUS\n");
if (handle_stop_requested (ecs))
return;
context_switch (ecs);
@@ -4827,8 +4817,6 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
case TARGET_WAITKIND_THREAD_CREATED:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_THREAD_CREATED\n");
if (handle_stop_requested (ecs))
return;
context_switch (ecs);
@@ -4838,16 +4826,6 @@ handle_inferior_event (struct execution_control_state *ecs)
case TARGET_WAITKIND_EXITED:
case TARGET_WAITKIND_SIGNALLED:
- if (debug_infrun)
- {
- if (ecs->ws.kind == TARGET_WAITKIND_EXITED)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_EXITED\n");
- else
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_SIGNALLED\n");
- }
-
inferior_ptid = ecs->ptid;
set_current_inferior (find_inferior_ptid (ecs->ptid));
set_current_program_space (current_inferior ()->pspace);
@@ -4912,14 +4890,6 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
the above cases end in a continue or goto. */
case TARGET_WAITKIND_FORKED:
case TARGET_WAITKIND_VFORKED:
- if (debug_infrun)
- {
- if (ecs->ws.kind == TARGET_WAITKIND_FORKED)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_FORKED\n");
- else
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_VFORKED\n");
- }
-
/* Check whether the inferior is displaced stepping. */
{
struct regcache *regcache = get_thread_regcache (ecs->event_thread);
@@ -5080,10 +5050,6 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
/* Done with the shared memory region. Re-insert breakpoints in
the parent, and keep going. */
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_VFORK_DONE\n");
-
context_switch (ecs);
current_inferior ()->waiting_for_vfork_done = 0;
@@ -5098,8 +5064,6 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
return;
case TARGET_WAITKIND_EXECD:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXECD\n");
/* Note we can't read registers yet (the stop_pc), because we
don't yet know the inferior's post-exec architecture.
@@ -5148,9 +5112,6 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
/* Be careful not to try to gather much state about a thread
that's in a syscall. It's frequently a losing proposition. */
case TARGET_WAITKIND_SYSCALL_ENTRY:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_SYSCALL_ENTRY\n");
/* Getting the current syscall number. */
if (handle_syscall_event (ecs) == 0)
process_event_stop_test (ecs);
@@ -5162,22 +5123,15 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
syscall. Stepping one instruction seems to get it back
into user code.) */
case TARGET_WAITKIND_SYSCALL_RETURN:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: TARGET_WAITKIND_SYSCALL_RETURN\n");
if (handle_syscall_event (ecs) == 0)
process_event_stop_test (ecs);
return;
case TARGET_WAITKIND_STOPPED:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_STOPPED\n");
handle_signal_stop (ecs);
return;
case TARGET_WAITKIND_NO_HISTORY:
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_NO_HISTORY\n");
/* Reverse execution: target ran out of history info. */
/* Switch to the stopped thread. */
diff --git a/gdb/target/waitstatus.c b/gdb/target/waitstatus.c
index 4ac98e5..f86ce22 100644
--- a/gdb/target/waitstatus.c
+++ b/gdb/target/waitstatus.c
@@ -20,8 +20,7 @@
#include "common/common-defs.h"
#include "waitstatus.h"
-/* Return a pretty printed form of target_waitstatus.
- Space for the result is malloc'd, caller must free. */
+/* Return a pretty printed form of target_waitstatus. */
std::string
target_waitstatus_to_string (const struct target_waitstatus *ws)