From d4453441f12a26c273c6bd8bcfa1b3f76889a884 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Sun, 25 Aug 2013 09:51:38 +0000 Subject: The crash test has two stack levels (for etsting purpose) --- src/htscoremain.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/htscoremain.c') diff --git a/src/htscoremain.c b/src/htscoremain.c index 3910157..044e720 100644 --- a/src/htscoremain.c +++ b/src/htscoremain.c @@ -105,6 +105,19 @@ extern int IPV6_resolver; } \ } while(0) +#ifdef HTS_CRASH_TEST +static __attribute__ ((noinline)) void fourty_two(void) { + char *const ptr = (char*) (uintptr_t) 0x42; + (*ptr)++; +} +static __attribute__ ((noinline)) void do_really_crash(void) { + fourty_two(); +} +static __attribute__ ((noinline)) void do_crash(void) { + do_really_crash(); +} +#endif + HTSEXT_API int hts_main(int argc, char **argv) { httrackp *opt = hts_create_opt(); int ret = hts_main2(argc, argv, opt); @@ -2607,10 +2620,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) { #ifdef HTS_CRASH_TEST case 'c': /* crash test */ - { - char *const ptr = (char*) (uintptr_t) 0x42; - (*ptr)++; - } + do_crash(); break; #endif -- cgit v1.2.3