aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-05-14 13:59:54 +0200
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-05-14 13:59:54 +0200
commit6ad82919702b60dee9f9a98047233e5374888e47 (patch)
tree44dbe0c465f757d9bd60cfbf49c9f1ab4b3b1197
parentd890404b63b8a0b6c28212388f21421d029f6ad2 (diff)
downloadbinutils-6ad82919702b60dee9f9a98047233e5374888e47.zip
binutils-6ad82919702b60dee9f9a98047233e5374888e47.tar.gz
binutils-6ad82919702b60dee9f9a98047233e5374888e47.tar.bz2
gdb/infrun: enable/disable thread events of all targets in stop_all_threads
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-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * infrun.c (stop_all_threads): Enable/disable thread events of all targets. Move a debug message denoting the end of the function into the SCOPED_EXIT block. gdb/testsuite/ChangeLog: 2020-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.base/annota1.exp: Update the expected output. * gdb.cp/annota2.exp: Ditto.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/infrun.c24
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/annota1.exp2
-rw-r--r--gdb/testsuite/gdb.cp/annota2.exp2
5 files changed, 32 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9f93948..6d56c04 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2020-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+ * infrun.c (stop_all_threads): Enable/disable thread events of all
+ targets. Move a debug message denoting the end of the function
+ into the SCOPED_EXIT block.
+
+2020-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
* process-stratum-target.h: Include <set>.
(all_non_exited_process_targets, switch_to_target_no_thread): New
function declarations.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index c5bf2d0..2a8e73c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4769,8 +4769,25 @@ 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);
+ }
+
+ SCOPE_EXIT
+ {
+ /* 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");
+ };
/* Request threads to stop, and then wait for the stops. Because
threads we already know about can spawn more threads while we're
@@ -4961,9 +4978,6 @@ stop_all_threads (void)
}
}
}
-
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: stop_all_threads done\n");
}
/* Handle a TARGET_WAITKIND_NO_RESUMED event. */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 98cff46..3ce59bc 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ * gdb.base/annota1.exp: Update the expected output.
+ * gdb.cp/annota2.exp: Ditto.
+
2020-05-12 Andrew Burgess <andrew.burgess@embecosm.com>
* lib/check-test-names.exp: Disable when testing is being run in
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 9d3bf73..829d144 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 dd3a0a5..1b4f04b 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" \
"" \