Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: gdb-patches@sourceware.org
Cc: Woody LaRue <larue@cadence.com>,	Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH RESEND] gdb: xtensa: fix register counters for xtensa-linux
Date: Sun, 13 Jan 2019 01:43:00 -0000	[thread overview]
Message-ID: <20190113014248.28071-1-jcmvbkbc@gmail.com> (raw)

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  <jcmvbkbc@gmail.com>

	* 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 1764b953a00b..796143c6699b 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);
 
-- 
2.11.0


             reply	other threads:[~2019-01-13  1:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-13  1:43 Max Filippov [this message]
     [not found] ` <b818ab1d-3f7f-9132-9c1b-b9b3b2a931e4@ericsson.com>
     [not found]   ` <CAMo8BfKWJj8=UBiM90p0x9g00K-qQ-47rr5mmbfpQ4KAD5azjg@mail.gmail.com>
2019-01-13 16:32     ` Simon Marchi
2019-01-13 19:33       ` Max Filippov
2019-01-13 19:43         ` Simon Marchi
2019-01-13 20:08           ` Max Filippov
2019-01-13 21:36           ` Max Filippov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190113014248.28071-1-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=larue@cadence.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox