[PATCH v4 20/44] gdbserver: allow inferiors without threads
Markus Metzger <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
An Intel GPU device is modeled as an inferior and GPU software threads are
modeled as threads. Software threads represent the work that has been
dispatched to a GPU device. When a thread completes its work, it exits.
When new work is dispatched to a GPU device, new software threads are
created.
In such a model, when no work is currently dispatched to a GPU device, we
are left with the GPU inferior representing the GPU device but no threads.
---
gdbserver/server.cc | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 03a40c7a19e..7ad93e5e303 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -278,7 +278,7 @@ struct notif_server notif_stop =
static int
target_running (void)
{
- return get_first_thread () != NULL;
+ return (get_first_process () != nullptr);
}
/* See gdbsupport/common-inferior.h. */
@@ -339,8 +339,12 @@ attach_inferior (int pid)
&& cs.last_status.sig () == GDB_SIGNAL_STOP)
cs.last_status.set_stopped (GDB_SIGNAL_TRAP);
- current_thread->last_resume_kind = resume_stop;
- current_thread->last_status = cs.last_status;
+ /* We may not have any threads, yet, after attaching. */
+ if (current_thread != nullptr)
+ {
+ current_thread->last_resume_kind = resume_stop;
+ current_thread->last_status = cs.last_status;
+ }
}
return 0;
--
2.43.0
________________________________________
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 (89) 99143-0
www.intel.de
Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman
Chairperson of the Supervisory Board: Sonja Pierer
Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.