From: Pedro Alves <palves@redhat.com>
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 [thread overview]
Message-ID: <20200513205338.14233-6-palves@redhat.com> (raw)
In-Reply-To: <20200513205338.14233-1-palves@redhat.com>
From: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
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 <tankut.baris.aktemur@intel.com>
* infrun.c (stop_all_threads): Enable/disable thread events of all
targets.
gdb/testsuite/ChangeLog:
2020-04-30 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* 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
next prev parent reply other threads:[~2020-05-13 20:53 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 20:53 [PATCH v8 0/6] Handle already-exited threads in 'stop_all_threads' Pedro Alves
2020-05-13 20:53 ` [PATCH v8 1/6] gdb: protect some 'regcache_read_pc' calls Pedro Alves
2020-05-13 20:53 ` [PATCH v8 2/6] gdb/infrun: move a 'regcache_read_pc' call down to first use Pedro Alves
2020-05-13 20:53 ` [PATCH v8 3/6] gdb/infrun: extract out a code piece into 'mark_non_executing_threads' function Pedro Alves
2020-05-13 20:53 ` [PATCH v8 4/6] gdb: introduce 'all_non_exited_process_targets' and 'switch_to_target_no_thread' Pedro Alves
2020-05-14 8:44 ` Aktemur, Tankut Baris
2020-05-14 11:12 ` Pedro Alves
2020-05-14 11:23 ` Aktemur, Tankut Baris
2020-05-13 20:53 ` Pedro Alves [this message]
2020-05-14 8:44 ` [PATCH v8 5/6] gdb/infrun: enable/disable thread events of all targets in stop_all_threads Aktemur, Tankut Baris
2020-05-14 11:16 ` Pedro Alves
2020-05-14 11:30 ` Aktemur, Tankut Baris
2020-05-13 20:53 ` [PATCH v8 6/6] gdb/infrun: handle already-exited threads when attempting to stop Pedro Alves
2020-05-14 8:47 ` Aktemur, Tankut Baris
2020-05-14 11:16 ` Pedro Alves
2020-05-14 11:40 ` Aktemur, Tankut Baris
2020-05-14 18:00 ` Tom de Vries
2020-05-14 18:54 ` Aktemur, Tankut Baris
2020-05-14 18:58 ` Pedro Alves
2020-05-15 7:53 ` Aktemur, Tankut Baris
2020-05-15 10:14 ` Pedro Alves
2020-05-15 10:17 ` Tom de Vries
2020-05-15 10:35 ` Pedro Alves
2020-05-15 11:53 ` Tom de Vries
2020-05-15 12:02 ` Pedro Alves
2020-05-15 14:16 ` Tom de Vries
2020-05-15 15:46 ` Pedro Alves
2020-05-15 17:17 ` Tom de Vries
2020-05-18 6:18 ` [PATCH][gdb/testsuite] Warn about leaked global array Tom de Vries
2020-05-18 10:41 ` Pedro Alves
2020-05-19 16:34 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200513205338.14233-6-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox