Module Name: src
Committed By: joerg
Date: Tue Mar 11 13:43:23 UTC 2014
Modified Files:
src/tests/lib/libexecinfo: t_backtrace.c
Log Message:
Use a struct for pair of frame name and whether it is optional. Add some
additional entries found in a -O0 build of ATF on PowerPC.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libexecinfo/t_backtrace.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libexecinfo/t_backtrace.c
diff -u src/tests/lib/libexecinfo/t_backtrace.c:1.12 src/tests/lib/libexecinfo/t_backtrace.c:1.13
--- src/tests/lib/libexecinfo/t_backtrace.c:1.12 Sat Jan 11 19:48:22 2014
+++ src/tests/lib/libexecinfo/t_backtrace.c Tue Mar 11 13:43:23 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: t_backtrace.c,v 1.12 2014/01/11 19:48:22 martin Exp $ */
+/* $NetBSD: t_backtrace.c,v 1.13 2014/03/11 13:43:23 joerg Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_backtrace.c,v 1.12 2014/01/11 19:48:22 martin Exp $");
+__RCSID("$NetBSD: t_backtrace.c,v 1.13 2014/03/11 13:43:23 joerg Exp $");
#include <atf-c.h>
#include <atf-c/config.h>
@@ -53,19 +53,28 @@ volatile int prevent_inline;
void
myfunc3(size_t ncalls)
{
- static const char *top[] = { "myfunc", "atfu_backtrace_fmt_basic_body",
- "atf_tc_run", "atf_tp_run", "atf_tp_main", "main", "___start" };
- static bool optional_frame[] = { false, false, false, true, false,
- true, true };
+ static const struct {
+ const char *name;
+ bool is_optional;
+ } frames[] = {
+ { "myfunc", false },
+ { "atfu_backtrace_fmt_basic_body", false },
+ { "atf_tc_run", false },
+ { "atf_tp_run", true },
+ { "run_tc", true },
+ { "controlled_main", true },
+ { "atf_tp_main", false },
+ { "main", true },
+ { "___start", true },
+ };
size_t j, nptrs, min_frames, max_frames;
void *buffer[ncalls + 10];
char **strings;
- __CTASSERT(__arraycount(top) == __arraycount(optional_frame));
min_frames = 0;
max_frames = 0;
- for (j = 0; j < __arraycount(optional_frame); ++j) {
- if (!optional_frame[j])
+ for (j = 0; j < __arraycount(frames); ++j) {
+ if (!frames[j].is_optional)
++min_frames;
++max_frames;
}
@@ -90,11 +99,12 @@ myfunc3(size_t ncalls)
ATF_CHECK_STREQ(strings[j], "myfunc1");
for (size_t i = 0; j < nptrs; i++, j++) {
- if (optional_frame[i] && strcmp(strings[j], top[i])) {
+ if (frames[i].is_optional &&
+ strcmp(strings[j], frames[i].name)) {
--i;
continue;
}
- ATF_CHECK_STREQ(strings[j], top[i]);
+ ATF_CHECK_STREQ(strings[j], frames[i].name);
}
free(strings);