Browse Source

configurator: HAVE_BACKTRACE

Rusty Russell 14 years ago
parent
commit
53de95c6ad
2 changed files with 7 additions and 0 deletions
  1. 1 0
      config.h
  2. 6 0
      tools/configurator/configurator.c

+ 1 - 0
config.h

@@ -17,6 +17,7 @@
 #define HAVE_ATTRIBUTE_PRINTF 1
 #define HAVE_ATTRIBUTE_UNUSED 1
 #define HAVE_ATTRIBUTE_USED 1
+#define HAVE_BACKTRACE 1
 #define HAVE_BIG_ENDIAN 0
 #define HAVE_BSWAP_64 1
 #define HAVE_BUILTIN_CHOOSE_EXPR 1

+ 6 - 0
tools/configurator/configurator.c

@@ -89,6 +89,12 @@ static struct test tests[] = {
 	  "static int __attribute__((unused)) func(int x) { return x; }" },
 	{ "HAVE_ATTRIBUTE_USED", OUTSIDE_MAIN, NULL,
 	  "static int __attribute__((used)) func(int x) { return x; }" },
+	{ "HAVE_BACKTRACE", DEFINES_FUNC, NULL,
+	  "#include <execinfo.h>\n"
+	  "static int func(int x) {"
+	  "	void *bt[10];\n"
+	  "	return backtrace(bt, 10) < x;\n"
+	  "}" },
 	{ "HAVE_BIG_ENDIAN", INSIDE_MAIN|EXECUTE, NULL,
 	  "union { int i; char c[sizeof(int)]; } u;\n"
 	  "u.i = 0x01020304;\n"