Changeset View
Standalone View
cddl/contrib/opensolaris/tools/ctf/dump/dump.c
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
} flags = 0; | } flags = 0; | ||||
static struct { | static struct { | ||||
ulong_t s_ndata; /* total number of data objects */ | ulong_t s_ndata; /* total number of data objects */ | ||||
ulong_t s_nfunc; /* total number of functions */ | ulong_t s_nfunc; /* total number of functions */ | ||||
ulong_t s_nargs; /* total number of function arguments */ | ulong_t s_nargs; /* total number of function arguments */ | ||||
ulong_t s_argmax; /* longest argument list */ | ulong_t s_argmax; /* longest argument list */ | ||||
ulong_t s_ntypes; /* total number of types */ | ulong_t s_ntypes; /* total number of types */ | ||||
ulong_t s_types[16]; /* number of types by kind */ | ulong_t s_types[CTF_K_MAX+1]; /* number of types by kind */ | ||||
ulong_t s_nsmem; /* total number of struct members */ | ulong_t s_nsmem; /* total number of struct members */ | ||||
ulong_t s_nsbytes; /* total size of all structs */ | ulong_t s_nsbytes; /* total size of all structs */ | ||||
ulong_t s_smmax; /* largest struct in terms of members */ | ulong_t s_smmax; /* largest struct in terms of members */ | ||||
ulong_t s_sbmax; /* largest struct in terms of bytes */ | ulong_t s_sbmax; /* largest struct in terms of bytes */ | ||||
ulong_t s_numem; /* total number of union members */ | ulong_t s_numem; /* total number of union members */ | ||||
ulong_t s_nubytes; /* total size of all unions */ | ulong_t s_nubytes; /* total size of all unions */ | ||||
ulong_t s_ummax; /* largest union in terms of members */ | ulong_t s_ummax; /* largest union in terms of members */ | ||||
ulong_t s_ubmax; /* largest union in terms of bytes */ | ulong_t s_ubmax; /* largest union in terms of bytes */ | ||||
▲ Show 20 Lines • Show All 516 Lines • ▼ Show 20 Lines | for (/* */; tp < end; id++) { | ||||
case CTF_K_RESTRICT: | case CTF_K_RESTRICT: | ||||
if (flags != F_STATS) { | if (flags != F_STATS) { | ||||
(void) printf("RESTRICT %s refers to %u", | (void) printf("RESTRICT %s refers to %u", | ||||
ref_to_str(tp->ctt_name, hp, cd), | ref_to_str(tp->ctt_name, hp, cd), | ||||
tp->ctt_type); | tp->ctt_type); | ||||
} | } | ||||
break; | break; | ||||
case CTF_K_CONSTVAL: | |||||
if (flags != F_STATS) { | |||||
int64_t decoded; | |||||
switch (n) { | |||||
case 0: | |||||
decoded = 0; | |||||
break; | |||||
case 4: { | |||||
int32_t dec32; | |||||
memcpy(&dec32, u.ptr, sizeof(dec32)); | |||||
decoded = dec32; | |||||
} | |||||
break; | |||||
case 8: | |||||
memcpy(&decoded, u.ptr, sizeof(decoded)); | |||||
break; | |||||
default: | |||||
printf("invalid constval size %lu\n", | |||||
n); | |||||
return (E_ERROR); | |||||
} | |||||
(void) printf("CONSTVAL '%jd' (0x%jx) of type:" | |||||
markj: "refers to:" sounds a bit odd to me. May "of type:"? | |||||
Done Inline ActionsIt's following the existing convention as far as printing the reference to the next type in the CTF typechain. ctt_name is always "(anon)" except for typedefs, AFAICT.
A CONSTVAL points to some arbitrary other type, which may referentially point to any number of other types. All of the types in the chain together describe the type of the value. So I'm not sure "CONSTVAL 7 of type: 23" makes too much more sense than "CONSTVAL 7 refers to 23", given the existing pattern. cem: It's following the existing convention as far as printing the reference to the next type in the… | |||||
Done Inline ActionsRight, but POINTER, CONST, etc., are qualifiers which necessarily refer to another type. CONSTVALs are instances of a type. I don't feel strongly about it, but I don't think there's a pattern to follow here. markj: Right, but POINTER, CONST, etc., are qualifiers which necessarily refer to another type. | |||||
Done Inline ActionsThat's reasonable. I'll spend a few minutes and see if I can come up with anything I like better; otherwise steal your suggestion directly. cem: That's reasonable. I'll spend a few minutes and see if I can come up with anything I like… | |||||
Not Done Inline ActionsThanks. markj: Thanks. | |||||
" %u", (intmax_t)decoded, | |||||
(intmax_t)decoded, tp->ctt_type); | |||||
} | |||||
vlen = roundup2(n, 4); | |||||
break; | |||||
case CTF_K_UNKNOWN: | case CTF_K_UNKNOWN: | ||||
break; /* hole in type id space */ | break; /* hole in type id space */ | ||||
default: | default: | ||||
(void) printf("unexpected kind %u\n", kind); | (void) printf("unexpected kind %u\n", kind); | ||||
return (E_ERROR); | return (E_ERROR); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | print_stats(void) | ||||
long_stat("total number of enums", stats.s_types[CTF_K_ENUM]); | long_stat("total number of enums", stats.s_types[CTF_K_ENUM]); | ||||
long_stat("total number of forward tags", stats.s_types[CTF_K_FORWARD]); | long_stat("total number of forward tags", stats.s_types[CTF_K_FORWARD]); | ||||
long_stat("total number of typedefs", stats.s_types[CTF_K_TYPEDEF]); | long_stat("total number of typedefs", stats.s_types[CTF_K_TYPEDEF]); | ||||
long_stat("total number of volatile types", | long_stat("total number of volatile types", | ||||
stats.s_types[CTF_K_VOLATILE]); | stats.s_types[CTF_K_VOLATILE]); | ||||
long_stat("total number of const types", stats.s_types[CTF_K_CONST]); | long_stat("total number of const types", stats.s_types[CTF_K_CONST]); | ||||
long_stat("total number of restrict types", | long_stat("total number of restrict types", | ||||
stats.s_types[CTF_K_RESTRICT]); | stats.s_types[CTF_K_RESTRICT]); | ||||
long_stat("total number of constval types", | |||||
stats.s_types[CTF_K_CONSTVAL]); | |||||
long_stat("total number of unknowns (holes)", | long_stat("total number of unknowns (holes)", | ||||
stats.s_types[CTF_K_UNKNOWN]); | stats.s_types[CTF_K_UNKNOWN]); | ||||
(void) printf("\n"); | (void) printf("\n"); | ||||
long_stat("total number of struct members", stats.s_nsmem); | long_stat("total number of struct members", stats.s_nsmem); | ||||
long_stat("maximum number of struct members", stats.s_smmax); | long_stat("maximum number of struct members", stats.s_smmax); | ||||
long_stat("total size of all structs", stats.s_nsbytes); | long_stat("total size of all structs", stats.s_nsbytes); | ||||
▲ Show 20 Lines • Show All 310 Lines • Show Last 20 Lines |
"refers to:" sounds a bit odd to me. May "of type:"?