[Lldb-commits] Support of MSVC function-level linking

Aleksandr Urakov via lldb-commits lldb-commits at lists.llvm.org
Wed May 30 02:35:38 PDT 2018


Hello!

I'm Aleksandr from JetBrains. We are working on improving support of
MSVC-compiled binaries in lldb. We have made several fixes and would like
to upstream them.

The first patch adds support of function-level linking feature. The
SymbolFilePDB::ParseCompileUnitLineTable function relies on the fact that
ranges of compiled source files in the binary are continuous and don't
intersect with each other. ParseCompileUnitLineTable creates LineSequence
for each file and inserts it into LineTable, and the implementation of
LineTable relies on continuity of the sequence. But it's not always true
when function-level linking is enabled, e.g. in the attached input test
file test-pdb-function-level-linking.exe there is xstring's
std__basic_string_char_std__char_traits_char__std__allocator_char_____max_size
(.00454820) between test-pdb-function-level-linking.cpp's foo (.00454770)
and main (.004548F0). The source is compiled with Microsoft C/C++ compiler
version 19.14.26429.4 for x86.

To fix the problem we propose to renew the sequence on each address gap.
The patch and related files are attached.

Thanks!

-- 
Aleksandr Urakov
Software Developer
JetBrains
http://www.jetbrains.com
The Drive to Develop
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180530/69bf079a/attachment-0001.html>
-------------- next part --------------
// Compile with "cl /c /ZI /sdl /EHsc /MTd /permissive-
// test-pdb-function-level-linking.cpp"
// Link with "link /debug:full test-pdb-function-level-linking.obj"

#include <memory>
#include <string>

std::string foo()
{
    return "Hello!";
}

int main()
{
    auto x = foo();
    return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 3456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180530/69bf079a/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-pdb-function-level-linking.ex#
Type: application/octet-stream
Size: 833024 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180530/69bf079a/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-pdb-function-level-linking.pdb
Type: application/octet-stream
Size: 6868992 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180530/69bf079a/attachment-0005.obj>


More information about the lldb-commits mailing list