public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] tromey/catch-exit: set $_exitcode when exiting Date: Fri, 02 Aug 2013 17:22:00 -0000 [thread overview] Message-ID: <20130802172254.13451.qmail@sourceware.org> (raw) The branch, tromey/catch-exit has been updated via 921b251ae9c48ae12273bfe3f742d190c0514fc6 (commit) from 385be8429c1bce524f7b2fcb284e92ed396eb472 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 921b251ae9c48ae12273bfe3f742d190c0514fc6 Author: Tom Tromey <tromey@redhat.com> Date: Fri Aug 2 11:19:02 2013 -0600 set $_exitcode when exiting this sets $_exitcode when TARGET_WAITKIND_EXITING is handled note that this will have to be redone when the $_exitcode change goes in ----------------------------------------------------------------------- Summary of changes: gdb/inferior.c | 14 ++++++++++++++ gdb/inferior.h | 3 +++ gdb/infrun.c | 11 ++--------- 3 files changed, 19 insertions(+), 9 deletions(-) First 500 lines of diff: diff --git a/gdb/inferior.c b/gdb/inferior.c index b9e9a8d..eef22ba 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -237,6 +237,20 @@ delete_inferior_silent (int pid) delete_inferior_1 (inf, 1); } +/* Set the inferior's exit code and $_exitcode as well. Note that it + is ok to set it more than once. For example we might see a "catch + exit" event and then a real exit. */ + +void +set_inferior_exit_code (struct inferior *inf, LONGEST code) +{ + /* Record the exit code in the convenience variable $_exitcode, so + that the user can inspect this again later. */ + set_internalvar_integer (lookup_internalvar ("_exitcode"), code); + + inf->has_exit_code = 1; + inf->exit_code = code; +} /* If SILENT then be quiet -- don't announce a inferior exit, or the exit of its threads. */ diff --git a/gdb/inferior.h b/gdb/inferior.h index 2a5770d..e312494 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -526,6 +526,9 @@ DECLARE_REGISTRY (inferior); /* Create an empty inferior list, or empty the existing one. */ extern void init_inferior_list (void); +/* Set inferior's exit code. */ +extern void set_inferior_exit_code (struct inferior *inf, LONGEST code); + /* Add an inferior to the inferior list, print a message that a new inferior is found, and return the pointer to the new inferior. Caller may use this pointer to initialize the private inferior diff --git a/gdb/infrun.c b/gdb/infrun.c index 31bd51f..f72a04b 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3423,15 +3423,7 @@ handle_inferior_event (struct execution_control_state *ecs) if (ecs->ws.kind == TARGET_WAITKIND_EXITED) { - /* Record the exit code in the convenience variable $_exitcode, so - that the user can inspect this again later. */ - set_internalvar_integer (lookup_internalvar ("_exitcode"), - (LONGEST) ecs->ws.value.integer); - - /* Also record this in the inferior itself. */ - current_inferior ()->has_exit_code = 1; - current_inferior ()->exit_code = (LONGEST) ecs->ws.value.integer; - + set_inferior_exit_code (current_inferior (), ecs->ws.value.integer); print_exited_reason (ecs->ws.value.integer); } else @@ -3690,6 +3682,7 @@ handle_inferior_event (struct execution_control_state *ecs) goto process_event_stop_test; case TARGET_WAITKIND_EXITING: + set_inferior_exit_code (current_inferior (), ecs->ws.value.integer); if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXITING\n"); ecs->event_thread->control.stop_bpstat hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2013-08-02 17:22 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20130802172254.13451.qmail@sourceware.org \ --to=tromey@sourceware.org \ --cc=archer-commits@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).