How to find type when same type name is used more than once?

Johan Erlandsson jeoerl@gmail.com
Mon Nov 7 19:17:00 GMT 2016


Hi

I have problem to deterministic find correct type in GDB, since the
same name 'some_type' is used for two different types. The type I am
looking for is only used as parameter and local variable.

I have observed different behavior depending on core file and build.
So when changing (core,build) I can get different result when running:

(gdb) ptype some_type

I can get either of the two types. From 'info types' I always see both.

(gdb) info types some_type
File a.h:
some_type;

File b.cpp:
some_type;


I am aware of this syntax for variables:

(gdb) p 'includefile'::some_global

Now I am looking for something similar but for types.

>From python I tried this function,

gdb.lookup_type (name [, block])

For block I used one of the functions that takes the wanted
'some_type' as a parameter. But this didn't help.

Any ideas how I can find the type that belong to a specific file?

Regards
Johan



More information about the Gdb mailing list