Previous: gdb.printing, Up: Python modules


23.2.4.2 gdb.types

This module provides a collection of utilities for working with gdb.Types objects.

get_basic_type (type)
Return type with const and volatile qualifiers stripped, and with typedefs and C++ references converted to the underlying type.

C++ example:

          typedef const int const_int;
          const_int foo (3);
          const_int& foo_ref (foo);
          int main () { return 0; }

Then in gdb:

          (gdb) start
          (gdb) python import gdb.types
          (gdb) python foo_ref = gdb.parse_and_eval("foo_ref")
          (gdb) python print gdb.types.get_basic_type(foo_ref.type)
          int

has_field (type, field)
Return True if type, assumed to be a type with fields (e.g., a structure or union), has field field.
make_enum_dict (enum_type)
Return a Python dictionary type produced from enum_type.