Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Denis Dmitriev <zealot351@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix target architecture address size inside gdbarch structure
Date: Tue, 16 Oct 2018 12:04:00 -0000	[thread overview]
Message-ID: <CAF3nGXdMOH5ynBPRNQ0XxrrFYZz7ujGqCVrp3=h+MSsTByNBUw@mail.gmail.com> (raw)

Hi all,
GDB can't get information about instructions when debugging mips:octeon2
architecture.
The problem is that the gdbarch structure contains the wrong address size
for target architecture (gdbarch->addr_bit, 32).
However, in the same structure there is data settings for the target
architecture (mips:octeon2) which indicate the correct address size
(gdbarch->bfd_arch_info->bits_per_address, 64).
This patch fixes creation gdbarch structure. Now the address size is taken
directly from the settings (gdbarch->bfd_arch_info).

diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index e2abf26..9d130a8 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -542,7 +542,12 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of floatformat_for_type, invalid_p == 0 */
   /* Skip verify of ptr_bit, invalid_p == 0 */
   if (gdbarch->addr_bit == 0)
-    gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch);
+  {
+    if (gdbarch->bfd_arch_info)
+      gdbarch->addr_bit = gdbarch->bfd_arch_info->bits_per_address;
+    else
+      gdbarch->addr_bit = gdbarch_ptr_bit(gdbarch);
+  }
   if (gdbarch->dwarf2_addr_size == 0)
     gdbarch->dwarf2_addr_size = gdbarch_ptr_bit (gdbarch) /
TARGET_CHAR_BIT;
   if (gdbarch->char_signed == -1)

-- 
Sincerely, Denis Dmitriev.


             reply	other threads:[~2018-10-16 12:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 12:04 Denis Dmitriev [this message]
2018-10-16 21:13 ` Simon Marchi
2018-10-17 11:33   ` Denis Dmitriev
2018-10-17 13:02     ` Simon Marchi
2018-10-17 14:35       ` Denis Dmitriev

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='CAF3nGXdMOH5ynBPRNQ0XxrrFYZz7ujGqCVrp3=h+MSsTByNBUw@mail.gmail.com' \
    --to=zealot351@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /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