setting malloc'd memory as executable on intel
setting malloc'd memory as executable on intel
- Subject: setting malloc'd memory as executable on intel
- From: "Chase" <email@hidden>
- Date: Mon, 09 Apr 2007 19:10:07 +0000
i'm creating a function on the fly (plain old c function).
i set up the function pointer.
i malloc enough memory for it and point the function pointer to it.
i populate the function with code (including boilerplate stack setup/cleanup).
when i inspect the code in memory at runtime, it looks perfect (and the function pointer is properly pointing to it).
but i cannot call it or even jump into it using gdb's jump.
i get "??" at the top of the call chain in xcode and nothing shows up in the assembly or code views in the debugger. when i hit the "Step Into Instruction" button, i get:
Previous frame inner to this frame (corrupt stack?)
Previous frame inner to this frame (corrupt stack?)
(this is on intel, by the way)
i tried MakeDataExecutable(), but it didn't help.
and i tried msync(ptr, size, MS_INVALIDATE), but it didn't help either.
what am i missing here?
thanks.
- Chase
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden