This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Debugging C++ using instrumentation.


Hi Lyle,

Thanks for the information on LD_PRELOAD.
I had posted this query in this mailing-list because I thought if there are
some
instrumentation options that gcc provides which could be useful for function
replacement.

Regards,
-Shriram.


| -----Original Message-----
| From: lrtaylor@micron.com [mailto:lrtaylor@micron.com] 
| Sent: Wednesday, July 07, 2004 1:35 AM
| To: shriram_vishwanathan@persistent.co.in; gcc-help@gcc.gnu.org
| Subject: RE: Debugging C++ using instrumentation.
| 
| 
| Unfortunately, I can't give you much information, but I 
| believe this is
| possible (at least on UNIX/Linux).  I've seen something 
| similar done for
| memory profilers (malloc and free would be overridden by 
| custom versions
| in a shared library).  The way it worked more or less (as 
| near as I can
| remember anyway) is that there were special versions of functions that
| were to be overridden in a shared library, and the runtime linker was
| told to load this library before any others using (maybe) the 
| LD_PRELOAD
| variable or something like that.  That way, the function calls would
| resolve to those defined in this special library.
| 
| Unfortunately, I don't remember much beyond that, and I could be
| remembering things wrong.  However, the important point is that I
| believe you can in fact override functions at runtime.  
| However, this is
| not going to be the forum to get a complete answer, since I believe it
| has nothing to do with the compiler, but rather with the 
| runtime linker.
| You might try a binutils list or something similar.  Also look at the
| man page for "ld.so".
| 
| Good luck,
| Lyle
| 
| 
| -----Original Message-----
| From: gcc-help-owner@gcc.gnu.org 
| [mailto:gcc-help-owner@gcc.gnu.org] On
| Behalf Of Shriram V
| Sent: Monday, July 05, 2004 7:14 AM
| To: gcc-help@gcc.gnu.org
| Subject: Debugging C++ using instrumentation.
| 
| Hi Gurus,
|  
| I was wondering if there is a method that allows a call to an 
| arbitrary
| function to be intercepted and replaced by a new function at runtime /
| compile-time / link-time.
| <SNIP>
| 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]