[Lldb-commits] [PATCH] D141633: [lldb-vscode] Use SBFrame.GetDisplayFunctionName() instead of SBFrame.GetFunctionName()
Ivan Hernandez via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 12 14:15:05 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.
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141633.488771.patch
Type: text/x-patch
Size: 819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230112/1c2589f8/attachment.bin>
More information about the lldb-commits
mailing list