aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/common
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2016-08-30 05:50:42 +0000
committerMark Johnston <markj@FreeBSD.org>2016-08-30 05:50:42 +0000
commit7447ca0eb235974642312b9555caec00b57d8fc1 (patch)
tree0eb2729f80618e3e7f6802c2e2877d9726c2bdd1 /cddl/contrib/opensolaris/common
parent96376f14a95d348c1fc284bda87fa92616689d37 (diff)
downloadsrc-7447ca0eb235974642312b9555caec00b57d8fc1.tar.gz
src-7447ca0eb235974642312b9555caec00b57d8fc1.zip
Recursively enumerate anonymous structs and unions in ctf_member_info().
Previously, ctf_member_info() would ignore members belonging to an anonymous struct or union. This made it impossible to, for example, trace the m_next field of an mbuf using DTrace. Reported and tested by: gallatin MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=305055
Diffstat (limited to 'cddl/contrib/opensolaris/common')
-rw-r--r--cddl/contrib/opensolaris/common/ctf/ctf_types.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_types.c b/cddl/contrib/opensolaris/common/ctf/ctf_types.c
index ab1b9ff14bd2..21b061cd9356 100644
--- a/cddl/contrib/opensolaris/common/ctf/ctf_types.c
+++ b/cddl/contrib/opensolaris/common/ctf/ctf_types.c
@@ -644,11 +644,8 @@ ctf_type_compat(ctf_file_t *lfp, ctf_id_t ltype,
}
}
-/*
- * Return the type and offset for a given member of a STRUCT or UNION.
- */
-int
-ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
+static int
+_ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name, ulong_t off,
ctf_membinfo_t *mip)
{
ctf_file_t *ofp = fp;
@@ -673,9 +670,13 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
((uintptr_t)tp + increment);
for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) {
+ if (mp->ctm_name == 0 &&
+ _ctf_member_info(fp, mp->ctm_type, name,
+ mp->ctm_offset + off, mip) == 0)
+ return (0);
if (strcmp(ctf_strptr(fp, mp->ctm_name), name) == 0) {
mip->ctm_type = mp->ctm_type;
- mip->ctm_offset = mp->ctm_offset;
+ mip->ctm_offset = mp->ctm_offset + off;
return (0);
}
}
@@ -684,9 +685,14 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
((uintptr_t)tp + increment);
for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) {
+ if (lmp->ctlm_name == 0 &&
+ _ctf_member_info(fp, lmp->ctlm_name, name,
+ (ulong_t)CTF_LMEM_OFFSET(lmp) + off, mip) == 0)
+ return (0);
if (strcmp(ctf_strptr(fp, lmp->ctlm_name), name) == 0) {
mip->ctm_type = lmp->ctlm_type;
- mip->ctm_offset = (ulong_t)CTF_LMEM_OFFSET(lmp);
+ mip->ctm_offset =
+ (ulong_t)CTF_LMEM_OFFSET(lmp) + off;
return (0);
}
}
@@ -696,6 +702,17 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
}
/*
+ * Return the type and offset for a given member of a STRUCT or UNION.
+ */
+int
+ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
+ ctf_membinfo_t *mip)
+{
+
+ return (_ctf_member_info(fp, type, name, 0, mip));
+}
+
+/*
* Return the array type, index, and size information for the specified ARRAY.
*/
int