summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-03-22 17:59:59 +0000
committerPedro Alves <palves@redhat.com>2009-03-22 17:59:59 +0000
commitc5a4d20bb945df22e3244f60cff1860932802354 (patch)
treea58a881ecb6f727cdfd7ceea57a9e2efba44f8d3
parent41d2bdb467371e3a18ff8eb69859b1d7cb56a2bd (diff)
downloadppe42-binutils-c5a4d20bb945df22e3244f60cff1860932802354.tar.gz
ppe42-binutils-c5a4d20bb945df22e3244f60cff1860932802354.zip
* 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.
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/gdbthread.h4
-rw-r--r--gdb/infcall.c23
-rw-r--r--gdb/infcmd.c3
-rw-r--r--gdb/inferior.h3
-rw-r--r--gdb/infrun.c6
-rw-r--r--gdb/mi/mi-interp.c11
-rw-r--r--gdb/thread.c6
8 files changed, 50 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 504ed02cf9..12aff52fa1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,21 @@
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
suppress_stop_observer.
* infcmd.c (suppress_stop_observer): Delete.
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 3a405a86ee..5b4bce5766 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -152,6 +152,10 @@ struct thread_info
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. */
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 3a111491cf..16b43208c6 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -330,10 +330,12 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
{
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 ();
@@ -342,17 +344,12 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
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. */
@@ -369,11 +366,13 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
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;
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 0d5dce9b44..fcabd3a423 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -166,9 +166,6 @@ int stopped_by_random_signal;
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;
/* Accessor routines. */
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 4d41402825..969974c3be 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -368,9 +368,6 @@ extern int debug_displaced;
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;
-
/* Possible values for gdbarch_call_dummy_location. */
#define ON_STACK 1
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 8466ed6bb2..dfd6e71ff5 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4451,7 +4451,8 @@ done:
|| 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,
@@ -5008,6 +5009,7 @@ struct inferior_status
int breakpoint_proceeded;
int proceed_to_finish;
+ int in_infcall;
};
/* Save all of the information associated with the inferior<==>gdb
@@ -5038,6 +5040,7 @@ save_inferior_status (void)
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));
@@ -5088,6 +5091,7 @@ restore_inferior_status (struct inferior_status *inf_status)
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)
{
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 131698b348..fb4b4d5374 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -370,6 +370,17 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
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,
diff --git a/gdb/thread.c b/gdb/thread.c
index 9dea7c2fa0..52e442841a 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -509,8 +509,8 @@ set_running (ptid_t ptid, int running)
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
{
@@ -521,7 +521,7 @@ set_running (ptid_t ptid, int running)
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);
}
}
OpenPOWER on IntegriCloud