2005-01-19 Andrew Cagney <cagney@gnu.org>

* infrun.c: (resume, proceed, wait_for_inferior)
	(handle_inferior_event, stop_stepping)
	(prepare_to_wait): Write debug output to gdb_stdlog.
This commit is contained in:
Andrew Cagney 2005-01-19 16:09:46 +00:00
parent e5604d797e
commit 8a9de0e488
2 changed files with 62 additions and 53 deletions

View File

@ -1,3 +1,9 @@
2005-01-19 Andrew Cagney <cagney@gnu.org>
* infrun.c: (resume, proceed, wait_for_inferior)
(handle_inferior_event, stop_stepping)
(prepare_to_wait): Write debug output to gdb_stdlog.
2005-01-19 Mark Kettenis <kettenis@gnu.org>
* inf-ptrace.c (inf_ptrace_prepare_to_store)

View File

@ -503,7 +503,8 @@ resume (int step, enum target_signal sig)
QUIT;
if (debug_infrun)
printf_unfiltered ("infrun: resume (step=%d, signal=%d)\n", step, sig);
fprintf_unfiltered (gdb_stdlog, "infrun: resume (step=%d, signal=%d)\n",
step, sig);
/* FIXME: calling breakpoint_here_p (read_pc ()) three times! */
@ -721,8 +722,9 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
}
if (debug_infrun)
printf_unfiltered ("infrun: proceed (addr=0x%s, signal=%d, step=%d)\n",
paddr_nz (addr), siggnal, step);
fprintf_unfiltered (gdb_stdlog,
"infrun: proceed (addr=0x%s, signal=%d, step=%d)\n",
paddr_nz (addr), siggnal, step);
/* In a multi-threaded task we may select another thread
and then continue or step.
@ -938,7 +940,7 @@ wait_for_inferior (void)
struct execution_control_state *ecs;
if (debug_infrun)
printf_unfiltered ("infrun: wait_for_inferior\n");
fprintf_unfiltered (gdb_stdlog, "infrun: wait_for_inferior\n");
old_cleanups = make_cleanup (delete_step_resume_breakpoint,
&step_resume_breakpoint);
@ -1224,20 +1226,21 @@ handle_inferior_event (struct execution_control_state *ecs)
{
case infwait_thread_hop_state:
if (debug_infrun)
printf_unfiltered ("infrun: infwait_thread_hop_state\n");
fprintf_unfiltered (gdb_stdlog, "infrun: infwait_thread_hop_state\n");
/* Cancel the waiton_ptid. */
ecs->waiton_ptid = pid_to_ptid (-1);
break;
case infwait_normal_state:
if (debug_infrun)
printf_unfiltered ("infrun: infwait_normal_state\n");
fprintf_unfiltered (gdb_stdlog, "infrun: infwait_normal_state\n");
stepped_after_stopped_by_watchpoint = 0;
break;
case infwait_nonstep_watch_state:
if (debug_infrun)
printf_unfiltered ("infrun: infwait_nonstep_watch_state\n");
fprintf_unfiltered (gdb_stdlog,
"infrun: infwait_nonstep_watch_state\n");
insert_breakpoints ();
/* FIXME-maybe: is this cleaner than setting a flag? Does it
@ -1273,7 +1276,7 @@ handle_inferior_event (struct execution_control_state *ecs)
{
case TARGET_WAITKIND_LOADED:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_LOADED\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_LOADED\n");
/* Ignore gracefully during startup of the inferior, as it
might be the shell which has just loaded some objects,
otherwise add the symbols for the newly loaded objects. */
@ -1319,14 +1322,14 @@ handle_inferior_event (struct execution_control_state *ecs)
case TARGET_WAITKIND_SPURIOUS:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_SPURIOUS\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SPURIOUS\n");
resume (0, TARGET_SIGNAL_0);
prepare_to_wait (ecs);
return;
case TARGET_WAITKIND_EXITED:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_EXITED\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXITED\n");
target_terminal_ours (); /* Must do this before mourn anyway */
print_stop_reason (EXITED, ecs->ws.value.integer);
@ -1344,7 +1347,7 @@ handle_inferior_event (struct execution_control_state *ecs)
case TARGET_WAITKIND_SIGNALLED:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_SIGNALLED\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SIGNALLED\n");
stop_print_frame = 0;
stop_signal = ecs->ws.value.sig;
target_terminal_ours (); /* Must do this before mourn anyway */
@ -1366,7 +1369,7 @@ handle_inferior_event (struct execution_control_state *ecs)
case TARGET_WAITKIND_FORKED:
case TARGET_WAITKIND_VFORKED:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_FORKED\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_FORKED\n");
stop_signal = TARGET_SIGNAL_TRAP;
pending_follow.kind = ecs->ws.kind;
@ -1390,7 +1393,7 @@ handle_inferior_event (struct execution_control_state *ecs)
case TARGET_WAITKIND_EXECD:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_EXECED\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXECED\n");
stop_signal = TARGET_SIGNAL_TRAP;
/* NOTE drow/2002-12-05: This code should be pushed down into the
@ -1444,7 +1447,7 @@ handle_inferior_event (struct execution_control_state *ecs)
that's in a syscall. It's frequently a losing proposition. */
case TARGET_WAITKIND_SYSCALL_ENTRY:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_SYSCALL_ENTRY\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SYSCALL_ENTRY\n");
resume (0, TARGET_SIGNAL_0);
prepare_to_wait (ecs);
return;
@ -1456,14 +1459,14 @@ handle_inferior_event (struct execution_control_state *ecs)
into user code.) */
case TARGET_WAITKIND_SYSCALL_RETURN:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_SYSCALL_RETURN\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SYSCALL_RETURN\n");
target_resume (ecs->ptid, 1, TARGET_SIGNAL_0);
prepare_to_wait (ecs);
return;
case TARGET_WAITKIND_STOPPED:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_STOPPED\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_STOPPED\n");
stop_signal = ecs->ws.value.sig;
break;
@ -1478,7 +1481,7 @@ handle_inferior_event (struct execution_control_state *ecs)
reported multiple times without an intervening resume. */
case TARGET_WAITKIND_IGNORE:
if (debug_infrun)
printf_unfiltered ("infrun: TARGET_WAITKIND_IGNORE\n");
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_IGNORE\n");
prepare_to_wait (ecs);
return;
}
@ -1500,7 +1503,7 @@ handle_inferior_event (struct execution_control_state *ecs)
stop_pc = read_pc_pid (ecs->ptid);
if (debug_infrun)
printf_unfiltered ("infrun: stop_pc = 0x%s\n", paddr_nz (stop_pc));
fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = 0x%s\n", paddr_nz (stop_pc));
if (stepping_past_singlestep_breakpoint)
{
@ -1517,7 +1520,7 @@ handle_inferior_event (struct execution_control_state *ecs)
if (stop_signal == TARGET_SIGNAL_TRAP)
{
if (debug_infrun)
printf_unfiltered ("infrun: stepping_past_singlestep_breakpoint\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepping_past_singlestep_breakpoint\n");
/* Pull the single step breakpoints out of the target. */
SOFTWARE_SINGLE_STEP (0, 0);
singlestep_breakpoints_inserted_p = 0;
@ -1575,7 +1578,7 @@ handle_inferior_event (struct execution_control_state *ecs)
int remove_status;
if (debug_infrun)
printf_unfiltered ("infrun: thread_hop_needed\n");
fprintf_unfiltered (gdb_stdlog, "infrun: thread_hop_needed\n");
/* Saw a breakpoint, but it was hit by the wrong thread.
Just continue. */
@ -1643,7 +1646,7 @@ handle_inferior_event (struct execution_control_state *ecs)
if (!ptid_equal (ecs->ptid, inferior_ptid))
{
if (debug_infrun)
printf_unfiltered ("infrun: context switch\n");
fprintf_unfiltered (gdb_stdlog, "infrun: context switch\n");
context_switch (ecs);
@ -1666,7 +1669,7 @@ handle_inferior_event (struct execution_control_state *ecs)
if (HAVE_STEPPABLE_WATCHPOINT && STOPPED_BY_WATCHPOINT (ecs->ws))
{
if (debug_infrun)
printf_unfiltered ("infrun: STOPPED_BY_WATCHPOINT\n");
fprintf_unfiltered (gdb_stdlog, "infrun: STOPPED_BY_WATCHPOINT\n");
resume (1, 0);
prepare_to_wait (ecs);
return;
@ -1695,7 +1698,7 @@ handle_inferior_event (struct execution_control_state *ecs)
stop in the correct manner. */
if (debug_infrun)
printf_unfiltered ("infrun: STOPPED_BY_WATCHPOINT\n");
fprintf_unfiltered (gdb_stdlog, "infrun: STOPPED_BY_WATCHPOINT\n");
remove_breakpoints ();
registers_changed ();
target_resume (ecs->ptid, 1, TARGET_SIGNAL_0); /* Single step */
@ -1742,7 +1745,7 @@ handle_inferior_event (struct execution_control_state *ecs)
= gdbarch_single_step_through_delay (current_gdbarch,
get_current_frame ());
if (debug_infrun && step_through_delay)
printf_unfiltered ("infrun: step through delay\n");
fprintf_unfiltered (gdb_stdlog, "infrun: step through delay\n");
if (step_range_end == 0 && step_through_delay)
{
/* The user issued a continue when stopped at a breakpoint.
@ -1792,7 +1795,7 @@ handle_inferior_event (struct execution_control_state *ecs)
if (stop_signal == TARGET_SIGNAL_TRAP && stop_after_trap)
{
if (debug_infrun)
printf_unfiltered ("infrun: stopped\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stopped\n");
stop_print_frame = 0;
stop_stepping (ecs);
return;
@ -1803,7 +1806,7 @@ handle_inferior_event (struct execution_control_state *ecs)
if (stop_soon == STOP_QUIETLY)
{
if (debug_infrun)
printf_unfiltered ("infrun: quietly stopped\n");
fprintf_unfiltered (gdb_stdlog, "infrun: quietly stopped\n");
stop_stepping (ecs);
return;
}
@ -1825,7 +1828,7 @@ handle_inferior_event (struct execution_control_state *ecs)
if (stop_signal == TARGET_SIGNAL_TRAP && trap_expected)
{
if (debug_infrun)
printf_unfiltered ("infrun: trap expected\n");
fprintf_unfiltered (gdb_stdlog, "infrun: trap expected\n");
bpstat_clear (&stop_bpstat);
}
else
@ -1889,7 +1892,7 @@ process_event_stop_test:
int printed = 0;
if (debug_infrun)
printf_unfiltered ("infrun: random signal %d\n", stop_signal);
fprintf_unfiltered (gdb_stdlog, "infrun: random signal %d\n", stop_signal);
stopped_by_random_signal = 1;
@ -1971,7 +1974,7 @@ process_event_stop_test:
duration of this command. Then, install a temporary
breakpoint at the target of the jmp_buf. */
if (debug_infrun)
printf_unfiltered ("infrun: BPSTATE_WHAT_SET_LONGJMP_RESUME\n");
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_SET_LONGJMP_RESUME\n");
disable_longjmp_breakpoint ();
remove_breakpoints ();
breakpoints_inserted = 0;
@ -1996,7 +1999,7 @@ process_event_stop_test:
case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME:
case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE:
if (debug_infrun)
printf_unfiltered ("infrun: BPSTATE_WHAT_CLEAR_LONGJMP_RESUME\n");
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_CLEAR_LONGJMP_RESUME\n");
remove_breakpoints ();
breakpoints_inserted = 0;
disable_longjmp_breakpoint ();
@ -2007,7 +2010,7 @@ process_event_stop_test:
case BPSTAT_WHAT_SINGLE:
if (debug_infrun)
printf_unfiltered ("infrun: BPSTATE_WHAT_SINGLE\n");
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_SINGLE\n");
if (breakpoints_inserted)
{
remove_breakpoints ();
@ -2020,7 +2023,7 @@ process_event_stop_test:
case BPSTAT_WHAT_STOP_NOISY:
if (debug_infrun)
printf_unfiltered ("infrun: BPSTATE_WHAT_STOP_NOISY\n");
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_STOP_NOISY\n");
stop_print_frame = 1;
/* We are about to nuke the step_resume_breakpointt via the
@ -2031,7 +2034,7 @@ process_event_stop_test:
case BPSTAT_WHAT_STOP_SILENT:
if (debug_infrun)
printf_unfiltered ("infrun: BPSTATE_WHAT_STOP_SILENT\n");
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_STOP_SILENT\n");
stop_print_frame = 0;
/* We are about to nuke the step_resume_breakpoin via the
@ -2059,7 +2062,7 @@ process_event_stop_test:
the one deleted is the one currently stopped at. MVS */
if (debug_infrun)
printf_unfiltered ("infrun: BPSTATE_WHAT_STEP_RESUME\n");
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_STEP_RESUME\n");
if (step_resume_breakpoint == NULL)
{
@ -2083,7 +2086,7 @@ process_event_stop_test:
case BPSTAT_WHAT_THROUGH_SIGTRAMP:
if (debug_infrun)
printf_unfiltered ("infrun: BPSTATE_WHAT_THROUGH_SIGTRAMP\n");
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_THROUGH_SIGTRAMP\n");
/* If were waiting for a trap, hitting the step_resume_break
doesn't count as getting it. */
if (trap_expected)
@ -2095,7 +2098,7 @@ process_event_stop_test:
#ifdef SOLIB_ADD
{
if (debug_infrun)
printf_unfiltered ("infrun: BPSTATE_WHAT_CHECK_SHLIBS\n");
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_CHECK_SHLIBS\n");
/* Remove breakpoints, we eventually want to step over the
shlib event breakpoint, and SOLIB_ADD might adjust
breakpoint addresses via breakpoint_re_set. */
@ -2209,14 +2212,14 @@ process_event_stop_test:
if (SOLIB_IN_DYNAMIC_LINKER (PIDGET (ecs->ptid), stop_pc))
{
if (debug_infrun)
printf_unfiltered ("infrun: stepping in dynamic linker\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepping in dynamic linker\n");
ecs->another_trap = 1;
keep_going (ecs);
return;
}
#endif
if (debug_infrun)
printf_unfiltered ("infrun: step past dynamic linker\n");
fprintf_unfiltered (gdb_stdlog, "infrun: step past dynamic linker\n");
/* Else, stop and report the catchpoint(s) whose triggering
caused us to begin stepping. */
ecs->stepping_through_solib_after_catch = 0;
@ -2231,7 +2234,7 @@ process_event_stop_test:
if (step_resume_breakpoint)
{
if (debug_infrun)
printf_unfiltered ("infrun: step-resume breakpoint\n");
fprintf_unfiltered (gdb_stdlog, "infrun: step-resume breakpoint\n");
/* Having a step-resume breakpoint overrides anything
else having to do with stepping commands until
@ -2243,7 +2246,7 @@ process_event_stop_test:
if (step_range_end == 0)
{
if (debug_infrun)
printf_unfiltered ("infrun: no stepping, continue\n");
fprintf_unfiltered (gdb_stdlog, "infrun: no stepping, continue\n");
/* Likewise if we aren't even stepping. */
keep_going (ecs);
return;
@ -2257,7 +2260,7 @@ process_event_stop_test:
if (stop_pc >= step_range_start && stop_pc < step_range_end)
{
if (debug_infrun)
printf_unfiltered ("infrun: stepping inside range [0x%s-0x%s]\n",
fprintf_unfiltered (gdb_stdlog, "infrun: stepping inside range [0x%s-0x%s]\n",
paddr_nz (step_range_start),
paddr_nz (step_range_end));
keep_going (ecs);
@ -2277,7 +2280,7 @@ process_event_stop_test:
gdbarch_skip_solib_resolver (current_gdbarch, stop_pc);
if (debug_infrun)
printf_unfiltered ("infrun: stepped into dynsym resolve code\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepped into dynsym resolve code\n");
if (pc_after_resolver)
{
@ -2300,7 +2303,7 @@ process_event_stop_test:
&& get_frame_type (get_current_frame ()) == SIGTRAMP_FRAME)
{
if (debug_infrun)
printf_unfiltered ("infrun: stepped into signal trampoline\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepped into signal trampoline\n");
/* The inferior, while doing a "step" or "next", has ended up in
a signal trampoline (either by a signal being delivered or by
the signal handler returning). Just single-step until the
@ -2316,7 +2319,7 @@ process_event_stop_test:
CORE_ADDR real_stop_pc;
if (debug_infrun)
printf_unfiltered ("infrun: stepped into subroutine\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepped into subroutine\n");
if ((step_over_calls == STEP_OVER_NONE)
|| ((step_range_end == 1)
@ -2409,7 +2412,7 @@ process_event_stop_test:
CORE_ADDR real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc);
if (debug_infrun)
printf_unfiltered ("infrun: stepped into solib return tramp\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepped into solib return tramp\n");
/* Only proceed through if we know where it's going. */
if (real_stop_pc)
@ -2440,7 +2443,7 @@ process_event_stop_test:
&& ecs->stop_func_name == NULL)
{
if (debug_infrun)
printf_unfiltered ("infrun: stepped into undebuggable function\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepped into undebuggable function\n");
/* The inferior just stepped into, or returned to, an
undebuggable function (where there is no symbol, not even a
@ -2473,7 +2476,7 @@ process_event_stop_test:
/* It is stepi or nexti. We always want to stop stepping after
one instruction. */
if (debug_infrun)
printf_unfiltered ("infrun: stepi/nexti\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepi/nexti\n");
stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
stop_stepping (ecs);
@ -2489,7 +2492,7 @@ process_event_stop_test:
when we do "s" in a function with no line numbers,
or can this happen as a result of a return or longjmp?). */
if (debug_infrun)
printf_unfiltered ("infrun: no line number info\n");
fprintf_unfiltered (gdb_stdlog, "infrun: no line number info\n");
stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
stop_stepping (ecs);
@ -2505,7 +2508,7 @@ process_event_stop_test:
That is said to make things like for (;;) statements work
better. */
if (debug_infrun)
printf_unfiltered ("infrun: stepped to a different line\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepped to a different line\n");
stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
stop_stepping (ecs);
@ -2527,7 +2530,7 @@ process_event_stop_test:
in which after skipping the prologue we better stop even though
we will be in mid-line. */
if (debug_infrun)
printf_unfiltered ("infrun: stepped to a different function\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stepped to a different function\n");
stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
stop_stepping (ecs);
@ -2565,7 +2568,7 @@ process_event_stop_test:
}
if (debug_infrun)
printf_unfiltered ("infrun: keep going\n");
fprintf_unfiltered (gdb_stdlog, "infrun: keep going\n");
keep_going (ecs);
}
@ -2703,7 +2706,7 @@ static void
stop_stepping (struct execution_control_state *ecs)
{
if (debug_infrun)
printf_unfiltered ("infrun: stop_stepping\n");
fprintf_unfiltered (gdb_stdlog, "infrun: stop_stepping\n");
/* Let callers know we don't want to wait for the inferior anymore. */
ecs->wait_some_more = 0;
@ -2783,7 +2786,7 @@ static void
prepare_to_wait (struct execution_control_state *ecs)
{
if (debug_infrun)
printf_unfiltered ("infrun: prepare_to_wait\n");
fprintf_unfiltered (gdb_stdlog, "infrun: prepare_to_wait\n");
if (ecs->infwait_state == infwait_normal_state)
{
overlay_cache_invalid = 1;