[PATCH v2 5/8] Generate new gdbarch-components.py from gdbarch.sh
John Baldwin
jhb@FreeBSD.org
Fri Dec 17 19:26:40 GMT 2021
On 12/17/21 10:32 AM, Pedro Alves wrote:
> On 2021-12-16 20:38, Tom Tromey wrote:
>> + params=(("readable_regcache *", "regcache"),),
>
> This gave me pause, until I saw an entry with more than one argument. Do you think it would be possible
> to tweak the generator to avoid putting the comma after the last entry, so that we'd get:
>
> params=(("readable_regcache *", "regcache")),
>
> ?
>
>
> Also, I'd suggest putting params right after type, so that the function's prototype is all together:
>
> I.e., instead of:
>
> Method(
> comment="""
> Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
> Return -1 for bad REGNUM. Note: Several targets get this wrong.
> """,
> name="dwarf2_reg_to_regnum",
> type="int",
> predefault="no_op_reg_to_regnum",
> invalid=False,
> params=(("int", "dwarf2_regnr"),),
> )
>
> This:
>
> Method(
> comment="""
> Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
> Return -1 for bad REGNUM. Note: Several targets get this wrong.
> """,
> name="dwarf2_reg_to_regnum",
> type="int",
> params=(("int", "dwarf2_regnr"),),
> predefault="no_op_reg_to_regnum",
> invalid=False,
> )
>
> The latter seems easier to eyeball to me.
If you moved 'type' up you'd almost have it match what ends up in C:
Method(
comment="""
Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
Return -1 for bad REGNUM. Note: Several targets get this wrong.
""",
type="int",
name="dwarf2_reg_to_regnum",
params=(("int", "dwarf2_regnr"),),
predefault="no_op_reg_to_regnum",
invalid=False,
)
But any order is fine really.
--
John Baldwin
More information about the Gdb-patches
mailing list