[Lldb-commits] [PATCH] D141637: [lldb-vscode] Fix an issue where lldb-vscode tries to display a source file for generated code

Ivan Hernandez via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 12 14:36:18 PST 2023


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

According to
https://github.com/llvm/llvm-project/blob/fbcefff9d0a3f5e97270ef8e7b8e0f2afc33dc1c/lldb/source/Symbol/LineEntry.cpp#L215,
a line entry of 0 indicates compiler generated code. Despite it
being generated code, the SBLineEntry.GetFileSpec().IsValid() check
can be true in which case lldb-vscode responds with a non-existent
file named "<compiler-generated>". This patch will instead have
lldb-vscode return the disassembly of the generated code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141637

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,7 @@
 llvm::json::Value CreateSource(lldb::SBFrame &frame, int64_t &disasm_line) {
   disasm_line = 0;
   auto line_entry = frame.GetLineEntry();
-  if (line_entry.GetFileSpec().IsValid())
+  if (line_entry.GetFileSpec().IsValid() && line_entry.GetLine() != 0)
     return CreateSource(line_entry);
 
   llvm::json::Object object;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141637.488777.patch
Type: text/x-patch
Size: 540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230112/a86151e8/attachment.bin>


More information about the lldb-commits mailing list