mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 05:54:26 +08:00
gdb: Mark async event handler when event is already pending
In PR22882 inferior functions are called on different threads while scheduler-locking is turned on. This results in a hang. This was discussed in this mailing list thread: https://sourceware.org/ml/gdb/2017-10/msg00032.html The problem is that when the thread is set running in order to execute the inferior call, a call to target_async is made. If the target is not already registered as 'target_async' then this will install the async event handler, AND unconditionally mark the handler as having an event pending. However, if the target is already registered as target_async then the event handler is not installed (its already installed) and the handler is NOT marked as having an event pending. If we try to set running a thread that already has a pending event, then we do want to set target_async, however, there will not be an external event incoming (the thread is already stopped) so we rely on manually marking the event handler as having a pending event in order to see the threads pending stop event. This is fine, if, at the point where we call target_async, the target is not already marked as async. But, if it is, then the event handler will not be marked as ready, and the threads pending stop event will never be processed. A similar pattern of code can be seen in linux_nat_target::resume, where, when a thread has a pending event, the call to target_async is followed by a call to async_file_mark to ensure that the pending thread event will be processed, even if target_async was already set. gdb/ChangeLog: PR gdb/22882 * infrun.c (resume_1): Add call to mark_async_event_handler. gdb/testsuite/ChangeLog: * gdb.threads/multiple-successive-infcall.exp: Remove kfail case, rewrite test to describe action performed, rather than possible failure.
This commit is contained in:
parent
defd21729f
commit
9516f85aea
@ -1,3 +1,9 @@
|
||||
2018-06-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
Stephen Roberts <stephen.roberts@arm.com>
|
||||
|
||||
PR gdb/22882
|
||||
* infrun.c (resume_1): Add call to mark_async_event_handler.
|
||||
|
||||
2018-06-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* infrun.c (do_target_wait): Change old version of $pc printed.
|
||||
|
@ -2408,7 +2408,11 @@ resume_1 (enum gdb_signal sig)
|
||||
tp->suspend.stop_signal = GDB_SIGNAL_0;
|
||||
|
||||
if (target_can_async_p ())
|
||||
target_async (1);
|
||||
{
|
||||
target_async (1);
|
||||
/* Tell the event loop we have an event to process. */
|
||||
mark_async_event_handler (infrun_async_inferior_event_token);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
2018-06-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
Stephen Roberts <stephen.roberts@arm.com>
|
||||
|
||||
* gdb.threads/multiple-successive-infcall.exp: Remove kfail case,
|
||||
rewrite test to describe action performed, rather than possible
|
||||
failure.
|
||||
|
||||
2018-06-08 Gary Benson <gbenson@redhat.com>
|
||||
|
||||
* gdb.threads/check-libthread-db.exp: New file.
|
||||
|
@ -56,17 +56,6 @@ gdb_test "show scheduler-locking" \
|
||||
|
||||
foreach_with_prefix thread {5 4 3 2 1} {
|
||||
gdb_test "thread ${thread}" "Switching to .*"
|
||||
set command "call get_value()"
|
||||
set hang_message "testing if ${command} hangs"
|
||||
gdb_test_multiple "${command}" "${hang_message}" {
|
||||
-re "= ${thread}\[\r\n]+${gdb_prompt} $" {
|
||||
pass "${hang_message}"
|
||||
}
|
||||
timeout {
|
||||
kfail "gdb/22882" "${hang_message}"
|
||||
# Exit. The debugger has hung, so there is no point in wasting
|
||||
# time timing out on further calls to get_value().
|
||||
return 0
|
||||
}
|
||||
}
|
||||
gdb_test "call get_value()" "= ${thread}" \
|
||||
"call inferior function"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user