From owner-p4-projects@FreeBSD.ORG Sat Feb 23 00:17:59 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6DBA616A407; Sat, 23 Feb 2008 00:17:59 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FD2216A415 for ; Sat, 23 Feb 2008 00:17:59 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 284F013C45D for ; Sat, 23 Feb 2008 00:17:59 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1N0Hx4b077598 for ; Sat, 23 Feb 2008 00:17:59 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1N0HxWv077595 for perforce@freebsd.org; Sat, 23 Feb 2008 00:17:59 GMT (envelope-from jb@freebsd.org) Date: Sat, 23 Feb 2008 00:17:59 GMT Message-Id: <200802230017.m1N0HxWv077595@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 135999 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Feb 2008 00:17:59 -0000 http://perforce.freebsd.org/chv.cgi?CH=135999 Change 135999 by jb@jb_freebsd1 on 2008/02/23 00:17:24 Add a chyeck that the second arg to printt() is a typeref(). Ideally we'd just silently insert the typeref by munging the args passed to printt(), but the parser design pretty much limits that. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cc.c#11 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cc.c#11 (text) ==== @@ -994,10 +994,11 @@ "be a non-zero positive integral constant expression\n"); } - if (dt_node_is_pointer(addr) == 0) { + if (addr == NULL || addr->dn_kind != DT_NODE_FUNC || + addr->dn_ident != dt_idhash_lookup(dtp->dt_globals, "typeref")) { dnerror(addr, D_PRINTT_ADDR, "printt( ) argument #2 is incompatible with " - "prototype:\n\tprototype: pointer\n" + "prototype:\n\tprototype: typeref()\n" "\t argument: %s\n", dt_node_type_name(addr, n, sizeof (n))); } @@ -1007,7 +1008,15 @@ ap->dtad_kind = DTRACEACT_PRINTT; ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF; - ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + sizeof(uintptr_t); + + /* + * Allow additional buffer space for the data size, type size, + * type string length and a stab in the dark (32 bytes) for the + * type string. The type string is part of the typeref() that + * this action references. + */ + ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + 3 * sizeof(uintptr_t) + 32; + } static void