From patchwork Tue Nov 20 02:54:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 30213 Received: (qmail 102653 invoked by alias); 20 Nov 2018 02:55: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 102635 invoked by uid 89); 20 Nov 2018 02:55:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*cadence.com, sk:xtensa_ X-HELO: mail-lj1-f196.google.com Received: from mail-lj1-f196.google.com (HELO mail-lj1-f196.google.com) (209.85.208.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Nov 2018 02:55:07 +0000 Received: by mail-lj1-f196.google.com with SMTP id l15-v6so310632lja.9 for ; Mon, 19 Nov 2018 18:55:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=dOcZBupXozXETy/B7IId14t4sgzk09VFBX+etYox45I=; b=CIOX2g8gD9NtY3j+n3JbT+w3Uz6OIXTUgzWhAdabKIC+roU9GN2PVuYK8YsnDwTXQy j4PXD032njF1Jmr1GrWTHe/Kgzau1nCRyuJYOHIPdXHCKxIvvBnyBMs/yo9KdAh1dgU2 mqNX1KrCju0LQq7L3083vv/ShSeiH16uZ2Guw/67KYwxTWKPtRshgAXiXxuNnmYz/Hew oE/21zS6iBCfjfWNrEMPMEloq1uI8XfeIHKifc9UL0q2mhqHopJHRG8By69d36lperP0 7myholxzCksznTUaglQzf1O0o5Bni3qGfafFksgT6ra2bpqCJPv41nvYJIgArwAvM8PM nWgg== Return-Path: Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id p23sm5818871lfh.47.2018.11.19.18.55.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 18:55:03 -0800 (PST) From: Max Filippov To: gdb-patches@sourceware.org Cc: Woody LaRue , Max Filippov Subject: [PATCH] gdb: xtensa: fix register counters for xtensa-linux Date: Mon, 19 Nov 2018 18:54:53 -0800 Message-Id: <20181120025453.8717-1-jcmvbkbc@gmail.com> X-IsSubscribed: yes Commit 37d9e0623102 ("gdb: xtensa: handle privileged registers") changed how the tdep->num_regs and tdep->num_pseudo_regs are calculated, but didn't update these numbers in the gdbarch for the xtensa-linux target. As a result xtensa-linux-gdb behaves as xtensa-elf-gdb and cannot communicate with the linux gdbserver. Fix tdep->num_pseudo_regs calculation and call set_gdbarch_num_regs and set_gdbarch_num_pseudo_regs in xtensa_linux_init_abi. gdb/ 2018-11-16 Max Filippov * xtensa-linux-tdep.c (xtensa_linux_init_abi): Update tdep->num_pseudo_regs. Add calls to set_gdbarch_num_regs and set_gdbarch_num_pseudo_regs. --- gdb/xtensa-linux-tdep.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c index b62085de2fcb..051c3b4c46f1 100644 --- a/gdb/xtensa-linux-tdep.c +++ b/gdb/xtensa-linux-tdep.c @@ -101,7 +101,13 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (tdep->num_nopriv_regs < tdep->num_regs) - tdep->num_regs = tdep->num_nopriv_regs; + { + tdep->num_pseudo_regs += tdep->num_regs - tdep->num_nopriv_regs; + tdep->num_regs = tdep->num_nopriv_regs; + + set_gdbarch_num_regs (gdbarch, tdep->num_regs); + set_gdbarch_num_pseudo_regs (gdbarch, tdep->num_pseudo_regs); + } linux_init_abi (info, gdbarch);