[v2] Fix mi_expect_stop for non-zero exit codes
Commit Message
This patch was accepted almost a year ago, but I only recently received my
commit access. I submit it again to make sure it is still relevant.
Original submission: https://sourceware.org/ml/gdb-patches/2013-06/msg00736.html
The message displayed by gdb is different when the inferior exits with
zero and non-zero values, this fix takes that into account.
gdb/testsuite/ChangeLog:
2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
* lib/mi-support.exp (mi_expect_stop): Expect message for
inferiors that exit with non-zero exit code.
---
gdb/testsuite/lib/mi-support.exp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Comments
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
Simon> This patch was accepted almost a year ago, but I only recently
Simon> received my commit access. I submit it again to make sure it is
Simon> still relevant.
Simon> Original submission: https://sourceware.org/ml/gdb-patches/2013-06/msg00736.html
Thanks for linking to the original.
Simon> 2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
Simon> * lib/mi-support.exp (mi_expect_stop): Expect message for
Simon> inferiors that exit with non-zero exit code.
Still ok. Thanks!
Tom
On 14-05-15 02:39 PM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>
> Simon> This patch was accepted almost a year ago, but I only recently
> Simon> received my commit access. I submit it again to make sure it is
> Simon> still relevant.
>
> Simon> Original submission: https://sourceware.org/ml/gdb-patches/2013-06/msg00736.html
>
> Thanks for linking to the original.
>
> Simon> 2014-05-13 Simon Marchi <simon.marchi@ericsson.com>
>
> Simon> * lib/mi-support.exp (mi_expect_stop): Expect message for
> Simon> inferiors that exit with non-zero exit code.
>
> Still ok. Thanks!
>
> Tom
>
Pushed, thanks.
@@ -1068,6 +1068,20 @@ 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
+ }
if { $reason == "solib-event" } {
set pattern "\\*stopped,reason=\"solib-event\",thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"