Bug 15949 - $_exitcode not reset on rerun
Summary: $_exitcode not reset on rerun
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-13 00:01 UTC by dje
Modified: 2013-09-16 16:26 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dje 2013-09-13 00:01:42 UTC
If I run a program to main and print $_exitcode I get "void", which is expected.
But if I then continue the program to completion and rerun to main, $_exitcode has the last exit code.  Seems like it should get reset to void on each rerun.
Comment 1 Sergio Durigan Junior 2013-09-13 21:22:06 UTC
Some brain dump here.

It would be good if GDB could provide a way to recover the last exit code of the inferior.  This way, we could safely reset $_exitcode without worrying about losing this information.  My first idea was to create yet another new convenience variable, e.g. "$_last_exitcode", but that may confuse users...

Another thing to (probably) consider is that $_exitcode is about to suffer some major changes in order to support multi-inferior.  It will probably become a lazy convenience variable.  Anyway, just something to consider.
Comment 2 Sergio Durigan Junior 2013-09-13 21:25:41 UTC
Correction: when I said about "a way to recover the last exit code of the inferior", I meant "the last exit code issued by the inferior after we started it again".  Something like what $_exitcode is already doing, but will stop to do after we fix this bug :-P.
Comment 3 dje 2013-09-16 16:26:28 UTC
re: multi-inferior: I think $_exitcode would just track the current inferior.