From 32202619c42f58a9dac6eee3b9a4c231f1ce394a Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Sat, 4 Aug 2012 17:58:24 -0700 Subject: [PATCH] Fix a test failure The test contains hints to users of unw_backtrace() and friends on how to ensure correctness in a multi-threaded program --- tests/Gtest-nocalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Gtest-nocalloc.c b/tests/Gtest-nocalloc.c index 6f61b96c..cf1d3f7c 100644 --- a/tests/Gtest-nocalloc.c +++ b/tests/Gtest-nocalloc.c @@ -108,7 +108,6 @@ void foo1 (void) { foo2 (); - return NULL; } int @@ -123,6 +122,10 @@ main (int argc, char **argv) if (pthread_key_create (&key, NULL)) panic ("FAILURE: unable to create key %d\n", i); } + /* Call backtrace right after thread creation, + * where we are sure that we're not inside malloc */ + do_backtrace(); + num_mallocs = num_callocs = 0; foo1 (); num_errors = num_mallocs + num_callocs; if (num_errors > 0)