[DTrace-devel] [PATCH 3/7] Add disassembler support for dynamic type vars
Kris Van Hees
kris.van.hees at oracle.com
Thu May 26 18:24:36 UTC 2022
The args[] built-in variable is a special array where each element has
its own datatype. The overall datatype is considered the 'dynamic type'
which is expressed as 'any'.
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
include/dtrace/dif_defines.h | 3 ++-
libdtrace/dt_dis.c | 3 +++
libdtrace/dt_parser.c | 4 ++++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/dtrace/dif_defines.h b/include/dtrace/dif_defines.h
index 9f30e649..43824646 100644
--- a/include/dtrace/dif_defines.h
+++ b/include/dtrace/dif_defines.h
@@ -2,7 +2,7 @@
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*
- * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -263,6 +263,7 @@ typedef uint32_t dif_instr_t;
#define DIF_TYPE_CTF 0
#define DIF_TYPE_STRING 1
+#define DIF_TYPE_ANY 2
#define DIF_TF_BYREF 0x1
diff --git a/libdtrace/dt_dis.c b/libdtrace/dt_dis.c
index 58c02fd5..9a365a6b 100644
--- a/libdtrace/dt_dis.c
+++ b/libdtrace/dt_dis.c
@@ -471,6 +471,9 @@ dt_dis_typestr(const dtrace_diftype_t *t, char *buf, size_t len)
case DIF_TYPE_STRING:
strcpy(kind, "string");
break;
+ case DIF_TYPE_ANY:
+ strcpy(kind, "any");
+ break;
default:
snprintf(kind, sizeof(kind), "0x%x", t->dtdt_kind);
}
diff --git a/libdtrace/dt_parser.c b/libdtrace/dt_parser.c
index 7c5c30c9..e410f993 100644
--- a/libdtrace/dt_parser.c
+++ b/libdtrace/dt_parser.c
@@ -4810,6 +4810,10 @@ dt_node_diftype(dtrace_hdl_t *dtp, const dt_node_t *dnp, dtrace_diftype_t *tp)
dnp->dn_type == DT_STR_TYPE(dtp)) {
tp->dtdt_kind = DIF_TYPE_STRING;
tp->dtdt_ckind = CTF_K_UNKNOWN;
+ } else if (dnp->dn_ctfp == DT_DYN_CTFP(dtp) &&
+ dnp->dn_type == DT_DYN_TYPE(dtp)) {
+ tp->dtdt_kind = DIF_TYPE_ANY;
+ tp->dtdt_ckind = CTF_K_UNKNOWN;
} else {
tp->dtdt_kind = DIF_TYPE_CTF;
tp->dtdt_ckind = ctf_type_kind(dnp->dn_ctfp,
--
2.34.1
More information about the DTrace-devel
mailing list