Solved

How to walk the call stack?

Posted on 1997-04-12
2
293 Views
Last Modified: 2010-04-06
I want to be able to generate within a procedure the call stack that got us there. Knowing the logical addresses of the callers on the stack will do -- I don't need (yet) to get the procedure names or such like.
0
Comment
Question by:RobMarsh
2 Comments
 
LVL 3

Accepted Solution

by:
mheacock earned 200 total points
ID: 1335371
You could use ASM directive and the SP register.  I believe
the SP register points to the top of the stack, therefore you
could work your way back through it.
0
 

Author Comment

by:RobMarsh
ID: 1335372
I worked something out myself through brute force and ignorance rather than insight. the function below called from within a procedure gives you the address of the caller of the procedure in a form that works with the IDE's Search|Find Error utility.

function GetCaller: pointer;
asm
  MOV  EAX, , [EBP+8]
  SUB   EAX,, 4
end;

Thanks,
RobMarsh
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to convert wav to mp3 in delphi 9 221
Delphi Dbf export problem to a Visual Foxpro application 6 207
Delphi: Connect to running MS Outlook 4 118
SUM 2 INTEGER ARRAYS INTO 1 10 108
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question