aboutsummaryrefslogtreecommitdiff
path: root/gdb/inferior.h
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@redhat.com>2013-10-07 05:34:11 +0000
committerSergio Durigan Junior <sergiodj@redhat.com>2013-10-07 05:34:11 +0000
commit0c5571793a8e3dbd0f99b8e4759bd201f5fe75b7 (patch)
tree38bb49888fe6cc02df72c1486b872b397d4ff21e /gdb/inferior.h
parentf872dc3d6e46cf29f9e89392f3c059ce0f6a58b3 (diff)
downloadgdb-0c5571793a8e3dbd0f99b8e4759bd201f5fe75b7.zip
gdb-0c5571793a8e3dbd0f99b8e4759bd201f5fe75b7.tar.gz
gdb-0c5571793a8e3dbd0f99b8e4759bd201f5fe75b7.tar.bz2
This patch adds a new convenience variable called "$_exitsignal", which
will hold the signal number when the inferior terminates due to the uncaught signal. I've made modifications on infrun.c:handle_inferior_event such that $_exitcode gets cleared when the inferior signalled, and vice-versa. This assumption was made because the variables are mutually exclusive, i.e., when the inferior terminates because of an uncaught signal it is not possible for it to return. I have also made modifications such that when a corefile is loaded, $_exitsignal gets set to the uncaught signal that "killed" the inferior, and $_exitcode is cleared. The patch also adds a NEWS entry, documentation bits, and a testcase. The documentation entry explains how to use $_exitsignal and $_exitcode in a GDB script, by making use of the new $_isvoid convenience function. gdb/ 2013-10-06 Sergio Durigan Junior <sergiodj@redhat.com> * NEWS: Mention new convenience variable $_exitsignal. * corelow.c (core_open): Reset exit convenience variables. Set $_exitsignal to the uncaught signal which generated the corefile. * infrun.c (handle_inferior_event): Reset exit convenience variables. Set $_exitsignal for TARGET_WAITKIND_SIGNALLED. (clear_exit_convenience_vars): New function. * inferior.h (clear_exit_convenience_vars): New prototype. gdb/testsuite/ 2013-10-06 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.base/corefile.exp: Test whether $_exitsignal is set and $_exitcode is void when opening a corefile. * gdb.base/exitsignal.exp: New file. * gdb.base/segv.c: Likewise. * gdb.base/normal.c: Likewise. gdb/doc/ 2013-10-06 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.texinfo (Convenience Variables): Document $_exitsignal. Update entry for $_exitcode.
Diffstat (limited to 'gdb/inferior.h')
-rw-r--r--gdb/inferior.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 922a0f2..fff072b 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -224,6 +224,12 @@ extern void follow_inferior_reset_breakpoints (void);
void set_step_info (struct frame_info *frame, struct symtab_and_line sal);
+/* Clear the convenience variables associated with the exit of the
+ inferior. Currently, those variables are $_exitcode and
+ $_exitsignal. */
+
+extern void clear_exit_convenience_vars (void);
+
/* From infcmd.c */
extern void post_create_inferior (struct target_ops *, int);