Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* gdb 7.6: Fix info mem command for 32 bits host/64 bits target
@ 2013-06-26 15:10 Udma Catalin-Dan-B32721
  2013-06-26 16:07 ` Pedro Alves
  0 siblings, 1 reply; 8+ messages in thread
From: Udma Catalin-Dan-B32721 @ 2013-06-26 15:10 UTC (permalink / raw)
  To: gdb-patches

Hi,
I found an issue with the "info mem" command when running gdb on 32 bits host for 64 bits target architecture.
"info mem" command truncates the target address to 32 bits, like in the example below:

    (gdb) set architecture powerpc:common64
    The target architecture is assumed to be powerpc:common64
    (gdb) mem 0x100000000 0x200000000 rw
    (gdb) info mem
    Using user-defined memory regions.
    Num Enb Low Addr           High Addr          Attrs
    1   y   0x0000000000000000 0x0000000000000000 rw nocache

Please find below the proposed patch. Please let me know your comments.

Regards,
Catalin


Subject: [PATCHH] Fix info mem command for 32 bits host/64 bits target

When running gdb on 32 bits host for 64 bits target, info mem command
truncates the target address to 32 bits, like in the example below
	(gdb) set architecture powerpc:common64 
	(gdb) mem 0x100000000 0x200000000 rw
	(gdb) info mem
	1   y  	0x0000000000000000 0x0000000000000000 rw nocache 

Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
---
--- gdb/memattr.c.orig	2013-06-27 17:28:20.000000000 +0300
+++ gdb/memattr.c	2013-06-27 17:29:16.000000000 +0300
@@ -447,9 +447,9 @@
 		       m->number,
 		       m->enabled_p ? 'y' : 'n');
       if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
-	tmp = hex_string_custom ((unsigned long) m->lo, 8);
+	tmp = hex_string_custom ((LONGEST) m->lo, 8);
       else
-	tmp = hex_string_custom ((unsigned long) m->lo, 16);
+	tmp = hex_string_custom ( (LONGEST) m->lo, 16);
       
       printf_filtered ("%s ", tmp);
 
@@ -458,14 +458,14 @@
 	  if (m->hi == 0)
 	    tmp = "0x100000000";
 	  else
-	    tmp = hex_string_custom ((unsigned long) m->hi, 8);
+	    tmp = hex_string_custom ((LONGEST) m->hi, 8);
 	}
       else
 	{
 	  if (m->hi == 0)
 	    tmp = "0x10000000000000000";
 	  else
-	    tmp = hex_string_custom ((unsigned long) m->hi, 16);
+	    tmp = hex_string_custom ((LONGEST) m->hi, 16);
 	}
 
       printf_filtered ("%s ", tmp);



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

end of thread, other threads:[~2013-06-27  8:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26 15:10 gdb 7.6: Fix info mem command for 32 bits host/64 bits target Udma Catalin-Dan-B32721
2013-06-26 16:07 ` Pedro Alves
2013-06-26 16:11   ` Pedro Alves
2013-06-26 16:17     ` Pedro Alves
2013-06-26 17:11     ` Tom Tromey
2013-06-26 16:20   ` Udma Catalin-Dan-B32721
2013-06-27  8:42   ` Udma Catalin-Dan-B32721
2013-06-27  8:44     ` Pedro Alves

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