2007-04-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* tests/test-ptrace.c (target_pid_kill): New function.
(target_pid, main): TARGET_PID made static, for target_pid_kill ().
(main): Register target_pid_kill () for atexit(3).
2007-04-04 Jan Kratochvil <jan.kratochvil@redhat.com>
* tests/Gtest-dyn1.c, tests/test-async-sig.c, tests/test-ptrace.c:
Fixed lockups on broken libunwind (as ppc64 is).
2007-03-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* tests/test-async-sig.c (do_backtrace): Limit maximum backtrace depth
to 100 iterations; it workarounds FC6 DWARF-broken glibc.
2006-12-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* tests/test-ptrace.c (main): Check for too many unexpected child
signals, such as the common `SIGSEGV'.
diff --git a/tests/test-async-sig.c b/tests/test-async-sig.c
index a114bff..0aea21c 100644
--- a/tests/test-async-sig.c
+++ b/tests/test-async-sig.c
@@ -41,6 +41,7 @@
int verbose;
int nerrors;
+static const int nerrors_max = 100;
int sigcount;
#define panic(args...) \
@@ -54,6 +55,7 @@
unw_word_t ip, sp, off;
unw_context_t uc;
int ret;
+ int depth = 0;
unw_getcontext (&uc);
if (unw_init_local (&cursor, &uc) < 0)
@@ -92,6 +94,11 @@
panic ("FAILURE: unw_step() returned %d for ip=%lx\n",
ret, (long) ip);
}
+ if (depth++ > 100)
+ {
+ panic ("FAILURE: unw_step() looping over %d iterations\n", depth);
+ break;
+ }
}
while (ret > 0);
}
@@ -110,8 +117,10 @@
unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL);
else if (sigcount == 200)
unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
- else if (sigcount == 300)
+ else if (sigcount == 300 || nerrors > nerrors_max)
{
+ if (nerrors > nerrors_max)
+ panic ("Too many errors (%d)\n", nerrors);
if (nerrors)
{
fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
@@ -147,5 +156,10 @@
if (0 && verbose)
printf ("%s: starting backtrace\n", __FUNCTION__);
do_backtrace (0, (i++ % 100) == 0);
+ if (nerrors > nerrors_max)
+ {
+ panic ("Too many errors (%d)\n", nerrors);
+ exit (-1);
+ }
}
}