Print this page
10823 should ignore DW_TAG_subprogram with DW_AT_declaration tags
10824 GCC7-derived CTF can double qualifiers on arrays
10825 ctfdump -c drops last type
10826 ctfdump -c goes off the rails with a missing parent
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Jason King <jason.king@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/test/util-tests/tests/ctf/check-forward.c
+++ new/usr/src/test/util-tests/tests/ctf/check-forward.c
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 - * Copyright (c) 2019, Joyent, Inc.
13 + * Copyright 2019, Joyent, Inc.
14 14 */
15 15
16 16 /*
17 17 * Verify that we can properly handle forward declarations.
18 18 *
19 19 * In test-forward.c barp is declared as a union, not a struct. However, today
20 20 * the CTF tooling does not contain enough information to know whether a forward
21 21 * declaration was for a struct or a union, only that it was a forward.
22 22 * Therefore, the type printing information assumes at the moment that the type
23 23 * is a struct. In a future revision of the CTF type data, we should encode this
24 24 * information in the equivalent of ctt_info so we can properly distinguish
25 25 * between these.
26 26 */
27 27
28 28 #include "check-common.h"
29 29
30 30 static check_symbol_t check_syms[] = {
31 31 { "forward", "struct forward" },
32 32 { "foop", "struct foo *" },
33 33 { "barp", "struct bar *" },
34 34 { "bazp", "enum baz *" },
35 35 { NULL }
36 36 };
37 37
38 38 static check_member_t check_member_forward[] = {
39 39 #ifdef TARGET_LP64
40 40 { "prev", "struct foo *", 0 },
41 41 { "next", "struct foo *", 8 * NBBY },
42 42 { "data", "struct bar *", 16 * NBBY },
43 43 { "tag", "enum baz *", 24 * NBBY },
44 44 #else
45 45 { "prev", "struct foo *", 0 },
46 46 { "next", "struct foo *", 4 * NBBY },
47 47 { "data", "struct bar *", 8 * NBBY },
48 48 { "tag", "enum baz *", 12 * NBBY },
49 49 #endif
50 50 { NULL }
51 51 };
52 52
53 53
54 54 static check_member_test_t members[] = {
55 55 #ifdef TARGET_LP64
56 56 { "struct forward", CTF_K_STRUCT, 32, check_member_forward },
57 57 #else
58 58 { "struct forward", CTF_K_STRUCT, 16, check_member_forward },
59 59 #endif
60 60 { NULL }
61 61 };
62 62
63 63 static check_descent_t check_descent_foo[] = {
64 64 { "struct foo *", CTF_K_POINTER },
65 65 { "struct foo", CTF_K_FORWARD },
66 66 { NULL }
67 67 };
68 68
69 69 static check_descent_t check_descent_bar[] = {
70 70 { "struct bar *", CTF_K_POINTER },
71 71 { "struct bar", CTF_K_FORWARD },
72 72 { NULL }
73 73 };
74 74
75 75 static check_descent_t check_descent_baz[] = {
76 76 { "enum baz *", CTF_K_POINTER },
77 77 { "enum baz", CTF_K_ENUM },
78 78 { NULL }
79 79 };
80 80
81 81 static check_descent_test_t descents[] = {
82 82 { "foop", check_descent_foo },
83 83 { "barp", check_descent_bar },
84 84 { "bazp", check_descent_baz },
85 85 { NULL }
86 86 };
87 87 int
88 88 main(int argc, char *argv[])
89 89 {
90 90 int i, ret = 0;
91 91
92 92 if (argc < 2) {
93 93 errx(EXIT_FAILURE, "missing test files");
94 94 }
95 95
96 96 for (i = 1; i < argc; i++) {
97 97 ctf_file_t *fp;
98 98 uint_t j;
99 99
100 100 if ((fp = ctf_open(argv[i], &ret)) == NULL) {
101 101 warnx("failed to open %s: %s", argv[i],
↓ open down ↓ |
78 lines elided |
↑ open up ↑ |
102 102 ctf_errmsg(ret));
103 103 ret = EXIT_FAILURE;
104 104 continue;
105 105 }
106 106
107 107 if (!ctftest_check_symbols(fp, check_syms))
108 108 ret = EXIT_FAILURE;
109 109
110 110 for (j = 0; descents[j].cdt_sym != NULL; j++) {
111 111 if (!ctftest_check_descent(descents[j].cdt_sym, fp,
112 - descents[j].cdt_tests)) {
112 + descents[j].cdt_tests, B_FALSE)) {
113 113 ret = EXIT_FAILURE;
114 114 }
115 115 }
116 116
117 117
118 118 for (j = 0; members[j].cmt_type != NULL; j++) {
119 119 if (!ctftest_check_members(members[j].cmt_type, fp,
120 120 members[j].cmt_kind, members[j].cmt_size,
121 121 members[j].cmt_members)) {
122 122 ret = EXIT_FAILURE;
123 123 }
124 124 }
125 125
126 126 ctf_close(fp);
127 127 }
128 128
129 129 return (ret);
130 130 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX