This is an archive of the discontinued LLVM Phabricator instance.

[WIP][LLDB] Parse the DW_AT_LLVM_lambda_name
AbandonedPublic

Authored by djtodoro on Apr 9 2020, 7:07 AM.

Details

Summary

See D77799.

$ cat basic.cpp
#include <iostream>
int main()
{
 auto printNum = [](int num) {
   std::cout << num << '\n';
 };
 for (int i = 0; i < 5; ++i)
   printNum(i);
 return 0;
}

After applying the set of patches and using the LLDB, debugging session on the test case looks:

$ clang++ -glldb -O2 basic.cpp
$ lldb a.out
..
(lldb) bt
* thread #1, name = ‘a.out’, stop reason = breakpoint 1.1
* frame #0: 0x0000000000401195 a.out `main [inlined] [lambda] printNum(this=<unavailable>, num=0) at basic.cpp:6:15 [opt]  //<== by adding this feature, I was able to add the [lambda] attribute and the name of lambda ‘printNum’//
frame #1: 0x0000000000401190 a.out `main at basic.cpp:10 [opt]
frame #2: 0x00007ffff7a961e3 libc.so.6`__libc_start_main + 243
frame #3: 0x00000000004010ce a.out _start + 46

Diff Detail