From owner-p4-projects@FreeBSD.ORG Sat Feb 23 00:21:04 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B21A116A409; Sat, 23 Feb 2008 00:21:04 +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 5EC8816A407 for ; Sat, 23 Feb 2008 00:21:04 +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 5746D13C43E for ; Sat, 23 Feb 2008 00:21:04 +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 m1N0L4vO077779 for ; Sat, 23 Feb 2008 00:21:04 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1N0L4Rt077771 for perforce@freebsd.org; Sat, 23 Feb 2008 00:21:04 GMT (envelope-from jb@freebsd.org) Date: Sat, 23 Feb 2008 00:21:04 GMT Message-Id: <200802230021.m1N0L4Rt077771@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 136000 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:21:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=136000 Change 136000 by jb@jb_freebsd1 on 2008/02/23 00:20:36 Add a hack to whip a couple of the dummy args to typeref() into shape by replacing the string with one containing the type string and the integer with the type size. Yes, this is a hack to get some functionality I really, really, want but the DTrace parser design doesn't really allow for. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#12 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#12 (text) ==== @@ -1339,6 +1339,31 @@ } static void +dt_cg_func_typeref(dt_node_t *dnp) +{ + dt_node_t *addr = dnp->dn_args; + dt_node_t *nelm = addr->dn_list; + dt_node_t *strp = nelm->dn_list; + dt_node_t *typs = strp->dn_list; + char buf[DT_TYPE_NAMELEN]; + + ctf_type_name(addr->dn_ctfp, addr->dn_type, buf, sizeof (buf)); + + /* + * XXX Hack alert! XXX + * The prototype has two dummy args that we munge to represent + * the type string and the type size. + * + * Yes, I hear your grumble, but it works for now. We'll come + * up with a more elegant implementation later. :-) + */ + free(strp->dn_string); + strp->dn_string = strdup(buf); + + typs->dn_value = ctf_type_size(addr->dn_ctfp, addr->dn_type); +} + +static void dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp) { ctf_file_t *ctfp = dnp->dn_ctfp; @@ -1801,11 +1826,13 @@ dt_idkind_name(idp->di_kind), idp->di_name); } - if (idp->di_id == DIF_SUBR_TYPEREF) { - dt_node_t *size = dnp->dn_args; - char buf[64]; - ctf_type_name(size->dn_ctfp, size->dn_type, buf, sizeof (buf)); -printf("%s(%d); %s %s( ) '%s'<----- DIF_SUBR_TYPEREF\n",__func__,__LINE__,dt_idkind_name(idp->di_kind), idp->di_name,buf); + switch (idp->di_id) { + case DIF_SUBR_TYPEREF: + dt_cg_func_typeref(dnp); + break; + + default: + break; } dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp);