Dumping stack?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
St8ic

Dumping stack?

Post by St8ic »

When I dump my stack to the screen (with my dump(); routine), it shows

00 00 00 00 00 00 00 00 00 (then ASCII symbols)

I'm hoping my stack isn't empty! The input to my dump routine has the location of data to dump (in this case it's 0x9000, my stack), and the length in bytes to display. The stack IS at 0x9000, I checked, but it still displays 00's. Do I have to lead my stack or something, or is it actualy empty?

Thanks bunches.
nullify

Re:Dumping stack?

Post by nullify »

Is 0x9000 the address of your stack base, or your stack pointer (ESP)? Remember, the stack grows from the stack base downward, so if that address points to the base of your stack, your dump() function has to dump out bytes progressively lower each iteration.
St8ic

Re:Dumping stack?

Post by St8ic »

Actualy I didn't know that! I'll use a ESP. Thanks!
mystran

Re:Dumping stack?

Post by mystran »

Notice, that this also affects the memory allocation process for stacks. When you allocate a region of memory for stack, you have to set ESP to the END of that region, before you start using your stack, or you are going to write just below your allocated memory..
Post Reply