[Lldb-commits] [lldb] 07ed325 - [lldb-dap] Include [opt] in the frame name only if a custom frame format is not specified. (#74861)

via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 11 11:46:29 PST 2023


Author: Walter Erquinigo
Date: 2023-12-11T14:46:25-05:00
New Revision: 07ed3258d0b38bdfd60c203c23a59c8ce8def914

URL: https://github.com/llvm/llvm-project/commit/07ed3258d0b38bdfd60c203c23a59c8ce8def914
DIFF: https://github.com/llvm/llvm-project/commit/07ed3258d0b38bdfd60c203c23a59c8ce8def914.diff

LOG: [lldb-dap] Include [opt] in the frame name only if a custom frame format is not specified. (#74861)

Currently there's an include in which `[opt]` might be emitted twice if
the frame format also asks for it. As a trivial fix, we should manually
emit `[opt]` only if a custom frame format is not specified.

Added: 
    

Modified: 
    lldb/tools/lldb-dap/JSONUtils.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index 3a63046d9a888..62d7fa54e75f1 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -804,9 +804,11 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) {
     llvm::raw_string_ostream os(frame_name);
     os << llvm::format_hex(frame.GetPC(), 18);
   }
-  bool is_optimized = frame.GetFunction().GetIsOptimized();
-  if (is_optimized)
+
+  // We only include `[opt]` if a custom frame format is not specified.
+  if (!g_dap.frame_format && frame.GetFunction().GetIsOptimized())
     frame_name += " [opt]";
+
   EmplaceSafeString(object, "name", frame_name);
 
   auto source = CreateSource(frame);


        


More information about the lldb-commits mailing list