Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLDB][LLDB-DAP] Wire up DAP to listen to external progress events #123826

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

Jlalond
Copy link
Contributor

@Jlalond Jlalond commented Jan 21, 2025

Recently I added SBProgress (#119052), and during that original commit I tested if the progress event was sent over LLDB-DAP, and it was. However upon the suggestion of @JDevlieghere and @labath we added an external category (#120171), which I did not test.

This small patch wires up DAP to listen for external events by default, and adds the external category to the SBDebugger enumeration.

@Jlalond Jlalond requested a review from clayborg January 21, 2025 21:47
@Jlalond Jlalond requested a review from JDevlieghere as a code owner January 21, 2025 21:47
@llvmbot llvmbot added the lldb label Jan 21, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 21, 2025

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

Changes

Recently I added SBProgress (#119052), and during that original commit I tested if the progress event was sent over LLDB-DAP, and it was. However upon the suggestion of @JDevlieghere and @labath we added an external category (#120171), which I did not test.

This small patch wires up DAP to listen for external events by default, and adds the external category to the SBDebugger enumeration.


Full diff: /~https://github.com/llvm/llvm-project/pull/123826.diff

2 Files Affected:

  • (modified) lldb/include/lldb/API/SBDebugger.h (+2-2)
  • (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+2-1)
diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h
index eb371e33c4951c..7f56bf34c37388 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -46,8 +46,8 @@ class LLDB_API SBDebugger {
       eBroadcastBitProgress = lldb::DebuggerBroadcastBit::eBroadcastBitProgress,
       eBroadcastBitWarning = lldb::DebuggerBroadcastBit::eBroadcastBitWarning,
       eBroadcastBitError = lldb::DebuggerBroadcastBit::eBroadcastBitError,
-      eBroadcastBitProgressCategory =
-          lldb::DebuggerBroadcastBit::eBroadcastBitProgressCategory,
+      eBroadcastBitExternalProgress =
+          lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgress,
   };
   SBDebugger();
 
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 7e8f7b5f6df679..6b12569d90a831 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -414,7 +414,8 @@ void SendStdOutStdErr(DAP &dap, lldb::SBProcess &process) {
 void ProgressEventThreadFunction(DAP &dap) {
   lldb::SBListener listener("lldb-dap.progress.listener");
   dap.debugger.GetBroadcaster().AddListener(
-      listener, lldb::SBDebugger::eBroadcastBitProgress);
+      listener, lldb::SBDebugger::eBroadcastBitProgress |
+                    lldb::SBDebugger::eBroadcastBitExternalProgress);
   dap.broadcaster.AddListener(listener, eBroadcastBitStopProgressThread);
   lldb::SBEvent event;
   bool done = false;

@Jlalond Jlalond requested a review from jeffreytan81 January 21, 2025 21:49
@Jlalond
Copy link
Contributor Author

Jlalond commented Jan 21, 2025

CC @youngdfb

Copy link

github-actions bot commented Jan 21, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@Jlalond Jlalond force-pushed the external-progress-dap branch 2 times, most recently from 1e14270 to ae32d8b Compare January 21, 2025 22:03
Copy link
Contributor

@jeffreytan81 jeffreytan81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General looks good. But please remove the duplication.

Comment on lines 49 to 54
eBroadcastBitExternalProgressCategory =
lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgressCategory,
eBroadcastBitExternalProgress =
lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgress,
eBroadcastBitExternalProgressCategory =
lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgressCategory,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two duplicated eBroadcastBitExternalProgressCategory. Remove one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixed.

@Jlalond Jlalond force-pushed the external-progress-dap branch from ae32d8b to fac56f0 Compare January 21, 2025 22:20
@Jlalond Jlalond merged commit b9813ce into llvm:main Jan 22, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants