0

There is gdb.lookup_type("SomeType") in GDB python API as listed blow, but I cannot find a way to get the source file and line number where the type is defined, much like what the GDB command info types ^SomeType$ does. Is it possible via GDB python API without invoking into the info types command?

https://sourceware.org/gdb/onlinedocs/gdb/Types-In-Python.html#Types-In-Python

Thomson
  • 20,586
  • 28
  • 90
  • 134
  • 1
    Try `gdb.lookup_static_symbol("SomeType")`, you should get a [gdb.Symbol](https://sourceware.org/gdb/onlinedocs/gdb/Symbols-In-Python.html) of the type, with `symtab` and `line` fields. – ssbssa Dec 17 '22 at 13:31
  • @ssbssa `gdb.lookup_static_symbol("SomeType")` seems working, thanks. – Thomson Dec 17 '22 at 19:11

0 Answers0