aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1995-07-20 02:09:30 +0000
committerStan Shebs <shebs@codesourcery.com>1995-07-20 02:09:30 +0000
commit641c7fdfd78ce3faf8663cc0d3a45baddc1bbf0f (patch)
treee49e54d72414360b350a133f399876d153ce80b8 /gdb/top.c
parent45bc71881e76402423cdfbc9adf02071ad626bbe (diff)
downloadgdb-641c7fdfd78ce3faf8663cc0d3a45baddc1bbf0f.zip
gdb-641c7fdfd78ce3faf8663cc0d3a45baddc1bbf0f.tar.gz
gdb-641c7fdfd78ce3faf8663cc0d3a45baddc1bbf0f.tar.bz2
From Richard Earnshaw (rearnsha@armltd.co.uk):
* infrun.c (wait_for_inferior): Set the convenience variable $_exitcode to the termination code of the inferior. * top.c (quit_command): Accept optional expression to use as parameter to exit().
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 47d9100..0afed966 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2763,6 +2763,17 @@ quit_command (args, from_tty)
char *args;
int from_tty;
{
+ int exit_code = 0;
+
+ /* An optional expression may be used to cause gdb to terminate with the
+ value of that expression. */
+ if (args)
+ {
+ value_ptr val = parse_and_eval (args);
+
+ exit_code = (int) value_as_long (val);
+ }
+
if (inferior_pid != 0 && target_has_execution)
{
if (attach_flag)
@@ -2787,7 +2798,7 @@ quit_command (args, from_tty)
if (write_history_p && history_filename)
write_history (history_filename);
- exit (0);
+ exit (exit_code);
}
/* Returns whether GDB is running on a terminal and whether the user