<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - llvm-symbolizer on windows report function name incorrectly"
   href="https://llvm.org/bugs/show_bug.cgi?id=27492">27492</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-symbolizer on windows report function name incorrectly
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows XP
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vitalybuka@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Reproducer is below. I use bash on Windows, so make sure to update paths if
needed.


>From build directory:
1. cmake -G Ninja ../llvm/
2. ninja -j 10 clang asan llvm-symbolizer
3. bin/clang.exe -fsanitize=address -mno-omit-leaf-frame-pointer
-fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only
-gcodeview -fms-compatibility-version=19.00.23918 -std=c++11 -O1 -mllvm
-asan-use-after-scope=1
../llvm/projects/compiler-rt/test/asan/TestCases/use-after-scope-capture.cc -o
use-after-scope-capture.cc.exe
4. ./use-after-scope-capture.cc.exe

You should see crash with:
    #0 0x1231f83 in main()::(anonymous class)::operator()
d:\src\clang.git\llvm\projects\compiler-rt\test\asan\TestCases
\use-after-scope-capture.cc:11
    #1 0x1231f1e in std::_Invoker_functor::_Call C:\Program Files
(x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\type_tra
its:1398
    #2 0x1231eee in std::invoke C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\INCLUDE\type_traits:1466
    #3 0x1231ece in std::_Invoke_ret C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\INCLUDE\type_traits:1491
    #4 0x12318ae in std::_Func_impl<`lambda at
../llvm/projects/compiler-rt/test/asan/TestCases/use-after-scope-capture.
cc:10:9',std::allocator<int>,int>::_Do_call C:\Program Files (x86)\Microsoft
Visual Studio 14.0\VC\INCLUDE\functional:21


Symbolizer was not used yet.

5. cp bin/llvm-symbolizer.exe .
6. ./use-after-scope-capture.cc.exe

Actual result:
Now llvm-symbolizer.exe is visible for asan runtime and it outputs:
    #0 0x221f83 in main
d:\src\clang.git\llvm\projects\compiler-rt\test\asan\TestCases\use-after-scope-capture.cc:11:14
    #1 0x221f1e in main C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\INCLUDE\type_traits:1398:11
    #2 0x221eee in main C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\INCLUDE\type_traits:1466:10
    #3 0x221ece in main C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\INCLUDE\type_traits:1491:10
    #4 0x2218ae in main C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\INCLUDE\functional:212:11

Expected correct result:
Stack with more detailed function names, e.g. #0 0x1231f83 in
main()::(anonymous class)::operator()

Another reproducer:
4. ASAN_OPTIONS=symbolize=0 ./use-after-scope-capture.cc.exe
5. see something like: #0 0x3d1f83 
(d:\src\clang.git\build\use-after-scope-capture.cc.exe+0x401f83)
6. copy address after + (here 0x401f83)
7. run bin/llvm-symbolizer.exe
8. type:
CODE
use-after-scope-capture.cc.exe 0x401f83

Result:
CODE
main
d:\src\clang.git\llvm\projects\compiler-rt\test\asan\TestCases\use-after-scope-capture.cc:11:14

Expected:
CODE
main()::(anonymous class)::operator()
d:\src\clang.git\llvm\projects\compiler-rt\test\asan\TestCases\use-after-scope-capture.cc:11:14</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>