https://github.com/walter-erquinigo created 
https://github.com/llvm/llvm-project/pull/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.


>From 349cd0694eccdaa4e403cfc6ba9389ed61b1d232 Mon Sep 17 00:00:00 2001
From: walter erquinigo <wal...@modular.com>
Date: Wed, 29 Nov 2023 13:46:54 -0500
Subject: [PATCH] [lldb-dap] Include [opt] in the frame name only if a custom
 frame format is not specified.

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.
---
 lldb/tools/lldb-dap/JSONUtils.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp 
b/lldb/tools/lldb-dap/JSONUtils.cpp
index 03a43f9da87f24..e55a69ecd0e9f2 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -803,9 +803,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);

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to