aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>2023-08-25 11:30:02 -0500
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2023-08-25 18:48:24 +0200
commit99dc97091be000ad4d724d677b361e7af7d35db8 (patch)
treef41f9a2b6e7f75613a4c276da35ae9bee6aec4e5 /gdb
parent26fca3f1fe3739939094161e94a80723cab52420 (diff)
downloadgdb-99dc97091be000ad4d724d677b361e7af7d35db8.zip
gdb-99dc97091be000ad4d724d677b361e7af7d35db8.tar.gz
gdb-99dc97091be000ad4d724d677b361e7af7d35db8.tar.bz2
Fix for call feature having 9th function parameter and beyond corrupt values.
In AIX the first eight function parameters are stored from R3 to R10. If there are more than eight parameters in a function then we store the 9th parameter onwards in the stack. While doing so, in 64 bit mode the words were not zero extended and was coming like 32 bit mode. This patch is a fix to the same.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/rs6000-aix-tdep.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 1894f60..c5446db 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -649,7 +649,7 @@ ran_out_of_registers_for_arguments:
if (argbytes)
{
- space += ((len - argbytes + 3) & -4);
+ space += ((len - argbytes + wordsize -1) & -wordsize);
jj = argno + 1;
}
else
@@ -658,7 +658,7 @@ ran_out_of_registers_for_arguments:
for (; jj < nargs; ++jj)
{
struct value *val = args[jj];
- space += ((val->type ()->length ()) + 3) & -4;
+ space += ((val->type ()->length () + wordsize -1) & -wordsize);
}
/* Add location required for the rest of the parameters. */
@@ -679,11 +679,11 @@ ran_out_of_registers_for_arguments:
if (argbytes)
{
- write_memory (sp + 24 + (ii * 4),
+ write_memory (sp + 6 * wordsize + (ii * wordsize),
arg->contents ().data () + argbytes,
len - argbytes);
++argno;
- ii += ((len - argbytes + 3) & -4) / 4;
+ ii += ((len - argbytes + wordsize - 1) & -wordsize) / wordsize;
}
/* Push the rest of the arguments into stack. */
@@ -707,8 +707,20 @@ ran_out_of_registers_for_arguments:
++f_argno;
}
- write_memory (sp + 24 + (ii * 4), arg->contents ().data (), len);
- ii += ((len + 3) & -4) / 4;
+ if (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_ENUM
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_CHAR )
+ {
+ gdb_byte word[PPC_MAX_REGISTER_SIZE];
+ memset (word, 0, PPC_MAX_REGISTER_SIZE);
+ store_unsigned_integer (word, tdep->wordsize, byte_order,
+ unpack_long (type, arg->contents ().data ()));
+ write_memory (sp + 6 * wordsize + (ii * wordsize), word, PPC_MAX_REGISTER_SIZE);
+ }
+ else
+ write_memory (sp + 6 * wordsize + (ii * wordsize), arg->contents ().data (), len);
+ ii += ((len + wordsize -1) & -wordsize) / wordsize;
}
}