This is an archive of the discontinued LLVM Phabricator instance.

Add [opt] suffix to optimized stack frame in lldb-vscode
ClosedPublic

Authored by yinghuitan on May 19 2022, 1:23 PM.

Details

Summary

To help user identify optimized code This diff adds a "[opt]" suffix to
optimized stack frames in lldb-vscode. This provides consistent experience
as command line lldb.

It also adds a new "optimized" attribute to DAP stack frame object so that
it is easy to identify from telemetry than parsing trailing "[opt]".

Diff Detail

Event Timeline

yinghuitan created this revision.May 19 2022, 1:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2022, 1:23 PM
yinghuitan requested review of this revision.May 19 2022, 1:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2022, 1:23 PM
clayborg requested changes to this revision.May 19 2022, 2:07 PM
clayborg added inline comments.
lldb/tools/lldb-vscode/JSONUtils.cpp
754–767

No need to test if the function is valid, the SBFunction::IsValid() does this already for us and will return false if it isn't valid.

758

This will crash if the function name is NULL, so we should guard against this.

762

We should probably get the function name with "const char *func_name = frame.GetFunctionName();" before the entire "if (is_optimized)" and use it here, and above

This revision now requires changes to proceed.May 19 2022, 2:07 PM
clayborg added inline comments.May 19 2022, 2:08 PM
lldb/tools/lldb-vscode/JSONUtils.cpp
754–767

I meant to say "the SBFunction::GetIsOptimized()" does this already and will return false if it isn't valid

yinghuitan added inline comments.May 20 2022, 10:22 AM
lldb/tools/lldb-vscode/JSONUtils.cpp
762

Thanks, seems we have this potential crash in existing code already. I will fix it.

Address review comments

clayborg accepted this revision.May 20 2022, 1:58 PM
This revision is now accepted and ready to land.May 20 2022, 1:58 PM