* infcall.c (run_inferior_call): Save, set and restore in_infcall.
Remove reverences to suppress_resume_observer. Refresh
`call_thread' after returning from `proceed'.
* infcmd.c (suppress_resume_observer): Delete.
* inferior.h (suppress_resume_observer): Delete declaration.
* mi/mi-interp.c (mi_on_resume): Suppress output while calling an
inferior function.
* thread.c (set_running): Remove references to
suppress_resume_observer.
* infrun.c (struct inferior_status): Add in_infcall member.
(save_inferior_status): Save it.
(restore_inferior_status): Restore it.
+2009-03-22 Pedro Alves <pedro@codesourcery.com>
+
+ * gdbthread.h (struct thread_info): Add in_infcall member.
+ * infcall.c (run_inferior_call): Save, set and restore in_infcall.
+ Remove reverences to suppress_resume_observer. Refresh
+ `call_thread' after returning from `proceed'.
+ * infcmd.c (suppress_resume_observer): Delete.
+ * inferior.h (suppress_resume_observer): Delete declaration.
+ * mi/mi-interp.c (mi_on_resume): Suppress output while calling an
+ inferior function.
+ * thread.c (set_running): Remove references to
+ suppress_resume_observer.
+ * infrun.c (struct inferior_status): Add in_infcall member.
+ (save_inferior_status): Save it.
+ (restore_inferior_status): Restore it.
+
2009-03-22 Pedro Alves <pedro@codesourcery.com>
* infcall.c (run_inferior_call): Remove references to
or a similar situation when stop_registers should be saved. */
int proceed_to_finish;
+ /* Nonzero if the thread is being proceeded for an inferior function
+ call. */
+ int in_infcall;
+
enum step_over_calls_kind step_over_calls;
/* Nonzero if stopped due to a step command. */
{
volatile struct gdb_exception e;
int saved_async = 0;
- int saved_suppress_resume_observer = suppress_resume_observer;
+ int saved_in_infcall = call_thread->in_infcall;
ptid_t call_thread_ptid = call_thread->ptid;
char *saved_target_shortname = xstrdup (target_shortname);
+ call_thread->in_infcall = 1;
+
clear_proceed_status ();
disable_watchpoints_before_interactive_call_start ();
if (target_can_async_p ())
saved_async = target_async_mask (0);
- suppress_resume_observer = 1;
-
TRY_CATCH (e, RETURN_MASK_ALL)
proceed (real_pc, TARGET_SIGNAL_0, 0);
- /* At this point the current thread may have changed.
- CALL_THREAD is no longer usable as its thread may have exited.
- Set it to NULL to prevent its further use. */
- call_thread = NULL;
-
- suppress_resume_observer = saved_suppress_resume_observer;
+ /* At this point the current thread may have changed. Refresh
+ CALL_THREAD as it could be invalid if its thread has exited. */
+ call_thread = find_thread_pid (call_thread_ptid);
/* Don't restore the async mask if the target has changed,
saved_async is for the original target. */
of error out of resume()), then we wouldn't need this. */
if (e.reason < 0)
{
- struct thread_info *tp = find_thread_pid (call_thread_ptid);
- if (tp != NULL)
- breakpoint_auto_delete (tp->stop_bpstat);
+ if (call_thread != NULL)
+ breakpoint_auto_delete (call_thread->stop_bpstat);
}
+ if (call_thread != NULL)
+ call_thread->in_infcall = saved_in_infcall;
+
xfree (saved_target_shortname);
return e;
in format described in environ.h. */
struct gdb_environ *inferior_environ;
-
-/* When set, no calls to target_resumed observer will be made. */
-int suppress_resume_observer = 0;
\f
/* Accessor routines. */
void displaced_step_dump_bytes (struct ui_file *file,
const gdb_byte *buf, size_t len);
-/* When set, no calls to target_resumed observer will be made. */
-extern int suppress_resume_observer;
-
\f
/* Possible values for gdbarch_call_dummy_location. */
#define ON_STACK 1
|| last.kind == TARGET_WAITKIND_EXITED
|| (!inferior_thread ()->step_multi
&& !(inferior_thread ()->stop_bpstat
- && inferior_thread ()->proceed_to_finish)))
+ && inferior_thread ()->proceed_to_finish)
+ && !inferior_thread ()->in_infcall))
{
if (!ptid_equal (inferior_ptid, null_ptid))
observer_notify_normal_stop (inferior_thread ()->stop_bpstat,
int breakpoint_proceeded;
int proceed_to_finish;
+ int in_infcall;
};
/* Save all of the information associated with the inferior<==>gdb
tp->stop_bpstat = bpstat_copy (tp->stop_bpstat);
inf_status->breakpoint_proceeded = breakpoint_proceeded;
inf_status->proceed_to_finish = tp->proceed_to_finish;
+ inf_status->in_infcall = tp->in_infcall;
inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL));
inf_status->stop_bpstat = NULL;
breakpoint_proceeded = inf_status->breakpoint_proceeded;
tp->proceed_to_finish = inf_status->proceed_to_finish;
+ tp->in_infcall = inf_status->in_infcall;
if (target_has_stack)
{
static void
mi_on_resume (ptid_t ptid)
{
+ struct thread_info *tp = NULL;
+
+ if (ptid_equal (ptid, minus_one_ptid))
+ tp = inferior_thread ();
+ else
+ tp = find_thread_pid (ptid);
+
+ /* Suppress output while calling an inferior function. */
+ if (tp->in_infcall)
+ return;
+
/* To cater for older frontends, emit ^running, but do it only once
per each command. We do it here, since at this point we know
that the target was successfully resumed, and in non-async mode,
any_started = 1;
tp->state_ = running ? THREAD_RUNNING : THREAD_STOPPED;
}
- if (any_started && !suppress_resume_observer)
- observer_notify_target_resumed (ptid);
+ if (any_started)
+ observer_notify_target_resumed (ptid);
}
else
{
if (running && tp->state_ == THREAD_STOPPED)
started = 1;
tp->state_ = running ? THREAD_RUNNING : THREAD_STOPPED;
- if (started && !suppress_resume_observer)
+ if (started)
observer_notify_target_resumed (ptid);
}
}