[Lldb-commits] [lldb] Send an explicit interrupt to cancel an attach waitfor. (PR #72565)

via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 16 12:35:19 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff a322d50804c5248f9e2981f3733bcb598fa13d51 f5d66b41bc06840648725daa640c6923b0eab923 -- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Target/Process.cpp lldb/tools/debugserver/source/DNB.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f3da2839e2..382daa92b6 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -3847,8 +3847,8 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
         // case we should tell it to stop doing that.  Normally, we don't NEED
         // to do that because we will next close the communication to the stub
         // and that will get it to shut down.  But there are remote debugging
-        // cases where relying on that side-effect causes the shutdown to be 
-        // flakey, so we should send a positive signal to interrupt the wait. 
+        // cases where relying on that side-effect causes the shutdown to be
+        // flakey, so we should send a positive signal to interrupt the wait.
         Status error = HaltPrivate();
         BroadcastEvent(eBroadcastBitInterrupt, nullptr);
       } else if (StateIsRunningState(m_last_broadcast_state)) {
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp
index 0ec50df42d..37d71fd47a 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -800,15 +800,15 @@ DNBProcessAttachWait(RNBContext *ctx, const char *waitfor_process_name,
       }
 
       // Now we're going to wait a while before polling again.  But we also
-      // need to check whether we've gotten an event from the debugger  
+      // need to check whether we've gotten an event from the debugger
       // telling us to interrupt the wait.  So we'll use the wait for a possible
       // next event to also be our short pause...
       struct timespec short_timeout;
       DNBTimer::OffsetTimeOfDay(&short_timeout, 0, waitfor_interval);
-      uint32_t event_mask = RNBContext::event_read_packet_available 
-          | RNBContext::event_read_thread_exiting;
-      nub_event_t set_events = ctx->Events().WaitForSetEvents(event_mask, 
-          &short_timeout);
+      uint32_t event_mask = RNBContext::event_read_packet_available |
+                            RNBContext::event_read_thread_exiting;
+      nub_event_t set_events =
+          ctx->Events().WaitForSetEvents(event_mask, &short_timeout);
       if (set_events & RNBContext::event_read_packet_available) {
         // If we get any packet from the debugger while waiting on the async,
         // it has to be telling us to interrupt.  So always exit here.
@@ -816,16 +816,16 @@ DNBProcessAttachWait(RNBContext *ctx, const char *waitfor_process_name,
         // the methods to actually handle it are protected.  It's not worth
         // rearranging all that just to get which packet we were sent...
         DNBLogError("Interrupted by packet while waiting for '%s' to appear.\n",
-                   waitfor_process_name);
+                    waitfor_process_name);
         break;
       }
       if (set_events & RNBContext::event_read_thread_exiting) {
         // The packet thread is shutting down, get out of here...
         DNBLogError("Interrupted by packet thread shutdown while waiting for "
-                    "%s to appear.\n", waitfor_process_name);
+                    "%s to appear.\n",
+                    waitfor_process_name);
         break;
       }
-      
     }
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/72565


More information about the lldb-commits mailing list