Debugging with GDB: Guile Types Module

Previous: Guile Printing Module, Up: Guile Modules [Contents][Index]

#### 23.4.5.2 Guile Types Module

This module provides a collection of utilities for working with `<gdb:type>` objects.

Usage:

    (use-modules (gdb types))

Scheme Procedure: 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) guile (use-modules (gdb) (gdb types))
      (gdb) guile (define foo-ref (parse-and-eval "foo_ref"))
      (gdb) guile (get-basic-type (value-type foo-ref))
      int

Scheme Procedure: type-has-field-deep? type field

  Return `#t` if type, assumed to be a type with fields (e.g., a structure or union), has field field. Otherwise return `#f`. This searches baseclasses, whereas `type-has-field?` does not.

Scheme Procedure: make-enum-hashtable enum-type

  Return a Guile hash table produced from enum-type. Elements in the hash table are referenced with `hashq-ref`.