Skip to content

Commit 485b851

Browse files
committed
Special-case wildcard requests in ravenscar-thread.c
ravenscar-thread.c intercepts resume and wait target requests and replaces the requested ptid with the ptid of the underlying CPU. However, this is incorrect when a request is made with a wildcard ptid. This patch adds a special case to ravenscar-thread.c for minus_one_ptid. I don't believe a special case for process wildcards is necessary, so I have not added that. Joel's description explains the bug well: At the user level, we noticed the issue because we had a test were we insert a breakpoint one some code which is only run from, say, CPU #2, whereas we unfortunately resumed the execution after having stopped somewhere in CPU #1. As a result, we sent an order to resume CPU #1, which starves CPU #2 forever, because the code in CPU #1 waits for some of the Ada tasks allocated to CPU #2 (and we never reach our breakpoint either). gdb/ChangeLog 2019-02-15 Tom Tromey <tromey@adacore.com> * ravenscar-thread.c (ravenscar_thread_target::resume) (ravenscar_thread_target::wait): Special case wildcard requests.
1 parent 0b790b1 commit 485b851

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

gdb/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2019-02-15 Tom Tromey <tromey@adacore.com>
2+
3+
* ravenscar-thread.c (ravenscar_thread_target::resume)
4+
(ravenscar_thread_target::wait): Special case wildcard requests.
5+
16
2019-02-15 Tom Tromey <tromey@adacore.com>
27

38
* ravenscar-thread.c (base_ptid): Remove.

gdb/ravenscar-thread.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,12 @@ void
323323
ravenscar_thread_target::resume (ptid_t ptid, int step,
324324
enum gdb_signal siggnal)
325325
{
326+
/* If we see a wildcard resume, we simply pass that on. Otherwise,
327+
arrange to resume the base ptid. */
326328
inferior_ptid = m_base_ptid;
327-
beneath ()->resume (m_base_ptid, step, siggnal);
329+
if (ptid != minus_one_ptid)
330+
ptid = m_base_ptid;
331+
beneath ()->resume (ptid, step, siggnal);
328332
}
329333

330334
ptid_t
@@ -335,7 +339,9 @@ ravenscar_thread_target::wait (ptid_t ptid,
335339
ptid_t event_ptid;
336340

337341
inferior_ptid = m_base_ptid;
338-
event_ptid = beneath ()->wait (m_base_ptid, status, 0);
342+
if (ptid != minus_one_ptid)
343+
ptid = m_base_ptid;
344+
event_ptid = beneath ()->wait (ptid, status, 0);
339345
/* Find any new threads that might have been created, and update
340346
inferior_ptid to the active thread.
341347
@@ -350,6 +356,8 @@ ravenscar_thread_target::wait (ptid_t ptid,
350356
this->update_thread_list ();
351357
this->update_inferior_ptid ();
352358
}
359+
else
360+
inferior_ptid = m_base_ptid;
353361
return inferior_ptid;
354362
}
355363

0 commit comments

Comments
 (0)