7 #if defined(HOST_ANDROID)
15 slow_get_thread_bounds (guint8 *current, guint8 **staddr, size_t *stsize)
18 FILE *f = fopen ("/proc/self/maps", "r");
20 g_error ("Could not determine thread bounds, failed to open /proc/self/maps");
22 while (fgets (buff, sizeof (buff), f)) {
26 //each line starts with the range we want: f7648000-f7709000
27 low = strtoimax (ptr, &end, 16);
29 ptr = end + 1; //skip the dash to make sure we don't get a negative number
31 high = strtoimax (ptr, &end, 16);
33 if (end && low <= (intmax_t)(size_t)current && high > (intmax_t)(size_t)current) {
34 *staddr = (guint8 *)(size_t)low;
35 *stsize = (size_t)(high - low);
40 g_error ("Could not determine thread bounds, failed to find current stack pointer in /proc/self/maps");
44 mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
47 guint8 *current = (guint8*)&attr;
52 pthread_getattr_np (pthread_self (), &attr);
53 pthread_attr_getstack (&attr, (void**)staddr, stsize);
54 pthread_attr_destroy (&attr);
56 if (*staddr && ((current <= *staddr) || (current > *staddr + *stsize)))
57 slow_get_thread_bounds (current, staddr, stsize);