There seems no way to create a gdb.Type from a string "char[10]". For non-arrays, gdb.lookup_type works: str(gdb.lookup_type('char')) == 'char' but for arrays I get gdb.lookup_type('char[10]') -> RuntimeError: No type named char[10].
Use the 'array' method on the constructed gdb.Type instance: (gdb) py print(gdb.lookup_type('char').array(9)) char [10]
(In reply to comment #1) > Use the 'array' method on the constructed gdb.Type instance: > > (gdb) py print(gdb.lookup_type('char').array(9)) > char [10] Yeah -- but I think what this bug is really about is having a method like "gdb.parse_type" that will parse a type according to the language rules.
Tom is right. It would be nice to have a roundtrip gdb.Type -> str(...) -> gdb.Type giving the original type as close as possible.