[Bug 31706] New: SBTarget::FindTypes does not find resolved function pointer types

Bug ID 31706
Summary SBTarget::FindTypes does not find resolved function pointer types
Product lldb
Version unspecified
Hardware Macintosh
OS MacOS X
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter alexandru.croitor@qt.io
CC llvm-bugs@lists.llvm.org
Classification Unclassified

Created attachment 17872 [details]
Example code which shows the issue regarding FindTypes

SBTarget::FindTypes does not find resolved function pointer types, which were
declared as function pointer typedefs.

Consider the code:

typedef struct _type {
  int value;
} MyType;
typedef void (*FunctionPointer)(MyType*);

void function(MyType* t) {
    (void) t;
}

int main(int argc, char* argv[]) {
    MyType t;
    FunctionPointer fp = &function;
    fp(&t);
    return 0;
}

Compile with clang++ -O0 -g ./main.cpp
Run lldb ./a.out and go into python script mode, then:

>>> lldb.target.FindTypes("FunctionPointer").GetSize()
1

>>> lldb.target.FindTypes("void (*)(MyType*)").GetSize()
0

>>> lldb.target.FindTypes("void (*)(MyType *)").GetSize()
0

But if I do:
>>> for t in lldb.target.GetModuleAtIndex(0).GetTypes():
...   print t.GetName()

I get:

FunctionPointer
void (*)(MyType *)
MyType *
MyType
_type
void (MyType *)
main
char **
char *
char
int

which obviously contains "void (*)(MyType *)" which I have searched for
previously.

dwardump-ing the executable dSYM I can see DWARF data for the typedef, but not
for the underlying type of the typedef.

Is this a bug? Should FindTypes find resolved typedefs? Or is this intended
behavior?

(lldb) version
lldb-360.99.0
  clang revision a41b64721d4be78870711cbb7b5af156a9e1f4ad
  llvm revision 3c45ea423a9e3d27eaf77af0639a73e0c56d9a35