[v2] Fix mi_expect_stop for non-zero exit codes

Message ID 1400015633-16145-1-git-send-email-simon.marchi@ericsson.com
State Committed
Headers

Commit Message

Simon Marchi May 13, 2014, 9:13 p.m. UTC
  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

Tom Tromey May 15, 2014, 6:39 p.m. UTC | #1
>>>>> "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
  
Simon Marchi May 15, 2014, 7:44 p.m. UTC | #2
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.
  

Patch

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index ad58775..4478ba0 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -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"