From patchwork Wed Dec 6 12:17:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 24756 Received: (qmail 120591 invoked by alias); 6 Dec 2017 12:17:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 120582 invoked by uid 89); 6 Dec 2017 12:17:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Dec 2017 12:17:06 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 113EB3D95E for ; Wed, 6 Dec 2017 12:17:05 +0000 (UTC) Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18A5378404 for ; Wed, 6 Dec 2017 12:17:03 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] remote: Make qXfer packets respect corresponding "set remote foo-packet" Date: Wed, 6 Dec 2017 12:17:03 +0000 Message-Id: <1512562623-27456-1-git-send-email-palves@redhat.com> I've noticed that "set remote target-features-packet off" before connecting has no effect -- GDB still fetches a target description anyway. The problem is that while most "set remote foo-packet" commands were fixed by: From 4082afcc3d1af9d8063d1c8e02deb34a8b97a489 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 25 Apr 2014 18:07:02 +0100 Subject: [PATCH] Fix several "set remote foo-packet on/off" commands. the "qXfer" packets where missed. This commit fixes that. I've changed remote_search_memory too for consistency (seems like those are the last direct references to packet->support), though the difference is not observable because the qSearch:memory packet is auto probed. Note gdb.base/find-unmapped.exp already exercises explicit "set remote search-memory-packet off". gdb/ChangeLog: 2017-12-06 Pedro Alves * remote.c (remote_query_supported): Don't send "xmlRegisters=" if "qXfer:features:read"" is disabled. (remote_write_qxfer, remote_read_qxfer, remote_search_memory): Check packet_config_support instead of packet->support directly. gdb/testsuite/ChangeLog: 2017-12-06 Pedro Alves * gdb.arch/i386-avx.exp: If testing with a RSP target, check force-disabling XML descriptions. --- gdb/remote.c | 16 +++++++++------- gdb/testsuite/gdb.arch/i386-avx.exp | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) --- gdb/ChangeLog | 7 +++++++ gdb/testsuite/ChangeLog | 5 +++++ gdb/remote.c | 16 +++++++++------- gdb/testsuite/gdb.arch/i386-avx.exp | 25 +++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 657f87b..93acc17 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2017-12-06 Pedro Alves + + * remote.c (remote_query_supported): Don't send "xmlRegisters=" if + "qXfer:features:read"" is disabled. + (remote_write_qxfer, remote_read_qxfer, remote_search_memory): + Check packet_config_support instead of packet->support directly. + 2017-12-05 Simon Marchi * target-descriptions.c (struct tdesc_feature) : Use diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 30ab10c..326af54 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-12-06 Pedro Alves + + * gdb.arch/i386-avx.exp: If testing with a RSP target, check + force-disabling XML descriptions. + 2017-12-04 Pedro Alves PR gdb/22499 diff --git a/gdb/remote.c b/gdb/remote.c index be2c65b..306cc1e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -4745,7 +4745,8 @@ remote_query_supported (void) /* Keep this one last to work around a gdbserver <= 7.10 bug in the qSupported:xmlRegisters=i386 handling. */ - if (remote_support_xml != NULL) + if (remote_support_xml != NULL + && packet_support (PACKET_qXfer_features) != PACKET_DISABLE) q = remote_query_supported_append (q, remote_support_xml); q = reconcat (q, "qSupported:", q, (char *) NULL); @@ -10302,7 +10303,7 @@ remote_write_qxfer (struct target_ops *ops, const char *object_name, struct remote_state *rs = get_remote_state (); int max_size = get_memory_write_packet_size (); - if (packet->support == PACKET_DISABLE) + if (packet_config_support (packet) == PACKET_DISABLE) return TARGET_XFER_E_IO; /* Insert header. */ @@ -10344,7 +10345,7 @@ remote_read_qxfer (struct target_ops *ops, const char *object_name, struct remote_state *rs = get_remote_state (); LONGEST i, n, packet_len; - if (packet->support == PACKET_DISABLE) + if (packet_config_support (packet) == PACKET_DISABLE) return TARGET_XFER_E_IO; /* Check whether we've cached an end-of-object packet that matches @@ -10656,9 +10657,10 @@ remote_search_memory (struct target_ops* ops, int found; ULONGEST found_addr; - /* Don't go to the target if we don't have to. - This is done before checking packet->support to avoid the possibility that - a success for this edge case means the facility works in general. */ + /* Don't go to the target if we don't have to. This is done before + checking packet_config_support to avoid the possibility that a + success for this edge case means the facility works in + general. */ if (pattern_len > search_space_len) return 0; if (pattern_len == 0) @@ -10703,7 +10705,7 @@ remote_search_memory (struct target_ops* ops, { /* The request may not have worked because the command is not supported. If so, fall back to the simple way. */ - if (packet->support == PACKET_DISABLE) + if (packet_config_support (packet) == PACKET_DISABLE) { return simple_search_memory (ops, start_addr, search_space_len, pattern, pattern_len, found_addrp); diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp index 012c3ce..ca96c00 100644 --- a/gdb/testsuite/gdb.arch/i386-avx.exp +++ b/gdb/testsuite/gdb.arch/i386-avx.exp @@ -97,3 +97,28 @@ for { set r 0 } { $r < $nr_regs } { incr r } { ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \ "check contents of data\[$r\]" } + +# If testing with a remote protocol target, check that we can +# force-disable the use of XML descriptions. This should make the +# client/server fallback to the pre-XML register file. + +with_test_prefix "force-disable xml descriptions" { + if {[target_info gdb_protocol] == "remote" + || [target_info gdb_protocol] == "extended-remote"} { + + save_vars { GDBFLAGS } { + append GDBFLAGS " -ex \"set remote target-features-packet off\"" + clean_restart ${binfile} + } + + if ![runto_main] then { + fail "run to main" + return + } + + # With qXfer:features:read disabled, we won't know anything + # about YMM registers. + gdb_test "print \$ymm0" " = void" + gdb_test "print \$xmm0" "v4_float.*" + } +}