Defer source path remap tilde expansion until source file use
authorJason Molenda <jason@molenda.com>
Thu, 26 May 2022 07:30:12 +0000 (00:30 -0700)
committerJason Molenda <jason@molenda.com>
Thu, 26 May 2022 07:30:12 +0000 (00:30 -0700)
commitc274b6e5830ea88d3f55d6dc1d2b99e38cf6595e
tree08e73384993997895f6ab1c35d8f104b481ef947
parent8ee35c5558aa86e3be5f2882f1db030d6281578f
Defer source path remap tilde expansion until source file use

When reading source path remappings out of a dSYM, lldb currently
does tilde expansion -- expanding the tilde-username and checking
that the destination pathname exists, for each dSYM with the path
remappings.  This cost happens during lldb's initial process launch
/ load, an especially perf-sensitive time.  Inside Apple, we have
dSYMs with source path remappings pointing to NFS directories where
these extra stats for every dSYM can be very expensive if the network
is slow.

This patch instead keeps the source path mapping in the original
tilde-username terms and does the tilde expansion when we need
to read a specific source file from one of the modules.  We'll
be stat'ing all of those inodes to load the source file anyway,
so the fact that we do the tilde expansion on every source file
we load, it doesn't cost us significantly.

Differential Revision: https://reviews.llvm.org/D126435
rdar://77091379
lldb/source/Core/SourceManager.cpp
lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp