Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Sven Schnelle <svens@stackframe.org>
Cc: gdb-patches@sourceware.org,  Helge Deller <deller@gmx.de>,
	 John David Anglin <dave.anglin@bell.net>,
	 binutils@sourceware.org
Subject: Re: [PATCH RESEND] gdb/hppa: guess g packet size
Date: Mon, 03 Nov 2025 14:22:36 -0700	[thread overview]
Message-ID: <87seeuak0z.fsf@tromey.com> (raw)
In-Reply-To: <20251101080538.857188-1-svens@stackframe.org> (Sven Schnelle's message of "Sat, 1 Nov 2025 09:05:38 +0100")

>>>>> "Sven" == Sven Schnelle <svens@stackframe.org> writes:

Sven> With qemu supporting 64 bit now, add some code to determine the
Sven> register size of a hppa remote target.

Thanks for the patch.

Sven> +struct target_desc *hppa_tdesc32;
Sven> +struct target_desc *hppa_tdesc64;

These should be 'static'.  They can also just be objects, not pointers,
I think.

Sven> +  /* Determine from the target description if we are dealing with
Sven> +     a 32 or 64 bits architecture. If the target description is not
Sven> +     available, then check whether bfd_arch_info could be used.
Sven> +     Otherwise default to a 32bit machine.
Sven> +  */
Sven> +  if (info.target_desc != NULL) {
Sven> +    if (tdesc_property (info.target_desc, PROPERTY_GP64) != NULL)
Sven> +      tdep->bytes_per_address = 8;
Sven> +    else if (tdesc_property (info.target_desc, PROPERTY_GP32) != NULL)
Sven> +      tdep->bytes_per_address = 4;
Sven> +  } else if (info.bfd_arch_info != NULL) {

There's a few coding style issues here.  Use 'nullptr' not 'NULL'.
And the braces are in the wrong spots -- see other code in gdb or the
GNU coding standards for where to put them.

Sven> +  } else {
Sven> +     tdep->bytes_per_address = 4;
Sven> +  }

Also single statements like this don't need braces, there were a couple
of instances of this.

Sven> +  hppa_tdesc32 = allocate_target_description ().release ();
Sven> +  set_tdesc_property (hppa_tdesc32, PROPERTY_GP32, "");
Sven> +
Sven> +  hppa_tdesc64 = allocate_target_description ().release ();
Sven> +  set_tdesc_property (hppa_tdesc64, PROPERTY_GP64, "");

The reason I suggested using objects and not pointers is that, although
we do have a number of calls to .release() in gdb, we somewhat try to
avoid them.

thanks,
Tom

  parent reply	other threads:[~2025-11-03 21:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-01  8:05 Sven Schnelle
2025-11-01 13:48 ` Helge Deller
2025-11-03 21:22 ` Tom Tromey [this message]
2025-11-03 21:39   ` Sven Schnelle
2025-11-03 22:59     ` Simon Marchi
2025-11-04  6:31       ` Sven Schnelle

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=87seeuak0z.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=binutils@sourceware.org \
    --cc=dave.anglin@bell.net \
    --cc=deller@gmx.de \
    --cc=gdb-patches@sourceware.org \
    --cc=svens@stackframe.org \
    /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