From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23709 invoked by alias); 3 Oct 2017 12:21:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23691 invoked by uid 89); 3 Oct 2017 12:21:17 -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,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=curious, roundtrip 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; Tue, 03 Oct 2017 12:21:15 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CABC8820F8; Tue, 3 Oct 2017 12:21:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CABC8820F8 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27A746017C; Tue, 3 Oct 2017 12:21:12 +0000 (UTC) Subject: Re: [PATCH 3/3] Fix "Remote 'g' packet reply is too long" problems with multiple inferiors To: Yao Qi References: <1506957311-30028-1-git-send-email-palves@redhat.com> <1506957311-30028-4-git-send-email-palves@redhat.com> <867ewc793g.fsf@gmail.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <2370cfd3-d54a-9b86-fde4-0bdd8c10e5b3@redhat.com> Date: Tue, 03 Oct 2017 12:21:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <867ewc793g.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-10/txt/msg00039.txt.bz2 On 10/03/2017 12:40 PM, Yao Qi wrote: > Pedro Alves writes: > >> struct gdbarch * >> default_thread_architecture (struct target_ops *ops, ptid_t ptid) >> { >> - return target_gdbarch (); >> + inferior *inf = find_inferior_ptid (ptid); >> + gdb_assert (inf != NULL); >> + return inf->gdbarch; >> } > > It is right, but forgot to mention that we need to update > spu_thread_architecture too, > > if (parse_spufs_run (ptid, &spufs_fd, &spufs_addr)) > return spu_gdbarch (spufs_fd); > > return target_gdbarch (); > > it looks wrong to call target_gdbarch. We may need to replace > target_gdbarch with default_thread_architecture. I think you're right. The target_gdbarch reference in process_stop_reply looks incorrect as well (last hunk below). I'm current running test with the patch below on top. Kind of curious that I didn't run into this one before. >From 60956bf76cf0b5582f4085f8f36f1ee0bf7f804f Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 2 Oct 2017 18:23:10 +0100 Subject: [PATCH] more target_gdbarch --- gdb/remote.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index b6a81a2..894c3de 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6363,6 +6363,9 @@ typedef struct stop_reply struct target_waitstatus ws; + /* The architecture associated with the expedited registers. */ + gdbarch *arch; + /* Expedited registers. This makes remote debugging a bit more efficient for those targets that provide critical registers as part of their normal status mechanism (as another roundtrip to @@ -6838,7 +6841,6 @@ static void remote_parse_stop_reply (char *buf, struct stop_reply *event) { remote_arch_state *rsa = NULL; - struct gdbarch *reply_arch = NULL; ULONGEST addr; const char *p; int skipregs = 0; @@ -7048,11 +7050,11 @@ Packet: '%s'\n"), continue; } - reply_arch = inf->gdbarch; - rsa = get_remote_arch_state (reply_arch); + event->arch = inf->gdbarch; + rsa = get_remote_arch_state (event->arch); } - struct packet_reg *reg = packet_reg_from_pnum (reply_arch, + struct packet_reg *reg = packet_reg_from_pnum (event->arch, rsa, pnum); cached_reg_t cached_reg; @@ -7063,13 +7065,13 @@ Packet: '%s'\n"), cached_reg.num = reg->regnum; cached_reg.data = (gdb_byte *) - xmalloc (register_size (reply_arch, reg->regnum)); + xmalloc (register_size (event->arch, reg->regnum)); p = p1 + 1; fieldsize = hex2bin (p, cached_reg.data, - register_size (reply_arch, reg->regnum)); + register_size (event->arch, reg->regnum)); p += 2 * fieldsize; - if (fieldsize < register_size (reply_arch, reg->regnum)) + if (fieldsize < register_size (event->arch, reg->regnum)) warning (_("Remote reply is too short: %s"), buf); VEC_safe_push (cached_reg_t, event->regcache, &cached_reg); @@ -7285,7 +7287,7 @@ process_stop_reply (struct stop_reply *stop_reply, if (stop_reply->regcache) { struct regcache *regcache - = get_thread_arch_regcache (ptid, target_gdbarch ()); + = get_thread_arch_regcache (ptid, stop_reply->arch); cached_reg_t *reg; int ix; -- 2.5.5