Re: [PATCHv8 3/3] gdb/python: extend gdb.write to support styled output

Tom Tromey
2025-09-23T18:38:38Z

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

>> FWIW if the type object is available there's a way to get Python to do
>> this bit when parsing the arguments.

Andrew> I think you're referring too 'O!' maybe? The reason that doesn't work
Andrew> is that the argument can be a gdb.Style _or_ None.

Andrew> It feels like this must be a common pattern, so I would have expected to
Andrew> find a modifier that takes a named type or accepts None, but I couldn't
Andrew> find anything.

Andrew> Is there another trick that I'm not aware of? Would love to know
Andrew> because I'm pretty sure I've had to do this elsewhere in GDB when an
Andrew> argument can also be None.

No, I think you're right, I missed the None bit. Sorry about that.

Tom