9 Aug 2012 20:18
Memory corruption for host double format different from target double format
Thomas Schwinge <thomas <at> codesourcery.com>
2012-08-09 18:18:27 GMT
2012-08-09 18:18:27 GMT
Hi!
Thanks to the recent memory checking instrastructure (well, it's been
some weeks already...), a memory corruption issue has been uncovered for
configurations where the host double format is not equal to target double
format. I have seen this for SH, but don't believe it really is specific
to SH, it's just that the very most of all GDB targets have host double
format match the target double format.
As I'm not sufficiently experienced with GDB's expressions and type
system, I'd like some help here.
$ install/bin/*-gdb -q -ex 'file [...]/gdb.cp/misc' -ex 'show architecture' -ex 'print (bool)17.93'
Reading symbols from [...]/gdb.cp/misc...done.
The target architecture is set automatically (currently sh2a-or-sh3e)
$1 = true
memory clobbered past end of allocated block
Aborted
sh2a-or-sh3e configures for a 32-bit double format, as opposed to the
"normal" 64-bit double format (which also is the x86_64 host's double
format).
sh-tdep.c:sh_gdbarch_init:
case bfd_mach_sh2a_or_sh3e:
/* doubles on sh2e and sh3e are actually 4 byte. */
set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
First and foremost -- is my understanding correct that given this
(Continue reading)
Looks like some checking like this is missing?
gdbarch->float_format->totalsize <= gdbarch->float_bit
gdbarch->double_format->totalsize <= gdbarch->double_bit
RSS Feed