This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix target architecture address size inside gdbarch structure


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]