aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcall.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2008-11-12 00:39:28 +0000
committerDoug Evans <dje@google.com>2008-11-12 00:39:28 +0000
commitde04a2489514e54287a18fecbad28efa74eb49f3 (patch)
tree05211ff6511bc18001062574844b217408585397 /gdb/infcall.c
parent6da1d149f338dd8f1d12c1bf275537bb6c8d5136 (diff)
downloadgdb-de04a2489514e54287a18fecbad28efa74eb49f3.zip
gdb-de04a2489514e54287a18fecbad28efa74eb49f3.tar.gz
gdb-de04a2489514e54287a18fecbad28efa74eb49f3.tar.bz2
* infcall.c (call_function_by_hand): Handle inferior exit.
* gdb.base/callexit.exp: New file. * gdb.base/callexit.c: New file.
Diffstat (limited to 'gdb/infcall.c')
-rw-r--r--gdb/infcall.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 5cc068a..aa3bee0 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -699,6 +699,16 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
discard_cleanups (old_cleanups);
}
+ if (! target_has_execution)
+ {
+ /* If we try to restore the inferior status (via the cleanup),
+ we'll crash as the inferior is no longer running. */
+ discard_cleanups (inf_status_cleanup);
+ discard_inferior_status (inf_status);
+ error (_("\
+The program being debugged exited while in a function called from GDB."));
+ }
+
if (stopped_by_random_signal || !stop_stack_dummy)
{
/* Find the name of the function we're about to complain about. */