summaryrefslogtreecommitdiff
path: root/usr/src/common/ctf/ctf_lookup.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2019-04-11 14:03:27 +0000
committerJohn Levon <john.levon@joyent.com>2019-05-03 02:15:58 -0700
commit6ef284f1d464c08bc420048a0b211080cb9fe009 (patch)
tree899285312544e2f8939f8e248283cbd4ae45e6d2 /usr/src/common/ctf/ctf_lookup.c
parent59d77acb140ef81a3e7784b472f41ff409b72114 (diff)
downloadillumos-joyent-6ef284f1d464c08bc420048a0b211080cb9fe009.tar.gz
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: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src/common/ctf/ctf_lookup.c')
-rw-r--r--usr/src/common/ctf/ctf_lookup.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/usr/src/common/ctf/ctf_lookup.c b/usr/src/common/ctf/ctf_lookup.c
index f8fa724355..05aa54d6cb 100644
--- a/usr/src/common/ctf/ctf_lookup.c
+++ b/usr/src/common/ctf/ctf_lookup.c
@@ -25,7 +25,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright 2019, Joyent, Inc.
+ */
#include <sys/sysmacros.h>
#include <ctf_impl.h>
@@ -311,3 +313,50 @@ ctf_func_args(ctf_file_t *fp, ulong_t symidx, uint_t argc, ctf_id_t *argv)
return (0);
}
+
+/*
+ * Unlike the normal lookup routines, ctf_dyn_*() variants consult both the
+ * processed CTF contents of a ctf_file_t as well as the dynamic types in the
+ * dtdef list.
+ */
+
+const ctf_type_t *
+ctf_dyn_lookup_by_id(ctf_file_t *fp, ctf_id_t id)
+{
+ ctf_file_t **fpp = &fp;
+ const ctf_type_t *t;
+ ctf_dtdef_t *dtd;
+
+ if ((t = ctf_lookup_by_id(fpp, id)) != NULL)
+ return (t);
+
+ if ((dtd = ctf_dtd_lookup(fp, id)) == NULL)
+ return (NULL);
+
+ return (&dtd->dtd_data);
+}
+
+int
+ctf_dyn_array_info(ctf_file_t *infp, ctf_id_t id, ctf_arinfo_t *arinfop)
+{
+ ctf_file_t *fp = infp;
+ const ctf_type_t *t;
+ ctf_dtdef_t *dtd;
+
+ if ((t = ctf_lookup_by_id(&fp, id)) != NULL) {
+
+ if (LCTF_INFO_KIND(fp, t->ctt_info) != CTF_K_ARRAY)
+ return (ctf_set_errno(infp, ECTF_NOTARRAY));
+
+ return (ctf_array_info(fp, id, arinfop));
+ }
+
+ if ((dtd = ctf_dtd_lookup(fp, id)) == NULL)
+ return (ctf_set_errno(infp, ENOENT));
+
+ if (LCTF_INFO_KIND(fp, dtd->dtd_data.ctt_info) != CTF_K_ARRAY)
+ return (ctf_set_errno(infp, ECTF_NOTARRAY));
+
+ bcopy(&dtd->dtd_u.dtu_arr, arinfop, sizeof (*arinfop));
+ return (0);
+}