]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/amd-dbgapi: pass amd_dbgapi_inferior_info to process_event_queue
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 9 Jun 2025 16:08:59 +0000 (12:08 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 16 Jun 2025 14:20:26 +0000 (10:20 -0400)
A following patch will make process_event_queue access a field of
amd_dbgapi_inferior_info.  Prepare for this by making
process_event_queue accept an amd_dbgapi_inferior_info object, instead
of a process id.

Change-Id: I9adc491dd1ff64ff74c40aa7662fffb11bd8332b
Approved-by: Lancelot Six <lancelot.six@amd.com>
gdb/amd-dbgapi-target.c

index 32a3f6d3c334f36e5adfa0f6747d1940f7a056f9..888552e00d3e85e393f9384c523a6c5533c1ee2a 100644 (file)
@@ -234,7 +234,7 @@ struct amd_dbgapi_inferior_info
 };
 
 static amd_dbgapi_event_id_t process_event_queue
-  (amd_dbgapi_process_id_t process_id,
+  (amd_dbgapi_inferior_info &info,
    amd_dbgapi_event_kind_t until_event_kind = AMD_DBGAPI_EVENT_KIND_NONE);
 
 static const target_info amd_dbgapi_target_info = {
@@ -564,8 +564,7 @@ amd_dbgapi_target_breakpoint::check_status (struct bpstat *bs)
   /* If the action is AMD_DBGAPI_BREAKPOINT_ACTION_HALT, we need to wait until
      a breakpoint resume event for this breakpoint_id is seen.  */
   amd_dbgapi_event_id_t resume_event_id
-    = process_event_queue (info->process_id,
-                          AMD_DBGAPI_EVENT_KIND_BREAKPOINT_RESUME);
+    = process_event_queue (*info, AMD_DBGAPI_EVENT_KIND_BREAKPOINT_RESUME);
 
   /* We should always get a breakpoint_resume event after processing all
      events generated by reporting the breakpoint hit.  */
@@ -1337,28 +1336,22 @@ event_kind_str (amd_dbgapi_event_kind_t kind)
   gdb_assert_not_reached ("unhandled amd_dbgapi_event_kind_t value");
 }
 
-/* Drain the dbgapi event queue of a given process_id, or of all processes if
-   process_id is AMD_DBGAPI_PROCESS_NONE.  Stop processing the events if an
-   event of a given kind is requested and `process_id` is not
-   AMD_DBGAPI_PROCESS_NONE.  Wave stop events that are not returned are queued
-   into their inferior's amd_dbgapi_inferior_info pending wave events. */
+/* Drain the dbgapi event queue of a given inferior.  Stop processing the
+   events if an event of a given kind is requested (not AMD_DBGAPI_EVENT_NONE).
+   Wave stop events that are not returned are queued into their inferior's
+   amd_dbgapi_inferior_info pending wave events. */
 
 static amd_dbgapi_event_id_t
-process_event_queue (amd_dbgapi_process_id_t process_id,
+process_event_queue (amd_dbgapi_inferior_info &info,
                     amd_dbgapi_event_kind_t until_event_kind)
 {
-  /* An event of a given type can only be requested from a single
-     process_id.  */
-  gdb_assert (until_event_kind == AMD_DBGAPI_EVENT_KIND_NONE
-             || process_id != AMD_DBGAPI_PROCESS_NONE);
-
   while (true)
     {
       amd_dbgapi_event_id_t event_id;
       amd_dbgapi_event_kind_t event_kind;
 
       amd_dbgapi_status_t status
-       = amd_dbgapi_process_next_pending_event (process_id, &event_id,
+       = amd_dbgapi_process_next_pending_event (info.process_id, &event_id,
                                                 &event_kind);
 
       if (status != AMD_DBGAPI_STATUS_SUCCESS)
@@ -1479,7 +1472,7 @@ amd_dbgapi_target::wait (ptid_t ptid, struct target_waitstatus *ws,
       /* Drain the events for the current inferior from the amd_dbgapi and
         preserve the ordering.  */
       auto info = get_amd_dbgapi_inferior_info (current_inferior ());
-      process_event_queue (info->process_id);
+      process_event_queue (*info);
 
       std::tie (event_ptid, gpu_waitstatus) = consume_one_event (ptid.pid ());
       if (event_ptid == minus_one_ptid)