Differential D38165 Diff 118368 www/qt5-webengine/files/patch-src_3rdparty_chromium_base_profiler_thread__delegate__posix.cc
Changeset View
Changeset View
Standalone View
Standalone View
www/qt5-webengine/files/patch-src_3rdparty_chromium_base_profiler_thread__delegate__posix.cc
--- src/3rdparty/chromium/base/profiler/thread_delegate_posix.cc.orig 2020-11-07 01:22:36 UTC | --- src/3rdparty/chromium/base/profiler/thread_delegate_posix.cc.orig 2021-12-15 16:12:54 UTC | ||||
+++ src/3rdparty/chromium/base/profiler/thread_delegate_posix.cc | +++ src/3rdparty/chromium/base/profiler/thread_delegate_posix.cc | ||||
@@ -9,6 +9,9 @@ | @@ -12,6 +12,9 @@ | ||||
#include "base/profiler/thread_delegate_posix.h" | |||||
#include "base/stl_util.h" | #include "base/stl_util.h" | ||||
#include "build/build_config.h" | #include "build/build_config.h" | ||||
+#if defined(OS_FREEBSD) | +#if defined(OS_FREEBSD) | ||||
+#include <pthread_np.h> | +#include <pthread_np.h> | ||||
+#endif | +#endif | ||||
namespace base { | #if defined(OS_ANDROID) | ||||
#include "base/files/file_util.h" | |||||
@@ -17,7 +20,12 @@ namespace { | @@ -43,7 +46,12 @@ uintptr_t GetThreadStackBaseAddressImpl( | ||||
uintptr_t GetThreadStackBaseAddressImpl( | uintptr_t GetThreadStackBaseAddressImpl( | ||||
SamplingProfilerThreadToken thread_token) { | SamplingProfilerThreadToken thread_token) { | ||||
pthread_attr_t attr; | pthread_attr_t attr; | ||||
+#if defined(OS_FREEBSD) | +#if defined(OS_FREEBSD) | ||||
+ pthread_attr_init(&attr); | + pthread_attr_init(&attr); | ||||
+ pthread_attr_get_np(thread_token.pthread_id, &attr); | + pthread_attr_get_np(thread_token.pthread_id, &attr); | ||||
+#elif defined(OS_LINUX) | +#elif defined(OS_LINUX) | ||||
pthread_getattr_np(thread_token.pthread_id, &attr); | pthread_getattr_np(thread_token.pthread_id, &attr); | ||||
+#endif | +#endif | ||||
// See crbug.com/617730 for limitations of this approach on Linux. | // See crbug.com/617730 for limitations of this approach on Linux. | ||||
void* address; | void* address; | ||||
size_t size; | size_t size; | ||||
@@ -93,16 +101,33 @@ std::vector<uintptr_t*> ThreadDelegatePosix::GetRegist | @@ -130,16 +138,33 @@ std::vector<uintptr_t*> ThreadDelegatePosix::GetRegist | ||||
return { | return { | ||||
// Return the set of callee-save registers per the i386 System V ABI | // Return the set of callee-save registers per the i386 System V ABI | ||||
// section 2.2.3, plus the stack pointer. | // section 2.2.3, plus the stack pointer. | ||||
+#if defined(OS_FREEBSD) | +#if defined(OS_FREEBSD) | ||||
+ reinterpret_cast<uintptr_t*>(&thread_context->mc_ebx), | + reinterpret_cast<uintptr_t*>(&thread_context->mc_ebx), | ||||
+ reinterpret_cast<uintptr_t*>(&thread_context->mc_ebp), | + reinterpret_cast<uintptr_t*>(&thread_context->mc_ebp), | ||||
+ reinterpret_cast<uintptr_t*>(&thread_context->mc_esi), | + reinterpret_cast<uintptr_t*>(&thread_context->mc_esi), | ||||
+ reinterpret_cast<uintptr_t*>(&thread_context->mc_edi), | + reinterpret_cast<uintptr_t*>(&thread_context->mc_edi), | ||||
Show All 17 Lines | |||||
+ reinterpret_cast<uintptr_t*>(&thread_context->mc_r13), | + reinterpret_cast<uintptr_t*>(&thread_context->mc_r13), | ||||
+ reinterpret_cast<uintptr_t*>(&thread_context->mc_r14), | + reinterpret_cast<uintptr_t*>(&thread_context->mc_r14), | ||||
+ reinterpret_cast<uintptr_t*>(&thread_context->mc_r15), | + reinterpret_cast<uintptr_t*>(&thread_context->mc_r15), | ||||
+ reinterpret_cast<uintptr_t*>(&thread_context->mc_rsp), | + reinterpret_cast<uintptr_t*>(&thread_context->mc_rsp), | ||||
+#else | +#else | ||||
reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RBP]), | reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RBP]), | ||||
reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RBX]), | reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RBX]), | ||||
reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R12]), | reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R12]), | ||||
@@ -110,6 +135,7 @@ std::vector<uintptr_t*> ThreadDelegatePosix::GetRegist | @@ -147,6 +172,7 @@ std::vector<uintptr_t*> ThreadDelegatePosix::GetRegist | ||||
reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R14]), | reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R14]), | ||||
reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R15]), | reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_R15]), | ||||
reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RSP]), | reinterpret_cast<uintptr_t*>(&thread_context->gregs[REG_RSP]), | ||||
+#endif | +#endif | ||||
}; | }; | ||||
#else // #if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS) | #else // #if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS) | ||||
// Unimplemented for other architectures. | // Unimplemented for other architectures. |