/* Perform an inferior function call, for GDB, the GNU debugger.
- Copyright (C) 1986-2013 Free Software Foundation, Inc.
+ Copyright (C) 1986-2014 Free Software Foundation, Inc.
This file is part of GDB.
#include "target.h"
#include "regcache.h"
#include "inferior.h"
-#include "gdb_assert.h"
+#include "infrun.h"
#include "block.h"
#include "gdbcore.h"
#include "language.h"
#include "objfiles.h"
#include "gdbcmd.h"
#include "command.h"
-#include "gdb_string.h"
#include "infcall.h"
#include "dummy-frame.h"
#include "ada-lang.h"
#include "gdbthread.h"
#include "exceptions.h"
+#include "event-top.h"
/* If we can't find a function's name from its address,
we print this instead. */
struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (funaddr);
if (msymbol.minsym)
- return SYMBOL_PRINT_NAME (msymbol.minsym);
+ return MSYMBOL_PRINT_NAME (msymbol.minsym);
}
{
volatile struct gdb_exception e;
int saved_in_infcall = call_thread->control.in_infcall;
ptid_t call_thread_ptid = call_thread->ptid;
+ int saved_sync_execution = sync_execution;
+
+ /* Infcalls run synchronously, in the foreground. */
+ if (target_can_async_p ())
+ sync_execution = 1;
call_thread->control.in_infcall = 1;
- clear_proceed_status ();
+ clear_proceed_status (0);
disable_watchpoints_before_interactive_call_start ();
TRY_CATCH (e, RETURN_MASK_ALL)
{
+ int was_sync = sync_execution;
+
proceed (real_pc, GDB_SIGNAL_0, 0);
/* Inferior function calls are always synchronous, even if the
target supports asynchronous execution. Do here what
`proceed' itself does in sync mode. */
- if (target_can_async_p () && is_running (inferior_ptid))
+ if (target_can_async_p ())
{
wait_for_inferior ();
normal_stop ();
+ /* If GDB was previously in sync execution mode, then ensure
+ that it remains so. normal_stop calls
+ async_enable_stdin, so reset it again here. In other
+ cases, stdin will be re-enabled by
+ inferior_event_handler, when an exception is thrown. */
+ if (was_sync)
+ async_disable_stdin ();
}
}
if (call_thread != NULL)
call_thread->control.in_infcall = saved_in_infcall;
+ sync_execution = saved_sync_execution;
+
return e;
}
/* Everything's ready, push all the info needed to restore the
caller (and identify the dummy-frame) onto the dummy-frame
stack. */
- dummy_frame_push (caller_state, &dummy_id);
+ dummy_frame_push (caller_state, &dummy_id, inferior_ptid);
/* Discard both inf_status and caller_state cleanups.
From this point on we explicitly restore the associated state
/* We must get back to the frame we were before the
dummy call. */
- dummy_frame_pop (dummy_id);
+ dummy_frame_pop (dummy_id, call_thread_ptid);
/* We also need to restore inferior status to that before the
dummy call. */
{
/* We must get back to the frame we were before the dummy
call. */
- dummy_frame_pop (dummy_id);
+ dummy_frame_pop (dummy_id, call_thread_ptid);
/* We also need to restore inferior status to that before
the dummy call. */