RE: Debugging C++ using instrumentation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
Behalf Of Shriram V
Sent: Monday, July 05, 2004 7:14 AM
To: gcc-help@xxxxxxxxxxx
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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux