From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id CB27D395BC2E for ; Wed, 13 May 2020 20:53:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CB27D395BC2E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-bl_7A7nOPJ2MeAuj0DbgfA-1; Wed, 13 May 2020 16:53:44 -0400 X-MC-Unique: bl_7A7nOPJ2MeAuj0DbgfA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01367460 for ; Wed, 13 May 2020 20:53:44 +0000 (UTC) Received: from cascais.Home (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 966CA61538 for ; Wed, 13 May 2020 20:53:43 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v8 5/6] gdb/infrun: enable/disable thread events of all targets in stop_all_threads Date: Wed, 13 May 2020 21:53:37 +0100 Message-Id: <20200513205338.14233-6-palves@redhat.com> In-Reply-To: <20200513205338.14233-1-palves@redhat.com> References: <20200513205338.14233-1-palves@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2020 20:53:48 -0000 From: Tankut Baris Aktemur In stop_all_threads, the thread events of the current top target are enabled at the beginning of the function and then disabled at the end (at scope exit time). Because there may be multiple targets whose thread lists will be updated and whose threads are stopped, enable/disable thread events for all targets. This update caused a change in the annotations. In particular, a "frames-invalid" annotation is printed one more time due to switching the current inferior. Hence, gdb.base/annota1.exp and gdb.cp/annota2.exp tests are also updated. Regression-tested on X86_64 Linux using the default board file and the native-extended-gdbserver board file. gdb/ChangeLog: 2020-04-30 Tankut Baris Aktemur * infrun.c (stop_all_threads): Enable/disable thread events of all targets. gdb/testsuite/ChangeLog: 2020-04-30 Tankut Baris Aktemur * gdb.base/annota1.exp: Update the expected output. * gdb.cp/annota2.exp: Ditto. --- gdb/infrun.c | 15 +++++++++++++-- gdb/testsuite/gdb.base/annota1.exp | 2 +- gdb/testsuite/gdb.cp/annota2.exp | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index c5bf2d0ad74..6602bc28d5e 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4769,8 +4769,12 @@ stop_all_threads (void) scoped_restore_current_thread restore_thread; - target_thread_events (1); - SCOPE_EXIT { target_thread_events (0); }; + /* Enable thread events of all targets. */ + for (auto *target : all_non_exited_process_targets ()) + { + switch_to_target_no_thread (target); + target_thread_events (true); + } /* Request threads to stop, and then wait for the stops. Because threads we already know about can spawn more threads while we're @@ -4962,6 +4966,13 @@ stop_all_threads (void) } } + /* Disable thread events of all targets. */ + for (auto *target : all_non_exited_process_targets ()) + { + switch_to_target_no_thread (target); + target_thread_events (false); + } + if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: stop_all_threads done\n"); } diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index 9d3bf73431c..829d144cc20 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -223,7 +223,7 @@ gdb_test_multiple "break printf" "break printf" { # # get to printf # -set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n${breakpoints_invalid}" +set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n${breakpoints_invalid}\r\n\032\032frames-invalid\r\n" set pat_adjust "warning: Breakpoint 3 address previously adjusted from $hex to $hex.\r\n" set pat_end "\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*.*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp index dd3a0a5d6de..1b4f04bb445 100644 --- a/gdb/testsuite/gdb.cp/annota2.exp +++ b/gdb/testsuite/gdb.cp/annota2.exp @@ -218,7 +218,7 @@ set pat [multi_line "" \ "\032\032post-prompt" \ "" \ "\032\032starting" \ - "\(${frames_invalid}\)*${breakpoints_invalid}" \ + "\(${frames_invalid}\)*${breakpoints_invalid}\(${frames_invalid}\)*" \ "\032\032watchpoint 3" \ ".*atchpoint 3: a.x" \ "" \ -- 2.14.5