问题描述
我想移植到OSX,其目的是在Linux和FreeBSD运行的工具。有一个在节目里获得了EIP和EBP是需要的情况。这是通过ucontext完成
I am trying to port a tool to osx which is designed to run on linux and freebsd. There is a case in the program where access to the EIP and EBP is need. This is done via the ucontext.
所以我增加了一个案例__APPLE__放置到ucontext结构合适的访问。
So i added a case for __APPLE__ to place a suitable access to the ucontext struct.
9887 #if defined(__FreeBSD__)
9888 *paddr = uc->uc_mcontext.mc_eip;
9889 #elif defined(__dietlibc__)
9890 *paddr = uc->uc_mcontext.eip;
9891 #elif defined(__APPLE__)
9892 *paddr = uc->uc_mcontext.ss.eip;
9893 #else
9894 *paddr = uc->uc_mcontext.gregs[REG_EIP];
9895 #endif
但UC-> uc_mcontext.ss.eip不能编译。不知道如何从ucontext访问EIP。
But uc->uc_mcontext.ss.eip doesn't compile. Not sure how to access the EIP from the ucontext.
推荐答案
它出现在OS X 10.5,它应该是改变了命名方案 UC-> uc_mcontext-> __ SS .__ EIP
。在以后的版本,这是 UC-> uc_mcontext-> __ SS .__撕裂
为x86_64的
It appears the naming scheme changed in OS X 10.5, where it should be uc->uc_mcontext->__ss.__eip
. On later versions this is uc->uc_mcontext->__ss.__rip
for x86_64.
<一个href=\"http://www.google.co.il/search?hl=en&client=firefox-a&rls=com.ubuntu%3Aen-US%3Aunofficial&hs=sxR&q=uc_mcontext+osx&btnG=Search&meta=\"相对=nofollow>谷歌搜索,裁判:
,的
这篇关于通过在OS X ucontext访问EIP和EBP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!