diff options
Diffstat (limited to 'gdb/python/py-inferior.c')
-rw-r--r-- | gdb/python/py-inferior.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index 45f5f04..da0a4b6 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -112,18 +112,14 @@ static void python_inferior_exit (struct inferior *inf) { struct cleanup *cleanup; - LONGEST exit_code = -1; - ptid_t ptidp; - struct target_waitstatus status; + const LONGEST *exit_code = NULL; cleanup = ensure_python_env (target_gdbarch, current_language); - get_last_target_status (&ptidp, &status); + if (inf->has_exit_code) + exit_code = &inf->exit_code; - exit_code = status.value.integer; - - if (exit_code >= 0 - && emit_exited_event (exit_code) < 0) + if (emit_exited_event (exit_code) < 0) gdbpy_print_stack (); do_cleanups (cleanup); |