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

Ulrich Weigand via Gdb-patches
2022-11-16T15:15:29Z

>In AIX for 64-bit programs, we need to zero extend variables of integer data type.

This looks much more reasonable, thanks!

Just a couple of remaining questions:

> memset (word, 0, reg_size);
>- memcpy (word, value_contents (arg).data (), len);
>+ if (type->code () == TYPE_CODE_INT)
>+ /* Sign or zero extend the "int" into a "word". */
>+ store_unsigned_integer (word, tdep->wordsize, 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);

Is it correct to handle *only* TYPE_CODE_INT here?

The corresponding code in the Linux ABI code has:
else if ((type->code () == TYPE_CODE_INT
|| type->code () == TYPE_CODE_ENUM
|| type->code () == TYPE_CODE_BOOL
|| type->code () == TYPE_CODE_CHAR
|| type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type))

It might not really be necessary to handle pointer and reference
types if those are always guaranteed to be word sized. But I
think enum, bool, and char types should be handled.

Also, it would probably be preferable to use reg_size instead
of tdep->wordsize to be consistent.

Finally, there are still white space issues (use tabs instead
of 8 spaces, if there's just a single statement inside an if
it is indented only 2 spaces, not 4).

Bye,
Ulrich