[PATCH] Add gdb.integer_type Python function

Tom Tromey tromey@adacore.com
Mon Oct 25 16:10:18 GMT 2021


>> This adds a new Python function, gdb.integer_type, which can be used
>> to look up an integer type of a given size and signed-ness.  This is
>> useful to avoid dependency on debuginfo when a particular integer type
>> would be useful.

Simon> IIUC, by "avoid dependency on debuginfo", you mean where you would use
Simon> gdb.lookup_type instead?

Yeah.  In our situation, we'd like a pretty-printer to be able to use a
uint32_t.  However, this type doesn't appear in the inferior's debuginfo.

Simon> So, gdb.integer_type depends on the current inferior, because it uses
Simon> its gdbarch.  Since I'd like to see Python methods depend less on "the
Simon> current thing", what about making a method on gdb.Architecture instead?

I had thought the results were arch-independent, but of course they
aren't due to endianness.  I'll make this change for v2.

Tom


More information about the Gdb-patches mailing list