diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/ctfdump/ctfdump.c | 7 | ||||
-rw-r--r-- | usr/src/common/ctf/ctf_types.c | 5 | ||||
-rw-r--r-- | usr/src/lib/libctf/common/ctf_dwarf.c | 11 | ||||
-rw-r--r-- | usr/src/man/man1/ctfdump.1 | 16 | ||||
-rw-r--r-- | usr/src/tools/ctf/common/ctf_headers.h | 9 |
5 files changed, 41 insertions, 7 deletions
diff --git a/usr/src/cmd/ctfdump/ctfdump.c b/usr/src/cmd/ctfdump/ctfdump.c index 65e393ccf2..ad5ef02d7c 100644 --- a/usr/src/cmd/ctfdump/ctfdump.c +++ b/usr/src/cmd/ctfdump/ctfdump.c @@ -725,7 +725,12 @@ ctfsrc_member_cb(const char *member, ctf_id_t type, ulong_t off, void *arg) (void) snprintf(name, sizeof (name), "unknown_t %s", member); } - (void) printf("\t%s; /* offset: 0x%lx bytes */\n", name, off); + /* + * Yes, the offset is wrong for bitfields, but in general byte offset is + * much friendlier; they can always check the traditional ctfdump output + * if needed. + */ + (void) printf("\t%s; /* offset: 0x%lx bytes */\n", name, off / NBBY); return (0); } diff --git a/usr/src/common/ctf/ctf_types.c b/usr/src/common/ctf/ctf_types.c index e3bd679a28..71c32f953e 100644 --- a/usr/src/common/ctf/ctf_types.c +++ b/usr/src/common/ctf/ctf_types.c @@ -256,9 +256,10 @@ ctf_format_func(ctf_file_t *fp, ctf_decl_t *cd, goto out; for (size_t i = 0; i < fi.ctc_argc; i++) { - char aname[512] = "unknown_t"; + char aname[512]; - (void) ctf_type_name(fp, args[i], aname, sizeof (aname)); + if (ctf_type_name(fp, args[i], aname, sizeof (aname)) != 0) + (void) strlcpy(aname, "unknown_t", sizeof (aname)); ctf_decl_sprintf(cd, "%s%s", aname, i + 1 == fi.ctc_argc ? "" : ", "); diff --git a/usr/src/lib/libctf/common/ctf_dwarf.c b/usr/src/lib/libctf/common/ctf_dwarf.c index db9415b60e..f490c8f351 100644 --- a/usr/src/lib/libctf/common/ctf_dwarf.c +++ b/usr/src/lib/libctf/common/ctf_dwarf.c @@ -1604,11 +1604,16 @@ ctf_dwarf_create_enum(ctf_die_t *cdp, Dwarf_Die die, ctf_id_t *idp, int isroot) eval = sval; } - if (ret != 0) - return (ret); + if (ret != 0) { + if (ret != ENOENT) + return (ret); - ret = ctf_add_enumerator(cdp->cd_ctfp, id, name, eval); + (void) snprintf(cdp->cd_errbuf, cdp->cd_errlen, + "encountered enumeration without constant value\n"); + return (ECTF_CONVBKERR); + } + ret = ctf_add_enumerator(cdp->cd_ctfp, id, name, eval); if (ret == CTF_ERR) { (void) snprintf(cdp->cd_errbuf, cdp->cd_errlen, "failed to add enumarator %s (%d) to %d\n", diff --git a/usr/src/man/man1/ctfdump.1 b/usr/src/man/man1/ctfdump.1 index 1fc8522cd7..b80c856eaf 100644 --- a/usr/src/man/man1/ctfdump.1 +++ b/usr/src/man/man1/ctfdump.1 @@ -417,6 +417,22 @@ $ mdb ./ctf.out cth_strlen = 0x7c9c } .Ed +.Lp +.Sy Example 3 +Dumping C-style output +.Bd -literal -offset 6n +$ ctfdump -c ./genunix | more +/* Types */ + +typedef Elf64_Addr Addr; + +typedef unsigned char Bool; + +typedef struct CK_AES_CCM_PARAMS CK_AES_CCM_PARAMS; + +typedef struct CK_AES_GCM_PARAMS CK_AES_GCM_PARAMS; +\&... +.Ed .Sh INTERFACE STABILITY The command syntax is .Sy Committed . diff --git a/usr/src/tools/ctf/common/ctf_headers.h b/usr/src/tools/ctf/common/ctf_headers.h index a63690be77..7cad0d2a27 100644 --- a/usr/src/tools/ctf/common/ctf_headers.h +++ b/usr/src/tools/ctf/common/ctf_headers.h @@ -22,6 +22,7 @@ /* * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2018 Joyent, Inc. */ #ifndef _CTF_HEADERS_H @@ -32,7 +33,7 @@ * the tools need to include the headers installed on the build system, * rather than those in the ON source tree. However, some of the headers * required by the tools are part of the ON source tree, but not delivered - * as part of Solaris. These include the following: + * as part of illumos. These include the following: * * $(SRC)/lib/libctf/common/libctf.h * $(SRC)/lib/libctf/common/libctf_impl.h @@ -62,8 +63,14 @@ * This last -I include is needed in order to prevent a build failure * when <sys/ctf_api.h> is included via a nested #include rather than * an explicit path #include. + * + * Finally, to make life easier, we also include the current definitions of the + * ccompile.h and sysmacros.h headers to make it so we have to rely less on the + * build system contents. */ +#include <uts/common/sys/sysmacros.h> +#include <uts/common/sys/ccompile.h> #include <uts/common/sys/ctf.h> #include <uts/common/sys/ctf_api.h> #include <common/ctf/ctf_impl.h> |