Merge "Add `sigset64_t` and accompanying functions."
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index f812df5..f288612 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -1419,18 +1419,23 @@
EXPECT_EQ(stack_size, stack_size2);
#if defined(__BIONIC__)
- // What does /proc/self/maps' [stack] line say?
+ // Find stack in /proc/self/maps using a pointer to the stack.
+ //
+ // We do not use "[stack]" label because in native-bridge environment it is not
+ // guaranteed to point to the right stack. A native bridge implementation may
+ // keep separate stack for the guest code.
void* maps_stack_hi = NULL;
std::vector<map_record> maps;
ASSERT_TRUE(Maps::parse_maps(&maps));
+ uintptr_t stack_address = reinterpret_cast<uintptr_t>(&maps_stack_hi);
for (const auto& map : maps) {
- if (map.pathname == "[stack]") {
+ if (map.addr_start <= stack_address && map.addr_end > stack_address){
maps_stack_hi = reinterpret_cast<void*>(map.addr_end);
break;
}
}
- // The high address of the /proc/self/maps [stack] region should equal stack_base + stack_size.
+ // The high address of the /proc/self/maps stack region should equal stack_base + stack_size.
// Remember that the stack grows down (and is mapped in on demand), so the low address of the
// region isn't very interesting.
EXPECT_EQ(maps_stack_hi, reinterpret_cast<uint8_t*>(stack_base) + stack_size);