How about you think you knew it all but in fact you do not?Sam111 wrote:your not telling me any thing new that I already don't know.
Most stack trace technique rely on the assumption on stack pointer points to meaningful things.Sam111 wrote:Basically my question is given an arbitrary programs stack is their away to backtraces it to get the calling function stack / calling functions address?
If you don't know the calling convention, you cannot guess anything from the register states, for example, EBP may be anything.
However, for some calling convention and compile option, stack frame *may be* used.
You can expect [EBP+4] points to caller's return address, so it's possible to further resolve the caller symbol by looking which function block encloses the address.
you may also resolve parameters and local variable by looking on the stack.
It's that somewhere cause the trouble, it can be anywhere. Consider this:Sam111 wrote: And I am assuming a function is something that uses at least the call asm instruction so the return address is in theory somewhere on the stack. (but may not use the stack necessary for passing parameters could use registers or other means)
Code: Select all
call foo
...
foo:
push eax
push ebx
(crash and do stack trace here)
ret
You need a policy (ie. stack frame) to make sure where it is.
The CPU may think otherwise.Sam111 wrote: Note: I don't consider storing in registers and jmp to a label to be a function