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>

*** 8,18 **** * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* ! * Copyright (c) 2019, Joyent, Inc. */ /* * Check that we properly understand reference types and can walk through them * as well as generate them. --- 8,18 ---- * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* ! * Copyright 2019, Joyent, Inc. */ /* * Check that we properly understand reference types and can walk through them * as well as generate them.
*** 129,150 **** { "const char", CTF_K_CONST }, { "char", CTF_K_INTEGER }, { NULL } }; - static check_descent_t check_descent_cvh[] = { - { "const volatile foo_t *", CTF_K_POINTER }, - { "const volatile foo_t", CTF_K_CONST }, - { "volatile foo_t", CTF_K_VOLATILE }, - { "foo_t", CTF_K_TYPEDEF }, - { "int *const *", CTF_K_POINTER }, - { "int *const", CTF_K_CONST }, - { "int *", CTF_K_POINTER }, - { "int", CTF_K_INTEGER }, - { NULL } - }; - static check_descent_test_t descents[] = { { "aa", check_descent_aa }, { "b", check_descent_b }, { "c", check_descent_c }, { "d", check_descent_d }, --- 129,138 ----
*** 154,167 **** { "ce", check_descent_ce }, { "ve", check_descent_ve }, { "cve", check_descent_cve }, { "f", check_descent_f }, { "g", check_descent_g }, - { "cvh", check_descent_cvh }, { NULL } }; int main(int argc, char *argv[]) { int i, ret = 0; --- 142,188 ---- { "ce", check_descent_ce }, { "ve", check_descent_ve }, { "cve", check_descent_cve }, { "f", check_descent_f }, { "g", check_descent_g }, { NULL } }; + static check_descent_t check_descent_cvh_gcc4[] = { + { "const volatile foo_t *", CTF_K_POINTER }, + { "const volatile foo_t", CTF_K_CONST }, + { "volatile foo_t", CTF_K_VOLATILE }, + { "foo_t", CTF_K_TYPEDEF }, + { "int *const *", CTF_K_POINTER }, + { "int *const", CTF_K_CONST }, + { "int *", CTF_K_POINTER }, + { "int", CTF_K_INTEGER }, + { NULL } + }; + + static check_descent_t check_descent_cvh_gcc7[] = { + { "volatile const foo_t *", CTF_K_POINTER }, + { "volatile const foo_t", CTF_K_VOLATILE }, + { "const foo_t", CTF_K_CONST }, + { "foo_t", CTF_K_TYPEDEF }, + { "int *const *", CTF_K_POINTER }, + { "int *const", CTF_K_CONST }, + { "int *", CTF_K_POINTER }, + { "int", CTF_K_INTEGER }, + { NULL } + }; + + /* + * GCC versions differ in how they order qualifiers, which is a shame for + * round-tripping; but as they're clearly both valid, we should cope. We'll + * just insist that at least one of these checks passes. + */ + static check_descent_test_t alt_descents[] = { + { "cvh", check_descent_cvh_gcc4 }, + { "cvh", check_descent_cvh_gcc7 }, + }; + int main(int argc, char *argv[]) { int i, ret = 0;
*** 169,178 **** --- 190,200 ---- errx(EXIT_FAILURE, "missing test files"); } for (i = 1; i < argc; i++) { ctf_file_t *fp; + int alt_ok = 0; uint_t d; if ((fp = ctf_open(argv[i], &ret)) == NULL) { warnx("failed to open %s: %s", argv[i], ctf_errmsg(ret));
*** 184,197 **** ret = EXIT_FAILURE; if (!ctftest_check_symbols(fp, check_syms)) ret = EXIT_FAILURE; for (d = 0; descents[d].cdt_sym != NULL; d++) { if (!ctftest_check_descent(descents[d].cdt_sym, fp, ! descents[d].cdt_tests)) { ret = EXIT_FAILURE; } } ctf_close(fp); } return (ret); } --- 206,234 ---- ret = EXIT_FAILURE; if (!ctftest_check_symbols(fp, check_syms)) ret = EXIT_FAILURE; for (d = 0; descents[d].cdt_sym != NULL; d++) { if (!ctftest_check_descent(descents[d].cdt_sym, fp, ! descents[d].cdt_tests, B_FALSE)) { ret = EXIT_FAILURE; } } + + for (d = 0; alt_descents[d].cdt_sym != NULL; d++) { + if (ctftest_check_descent(alt_descents[d].cdt_sym, fp, + alt_descents[d].cdt_tests, B_TRUE)) { + alt_ok = 1; + break; + } + } + + if (!alt_ok) { + warnx("all descents failed for %s", + alt_descents[0].cdt_sym); + ret = EXIT_FAILURE; + } + ctf_close(fp); } return (ret); }