Skip to content

Commit

Permalink
Fix omrthread_get_stack_range on Mac OSX
Browse files Browse the repository at this point in the history
On Mac OSX stack start means where sp begins not the low memory.
This is the opposite of how it is on linux and how this API is
intended to be used.

Signed-off-by: Tobi Ajila <atobia@ca.ibm.com>
  • Loading branch information
tajila committed May 10, 2021
1 parent 896966c commit 76e5e03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions thread/common/omrthreadinspect.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ omrthread_get_stack_range(omrthread_t thread, void **stackStart, void **stackEnd
OSTHREAD osTid = thread->handle;
size_t stackSize = 0;

*stackStart = pthread_get_stackaddr_np(osTid);
*stackEnd = pthread_get_stackaddr_np(osTid);
stackSize = pthread_get_stacksize_np(osTid);
*stackEnd = (void *)((uintptr_t)*stackStart + stackSize);
*stackStart = (void *)((uintptr_t)*stackEnd - stackSize);
return J9THREAD_SUCCESS;
#else /* defined(OSX) */
return J9THREAD_ERR_UNSUPPORTED_PLAT;
Expand Down

0 comments on commit 76e5e03

Please sign in to comment.