[PATCH RESEND] gdb/hppa: guess g packet size
Tom Tromey
tom@tromey.com
Mon Nov 3 21:22:36 GMT 2025
>>>>> "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
More information about the Binutils
mailing list