diff options
author | Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com> | 2022-11-17 13:50:35 +0100 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2022-11-17 13:51:37 +0100 |
commit | 7aae1a86b30185224554d450e233ca967359b75d (patch) | |
tree | d97ed0e240e5967ea9d7c91ca60eae7d0fcfd34a | |
parent | 1c01b23603766fbca4ed4dd12fdd710860e6038e (diff) | |
download | gdb-7aae1a86b30185224554d450e233ca967359b75d.zip gdb-7aae1a86b30185224554d450e233ca967359b75d.tar.gz gdb-7aae1a86b30185224554d450e233ca967359b75d.tar.bz2 |
Fix call functions command bug in 64 bits programs for AIX
In AIX for 64 bit programs we need to zero extend variables
of integer or enum or char data type.
Otherwise a zero will get dumped in the register as we memset
our word to 0 and we copy non zero extended contents to the cache.
-rw-r--r-- | gdb/rs6000-aix-tdep.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index d47974b..3efafbd 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -400,7 +400,15 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, gdb_byte word[PPC_MAX_REGISTER_SIZE]; memset (word, 0, reg_size); - memcpy (word, value_contents (arg).data (), len); + if (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_ENUM + || type->code () == TYPE_CODE_BOOL + || type->code () == TYPE_CODE_CHAR) + /* Sign or zero extend the "int" into a "word". */ + store_unsigned_integer (word, reg_size, byte_order, + unpack_long (type, value_contents (arg).data ())); + else + memcpy (word, value_contents (arg).data (), len); regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word); } ++argno; |