x64程序集中的“阴影空间”是什么? [英] What is the 'shadow space' in x64 Assembly?

查看:290
本文介绍了x64程序集中的“阴影空间”是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现很多关于这个阴影空间的话题,但我没有找到答案,所以我的问题是:



我需要从堆栈指针中减去,在进入一个过程?



之前,我应该把过程参数推到堆栈减去阴影空间?

我已经反汇编我的代码,但我找不到逻辑。



p>

解决方案

阴影空间(有时也称为溢出空间



回想一下前4个参数在寄存器中传递。如果你进入调试器并检查一个线程的调用堆栈,你将看不到传递给函数的任何参数。存储在寄存器中的值是暂时的,并且在向上移动调用堆栈时无法重构。



这是首页空间 :它可以由编译器使用留在堆栈上的寄存器值的副本以供以后在调试器中检查。这通常发生在未优化的构建中。但是,当启用优化时,编译器通常将主空间视为可用于临时使用。



调试的挑战优化的x64代码提供了有关此问题的深入信息。


I found plenty of topics about this shadow space, but I couldn't find the answer in none of them, so my question is:

how much exactly bytes I need to subtract from the stack pointer, before entering to a procedure?

and should I push the procedure parameters to the stack before subtracting the "shadow space"?

I've disassembled my codes, but I couldn't find the logic.

thanks in advance.

解决方案

The Shadow space (also sometimes called Spill space or Home space) is meant to be used, to make debugging x64 easier.

Recall that the first 4 parameters are passed in registers. If you break into the debugger and inspect the call stack for a thread, you won't be able to see any parameters passed to functions. The values stored in registers are transient, and cannot be reconstructed when moving up the call stack.

This is where the Home space comes into play: It can be used by compilers to leave a copy of the register values on the stack for later inspection in the debugger. This usually happens for unoptimized builds. When optimizations are enabled, however, compilers generally treat the Home space as available for scratch use. No copies are left on the stack, and debugging a crash dump turns into a nightmare.

Challenges of Debugging Optimized x64 Code offers in-depth information on the issue.

这篇关于x64程序集中的“阴影空间”是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆