Re: Stack Pointer..?



7trackers@xxxxxxxxx wrote:
: Hi people...

: Here's my question...

: a function other than main is getting executed
: you have to find out which function called this function

: how can we do in C...?

You could rewrite your functions to include that information

(No pretense of being real code)

main()
{
do_something("from main",1,2,3);
}

do_something( char *from, int i, int j, int k)
{
do_something_else("do_something",'a','b','c');
}

do_something_else( char *from, etc...)
{
printf("I was called from %s",from);
}


To get a full stack trace you would have to add some kind of link as well,
but I haven't thought to add that here.

Various compilers and debuggers have options to help do this sort of thing
much easier.



--

This programmer available for rent.
.



Relevant Pages

  • Re: rent or medicine?
    ... > If you absolutely had to choose, which would it be- rent or medicine? ... If you have some close friends or family let them help you sort ... Prev by Date: ...
    (alt.support.diabetes)
  • Re: Famous XML cliches
    ... :>it about W3C Schemas. ... This programmer available for rent. ... Prev by Date: ...
    (comp.text.xml)
  • Re: "Sorting" assignment
    ... is the fastest possible way of exchanging two ... implement the exchange in a sort. ... In your Employee example, you never have to copy actual class ... programmer reasons that if his code is doin' a lotta data movin' (like ...
    (comp.programming)
  • Re: ways to update PS files?
    ... method you can even do random access I/O operations. ... multi-user access (without some sort of higher level manager) would ... And finally, if it is an application programmer type asking, the ... Behalf Of john gilmore ...
    (bit.listserv.ibm-main)
  • DFSORT - simple formula for SORTWKn size?
    ... allocate the SORTWKnn datasets dynamically. ... From my looking, SORT ... ICE084I 0 EXCP ACCESS METHOD USED FOR SORTOUT ... explanation to the programmer who was the one that started me up on this ...
    (bit.listserv.ibm-main)