aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcall.c
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 /gdb/infcall.c
parent41d2bdb467371e3a18ff8eb69859b1d7cb56a2bd (diff)
downloadgdb-c5a4d20bb945df22e3244f60cff1860932802354.zip
gdb-c5a4d20bb945df22e3244f60cff1860932802354.tar.gz
gdb-c5a4d20bb945df22e3244f60cff1860932802354.tar.bz2
* 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.
Diffstat (limited to 'gdb/infcall.c')
-rw-r--r--gdb/infcall.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 3a11149..16b4320 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;