Skip to content

Commit 0394e08

Browse files
labathJDevlieghere
andauthored
[lldb] Reword the "line 0" warning (#116827)
We got a bug report that this message is confusing. In this particular case, the line zero was due to compiler tail merging (in optimized code). The main issue was the "no source code" part: in this case it's kind of incorrect because -- even though we can't really know that -- the address is arguably associated with *multiple* lines of source code. I've tried to make the new wording more neutral, and added a wink towards compiler optimizations. I left out the "compiler generated" part of the message because I couldn't find a way to squeeze that in nicely. I'm also not entirely sure what it was referring to -- if this was (just) function prologue/epilogue, then maybe leaving it out is fine, as we're not likely to stop there anyway (?) I also left out the function name, because: - for template functions it gets rather long - it's already present in the message, potentially twice (once in the "frame summary" line and once in the snippet of code we show for the function declaration) --------- Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
1 parent d33673a commit 0394e08

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

lldb/source/Target/StackFrame.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,19 +2007,9 @@ bool StackFrame::GetStatus(Stream &strm, bool show_frame_info, bool show_source,
20072007
if (num_lines != 0)
20082008
have_source = true;
20092009
// TODO: Give here a one time warning if source file is missing.
2010-
if (!m_sc.line_entry.line) {
2011-
ConstString fn_name = m_sc.GetFunctionName();
2012-
2013-
if (!fn_name.IsEmpty())
2014-
strm.Printf(
2015-
"Note: this address is compiler-generated code in function "
2016-
"%s that has no source code associated with it.",
2017-
fn_name.AsCString());
2018-
else
2019-
strm.Printf("Note: this address is compiler-generated code that "
2020-
"has no source code associated with it.");
2021-
strm.EOL();
2022-
}
2010+
if (!m_sc.line_entry.line)
2011+
strm << "note: This address is not associated with a specific line "
2012+
"of code. This may be due to compiler optimizations.\n";
20232013
}
20242014
}
20252015
switch (disasm_display) {

lldb/test/API/source-manager/TestSourceManager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ def test_artificial_source_location(self):
336336
"stop reason = breakpoint",
337337
f"{src_file}:0",
338338
"static int foo();",
339-
"Note: this address is compiler-generated code in function",
340-
"that has no source code associated with it.",
339+
"note: This address is not associated with a specific line "
340+
"of code. This may be due to compiler optimizations.",
341341
],
342342
)
343343

0 commit comments

Comments
 (0)