[4/8] Test --wrapper when restarting process.

Message ID 1437392126-29503-5-git-send-email-yao.qi@linaro.org
State New, archived
Headers

Commit Message

Yao Qi July 20, 2015, 11:35 a.m. UTC
  My patch series will affect the code starting inferior in GDBserver
(callees of start_inferior), so we need tests to cover how
start_inferior is used in different cases.

In server.c:process_serial_event, start_inferior is used when
GBDserver receives 'R' packet, and this patch is to add a test
for this path, and see how --wrapper option works when the process
is restarted.

gdb/testsuite:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

	* gdb.server/ext-wrapper.exp: Test --wrapper option when
	restarting process.
---
 gdb/testsuite/gdb.server/ext-wrapper.exp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Comments

Pedro Alves July 23, 2015, 10:59 p.m. UTC | #1
On 07/20/2015 12:35 PM, Yao Qi wrote:
> My patch series will affect the code starting inferior in GDBserver
> (callees of start_inferior), so we need tests to cover how
> start_inferior is used in different cases.
> 
> In server.c:process_serial_event, start_inferior is used when
> GBDserver receives 'R' packet, and this patch is to add a test
> for this path, and see how --wrapper option works when the process
> is restarted.
> 

LGTM.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/testsuite/gdb.server/ext-wrapper.exp b/gdb/testsuite/gdb.server/ext-wrapper.exp
index 2ddd3a8..ac5f14a 100644
--- a/gdb/testsuite/gdb.server/ext-wrapper.exp
+++ b/gdb/testsuite/gdb.server/ext-wrapper.exp
@@ -47,6 +47,26 @@  gdb_test "run" "Breakpoint.* marker .*" "run to marker"
 
 gdb_test "print d" "\\$${decimal} = ${hex} \"1\".*"
 
+# Restart the process.
+with_test_prefix "restart" {
+    # Disable vRun packet and clear remote exec-file, so that GDB will
+    # use R packet to restart the process.
+    gdb_test_no_output "set remote run-packet off"
+    gdb_test_no_output "set remote exec-file"
+    set test "run to marker"
+    gdb_test_multiple "run" $test {
+	-re {Start it from the beginning\? \(y or n\) $} {
+	    send_gdb "y\n"
+	    exp_continue
+	}
+	-re "Breakpoint.* marker .*\r\n$gdb_prompt $" {
+	    pass $test
+	}
+    }
+
+    gdb_test "print d" "\\$${decimal} = ${hex} \"1\".*"
+}
+
 gdb_test "kill" "" "kill" "Kill the program being debugged.*" "y"
 
 gdb_test_no_output "monitor exit"