public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: gdb-patches@sourceware.org
Subject: Re: [COMMITTED PATCH] gdb: LoongArch: Implement the push_dummy_call gdbarch method
Date: Fri, 15 Jul 2022 11:27:46 -0600	[thread overview]
Message-ID: <875yjyp9pp.fsf@tromey.com> (raw)
In-Reply-To: <20220707091536.4884-1-yangtiezhu@loongson.cn> (Tiezhu Yang's message of "Thu, 7 Jul 2022 17:15:36 +0800")

>>>>> 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

  reply	other threads:[~2022-07-15 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  9:15 Tiezhu Yang
2022-07-15 17:27 ` Tom Tromey [this message]
2022-07-16 11:58   ` Tiezhu Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yjyp9pp.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).