From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12410 invoked by alias); 28 Aug 2010 17:43:15 -0000 Received: (qmail 12398 invoked by uid 22791); 28 Aug 2010 17:43:14 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from n7.bullet.re3.yahoo.com (HELO n7.bullet.re3.yahoo.com) (68.142.237.92) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Sat, 28 Aug 2010 17:43:08 +0000 Received: from [68.142.237.87] by n7.bullet.re3.yahoo.com with NNFMP; 28 Aug 2010 17:43:06 -0000 Received: from [66.196.97.146] by t3.bullet.re3.yahoo.com with NNFMP; 28 Aug 2010 17:43:06 -0000 Received: from [127.0.0.1] by omp204.mail.re3.yahoo.com with NNFMP; 28 Aug 2010 17:43:06 -0000 Received: (qmail 73401 invoked by uid 60001); 28 Aug 2010 17:43:06 -0000 Message-ID: <447021.61605.qm@web88105.mail.re2.yahoo.com> Received: from [216.183.93.98] by web88105.mail.re2.yahoo.com via HTTP; Sat, 28 Aug 2010 10:43:06 PDT Date: Sat, 28 Aug 2010 17:53:00 -0000 From: Jeff Saremi Subject: Re: Guidance needed: hi-level steps to track an object until its destruction To: basile@starynkevitch.net Cc: gcc@gcc.gnu.org In-Reply-To: <1283015110.3067.37.camel@glinka> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg00427.txt.bz2 Basile, you fully understood what I was asking. And I think I understood that I may= have to rethink what I wanted to do since the effort is seemingly out-weig= hing the benefits. thanks again. jeff --- On Sat, 8/28/10, Basile Starynkevitch wrote: > From: Basile Starynkevitch > Subject: Re: Guidance needed: hi-level steps to track an object until its= destruction > To: "Jeff Saremi" > Cc: gcc@gcc.gnu.org > Received: Saturday, August 28, 2010, 1:05 PM > On Thu, 2010-08-26 at 18:16 -0700, > Jeff Saremi wrote: > > I'm hoping someone here could take the time to outline > what I need to do (i'm not looking for code but if you point > me to some i'd appreciate it). > >=20 > > I'd like to track an object from the it's created > until it's destroyed (in C++). And then see if a certain > method of it is called or not. To keep it short we can limit > this to one function at the beginning of which an object > gets created and at the end of it the object goes out of > scope. > > And i'm guessing this can be done via one a pass at > the right time. I guess before gimplification or being > converted to RTL and such. >=20 >=20 > I am not sure that is easily feasible. I would believe it > is impossible. >=20 > Within the compiler (or inside a GCC plugin, or inside a > GCC extension > coded in MELT), you probably are able change/inspect C++ > classes & every > other declaration any compiler is tracking. You are also > able to find > every occurrence of variables containing a pointer to such > classes. >=20 > However, you are apparently willing to track a single > *instance* of such > a class, and this instance is in the execution of the > compiled program > [not inside the compiler]. This means that you are able to > deal with all > the aliasing & pointer equivalence issues (a task known > to be > impossible). How can the compiler surely know that pointer > p in [a > particular instruction of] method YourClass::foo() is never > (or > sometimes, or always) pointing to the same instance -in the > running > process of the compiled program- as pointer q in method > yourclass::bar() >=20 > Or perhaps my English is so weak that I misunderstood you. > If that is > the case, apologies. >=20 > Or maybe you want to instrument your compiler so that for > every code > emitted for method yourclass::gee() you add a first block > which checks > that the this reciever is not a given pointer. >=20 > In other words & C++ parlance, you could (this is > doable, but not > trivial) hack the compiler so that at the start of every > method (i.e. > member function in C++) the equivalent of the following C++ > code has > been magically added >=20 > =A0 extern "C" YourClass* hunted_yourclass_pointer; > =A0 extern "C" void some_error_routine(void); >=20 > =A0 if (this =3D=3D hunted_yourclass_pointer)=20 > =A0 =A0 some_error_routine(); >=20 > But I am not sure you want to do that. >=20 > Cheers. > --=20 > Basile STARYNKEVITCH=A0 =A0 =A0 > =A0=A0=A0http://starynkevitch.net/Basile/ > email: basilestarynkevitchnet mobile: > +33 6 8501 2359 > 8, rue de la Faiencerie, 92340 Bourg La Reine, France > *** opinions {are only mine, sont seulement les miennes} > *** >=20 >