[COMMITTED PATCH] gdb: LoongArch: Implement the push_dummy_call gdbarch method

Tom Tromey tom@tromey.com
Fri Jul 15 17:27:46 GMT 2022


>>>>> Tiezhu Yang <yangtiezhu@loongson.cn> writes:

> +static void
> +pass_in_gar (struct regcache *regcache, unsigned int gar, const gdb_byte *val)

In gdb, functions generally should have an introductory comment
explaining their purpose.

> +static __attribute__((aligned(16))) gdb_byte buf[1024] = { 0 };
> +static gdb_byte *addr = buf;

I don't understand why a global is needed here, or why the attribute is
needed.  But anyway, the attribute isn't really portable, and since this
is tdep code (not specific to some host where you could maybe get away
with assuming the compiler), it can't be used.

> +static unsigned int fixed_point_members = 0;
> +static unsigned int floating_point_members = 0;
> +static bool first_member_is_fixed_point = false;

Please don't use globals for this kind of thing.
You can make a new object or you can pass pointers to locals.

> +	    /* integer or pointer type is passed in GAR.
> +	     * If no GAR is available, it€s passed on the stack.
> +	     * When passed in registers or on the stack,
> +	     * the unsigned integer scalars are zero-extended to GRLEN bits,
> +	     * and the signed integer scalars are sign-extended.  */

In the gdb style, subsequent comment lines don't have the "*".

thanks,
Tom


More information about the Gdb-patches mailing list