Mental Patient on Tue, 24 Sep 2002 11:54:07 -0400


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

Re: [PLUG] [C QUESTION] how to tell caller of a function


On Tue, 2002-09-24 at 11:29, Kevin Brosius wrote:

> Hmmm, guess I wasn't clear enough.
> 
> You add printf's to the function in question and the callers, then the
> log shows up like:
> 
> parent_fn()
> target_fn()
> parent_fn2()
> target_fn()
> 

Beware wacky buffering issues. But you should be ok for hte most part.

SNIP

> Mental makes a good point about a debugger being a good thing to learn. 
> However, there are situations where a debugger is not usable, so the
> printf method is valid also.  (Different tools for different
> situations.)
> 

Yes, especially when shared libs/external calls come into the picture.
There was a really annoying bug when I was porting q2max where it'd just
run off into the bushes and not come back while trying to load
gamei386.so. There was no stack to back trace. I forget exactly what it
wound up being, but I think I tracked it down with nm and ldd or
something like that. Evidently that brain cell died.


-- 

Mental (Mental@NeverLight.com)

This body. This body holding me. Be my reminder here that 
I am not alone in
This body, this body holding me, feeling eternal
All this pain is an illusion.

--Tool "Parabola"

CARPE NOCTEM, QUAM MINIMUM CREDULA POSTERO.

GPG public key: http://www.neverlight.com/pas/Mental.asc


Attachment: signature.asc
Description: This is a digitally signed message part