mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 19:23:33 +08:00
1cf2f1b045
I have started seeing occasional runaway 'attach' processes these days. I cannot be certain it is really caused by this patch, for example grep 'FAIL.*cmdline attach run' does not show anything in my logs. But as I remember this 'attach' runaway process always happened in GDB (but I do not remember it in the past months) I think it would be most safe to just solve it forever by [attached]. gdb/testsuite/ChangeLog 2014-09-12 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.base/attach.c: Include unistd.h. (main): Call alarm. Add label postloop. * gdb.base/attach.exp (do_attach_tests): Use gdb_get_line_number, gdb_breakpoint, gdb_continue_to_breakpoint. (test_command_line_attach_run): Kill ${testpid} in one exit path.
24 lines
526 B
C
24 lines
526 B
C
/* This program is intended to be started outside of gdb, and then
|
|
attached to by gdb. Thus, it simply spins in a loop. The loop
|
|
is exited when & if the variable 'should_exit' is non-zero. (It
|
|
is initialized to zero in this program, so the loop will never
|
|
exit unless/until gdb sets the variable to non-zero.)
|
|
*/
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
int should_exit = 0;
|
|
|
|
int main ()
|
|
{
|
|
int local_i = 0;
|
|
|
|
alarm (60);
|
|
|
|
while (! should_exit)
|
|
{
|
|
local_i++;
|
|
}
|
|
return 0; /* postloop */
|
|
}
|