From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47195 invoked by alias); 7 Aug 2015 15:12:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 47178 invoked by uid 89); 7 Aug 2015 15:12:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL,BAYES_20,KAM_LAZY_DOMAIN_SECURITY,LIKELY_SPAM_BODY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 07 Aug 2015 15:12:56 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id EDFDE29A8D; Fri, 7 Aug 2015 11:12:47 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wAwEkDFF9GKk; Fri, 7 Aug 2015 11:12:47 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 2801C1166B6; Fri, 7 Aug 2015 11:12:34 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id AB4BE46986; Fri, 7 Aug 2015 08:12:32 -0700 (PDT) Date: Fri, 07 Aug 2015 15:12:00 -0000 From: Joel Brobecker To: "Jose E. Marchesi" Cc: Sergio Durigan Junior , gdb-patches@sourceware.org Subject: Re: [PATCH V4 5/9] New probe type: DTrace USDT probes. Message-ID: <20150807151232.GD14992@adacore.com> References: <87r3tp722i.fsf@redhat.com> <20150325191418.GA32233@adacore.com> <87bnjfraq1.fsf@oracle.com> <20150326175028.GA13867@adacore.com> <87y4mdjcie.fsf@oracle.com> <20150331184727.GF13867@adacore.com> <878uedey48.fsf@oracle.com> <20150806213103.GC14992@adacore.com> <874mkb9qv9.fsf@oracle.com> <87k2t7rxmk.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k2t7rxmk.fsf@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-08/txt/msg00202.txt.bz2 > Confirmed: DOF version 2 added support for is-enabled probes, and the > struct dtrace_dof_provider got a new 4 bytes field: > > @@ -719,6 +722,7 @@ typedef struct dof_provider { > dof_attr_t dofpv_funcattr; /* function attributes */ > dof_attr_t dofpv_nameattr; /* name attributes */ > dof_attr_t dofpv_argsattr; /* args attributes */ > + dof_secidx_t dofpv_prenoffs; /* link to DOF_SECT_PRENOFFS section */ > } dof_provider_t; > > Looks like your solaris-x86 binaries are embedding DOFv1 programs. You > can check that by looking at dof->dofh_ident[6]: it will be 1 in a DOFv1 > program and 2 in a DOFv2 program. I think I can confirm that. This is the contents of the .SUNW_dof section for the .so file: Contents of section .SUNW_dof: b4398 7f444f46 01010102 08080000 00000000 .DOF............ ^^ || > So... we can make GDB to look at the DOF version and then use a > different struct (struct dof_provider_v1 ?) when handling embedded > programs using the old format. > > I can prepare a patch for this. For testing purposes pdtrace can be > made to generate DOFv1 programs even in systems lacking an old enough > dtrace. Sure. I would perhaps also consider the idea of not support DOF v1, if v1 support is only of marginal value. Also, I didn't say it before, I wasn't so sure that casting a binary stream to a structure to read its contents was the best way to do things. It can of works, but makes the code a little harder to read, IMO, because accessing its contents requires the accessor macros. Perhaps it might be better to just have decoding routines that take the binary data and produce the corresponding struct, with the data properly decoded. That way, you can add DOF version checks and decode the data differently, without the rest of the code having to worry about which version of the type they should be using. It's not obvious to me that this way is better than the current way, but that's how I would have tried it first... (just my 2 cents) -- Joel