From 1ee6b0ac74da477a52ce589bed83db3908dcc4f7 Mon Sep 17 00:00:00 2001 From: "mostang.com!davidm" Date: Tue, 3 May 2005 09:13:17 +0000 Subject: [PATCH] (STACK_SIZE): SIGSTKSZ is also ridiculously small on x86-64 (at least for SuSE LES 9) so use 128KB instead. (do_backtrace): Also print backtrace obtained via backtrace(). (foo): Remove backtrace() call---now done in do_backtrace(). (Logical change 1.290) --- tests/Gtest-bt.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tests/Gtest-bt.c b/tests/Gtest-bt.c index c844779f..1256512a 100644 --- a/tests/Gtest-bt.c +++ b/tests/Gtest-bt.c @@ -38,8 +38,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include -#if UNW_TARGET_X86 -# define STACK_SIZE (128*1024) /* On x86, SIGSTKSZ is too small */ +#if UNW_TARGET_X86 || UNW_TARGET_X86_64 +# define STACK_SIZE (128*1024) /* On x86/-64, SIGSTKSZ is too small */ #else # define STACK_SIZE SIGSTKSZ #endif @@ -64,6 +64,9 @@ do_backtrace (void) unw_context_t uc; int ret; + if (verbose) + printf ("\texplicit backtrace:\n"); + unw_getcontext (&uc); if (unw_init_local (&cursor, &uc) < 0) panic ("unw_init_local failed!\n"); @@ -110,24 +113,24 @@ do_backtrace (void) } } while (ret > 0); + + { + void *buffer[20]; + int i, n; + + if (verbose) + printf ("\n\tvia backtrace():\n"); + n = backtrace (buffer, 20); + if (verbose) + for (i = 0; i < n; ++i) + printf ("[%d] ip=%p\n", i, buffer[i]); + } } void foo (long val) { - void *buffer[20]; - int i, n; - - if (verbose) - printf ("\texplicit backtrace:\n"); do_backtrace (); - - if (verbose) - printf ("\n\tvia backtrace():\n"); - n = backtrace (buffer, 20); - if (verbose) - for (i = 0; i < n; ++i) - printf ("[%d] ip=%p\n", i, buffer[i]); } void