[all-commits] [llvm/llvm-project] dc9e6c: Add auto deduce source map setting
jeffreytan81 via All-commits
all-commits at lists.llvm.org
Mon Sep 19 13:42:03 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dc9e6c52f3d805ab454bcf2a4502037d15fb2b8c
https://github.com/llvm/llvm-project/commit/dc9e6c52f3d805ab454bcf2a4502037d15fb2b8c
Author: Jeffrey Tan <jeffreytan at fb.com>
Date: 2022-09-19 (Mon, 19 Sep 2022)
Changed paths:
M lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
M lldb/include/lldb/Target/PathMappingList.h
M lldb/include/lldb/Target/Target.h
M lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
M lldb/source/Target/PathMappingList.cpp
M lldb/source/Target/Target.cpp
M lldb/source/Target/TargetProperties.td
M lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
M lldb/unittests/Target/PathMappingListTest.cpp
Log Message:
-----------
Add auto deduce source map setting
This patch adds a new "target.auto-source-map-relative" setting.
If enabled, this setting may auto deduce a source map entry based on requested
breakpoint path and the original path stored in debug info for resolved
breakpoint.
As an example, if debug info contains "./a/b/c/main.cpp", user sets a source
breakpoint at "/root/repo/x/y/z/a/b/c/main.cpp". The breakpoint will resolve
correctly now with Greg's patch https://reviews.llvm.org/D130401. However, the
resolved breakpoint will use "./a/b/c/main.cpp" to locate source file during
stop event which would fail most of the time.
With the new "target.auto-source-map-relative" setting enabled, a auto deduced
source map entry "." => "/root/repo/x/y/z" will be added. This new mapping will
help lldb to map resolved breakpoint path "./a/b/c/main.cpp" back to
"/root/repo/x/y/z/a/b/c/main.cpp" and locate it on disk.
If an existing source map entry is used the patch also concatenates the auto
deduced entry with any stripped reverse mapping prefix (see example below).
As a second example, debug info contains "./a/b/c/main.cpp" and user sets
breakpoint at "/root/repo/x/y/z/a/b/c/main.cpp". Let's say there is an existing
source map entry "." => "/root/repo"; this mapping would strip the prefix out of
"/root/repo/x/y/z/a/b/c/main.cpp" and use "x/y/z/a/b/c/main.cpp" to resolve
breakpoint. "target.auto-source-map-relative" setting would auto deduce a new
potential mapping of "." => "x/y/z", then it detects that there is a stripped
prefix from reverse mapping and concatenates it as the new mapping:
"." => "/root/repo/x/y/z" which would correct map "./a/b/c/main.cpp" path to
new path in disk.
This patches depends on https://reviews.llvm.org/D130401 to use new added
SBDebugger::GetSetting() API for testing.
Differential Revision: https://reviews.llvm.org/D133042
More information about the All-commits
mailing list