[llvm-bugs] [Bug 48432] New: [codeview] Different lambda functions getting the same codeview function ID

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 7 12:03:56 PST 2020


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

            Bug ID: 48432
           Summary: [codeview] Different lambda functions getting the same
                    codeview function ID
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: akhuang at google.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

If there are multiple lambda functions in a file, they sometimes get the same
function id.
In the symbolizer output below, both lambda functions in the stack trace have
the line number 5, even though the second one should be on line 6.

repro:

$ cat t.cpp
template <class F> void uselambda1(int &x, F f) { f(x); }
template <class F> void uselambda2(int &x, F f) { f(x); }

int Test(int n) {
  uselambda1(n, [](int &x) { x /= 10; });
  uselambda2(n, [](int &x) { x *= 2; });
  return n;
}

int main() {
  return Test(100);
}

$ clang -cc1 -triple x86_64-pc-windows-msvc -gcodeview
-debug-info-kind=line-tables-only -O2 -emit-obj -o t.obj t.cpp
$ lld-link -debug -entry:main -pdb:t.pdb t.obj
$ llvm-symbolizer --obj=t.exe --relative-address 0x1001 0x1018
Test(int)::(anonymous class)::operator()
C:\src\tests\sbox-integration\small-repro\t.cpp:5:0
uselambda1
C:\src\tests\sbox-integration\small-repro\t.cpp:1:0
Test(int)??:0:0

Test(int)::(anonymous class)::operator()
C:\src\tests\sbox-integration\small-repro\t.cpp:5:0
uselambda2
C:\src\tests\sbox-integration\small-repro\t.cpp:2:0
Test(int)
??:0:0

A dump of the inline line table shows that there are two functions with the
func id 0x1001.

                       Inlinee Lines
============================================================
Mod 0000 | `C:\src\tests\t.obj`:
 Inlinee |  Line | Source File
  0x1000 |     1 | C:\src\tests\t.cpp (MD5: 4A4CBE958FA977B1C4A844AA292CF8C3)
  0x1001 |     5 | C:\src\tests\t.cpp (MD5: 4A4CBE958FA977B1C4A844AA292CF8C3)
  0x1002 |     2 | C:\src\tests\t.cpp (MD5: 4A4CBE958FA977B1C4A844AA292CF8C3)
  0x1001 |     6 | C:\src\tests\t.cpp (MD5: 4A4CBE958FA977B1C4A844AA292CF8C3)

Mod 0001 | `* Linker *`:


(side note: there should be a line number for `Test(int)` in the symbolizer
output -- this is an unrelated bug in llvm-symbolizer)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201207/8dd13025/attachment.html>


More information about the llvm-bugs mailing list