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.

This change replaces calls to SBFrame.GetFunctionName() with
SBFrame.GetDisplayFunctionName() which can return much more user
friendly names in some cases, particularly for Swift code.

A trivial example:

main.swift

  class Doer {
      static func doTheThing() {
          print("Hello World!")
      }
  }
  Doer.doTheThing()

lldb

  (lldb) script 
lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().GetDisplayFunctionName()
  'static Doer.doTheThing()'
  (lldb) script 
lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().GetFunctionName()
  'static main.Doer.doTheThing() -> ()'


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141633

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
@@ -650,7 +650,7 @@
   }
   const auto num_insts = insts.GetSize();
   if (low_pc != LLDB_INVALID_ADDRESS && num_insts > 0) {
-    EmplaceSafeString(object, "name", frame.GetFunctionName());
+    EmplaceSafeString(object, "name", frame.GetDisplayFunctionName());
     SourceReference source;
     llvm::raw_string_ostream src_strm(source.content);
     std::string line;
@@ -759,7 +759,7 @@
   object.try_emplace("id", frame_id);
 
   std::string frame_name;
-  const char *func_name = frame.GetFunctionName();
+  const char *func_name = frame.GetDisplayFunctionName();
   if (func_name)
     frame_name = func_name;
   else


Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===================================================================
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -650,7 +650,7 @@
   }
   const auto num_insts = insts.GetSize();
   if (low_pc != LLDB_INVALID_ADDRESS && num_insts > 0) {
-    EmplaceSafeString(object, "name", frame.GetFunctionName());
+    EmplaceSafeString(object, "name", frame.GetDisplayFunctionName());
     SourceReference source;
     llvm::raw_string_ostream src_strm(source.content);
     std::string line;
@@ -759,7 +759,7 @@
   object.try_emplace("id", frame_id);
 
   std::string frame_name;
-  const char *func_name = frame.GetFunctionName();
+  const char *func_name = frame.GetDisplayFunctionName();
   if (func_name)
     frame_name = func_name;
   else
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to