diff options
author | royitaqi <royitaqi@users.noreply.github.com> | 2024-08-15 11:26:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-15 11:26:24 -0700 |
commit | 47721d46187f89c12a13d07b5857496301cf5d6e (patch) | |
tree | 948ec5d1e574b63e8b71226807874ffefe4a8bd6 /lldb/source/Breakpoint/BreakpointResolverFileLine.cpp | |
parent | 52337d5f9d108f04b2ed06069b21a255c232dc1f (diff) | |
download | llvm-47721d46187f89c12a13d07b5857496301cf5d6e.zip llvm-47721d46187f89c12a13d07b5857496301cf5d6e.tar.gz llvm-47721d46187f89c12a13d07b5857496301cf5d6e.tar.bz2 |
[lldb] Realpath symlinks for breakpoints (#102223)
Improve the chance of resolving file/line breakpoints by realpath'ing the support files before doing a second match attempt, with some conditions applied.
A working [hello-world example](https://github.com/royitaqi/lldb_demos/blob/main/realpath/README.md).
See [patch](https://github.com/llvm/llvm-project/pull/102223) for more info about problem/motivation, details of the feature, new settings, telemetries and tests.
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointResolverFileLine.cpp')
-rw-r--r-- | lldb/source/Breakpoint/BreakpointResolverFileLine.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index 16c4ee1..5087540 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -15,6 +15,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/RealpathPrefixes.h" #include "lldb/Utility/StreamString.h" #include <optional> @@ -290,16 +291,25 @@ Searcher::CallbackReturn BreakpointResolverFileLine::SearchCallback( const uint32_t line = m_location_spec.GetLine().value_or(0); const std::optional<uint16_t> column = m_location_spec.GetColumn(); + Target &target = GetBreakpoint()->GetTarget(); + RealpathPrefixes realpath_prefixes = target.GetSourceRealpathPrefixes(); + const size_t num_comp_units = context.module_sp->GetNumCompileUnits(); for (size_t i = 0; i < num_comp_units; i++) { CompUnitSP cu_sp(context.module_sp->GetCompileUnitAtIndex(i)); if (cu_sp) { if (filter.CompUnitPasses(*cu_sp)) cu_sp->ResolveSymbolContext(m_location_spec, eSymbolContextEverything, - sc_list); + sc_list, &realpath_prefixes); } } + // Gather stats into the Target + target.GetStatistics().IncreaseSourceRealpathAttemptCount( + realpath_prefixes.GetSourceRealpathAttemptCount()); + target.GetStatistics().IncreaseSourceRealpathCompatibleCount( + realpath_prefixes.GetSourceRealpathCompatibleCount()); + FilterContexts(sc_list); DeduceSourceMapping(sc_list); |