Re: [PATCH] Fix call functions command bug in 64-bit programs for AIX

Ulrich Weigand via Gdb-patches
2022-11-14T15:54:30Z

>>- what does ARCH64() return?
>True in 64 bit mode and false in 32 bit mode
>> - what does register_size(...) return for those registers?
>8 in 64 bit mode, 4 in 32 bit mode
> (for GPRs with a 64-bit inferior it should return 8, if
> it doesn't that's probably the root cause of the problem)
>> - what value does ptrace return in your case?
>It returns the data parameter value that is passed as the calls are successful.

Did you actually verify any of this information?
I.e. by debugging GDB itself, or by adding debug print
statements to store_register?

I'm asking because if the above is all true, then your patch
to store_register is a complete no-op for this case:

Before your patch, you have:
int addr[PPC_MAX_REGISTER_SIZE];
[...]
memcpy (addr, &buf, 8);
[...]
regcache->raw_supply (regno, (char *) addr);

After your patch, you have:
long long addr64[PPC_MAX_REGISTER_SIZE];
[...]
memcpy (addr64, &buf, 8);
[...]
regcache->raw_supply (regno, (char *) addr64);

which is exactly the same! Note that both the place
that stores into addr[64] and the place that uses it
cast to (char *), so whether you declare the array
as int or long long does not make any difference
whatsoever.

Therefore, I believe that something else must be
going on that is actually causing the problem
you're seeing. You really need to debug the
actual behavior in store_register to understand
what is in fact going on here.

Bye,
Ulrich