aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2024-11-13 09:56:00 +0100
committerGitHub <noreply@github.com>2024-11-13 09:56:00 +0100
commit39b2979a434e70a4ce76d4adf91572dcfc9662ff (patch)
treef46f999c984e0bea1e21bb2c1a77ba22573a7944 /lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
parent12dcaa2e1e6c46d8a1b440d8a836d6b81ab92efb (diff)
downloadllvm-39b2979a434e70a4ce76d4adf91572dcfc9662ff.zip
llvm-39b2979a434e70a4ce76d4adf91572dcfc9662ff.tar.gz
llvm-39b2979a434e70a4ce76d4adf91572dcfc9662ff.tar.bz2
[lldb] Fix source display for artificial locations (#115876)
When retrieving the location of the function declaration, we were dropping the file component on the floor, which resulted in an amusingly confusing situation were we displayed the file containing the implementation of the function, but used the line number of the declaration. This patch fixes that. It required a small refactor Function::GetStartLineSourceLineInfo to return a SupportFile (instead of just the file spec), which in turn necessitated changes in a couple of other places as well.
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointResolverFileLine.cpp')
-rw-r--r--lldb/source/Breakpoint/BreakpointResolverFileLine.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index 8e7386d..a94e9e2 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -139,21 +139,23 @@ void BreakpointResolverFileLine::FilterContexts(SymbolContextList &sc_list) {
if (!sc.block)
continue;
- FileSpec file;
+ SupportFileSP file_sp;
uint32_t line;
const Block *inline_block = sc.block->GetContainingInlinedBlock();
if (inline_block) {
const Declaration &inline_declaration = inline_block->GetInlinedFunctionInfo()->GetDeclaration();
if (!inline_declaration.IsValid())
continue;
- file = inline_declaration.GetFile();
+ file_sp = std::make_shared<SupportFile>(inline_declaration.GetFile());
line = inline_declaration.GetLine();
} else if (sc.function)
- sc.function->GetStartLineSourceInfo(file, line);
+ sc.function->GetStartLineSourceInfo(file_sp, line);
else
continue;
- if (file != sc.line_entry.GetFile()) {
+ if (!file_sp ||
+ !file_sp->Equal(*sc.line_entry.file_sp,
+ SupportFile::eEqualFileSpecAndChecksumIfSet)) {
LLDB_LOG(log, "unexpected symbol context file {0}",
sc.line_entry.GetFile());
continue;
@@ -190,7 +192,8 @@ void BreakpointResolverFileLine::FilterContexts(SymbolContextList &sc_list) {
const int decl_line_is_too_late_fudge = 1;
if (line &&
m_location_spec.GetLine() < line - decl_line_is_too_late_fudge) {
- LLDB_LOG(log, "removing symbol context at {0}:{1}", file, line);
+ LLDB_LOG(log, "removing symbol context at {0}:{1}",
+ file_sp->GetSpecOnly(), line);
sc_list.RemoveContextAtIndex(i);
--i;
}