setting malloc'd memory as executable on intel
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Chase