[2/2] gdb, remote: Skip sending of 'vCont' package if remote target is empty
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
Commit Message
From: "Rohr, Stephan" <stephan.rohr@intel.com>
If the remote target has no threads that need to be stopped, we can
skip sending the 'vCont' package in 'remote_stop_ns'.
---
gdb/remote.c | 4 ++++
.../interrupt-empty-remote-target.exp | 18 +++++++++++++++++-
gdb/thread-iter.h | 3 +++
3 files changed, 24 insertions(+), 1 deletion(-)
@@ -7884,6 +7884,10 @@ remote_target::remote_stop_ns (ptid_t ptid)
}
}
+ /* Skip 'vCont' package if there are no threads to be stopped. */
+ if (all_non_exited_threads (this, ptid).empty ())
+ return;
+
if (!rs->supports_vCont.t)
error (_("Remote server does not support stopping threads"));
@@ -14,7 +14,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Tests that GDB does not assert if interrupting an empty remote target
-# in non-stop mode.
+# in non-stop mode. Also tests that no 'vCont' package is sent for empty
+# remote targets.
load_lib gdbserver-support.exp
@@ -38,3 +39,18 @@ gdb_test_no_output "set non-stop on"
gdb_test "interrupt" \
"Cannot execute this command without a live selected thread."
+
+gdb_test_no_output "set debug remote on"
+
+# Test that we do not see a 'vCont' package if we interrupt an empty
+# remote target.
+gdb_test_multiple "interrupt -a" "no vCont is sent" {
+ -re -wrap "vCont.*" {
+ fail $gdb_test_name
+ }
+ -re -wrap "" {
+ pass $gdb_test_name
+ }
+}
+
+gdb_test_no_output "set debug remote off"
@@ -248,6 +248,9 @@ class all_non_exited_threads_range
all_non_exited_threads_iterator end () const
{ return all_non_exited_threads_iterator (); }
+ bool empty ()
+ { return begin () == end (); }
+
private:
process_stratum_target *m_filter_target;
ptid_t m_filter_ptid;