[Lldb-commits] [PATCH] D126013: Add [opt] suffix to optimized stack frame in lldb-vscode

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 19 14:07:44 PDT 2022


clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.


================
Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:754-755
   object.try_emplace("id", frame_id);
-  EmplaceSafeString(object, "name", frame.GetFunctionName());
+  bool is_optimized =
+      frame.GetFunction().IsValid() && frame.GetFunction().GetIsOptimized();
+  if (is_optimized) {
----------------
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.


================
Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:758
+    std::string frame_name;
+    frame_name += frame.GetFunctionName();
+    frame_name += " [opt]";
----------------
This will crash if the function name is NULL, so we should guard against this.


================
Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:762
+  } else {
+    EmplaceSafeString(object, "name", frame.GetFunctionName());
+  }
----------------
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


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126013/new/

https://reviews.llvm.org/D126013



More information about the lldb-commits mailing list