How to walk the call stack?

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.
RobMarshAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mheacockConnect With a Mentor Commented:
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
 
RobMarshAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.