[8/8] add non-stop test that stresses thread starvation issues
Commit Message
Hi, Pedro,
On 26/12/14 20:31, Pedro Alves wrote:
> +int
> +main (void)
> +{
> + int res;
> + int i;
> +
> + alarm (60);
Is there any reason to call alarm here? It causes some fails on
arm-linux, that is, the board is slow, and alarm is triggered.
Then thread is disappeared and current_thread is set to NULL.
GDB/GDBserver doesn't know about that. When the inferior memory is
accessed, current_thread is dereferenced, and GDBserver is crashed.
How about removing it?
Comments
On 04/02/2015 03:53 PM, Yao Qi wrote:
> Hi, Pedro,
>
> On 26/12/14 20:31, Pedro Alves wrote:
>> +int
>> +main (void)
>> +{
>> + int res;
>> + int i;
>> +
>> + alarm (60);
>
> Is there any reason to call alarm here?
Yes, the test runs forever otherwise. See:
https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Don.27t_write_tests_that_run_forever
How about fixing this like attach-many-short-lived-threads.exp was
fixed here:
https://sourceware.org/ml/gdb-patches/2015-02/msg00152.html
?
> It causes some fails on
> arm-linux, that is, the board is slow, and alarm is triggered.
> Then thread is disappeared and current_thread is set to NULL.
> GDB/GDBserver doesn't know about that. When the inferior memory is
> accessed, current_thread is dereferenced, and GDBserver is crashed.
Sounds like we should have a test that explicitly covers that.
GDBserver shouldn't crash.
b/gdb/testsuite/gdb.threads/non-stop-fair-events.c
@@ -64,8 +64,6 @@ main (void)
int res;
int i;
- alarm (60);
-
signal (SIGUSR1, handler);
for (i = 0; i < NUM_THREADS; i++)