S James S Stapleton wrote, On 14/08/08 20:51:
Ugh, I typoed that badly. Sorry.
I'm having trouble with part of a program I'm working on - I'm not writing
my own libc. I want to take a copy of some functions in libc, add a bunch of
diagnostic outputs, and see where and why my code is failing.
Some systems provide a mechanism for overriding specific functions, and
sometimes for calling the standard function from within your version,
but others do not. The mechanism for doing so also varies. So for
details on how to do that you will have to ask on a group dedicated to
your implementation.
Other options I can think of include doing things like:
#define malloc(x) mymalloc(x)
I believe this invokes undefined behaviour if you have included the
standard header that declares the function, but it will work on many
implementations.
Installing and using a debug version of the standard library so you can
step in to any functions you want.
One of the most common causes (in my experience) of "failures in libc"
is you overrunning the end of a buffer. For this tools like vagrind can
be very useful. Depending on what debug you want to do then tools like
strace may also be useful if available on your system.
However, for the best advice on what is available for your system you
will have to ask on a group dedicated to your system. For this reason
details of specific tools and systems are generally considered off-topic
here.
Sorry, I need to slow down when I type, so what I am trying to say resembles
comprehensible language. I'm sorry for the obnoxious original post.
Your original post did not seem obnoxious to me, just hard to understand.