aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.threads/detach-step-over.exp
AgeCommit message (Collapse)AuthorFilesLines
2023-01-13Use require can_spawn_for_attachTom Tromey1-3/+1
This changes some tests to use "require can_spawn_for_attach".
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-12-16[gdb/testsuite] Fix race in gdb.threads/detach-step-over.expTom de Vries1-8/+26
Once in a while I run into: ... FAIL: gdb.threads/detach-step-over.exp: \ breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \ displaced=off: iter 1: all threads running ... In can easily reproduce this by doing: ... # Wait a bit, to give time for the threads to hit the # breakpoint. - sleep 1 return true ... Fix this by counting the running threads in a loop, effectively allowing 10 seconds (instead of 1) for the threads to start running, but only sleeping if needed. Reduces total execution time from 1m27s to 56s. Tested on x86_64-linux.
2022-11-28gdb/testsuite: remove use of then keyword from gdb.threads/*.expAndrew Burgess1-1/+1
The canonical form of 'if' in modern TCL is 'if {} {}'. But there's still a bunch of places in the testsuite where we make use of the 'then' keyword, and sometimes these get copies into new tests, which just spreads poor practice. This commit removes all use of the 'then' keyword from the gdb.threads/ test script directory. There should be no changes in what is tested after this commit.
2022-11-28gdb: fix assert when quitting GDB while a thread is steppingAndrew Burgess1-0/+52
This commit addresses one of the issues identified in PR gdb/28275. Bug gdb/28275 identifies a number of situations in which this assert: Assertion `!proc_target->commit_resumed_state' failed. could be triggered. There's actually a number of similar places where this assert is found in GDB, the two of interest in gdb/28275 are in target_wait and target_stop. In one of the comments: https://sourceware.org/bugzilla/show_bug.cgi?id=28275#c1 steps to trigger the assertion within target_stop were identified when using a modified version of the gdb.threads/detach-step-over.exp test script. In the gdb.threads/detach-step-over.exp test, we attach to a multi-threaded inferior, and continue the inferior in asynchronous (background) mode. Each thread is continuously hitting a conditional breakpoint where the condition is always false. While the inferior is running we detach. The goal is that we detach while GDB is performing a step-over for the conditional breakpoint in at least one thread. While detaching, if a step-over is in progress, then GDB has to complete the step over before we can detach. This involves calling target_stop and target_wait (see prepare_for_detach). As far as gdb/28275 is concerned, the interesting part here, is the the process_stratum_target::commit_resumed_state variable must be false when target_stop and target_wait are called. This is currently ensured because, in detach_command (infrun.c), we create an instance of scoped_disable_commit_resumed, this ensures that when target_detach is called, ::commit_resumed_state will be false. The modification to the test that I propose here, and which exposed the bug, is that, instead of using "detach" to detach from the inferior, we instead use "quit". Quitting GDB after attaching to an inferior will cause GDB to first detach, and then exit. When we quit GDB we end up calling target_detach via a different code path, the stack looks like: #0 target_detach #1 kill_or_detach #2 quit_force #3 quit_command Along this path there is no scoped_disable_commit_resumed created. ::commit_resumed_state can be true when we reach prepare_for_detach, which calls target_wait and target_stop, so the assertion will trigger. In this commit, I propose fixing this by adding the creation of a scoped_disable_commit_resumed into target_detach. This will ensure that ::commit_resumed_state is false when calling prepare_for_detach from within target_detach. I did consider placing the scoped_disable_commit_resumed in prepare_for_detach, however, placing it in target_detach ensures that the target's commit_resumed_state flag is left to false if the detached inferior was the last one for that target. It's the same rationale as for patch "gdb: disable commit resumed in target_kill" that comes later in this series, but for detach instead of kill. detach_command still includes a scoped_disable_commit_resumed too, but I think it is still relevant to cover the resumption at the end of the function. Co-Authored-By: Simon Marchi <simon.marchi@efficios.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28275 Change-Id: Ie128f7aba6ef0e018859275eca372e6ea738e96f
2022-11-28gdb/testsuite: refactor gdb.threads/detach-step-over.expAndrew Burgess1-100/+138
Factor out some bits of gdb.threads/detach-step-over.exp to procs in preparation to adding some new variations of the test. Rename the existing "test" proc and make it use proc_with_prefix. Co-Authored-By: Simon Marchi <simon.marchi@efficios.com> Change-Id: Ib4412545c81c8556029e0f7bfa9dd48d7a9f3189
2022-11-28gdb/testsuite: remove global declarations in gdb.threads/detach-step-over.expSimon Marchi1-23/+17
Before doing further changes to this file, change to use the :: notation instead of declaring global variables with the `global` keyword. Change-Id: I72301fd8f4693fea61aac054ba17245a1f4442fb Approved-By: Andrew Burgess <aburgess@redhat.com>
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-05-05[gdb/testsuite] Fix timeout in gdb.threads/detach-step-over.exp with readnowTom de Vries1-17/+32
When running test-case gdb.threads/detach-step-over.exp with target board readnow, I run into: ... Reading symbols from /lib64/libc.so.6...^M Reading symbols from \ /usr/lib/debug/lib64/libc-2.26.so-2.26-lp152.26.6.1.x86_64.debug...^M Expanding full symbols from \ /usr/lib/debug/lib64/libc-2.26.so-2.26-lp152.26.6.1.x86_64.debug...^M FAIL: gdb.threads/detach-step-over.exp: \ breakpoint-condition-evaluation=host: target-non-stop=on: non-stop=on: \ displaced=off: iter 2: attach (timeout) ... Fix this by doing exp_continue when encountering the "Reading symbols" or "Expanding full symbols" lines. This is still fragile and times out with a higher load, similated f.i. by stress -c 5. Fix that by using a timeout factor of 2. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-05-05 Tom de Vries <tdevries@suse.de> * gdb.threads/detach-step-over.exp: Do exp_continue when encountering "Reading symbols" or "Expanding full symbols" lines. Using timeout factor of 2 for attach.
2021-02-03Testcase for detaching while stepping over breakpointPedro Alves1-0/+290
This adds a testcase that exercises detaching while GDB is stepping over a breakpoint, in all combinations of: - maint target non-stop off/on - set non-stop on/off - displaced stepping on/off This exercises the bugs fixed in the previous 8 patches. gdb/testsuite/ChangeLog: * gdb.threads/detach-step-over.c: New file. * gdb.threads/detach-step-over.exp: New file.