[Lldb-commits] [lldb] b9b0ab3 - [lldb-vscode] Adjusting CreateSource to detect compiler generated frames.
David Goldman via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 29 12:31:44 PDT 2023
Author: John Harrison
Date: 2023-06-29T15:31:08-04:00
New Revision: b9b0ab32f9d0a40ee225b2dc71bdf2f66b7127e8
URL: https://github.com/llvm/llvm-project/commit/b9b0ab32f9d0a40ee225b2dc71bdf2f66b7127e8
DIFF: https://github.com/llvm/llvm-project/commit/b9b0ab32f9d0a40ee225b2dc71bdf2f66b7127e8.diff
LOG: [lldb-vscode] Adjusting CreateSource to detect compiler generated frames.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D154026
Added:
Modified:
lldb/tools/lldb-vscode/JSONUtils.cpp
Removed:
################################################################################
diff --git a/lldb/tools/lldb-vscode/JSONUtils.cpp b/lldb/tools/lldb-vscode/JSONUtils.cpp
index bf7f766a58e3d..2c54f1a4e271b 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.cpp
+++ b/lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -613,7 +613,9 @@ llvm::json::Value CreateSource(llvm::StringRef source_path) {
llvm::json::Value CreateSource(lldb::SBFrame &frame, int64_t &disasm_line) {
disasm_line = 0;
auto line_entry = frame.GetLineEntry();
- if (line_entry.GetFileSpec().IsValid())
+ // A line entry of 0 indicates the line is compiler generated i.e. no source
+ // file so don't return early with the line entry.
+ if (line_entry.GetFileSpec().IsValid() && line_entry.GetLine() != 0)
return CreateSource(line_entry);
llvm::json::Object object;
@@ -650,7 +652,11 @@ llvm::json::Value CreateSource(lldb::SBFrame &frame, int64_t &disasm_line) {
}
const auto num_insts = insts.GetSize();
if (low_pc != LLDB_INVALID_ADDRESS && num_insts > 0) {
- EmplaceSafeString(object, "name", frame.GetFunctionName());
+ if (line_entry.GetLine() == 0) {
+ EmplaceSafeString(object, "name", "<compiler-generated>");
+ } else {
+ EmplaceSafeString(object, "name", frame.GetDisplayFunctionName());
+ }
SourceReference source;
llvm::raw_string_ostream src_strm(source.content);
std::string line;
More information about the lldb-commits
mailing list