Skip to content

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

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

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
Jlalond added a commit that referenced this pull request Jan 22, 2025
When testing my SBProgress DAP PR (#123826), I noticed Progress update
messages aren't sent over DAP. This patch adds the lldb progress event's
message to the body when sent over DAP.

Before 

![image](https://github.com/user-attachments/assets/404adaa8-b784-4f23-895f-cd3625fdafad)


Now

![image](https://github.com/user-attachments/assets/eb1c3235-0936-4e36-96e5-0a0ee60dabb8)

Tested with my [progress tester
command](https://gist.github.com/Jlalond/48d85e75a91f7a137e3142e6a13d0947),
testing 10 events 5 seconds apart 1-10
JDevlieghere pushed a commit to swiftlang/llvm-project that referenced this pull request Jan 27, 2025
When testing my SBProgress DAP PR (llvm#123826), I noticed Progress update
messages aren't sent over DAP. This patch adds the lldb progress event's
message to the body when sent over DAP.

Before

![image](https://github.com/user-attachments/assets/404adaa8-b784-4f23-895f-cd3625fdafad)

Now

![image](https://github.com/user-attachments/assets/eb1c3235-0936-4e36-96e5-0a0ee60dabb8)

Tested with my [progress tester
command](https://gist.github.com/Jlalond/48d85e75a91f7a137e3142e6a13d0947),
testing 10 events 5 seconds apart 1-10

(cherry picked from commit a939a9f)
JDevlieghere pushed a commit to swiftlang/llvm-project that referenced this pull request Jan 27, 2025
…lvm#123826)

Recently I added SBProgress (llvm#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 (llvm#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.

(cherry picked from commit b9813ce)
JDevlieghere pushed a commit to swiftlang/llvm-project that referenced this pull request Feb 25, 2025
…lvm#123826)

Recently I added SBProgress (llvm#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 (llvm#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.

(cherry picked from commit b9813ce)
@Jlalond Jlalond deleted the external-progress-dap branch March 7, 2025 19:20
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