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.
*/
/*
* Collection of common utilities for CTF testing.
*/
--- 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.
*/
/*
* Collection of common utilities for CTF testing.
*/
*** 246,256 ****
}
boolean_t
ctftest_check_descent(const char *symbol, ctf_file_t *fp,
! const check_descent_t *tests)
{
ctf_id_t base;
uint_t layer = 0;
/*
--- 246,256 ----
}
boolean_t
ctftest_check_descent(const char *symbol, ctf_file_t *fp,
! const check_descent_t *tests, boolean_t quiet)
{
ctf_id_t base;
uint_t layer = 0;
/*
*** 266,334 ****
ctf_id_t tid;
int kind;
ctf_arinfo_t ari;
if (base == CTF_ERR) {
! warnx("encountered non-reference type at layer %u "
! "while still expecting type %s for symbol %s",
! layer, tests->cd_tname, symbol);
return (B_FALSE);
}
tid = ctftest_lookup_type(fp, tests->cd_tname);
if (tid == CTF_ERR) {
! warnx("failed to lookup type %s", tests->cd_tname);
return (B_FALSE);
}
if (tid != base) {
! warnx("type mismatch at layer %u: found id %u, but "
! "expecting type id %u for type %s, symbol %s",
! layer, base, tid, tests->cd_tname, symbol);
return (B_FALSE);
}
kind = ctf_type_kind(fp, base);
if (kind != tests->cd_kind) {
! warnx("type kind mismatch at layer %u: found kind %u, "
! "but expected kind %u for %s, symbol %s", layer,
! kind, tests->cd_kind, tests->cd_tname, symbol);
return (B_FALSE);
}
switch (kind) {
case CTF_K_ARRAY:
if (ctf_array_info(fp, base, &ari) == CTF_ERR) {
! warnx("failed to lookup array info at layer "
! "%u for type %s, symbol %s: %s", base,
! tests->cd_tname, symbol,
! ctf_errmsg(ctf_errno(fp)));
return (B_FALSE);
}
if (tests->cd_nents != ari.ctr_nelems) {
! warnx("array element mismatch at layer %u "
! "for type %s, symbol %s: found %u, "
! "expected %u", layer, tests->cd_tname,
! symbol, ari.ctr_nelems, tests->cd_nents);
return (B_FALSE);
}
tid = ctftest_lookup_type(fp, tests->cd_contents);
if (tid == CTF_ERR) {
warnx("failed to look up type %s",
tests->cd_contents);
return (B_FALSE);
}
if (ari.ctr_contents != tid) {
! warnx("array contents mismatch at layer %u "
! "for type %s, symbol %s: found %u, "
! "expected %s/%u", layer, tests->cd_tname,
! symbol, ari.ctr_contents,
tests->cd_contents, tid);
!
return (B_FALSE);
}
base = ari.ctr_contents;
break;
default:
--- 266,355 ----
ctf_id_t tid;
int kind;
ctf_arinfo_t ari;
if (base == CTF_ERR) {
! if (!quiet) {
! warnx("encountered non-reference type at layer "
! "%u while still expecting type %s for "
! "symbol %s", layer,
! tests->cd_tname, symbol);
! }
return (B_FALSE);
}
tid = ctftest_lookup_type(fp, tests->cd_tname);
if (tid == CTF_ERR) {
! if (!quiet) {
! warnx("failed to lookup type %s",
! tests->cd_tname);
! }
return (B_FALSE);
}
if (tid != base) {
! if (!quiet) {
! warnx("type mismatch at layer %u: found id %u, "
! "but expecting type id %u for type %s, "
! "symbol %s", layer, base, tid,
! tests->cd_tname, symbol);
! }
return (B_FALSE);
}
kind = ctf_type_kind(fp, base);
if (kind != tests->cd_kind) {
! if (!quiet) {
! warnx("type kind mismatch at layer %u: found "
! "kind %u, but expected kind %u for %s, "
! "symbol %s", layer, kind, tests->cd_kind,
! tests->cd_tname, symbol);
! }
return (B_FALSE);
}
switch (kind) {
case CTF_K_ARRAY:
if (ctf_array_info(fp, base, &ari) == CTF_ERR) {
! if (!quiet) {
! warnx("failed to lookup array info at "
! "layer %u for type %s, symbol "
! "%s: %s", base, tests->cd_tname,
! symbol, ctf_errmsg(ctf_errno(fp)));
! }
return (B_FALSE);
}
if (tests->cd_nents != ari.ctr_nelems) {
! if (!quiet) {
! warnx("array element mismatch at layer "
! "%u for type %s, symbol %s: found "
! "%u, expected %u", layer,
! tests->cd_tname, symbol,
! ari.ctr_nelems, tests->cd_nents);
! }
return (B_FALSE);
}
tid = ctftest_lookup_type(fp, tests->cd_contents);
if (tid == CTF_ERR) {
+ if (!quiet) {
warnx("failed to look up type %s",
tests->cd_contents);
+ }
return (B_FALSE);
}
if (ari.ctr_contents != tid) {
! if (!quiet) {
! warnx("array contents mismatch at "
! "layer %u for type %s, symbol %s: "
! "found %u, expected %s/%u", layer,
! tests->cd_tname, symbol,
! ari.ctr_contents,
tests->cd_contents, tid);
! }
return (B_FALSE);
}
base = ari.ctr_contents;
break;
default:
*** 339,350 ****
tests++;
layer++;
}
if (base != CTF_ERR) {
! warnx("found additional type %u in chain, but expected no more",
! base);
return (B_FALSE);
}
return (B_TRUE);
}
--- 360,373 ----
tests++;
layer++;
}
if (base != CTF_ERR) {
! if (!quiet) {
! warnx("found additional type %u in chain, "
! "but expected no more", base);
! }
return (B_FALSE);
}
return (B_TRUE);
}