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.
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.
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.
re: multi-inferior: I think $_exitcode would just track the current inferior.