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

via lldb-dev lldb-dev at lists.llvm.org
Fri Jan 20 07:52:56 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31706

            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 at lists.llvm.org
          Reporter: alexandru.croitor at qt.io
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17872
  --> https://llvm.org/bugs/attachment.cgi?id=17872&action=edit
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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170120/262e33ad/attachment.html>


More information about the lldb-dev mailing list