summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/cmd/sgs/elfdump/Makefile.targ32
-rw-r--r--usr/src/cmd/sgs/elfdump/amd64/Makefile3
-rw-r--r--usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c58
-rw-r--r--usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c467
-rw-r--r--usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c2
-rw-r--r--usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c2
-rw-r--r--usr/src/cmd/sgs/elfdump/i386/Makefile4
-rw-r--r--usr/src/cmd/sgs/elfdump/sparc/Makefile4
-rw-r--r--usr/src/cmd/sgs/elfdump/sparcv9/Makefile3
9 files changed, 480 insertions, 95 deletions
diff --git a/usr/src/cmd/sgs/elfdump/Makefile.targ b/usr/src/cmd/sgs/elfdump/Makefile.targ
index 5eda4d1b47..8f30f5614c 100644
--- a/usr/src/cmd/sgs/elfdump/Makefile.targ
+++ b/usr/src/cmd/sgs/elfdump/Makefile.targ
@@ -23,7 +23,7 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
+# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
%.o: ../common/%.c
@@ -42,18 +42,36 @@
$(COMPILE.c) -o $@ $<
$(POST_PROCESS_O)
-gen_struct_layout: ../common/gen_struct_layout.c
- $(NATIVECC) $(NATIVECC_CFLAGS) $(CFLAGS) -o $@ \
- ../common/gen_struct_layout.c
+all: $(PROG)
-$(PROG): $(OBJS) $(MAPFILE) gen_struct_layout
+$(PROG): $(OBJS) $(MAPFILE) check_struct_layout
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
$(POST_PROCESS)
-all: $(PROG)
+check_struct_layout: gen_struct_layout gen_layout_obj.o
+ sed -e '/^#include <struct_layout.h>/q' \
+ ../common/struct_layout_$(ARCH).c | sed -e '$$d' \
+ > struct_layout_$(ARCH).tmp
+ ./gen_struct_layout gen_layout_obj.o $(ARCH) \
+ >> struct_layout_$(ARCH).tmp
+ diff -u struct_layout_$(ARCH).tmp \
+ ../common/struct_layout_$(ARCH).c ||\
+ { echo "Error: struct_layout_$(ARCH).c needs update!" ; exit 1; }
+ touch check_struct_layout
+
+# We need CTF data in this object.
+gen_layout_obj.o := CFLAGS += $(CTF_FLAGS)
+gen_layout_obj.o := CFLAGS64 += $(CTF_FLAGS)
+gen_layout_obj.o := POST_PROCESS_O = $(CTFCONVERT_O)
+
+gen_struct_layout: ../common/gen_struct_layout.c
+ $(NATIVECC) $(NATIVECC_CFLAGS) -o $@ \
+ ../common/gen_struct_layout.c -lctf
clean:
- $(RM) $(OBJS) $(CLEANFILES)
+ $(RM) $(OBJS) $(CLEANFILES) gen_struct_layout \
+ check_struct_layout gen_layout_obj.o \
+ struct_layout_$(ARCH).tmp
delete:
$(RM) $(PROG)
diff --git a/usr/src/cmd/sgs/elfdump/amd64/Makefile b/usr/src/cmd/sgs/elfdump/amd64/Makefile
index 906b6b6754..be0f2c33f6 100644
--- a/usr/src/cmd/sgs/elfdump/amd64/Makefile
+++ b/usr/src/cmd/sgs/elfdump/amd64/Makefile
@@ -23,13 +23,12 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
include ../Makefile.com
.KEEP_STATE:
+ARCH = amd64
LLDFLAGS = $(LLDFLAGS64)
ELFLIBDIR = $(ELFLIBDIR64)
LDDBGLIBDIR = $(LDDBGLIBDIR64)
diff --git a/usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c b/usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c
new file mode 100644
index 0000000000..43c195e0e5
--- /dev/null
+++ b/usr/src/cmd/sgs/elfdump/common/gen_layout_obj.c
@@ -0,0 +1,58 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
+/*
+ * A little program who's only purpose is to get all the
+ * CTF type information we want into an object.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <sys/corectl.h>
+#define _STRUCTURED_PROC 1
+#include <sys/procfs.h>
+#include <sys/auxv.h>
+#include <sys/old_procfs.h>
+#include <sys/utsname.h>
+
+/* prgregset_t is a define on intel */
+#ifdef prgregset_t
+typedef prgregset_t
+#undef prgregset_t
+ prgregset_t;
+#endif
+
+/* instantiate the types for CTF */
+auxv_t auxv;
+prgregset_t prgregset;
+lwpstatus_t lwpstatus;
+pstatus_t pstatus;
+prstatus_t prstatus;
+psinfo_t psinfo;
+prpsinfo_t prpsinfo;
+lwpsinfo_t lwpsinfo;
+prcred_t prcred;
+prpriv_t prpriv;
+priv_impl_info_t priv_impl;
+fltset_t fltset;
+siginfo_t siginfo;
+sigset_t sigset;
+struct sigaction sigact;
+stack_t stack;
+sysset_t sysset;
+timestruc_t ts;
+struct utsname uts;
+prfdinfo_t ptfd;
diff --git a/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c b/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
index dba807dcd6..67d5378db3 100644
--- a/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
+++ b/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
@@ -22,28 +22,13 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/sysmacros.h>
-#include <sys/corectl.h>
-#include <procfs.h>
-#include <sys/auxv.h>
-#include <sys/old_procfs.h>
-#include <sys/utsname.h>
-
-
-
/*
- * This standalone program is used to generate the contents
- * of the struct_layout_XXX.c files that contain per-archtecture
+ * This program is used to generate the contents of the
+ * struct_layout_XXX.c files that contain per-archtecture
* structure layout information.
*
* Although not part of elfdump, it is built by the makefile
@@ -65,34 +50,17 @@
* in struct_layout.c.
*/
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <err.h>
+#include <sys/types.h>
+#include <libctf.h>
/*
- * Which machine is this build for?
- */
-#if defined(__i386)
-
-#define MACH "i386"
-
-#elif defined(__amd64)
-
-#define MACH "amd64"
-
-#elif defined(__sparcv9)
-
-#define MACH "sparcv9"
-
-#elif defined(__sparc)
-
-#define MACH "sparc"
-
-#else
-
-#error "unrecognized build host type"
-
-#endif
-
-
-/*
+ * This extracts CTF information from a temporary object file.
+ *
* START and END bracket a struct layout definition. They issue
* the typedef boilerplate, and the standard first element (sizeof)
* which captures the overall size of the structure.
@@ -101,27 +69,38 @@
*
* ARRAY_FIELD is for array struct fields
*
- * ARRAY is for plain (non-struct) array types
+ * ARRAY_TYPE is for plain (non-struct) array types
*/
#define START(_name, _type) \
- (void) printf("\n\nstatic const sl_" #_name \
- "_layout_t " #_name "_layout = {\n"); \
- (void) printf("\t{ 0,\t%d,\t0,\t0 },\t\t/* sizeof (%s) */\n", \
- sizeof (_type), #_type)
+ do_start(#_name, #_type)
+#define END (void) \
+ do_end()
#define SCALAR_FIELD(_type, _field, _sign) \
- (void) printf("\t{ %d,\t%d,\t0,\t%d },\t\t/* " #_field " */\n", \
- offsetof(_type, _field), sizeof (((_type *)0)->_field), _sign)
+ do_scalar_field(#_type, #_field, _sign, NULL)
+#define SCALAR_FIELD4(_type, _field, _sign, _rtype) \
+ do_scalar_field(#_type, #_field, _sign, _rtype)
#define ARRAY_FIELD(_type, _field, _sign) \
- (void) printf("\t{ %d,\t%d,\t%d,\t%d },\t\t/* " #_field "[] */\n", \
- offsetof(_type, _field), sizeof (((_type *)0)->_field[0]), \
- sizeof (((_type *)0)->_field) / sizeof (((_type *)0)->_field[0]), \
- _sign)
-#define ARRAY(_type, _sign) \
- (void) printf("\t{ 0,\t%d,\t%d,\t%d },\t\t/* elt0 */\n", \
- sizeof (*((_type *)0)[0]), \
- sizeof (_type) / sizeof (*((_type *)0)[0]), _sign)
-#define END (void) printf("};\n")
-
+ do_array_field(#_type, #_field, _sign, NULL)
+#define ARRAY_TYPE(_type, _sign) \
+ do_array_type(#_type, "elt0", _sign)
+
+static void do_start(char *_name, char *_type);
+static void do_end(void);
+static void do_start_name(char *name);
+static void do_start_sizeof(char *_type, char *realtype);
+static void do_scalar_field(char *_type, char *_field,
+ int _sign, char *dotfield);
+static void do_array_field(char *_type, char *_field,
+ int _sign, char *dotfield);
+static void do_array_type(char *_type, char *_field, int _sign);
+
+static void get_ctf_file(char *fname);
+static int get_field_info(char *tname, char *fname, char *dotname,
+ int *offp, int *sizep);
+
+static ctf_file_t *ctf;
+static char *objfile;
+static char *machname;
/* auxv_t, <sys/auxv.h> */
static void
@@ -144,7 +123,7 @@ gen_prgregset(void)
{
START(prgregset, prgregset_t);
- ARRAY(prgregset_t, 0);
+ ARRAY_TYPE(prgregset_t, 0);
END;
}
@@ -454,7 +433,13 @@ gen_fltset(void)
END;
}
-/* Layout description of siginfo_t, <sys/siginfo.h> */
+/*
+ * Layout description of siginfo_t, <sys/siginfo.h>
+ *
+ * Note: many siginfo_t members are #defines mapping to
+ * long dotted members of sub-structs or unions, and
+ * we need the full member spec (with dots) for those.
+ */
static void
gen_siginfo(void)
{
@@ -463,16 +448,36 @@ gen_siginfo(void)
SCALAR_FIELD(siginfo_t, si_signo, 0);
SCALAR_FIELD(siginfo_t, si_errno, 0);
SCALAR_FIELD(siginfo_t, si_code, 1);
- SCALAR_FIELD(siginfo_t, si_value.sival_int, 0);
- SCALAR_FIELD(siginfo_t, si_value.sival_ptr, 0);
- SCALAR_FIELD(siginfo_t, si_pid, 0);
- SCALAR_FIELD(siginfo_t, si_uid, 0);
- SCALAR_FIELD(siginfo_t, si_ctid, 0);
- SCALAR_FIELD(siginfo_t, si_zoneid, 0);
- SCALAR_FIELD(siginfo_t, si_entity, 0);
- SCALAR_FIELD(siginfo_t, si_addr, 0);
- SCALAR_FIELD(siginfo_t, si_status, 0);
- SCALAR_FIELD(siginfo_t, si_band, 0);
+
+ SCALAR_FIELD4(siginfo_t, si_value.sival_int, 0,
+ "__data.__proc.__pdata.__kill.__value.sival_int");
+
+ SCALAR_FIELD4(siginfo_t, si_value.sival_ptr, 0,
+ "__data.__proc.__pdata.__kill.__value.sival_ptr");
+
+ SCALAR_FIELD4(siginfo_t, si_pid, 0,
+ "__data.__proc.__pid");
+
+ SCALAR_FIELD4(siginfo_t, si_uid, 0,
+ "__data.__proc.__pdata.__kill.__uid");
+
+ SCALAR_FIELD4(siginfo_t, si_ctid, 0,
+ "__data.__proc.__ctid");
+
+ SCALAR_FIELD4(siginfo_t, si_zoneid, 0,
+ "__data.__proc.__zoneid");
+
+ SCALAR_FIELD4(siginfo_t, si_entity, 0,
+ "__data.__rctl.__entity");
+
+ SCALAR_FIELD4(siginfo_t, si_addr, 0,
+ "__data.__fault.__addr");
+
+ SCALAR_FIELD4(siginfo_t, si_status, 0,
+ "__data.__proc.__pdata.__cld.__status");
+
+ SCALAR_FIELD4(siginfo_t, si_band, 0,
+ "__data.__file.__band");
END;
}
@@ -496,8 +501,13 @@ gen_sigaction(void)
START(sigaction, struct sigaction);
SCALAR_FIELD(struct sigaction, sa_flags, 0);
- SCALAR_FIELD(struct sigaction, sa_handler, 0);
- SCALAR_FIELD(struct sigaction, sa_sigaction, 0);
+
+ SCALAR_FIELD4(struct sigaction, sa_handler, 0,
+ "_funcptr._handler");
+
+ SCALAR_FIELD4(struct sigaction, sa_sigaction, 0,
+ "_funcptr._sigaction");
+
SCALAR_FIELD(struct sigaction, sa_mask, 0);
END;
@@ -584,7 +594,19 @@ main(int argc, char *argv[])
{
const char *fmt = "\t&%s_layout,\n";
- printf("#include <struct_layout.h>\n");
+ /* get obj file for input */
+ if (argc < 3) {
+ (void) fprintf(stderr,
+ "usage: %s {object_file} {MACH}\n", argv[0]);
+ exit(1);
+ }
+
+ objfile = argv[1];
+ machname = argv[2];
+
+ get_ctf_file(objfile);
+
+ (void) printf("#include <struct_layout.h>\n");
gen_auxv();
gen_prgregset();
@@ -613,7 +635,7 @@ main(int argc, char *argv[])
*/
(void) printf(
"\n\n\n\nstatic const sl_arch_layout_t layout_%s = {\n",
- MACH);
+ machname);
(void) printf(fmt, "auxv");
(void) printf(fmt, "fltset");
(void) printf(fmt, "lwpsinfo");
@@ -640,8 +662,293 @@ main(int argc, char *argv[])
* A public function, to make the information available
*/
(void) printf("\n\nconst sl_arch_layout_t *\n");
- (void) printf("struct_layout_%s(void)\n", MACH);
- (void) printf("{\n\treturn (&layout_%s);\n}\n", MACH);
+ (void) printf("struct_layout_%s(void)\n", machname);
+ (void) printf("{\n\treturn (&layout_%s);\n}\n", machname);
+
+ return (0);
+}
+
+/*
+ * Helper functions using the CTF library to get type info.
+ */
+
+static void
+get_ctf_file(char *fname)
+{
+ int ctferr;
+
+ objfile = fname;
+ if ((ctf = ctf_open(objfile, &ctferr)) == NULL) {
+ errx(1, "Couldn't open object file %s: %s\n", objfile,
+ ctf_errmsg(ctferr));
+ }
+}
+
+static void
+print_row(int boff, int eltlen, int nelts, int issigned, char *comment)
+{
+ (void) printf("\t{ %d,\t%d,\t%d,\t%d },\t\t/* %s */\n",
+ boff, eltlen, nelts, issigned, comment);
+}
+
+static void
+do_start(char *sname, char *tname)
+{
+ do_start_name(sname);
+ do_start_sizeof(tname, NULL);
+}
+
+static void
+do_start_name(char *sname)
+{
+ (void) printf("\n\nstatic const sl_%s_layout_t %s_layout = {\n",
+ sname, sname);
+}
+
+static void
+do_end(void)
+{
+ (void) printf("};\n");
+}
+
+static void
+do_start_sizeof(char *tname, char *rtname)
+{
+ char comment[100];
+ ctf_id_t stype;
+ int sz;
+
+ if (rtname == NULL)
+ rtname = tname;
+
+ if ((stype = ctf_lookup_by_name(ctf, rtname)) == CTF_ERR)
+ errx(1, "Couldn't find type %s", rtname);
+ if ((stype = ctf_type_resolve(ctf, stype)) == CTF_ERR)
+ errx(1, "Couldn't resolve type %s", tname);
+
+ if ((sz = (int)ctf_type_size(ctf, stype)) < 0) {
+ errx(1, "Couldn't get size for type %s", tname);
+ } else if (sz == 0) {
+ errx(1, "Invalid type size 0 for %s", tname);
+ }
+
+ (void) snprintf(comment, sizeof (comment), "sizeof (%s)", tname);
+ print_row(0, sz, 0, 0, comment);
+}
+
+static void
+do_scalar_field(char *tname, char *fname, int _sign, char *dotfield)
+{
+ int rc, off, sz, ftype;
+
+ rc = get_field_info(tname, fname, dotfield, &off, &ftype);
+ if (rc < 0)
+ errx(1, "Can't get field info for %s->%s", tname, fname);
+
+ if ((ftype = ctf_type_resolve(ctf, ftype)) == CTF_ERR)
+ errx(1, "Couldn't resolve type of %s->%s", tname, fname);
+
+ if ((sz = (int)ctf_type_size(ctf, ftype)) < 0) {
+ errx(1, "Couldn't get size for type ID %d", ftype);
+ } else if (sz == 0) {
+ errx(1, "Invalid type size 0 for type ID %d", ftype);
+ }
+
+ print_row(off, sz, 0, _sign, fname);
+}
+
+static void
+do_array_field(char *tname, char *fname,
+ int _sign, char *dotfield)
+{
+ char comment[100];
+ ctf_arinfo_t ai;
+ int typekind;
+ int esz, rc, off, ftype;
+
+ rc = get_field_info(tname, fname, dotfield, &off, &ftype);
+ if (rc < 0)
+ errx(1, "Can't get field info for %s->%s", tname, fname);
+
+ if ((ftype = ctf_type_resolve(ctf, ftype)) == CTF_ERR)
+ errx(1, "Couldn't resolve type of %s->%s", tname, fname);
+
+ typekind = ctf_type_kind(ctf, ftype);
+ if (typekind != CTF_K_ARRAY)
+ errx(1, "Wrong type for %s->%s", tname, fname);
+
+ rc = ctf_array_info(ctf, ftype, &ai);
+ if (rc != 0)
+ errx(1, "Can't get array info for %s->%s\n", tname, fname);
+ esz = ctf_type_size(ctf, ai.ctr_contents);
+ if (esz < 0)
+ errx(1, "Can't get element size for %s->%s\n", tname, fname);
+
+ (void) snprintf(comment, sizeof (comment), "%s[]", fname);
+ print_row(off, esz, ai.ctr_nelems, _sign, comment);
+}
+
+static void
+do_array_type(char *tname, char *fname, int _sign)
+{
+ ctf_arinfo_t ai;
+ int stype, typekind;
+ int esz, rc;
+
+ if ((stype = ctf_lookup_by_name(ctf, tname)) == CTF_ERR)
+ errx(1, "Couldn't find type %s", tname);
+ if ((stype = ctf_type_resolve(ctf, stype)) == CTF_ERR)
+ errx(1, "Couldn't resolve type %s", tname);
+
+ typekind = ctf_type_kind(ctf, stype);
+ if (typekind != CTF_K_ARRAY)
+ errx(1, "Wrong type for %s->%s", tname, fname);
+
+ rc = ctf_array_info(ctf, stype, &ai);
+ if (rc != 0)
+ errx(1, "Can't get array info for %s->%s\n", tname, fname);
+ esz = ctf_type_size(ctf, ai.ctr_contents);
+ if (esz < 0)
+ errx(1, "Can't get element size for %s->%s\n", tname, fname);
+
+ print_row(0, esz, ai.ctr_nelems, _sign, fname);
+}
+
+
+struct gfinfo {
+ char *tname; /* top type name, i.e. the struct */
+ char *fname; /* field name */
+ char *dotname; /* full field name with dots (optional) */
+ char *prefix; /* current field search prefix */
+ int base_off;
+ int fld_off;
+ int fld_type;
+};
+
+static int gfi_iter(const char *fname, ctf_id_t mbrtid,
+ ulong_t off, void *varg);
+
+/*
+ * Lookup field "fname" in type "tname". If "dotname" is non-NULL,
+ * that's the full field name with dots, i.e. a_un.un_foo, which
+ * we must search for by walking the struct CTF recursively.
+ */
+static int
+get_field_info(char *tname, char *fname, char *dotname,
+ int *offp, int *tidp)
+{
+ struct gfinfo gfi;
+ ctf_id_t stype;
+ int typekind;
+ int rc;
+
+ if ((stype = ctf_lookup_by_name(ctf, tname)) == CTF_ERR)
+ errx(1, "Couldn't find type %s", tname);
+ if ((stype = ctf_type_resolve(ctf, stype)) == CTF_ERR)
+ errx(1, "Couldn't resolve type %s", tname);
+
+ /* If fname has a dot, use it as dotname too. */
+ if (dotname == NULL && strchr(fname, '.') != NULL)
+ dotname = fname;
+
+ gfi.tname = tname;
+ gfi.fname = fname;
+ gfi.dotname = dotname;
+ gfi.prefix = "";
+ gfi.base_off = 0;
+ gfi.fld_off = 0;
+ gfi.fld_type = 0;
+
+ typekind = ctf_type_kind(ctf, stype);
+ switch (typekind) {
+
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ rc = ctf_member_iter(ctf, stype, gfi_iter, &gfi);
+ break;
+
+ default:
+ errx(1, "Unexpected top-level type for %s", tname);
+ break;
+ }
+
+ if (rc < 0)
+ errx(1, "Error getting info for %s.%s", stype, fname);
+ if (rc == 0)
+ errx(1, "Did not find %s.%s", tname, fname);
+
+ *offp = gfi.fld_off;
+ *tidp = gfi.fld_type;
return (0);
}
+
+/*
+ * Iteration callback for ctf_member_iter
+ * Return <0 on error, 0 to keep looking, >0 for found.
+ *
+ * If no dotname, simple search for fieldname.
+ * If we're asked to search with dotname, we need to do a full
+ * recursive walk of the types under the dotname.
+ */
+int
+gfi_iter(const char *fieldname, ctf_id_t mbrtid, ulong_t off, void *varg)
+{
+ char namebuf[100];
+ struct gfinfo *gfi = varg;
+ char *saveprefix;
+ int saveoff;
+ int typekind;
+ int byteoff;
+ int len, rc;
+
+ byteoff = gfi->base_off + (int)(off >> 3);
+
+ /* Easy cases first: no dotname */
+ if (gfi->dotname == NULL) {
+ if (strcmp(gfi->fname, fieldname) == 0) {
+ gfi->fld_off = byteoff;
+ gfi->fld_type = mbrtid;
+ return (1);
+ }
+ return (0);
+ }
+
+ /* Exact match on the dotname? */
+ (void) snprintf(namebuf, sizeof (namebuf), "%s%s",
+ gfi->prefix, fieldname);
+ if (strcmp(gfi->dotname, namebuf) == 0) {
+ gfi->fld_off = byteoff;
+ gfi->fld_type = mbrtid;
+ return (1);
+ }
+
+ /*
+ * May need to recurse under this field, but
+ * only if there's a match through '.'
+ */
+ (void) strlcat(namebuf, ".", sizeof (namebuf));
+ len = strlen(namebuf);
+ if (strncmp(gfi->dotname, namebuf, len) != 0)
+ return (0);
+
+ typekind = ctf_type_kind(ctf, mbrtid);
+ switch (typekind) {
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ break;
+ default:
+ return (0);
+ }
+
+ /* Recursively walk members */
+ saveprefix = gfi->prefix;
+ saveoff = gfi->base_off;
+ gfi->prefix = namebuf;
+ gfi->base_off = byteoff;
+ rc = ctf_member_iter(ctf, mbrtid, gfi_iter, gfi);
+ gfi->prefix = saveprefix;
+ gfi->base_off = saveoff;
+
+ return (rc);
+}
diff --git a/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c b/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c
index 3300a00035..2cf4f7b776 100644
--- a/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c
+++ b/usr/src/cmd/sgs/elfdump/common/struct_layout_sparc.c
@@ -376,6 +376,8 @@ static const sl_prfdinfo_layout_t prfdinfo_layout = {
};
+
+
static const sl_arch_layout_t layout_sparc = {
&auxv_layout,
&fltset_layout,
diff --git a/usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c b/usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c
index d416e47b82..23ad0aa0b1 100644
--- a/usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c
+++ b/usr/src/cmd/sgs/elfdump/common/struct_layout_sparcv9.c
@@ -377,6 +377,8 @@ static const sl_prfdinfo_layout_t prfdinfo_layout = {
};
+
+
static const sl_arch_layout_t layout_sparcv9 = {
&auxv_layout,
&fltset_layout,
diff --git a/usr/src/cmd/sgs/elfdump/i386/Makefile b/usr/src/cmd/sgs/elfdump/i386/Makefile
index 607c8a31ce..d3cb302ac1 100644
--- a/usr/src/cmd/sgs/elfdump/i386/Makefile
+++ b/usr/src/cmd/sgs/elfdump/i386/Makefile
@@ -23,11 +23,11 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
include ../Makefile.com
.KEEP_STATE:
+ARCH = i386
+
include ../Makefile.targ
diff --git a/usr/src/cmd/sgs/elfdump/sparc/Makefile b/usr/src/cmd/sgs/elfdump/sparc/Makefile
index 607c8a31ce..a2c6327b0b 100644
--- a/usr/src/cmd/sgs/elfdump/sparc/Makefile
+++ b/usr/src/cmd/sgs/elfdump/sparc/Makefile
@@ -23,11 +23,11 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
include ../Makefile.com
.KEEP_STATE:
+ARCH = sparc
+
include ../Makefile.targ
diff --git a/usr/src/cmd/sgs/elfdump/sparcv9/Makefile b/usr/src/cmd/sgs/elfdump/sparcv9/Makefile
index a15f2caf82..e629729766 100644
--- a/usr/src/cmd/sgs/elfdump/sparcv9/Makefile
+++ b/usr/src/cmd/sgs/elfdump/sparcv9/Makefile
@@ -23,13 +23,12 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
include ../Makefile.com
.KEEP_STATE:
+ARCH = sparcv9
LLDFLAGS = $(LLDFLAGS64)
ELFLIBDIR = $(ELFLIBDIR64)
LDDBGLIBDIR = $(LDDBGLIBDIR64)