Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix target architecture address size inside gdbarch structure
@ 2018-10-16 12:04 Denis Dmitriev
  2018-10-16 21:13 ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Dmitriev @ 2018-10-16 12:04 UTC (permalink / raw)
  To: gdb-patches

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-17 14:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16 12:04 [PATCH] Fix target architecture address size inside gdbarch structure Denis Dmitriev
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox