summaryrefslogtreecommitdiff
path: root/lib/libdtrace/common/dt_parser.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2012-06-30 07:46:38 +0000
committerMartin Matuska <mm@FreeBSD.org>2012-06-30 07:46:38 +0000
commit4a37bb98c980176bf8002f7ccd8807092ff8f9cf (patch)
treefb4e00bd775ffa753a3b8466008fa3dbca70d12d /lib/libdtrace/common/dt_parser.c
parente0ea83ebb1a4b194c927cb114766e8781676380b (diff)
Notes
Diffstat (limited to 'lib/libdtrace/common/dt_parser.c')
-rw-r--r--lib/libdtrace/common/dt_parser.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/libdtrace/common/dt_parser.c b/lib/libdtrace/common/dt_parser.c
index 9aabc18565db..05715894a7df 100644
--- a/lib/libdtrace/common/dt_parser.c
+++ b/lib/libdtrace/common/dt_parser.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -21,12 +20,10 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* DTrace D Language Parser
*
@@ -472,9 +469,9 @@ dt_node_name(const dt_node_t *dnp, char *buf, size_t len)
case DT_NODE_XLATOR:
(void) snprintf(buf, len, "translator <%s> (%s)",
dt_type_name(dnp->dn_xlator->dx_dst_ctfp,
- dnp->dn_xlator->dx_dst_type, n1, sizeof (n1)),
+ dnp->dn_xlator->dx_dst_type, n1, sizeof (n1)),
dt_type_name(dnp->dn_xlator->dx_src_ctfp,
- dnp->dn_xlator->dx_src_type, n2, sizeof (n2)));
+ dnp->dn_xlator->dx_src_type, n2, sizeof (n2)));
break;
case DT_NODE_PROG:
(void) snprintf(buf, len, "%s", "program");
@@ -723,12 +720,19 @@ dt_node_type_name(const dt_node_t *dnp, char *buf, size_t len)
size_t
dt_node_type_size(const dt_node_t *dnp)
{
+ ctf_id_t base;
+
if (dnp->dn_kind == DT_NODE_STRING)
return (strlen(dnp->dn_string) + 1);
if (dt_node_is_dynamic(dnp) && dnp->dn_ident != NULL)
return (dt_ident_size(dnp->dn_ident));
+ base = ctf_type_resolve(dnp->dn_ctfp, dnp->dn_type);
+
+ if (ctf_type_kind(dnp->dn_ctfp, base) == CTF_K_FORWARD)
+ return (0);
+
return (ctf_type_size(dnp->dn_ctfp, dnp->dn_type));
}
@@ -1440,9 +1444,9 @@ dt_node_decl(void)
"\t current: %s\n\tprevious: %s\n",
dmp->dm_name, dsp->ds_ident,
dt_type_name(dtt.dtt_ctfp, dtt.dtt_type,
- n1, sizeof (n1)),
+ n1, sizeof (n1)),
dt_type_name(ott.dtt_ctfp, ott.dtt_type,
- n2, sizeof (n2)));
+ n2, sizeof (n2)));
} else if (!exists && dt_module_extern(dtp, dmp,
dsp->ds_ident, &dtt) == NULL) {
xyerror(D_UNKNOWN,
@@ -1452,7 +1456,7 @@ dt_node_decl(void)
dt_dprintf("extern %s`%s type=<%s>\n",
dmp->dm_name, dsp->ds_ident,
dt_type_name(dtt.dtt_ctfp, dtt.dtt_type,
- n1, sizeof (n1)));
+ n1, sizeof (n1)));
}
break;
}
@@ -1756,8 +1760,7 @@ dt_node_offsetof(dt_decl_t *ddp, char *s)
ctf_id_t type;
uint_t kind;
- name = alloca(strlen(s) + 1);
- (void) strcpy(name, s);
+ name = strdupa(s);
free(s);
err = dt_decl_type(ddp, &dtt);