zhyty created this revision.
Herald added a project: All.
zhyty requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
It isn't useful for users to see "<unknown>" as a stack trace when lldb fails
to symbolicate a stack frame. I've replaced "<unknown>" with the value of the
program counter instead.
Test Plan:
To test this, I opened a target that lldb fails to symbolicate in
VSCode, and observed in the CALL STACK section that instead of being
shown as "<unknown>", those stack frames are represented by their
program counters.
I also ran `lldb-dotest -p TestVSCode` and saw that the tests passed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D156732
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
@@ -762,8 +762,14 @@
const char *func_name = frame.GetFunctionName();
if (func_name)
frame_name = func_name;
- else
- frame_name = "<unknown>";
+ else {
+ // If the function name is unavailable, display the pc address as a
16-digit
+ // hex string.
+ frame_name.clear();
+ llvm::raw_string_ostream os(frame_name);
+ os << llvm::format_hex(frame.GetPC(), 18);
+ os.flush();
+ }
bool is_optimized = frame.GetFunction().GetIsOptimized();
if (is_optimized)
frame_name += " [opt]";
Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===================================================================
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -762,8 +762,14 @@
const char *func_name = frame.GetFunctionName();
if (func_name)
frame_name = func_name;
- else
- frame_name = "<unknown>";
+ else {
+ // If the function name is unavailable, display the pc address as a 16-digit
+ // hex string.
+ frame_name.clear();
+ llvm::raw_string_ostream os(frame_name);
+ os << llvm::format_hex(frame.GetPC(), 18);
+ os.flush();
+ }
bool is_optimized = frame.GetFunction().GetIsOptimized();
if (is_optimized)
frame_name += " [opt]";
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits