[PATCH] Fix mi_expect_stop for non-zero exit codes

Simon Marchi
2013-06-25T19:10:01Z

The message is a different when the inferior exits with zero
and non-zero values, this fix takes that into account.

I split the following patch in two distinct patches:
http://sourceware.org/ml/gdb-patches/2013-06/msg00374.html

gdb/testsuite/ChangeLog:
2013-06-25 Simon Marchi <simon.marchi@ericsson.com>

* lib/mi-support.exp (mi_expect_stop): Expect message for
inferiors that exit with non-zero exit code. Also, remove useless
whitespace just above.
---
gdb/testsuite/lib/mi-support.exp | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/mi-support.exp
b/gdb/testsuite/lib/mi-support.exp
index 86a0fd6..b3a9de7 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1040,7 +1040,7 @@ proc mi_expect_stop { reason func args file line
extra test } {
}
return
}
-
+
if { $reason == "exited-normally" } {

gdb_expect {
@@ -1055,6 +1055,21 @@ proc mi_expect_stop { reason func args file line
extra test } {
return
}

+ if { $reason == "exited" } {
+ gdb_expect {
+ -re
"\\*stopped,reason=\"exited\",exit-code=\"\[0-7\]+\"\r\n$prompt_re" {
+ pass "$test"
+ }
+ -re ".*$mi_gdb_prompt$" {
+ fail "$test (inferior not stopped)"
+ }
+ timeout {
+ fail "$test (unknown output after running)"
+ }
+ }
+ return
+ }
+
set args "\\\[$args\\\]"

set bn ""