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; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits