This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/4] Fix PR breakpoints/16494: add dprintf-style "agent-call"(testsuite)


This patch is for testsuite.  It add test for "agent-call" to current
test for dprintf.

Thanks,
Hui

2014-03-04  Hui Zhu  <hui@codesourcery.com>

	PR breakpoint/16494
	* gdb.base/dprintf.exp: Add test for "agent-call".
	* gdb.mi/mi-dprintf.exp: Ditto.

--- a/gdb/testsuite/gdb.base/dprintf.exp
+++ b/gdb/testsuite/gdb.base/dprintf.exp
@@ -130,5 +130,38 @@ if $target_can_dprintf {
     }
 }
+# Test agent-call. Because dprintf agent-call use inferior output
+# but not gdbserver.  So it doesn't need check "gdb,noinferiorio".
+set target_can_dprintf_agent_call 1
+set msg "Set dprintf style to agent-call"
+gdb_test_multiple "set dprintf-style agent-call" $msg {
+    -re "warning: Target cannot run dprintf agent call.*\r\n$gdb_prompt $" {
+	set target_can_dprintf_agent_call 0
+	pass "$msg - cannot do"
+    }
+    -re ".*$gdb_prompt $" {
+	pass "$msg - can do"
+    }
+}
+
+if $target_can_dprintf_agent_call {
+    gdb_run_cmd
+
+    gdb_test "" "Breakpoint"
+
+    gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "1st dprintf, agent-call"
+    gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf, agent-call"
+
+    gdb_test_no_output "set dprintf-function fprintf" "Set dprintf function for agent-call"
+    gdb_test_no_output "set dprintf-channel stderr" "Set dprintf channel for agent-call"
+
+    gdb_run_cmd
+
+    gdb_test "" "Breakpoint"
+
+    gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "1st dprintf, agent-call"
+    gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf, agent-call"
+}
+
 gdb_test "set dprintf-style foobar" "Undefined item: \"foobar\"." \
     "Set dprintf style to an unrecognized type"
--- a/gdb/testsuite/gdb.mi/mi-dprintf.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp
@@ -166,4 +166,52 @@ if $target_can_dprintf {
     mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 2nd dprintf, agent"
 }
+# Test agent-call. Because dprintf agent-call use inferior output
+# but not gdbserver.  So it doesn't need check "gdb,noinferiorio".
+set target_can_dprintf_agent_call 0
+set msg "set dprintf style to agent-call"
+send_gdb "set dprintf-style agent-call\n"
+gdb_expect {
+    -re "warning: Target cannot run dprintf agent call, falling back to GDB printf.*$mi_gdb_prompt$" {
+	unsupported "$msg"
+    }
+    -re ".*done.*$mi_gdb_prompt$" {
+	set target_can_dprintf_agent_call 1
+	pass "$msg"
+    }
+    -re ".*$mi_gdb_prompt$" {
+	fail "$msg"
+    }
+    timeout {
+	fail "$msg"
+    }
+}
+
+if $target_can_dprintf_agent_call {
+    mi_run_cmd
+
+    mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "second mi expect stop"
+
+    mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent-call"
+    mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 1st dprintf, agent-call"
+
+    mi_send_resuming_command "exec-continue" "mi 2nd dprintf continue, agent-call"
+
+    # The =breakpoint-modified text is a part of the "-exec-continue" output.
+    set msg "mi info dprintf third time"
+    gdb_expect {
+	-re "=breakpoint-modified," {
+	    pass $msg
+	}
+	-re ".*$mi_gdb_prompt$" {
+	    fail "$msg"
+	}
+	timeout {
+	    fail "$msg"
+	}
+    }
+
+    mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 2nd dprintf, agent-call"
+}
+
 mi_gdb_test "set dprintf-style foobar" ".*error.*" "mi set dprintf style to an unrecognized type"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]