[Lldb-commits] [PATCH] D154026: [lldb-vscode] Adjusting CreateSource to detect compiler generated frames.

John Harrison via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 28 17:19:46 PDT 2023


ashgti created this revision.
Herald added a project: All.
ashgti requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154026

Files:
  lldb/tools/lldb-vscode/JSONUtils.cpp


Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===================================================================
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -613,7 +613,9 @@
 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 @@
   }
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154026.535574.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230629/7b95317e/attachment.bin>


More information about the lldb-commits mailing list