Click here to Skip to main content
16,006,768 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Non Printing Characters Pin
John Bosko10-Dec-02 18:36
John Bosko10-Dec-02 18:36 
GeneralRe: Non Printing Characters Pin
John Bosko10-Dec-02 18:47
John Bosko10-Dec-02 18:47 
QuestionRuntime Error?? Pin
MVH9-Dec-02 20:48
MVH9-Dec-02 20:48 
AnswerRe: Runtime Error?? Pin
KarstenK9-Dec-02 21:29
mveKarstenK9-Dec-02 21:29 
QuestionHow to get the caller of a fuction? Pin
Lizp9-Dec-02 20:31
Lizp9-Dec-02 20:31 
AnswerRe: How to get the caller of a fuction? Pin
MVH9-Dec-02 21:08
MVH9-Dec-02 21:08 
GeneralRe: How to get the caller of a fuction? Pin
Lizp9-Dec-02 21:26
Lizp9-Dec-02 21:26 
AnswerRe: How to get the caller of a fuction? Pin
Daniel Turini9-Dec-02 21:22
Daniel Turini9-Dec-02 21:22 
You want a stack trace, huh?
I did it once and regreted it. It was a great bunch of work.
Some starting points:

1. Look at the StackWalk Win32 API function. Walk the stack until you find the calling function.
2. Once with the address of the calling function, you'll need the SymFromAddr Win32 API function.
3. You'll need to ship the PDB file together with your application, because the Symbol functions will need this file.

If you only need this info for debugging purposes, you could try looking, IIRC, the address (&i)[1] (the address of the first parameter + 4 bytes. In your case, the parameter is an int), which will give you the return address on the stack. This is a hack and can fail for a hundred reasons, including the automatic inline made by the optimizer. The right way of doing it is the StackWalk way.


I see dumb people
AnswerRe: How to get the caller of a fuction? Pin
David Chamberlain10-Dec-02 3:09
David Chamberlain10-Dec-02 3:09 
Generalnew user of vc++ Pin
Rajes9-Dec-02 20:15
Rajes9-Dec-02 20:15 
GeneralRe: new user of vc++ Pin
User 66589-Dec-02 20:39
User 66589-Dec-02 20:39 
GeneralRe: new user of vc++ Pin
Rickard Andersson209-Dec-02 20:53
Rickard Andersson209-Dec-02 20:53 
GeneralRe: new user of vc++ Pin
srisvs9-Dec-02 21:43
srisvs9-Dec-02 21:43 
GeneralRe: new user of vc++ Pin
Christian Graus9-Dec-02 21:57
protectorChristian Graus9-Dec-02 21:57 
GeneralRe: new user of vc++ Pin
Michael P Butler9-Dec-02 22:21
Michael P Butler9-Dec-02 22:21 
Questionusing the system year...????? Pin
G3m1n19-Dec-02 18:56
G3m1n19-Dec-02 18:56 
AnswerRe: using the system year...????? Pin
G3m1n19-Dec-02 18:58
G3m1n19-Dec-02 18:58 
GeneralRe: using the system year...????? Pin
Joe Woodbury9-Dec-02 19:04
professionalJoe Woodbury9-Dec-02 19:04 
GeneralRe: using the system year...????? Pin
Alvaro Mendez10-Dec-02 14:47
Alvaro Mendez10-Dec-02 14:47 
GeneralRe: using the system year...????? Pin
G3m1n110-Dec-02 15:01
G3m1n110-Dec-02 15:01 
AnswerRe: using the system year...????? Pin
Mazdak9-Dec-02 22:17
Mazdak9-Dec-02 22:17 
GeneralEqv of itoa() in shlwapi.h Pin
Suren9-Dec-02 18:23
Suren9-Dec-02 18:23 
GeneralRe: Eqv of itoa() in shlwapi.h Pin
Michael P Butler9-Dec-02 22:57
Michael P Butler9-Dec-02 22:57 
GeneralRe: Eqv of itoa() in shlwapi.h Pin
Suren9-Dec-02 23:04
Suren9-Dec-02 23:04 
GeneralRe: Eqv of itoa() in shlwapi.h Pin
Michael P Butler9-Dec-02 23:31
Michael P Butler9-Dec-02 23:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.