[DTrace-devel] [PATCH 3/7] Make dt_cg_ctf_offsetof() search across all modules, not just shared dict
eugene.loh at oracle.com
eugene.loh at oracle.com
Tue Aug 22 21:51:10 UTC 2023
From: Eugene Loh <eugene.loh at oracle.com>
The function dt_cg_ctf_offsetof() was searching just in the shared
dict. Have it look for types across all modules.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
libdtrace/dt_cg.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
index ea7fb6d5..35feb887 100644
--- a/libdtrace/dt_cg.c
+++ b/libdtrace/dt_cg.c
@@ -4190,19 +4190,22 @@ dt_cg_asgn_op(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
int
dt_cg_ctf_offsetof(dtrace_hdl_t *dtp, const char *structname, const char *membername, size_t *sizep)
{
- ctf_file_t *cfp = dtp->dt_shared_ctf;
- ctf_id_t type;
+ dtrace_typeinfo_t sym;
+ ctf_file_t *cfp;
ctf_membinfo_t ctm;
- if (!cfp)
+// FIXME: add diagnostic info to the longjump paths?
+ if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY, structname, &sym))
longjmp(yypcb->pcb_jmpbuf, EDT_NOCTF);
- type = ctf_lookup_by_name(cfp, structname);
- if (type == CTF_ERR)
+
+ cfp = sym.dtt_ctfp;
+ if (!cfp) // FIXME is this needed?
longjmp(yypcb->pcb_jmpbuf, EDT_NOCTF);
- if (ctf_member_info(cfp, type, membername, &ctm) == CTF_ERR)
+ if (ctf_member_info(cfp, sym.dtt_type, membername, &ctm) == CTF_ERR)
longjmp(yypcb->pcb_jmpbuf, EDT_NOCTF);
if (sizep)
*sizep = ctf_type_size(cfp, ctm.ctm_type);
+
return (ctm.ctm_offset / NBBY);
}
--
2.18.4
More information about the DTrace-devel
mailing list