[source maps] fix source mapping when there are multiple matching rules
authorWalter Erquinigo <wallace@fb.com>
Fri, 23 Jul 2021 23:21:05 +0000 (16:21 -0700)
committerWalter Erquinigo <wallace@fb.com>
Sat, 24 Jul 2021 00:53:12 +0000 (17:53 -0700)
commitef8c6849a235e97b8b981e0f998d430fdbd7bc2a
tree507b097d2e8aa50f3fc958dc6af368f815d18012
parente9d4bb43f8432c58d87ff6c725f4b92db084d650
[source maps] fix source mapping when there are multiple matching rules

D104406 introduced an error in which, if there are multiple matchings rules for a given path, lldb was only checking for the validity in the filesystem of the first match instead of looking exhaustively one by one until a valid file is found.

Besides that, a call to consume_front was being done incorrectly, as it was modifying the input, which renders subsequent matches incorrect.

I added a test that checks for both cases.

Differential Revision: https://reviews.llvm.org/D106723
lldb/include/lldb/Target/PathMappingList.h
lldb/source/Target/PathMappingList.cpp
lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py