aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.threads
diff options
context:
space:
mode:
authorDon Breazeal <donb@codesourcery.com>2016-02-16 08:56:06 -0800
committerDon Breazeal <donb@codesourcery.com>2016-02-16 08:56:06 -0800
commit4041ed778095ed74f7cb9cdaac4115597f35147c (patch)
treed1a5e0a32b493cbcc328e83e2705871911ef07a6 /gdb/testsuite/gdb.threads
parent726c18e1c8a74682270bcd80f7145cda3cc76389 (diff)
downloadgdb-4041ed778095ed74f7cb9cdaac4115597f35147c.zip
gdb-4041ed778095ed74f7cb9cdaac4115597f35147c.tar.gz
gdb-4041ed778095ed74f7cb9cdaac4115597f35147c.tar.bz2
PR remote/19496, internal err forking-threads-plus-bkpt
This patch fixes an internal error that occurs in gdb.threads/forking-threads-plus-breakpoint.exp: /blah/binutils-gdb/gdb/target.c:2723: internal-error: Can't determine the current address space of thread Thread 3170.3170 In default_thread_address_space, find_inferior_ptid couldn't find 3170.3170 because it had been overwritten in inferior_appeared, called as follows: inferior_appeared remote_add_inferior remote_notice_new_inferior remote_update_thread_list The cause of the problem was the following sequence of events: * GDB knows only about the main thread * the first fork event is reported to GDB, saved as pending_event * qXfer:threads:read gets the threads from the remote. remove_new_fork_children id's the fork child from the pending event and removes it from the list reported to GDB. All the rest of the threads, including the fork parent, are added to the GDB thread list. * GDB stops all the threads. All the stop events are pushed onto the stop reply queue behind the pending fork event. The fork waitstatus is saved in the fork parent thread's pending status field thread_info.suspend. * remote_wait_ns calls queued_stop_reply and process_stop_reply to remove the fork event from the front of the stop reply queue and save event information in the thread_info structure for the fork parent thread. Unfortunately, none of the information saved in this way is the fork-specific information. * A subsequent qXfer:threads:read packet gets the thread list including the fork parent and fork child. remove_new_fork_children checks the thread list to see if there is a fork parent, doesn't find one, checks the stop reply queue for a pending fork event, doesn't find one, and allows the fork child thread to be reported to GDB before the fork event has been handled. remote_update_thread_list calls remote_notice_new_thread and overwrites the current (main) thread in inferior_appeared. So the fork event has been reported out of target_wait but it was left pending on the infrun side (infrun.c:save_waitstatus). IOW, the fork event hasn't been processed by handle_inferior_event yet, so it hasn't made it to tp->pending_follow yet. The fix is to check thread_info.suspend along with the thread_info.pending_follow in remote.c:remove_new_fork_children, to prevent premature reporting of the fork child thread creation. gdb/ChangeLog: PR remote/19496 * remote.c (remove_new_fork_children): Check for pending fork status in thread_info.suspend. gdb/testsuite/ChangeLog: PR remote/19496 * gdb.threads/forking-threads-plus-breakpoint.exp (do_test): Remove kfail for PR remote/19496.
Diffstat (limited to 'gdb/testsuite/gdb.threads')
-rw-r--r--gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp6
1 files changed, 0 insertions, 6 deletions
diff --git a/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp b/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp
index 6c72061..ff3ca9a 100644
--- a/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp
+++ b/gdb/testsuite/gdb.threads/forking-threads-plus-breakpoint.exp
@@ -100,12 +100,6 @@ proc do_test { cond_bp_target detach_on_fork displaced } {
set fork_count 0
set ok 0
- if {$displaced == "off"
- && [target_info exists gdb_protocol]
- && ([target_info gdb_protocol] == "remote"
- || [target_info gdb_protocol] == "extended-remote")} {
- setup_kfail "remote/19496" *-*-*
- }
set test "inferior 1 exited"
gdb_test_multiple "" $test {
-re "Inferior 1 \(\[^\r\n\]+\) exited normally" {