Bug 1541571 - Breakpad threads should have names, r=gsvelto.

Differential Revision: https://phabricator.services.mozilla.com/D106417
This commit is contained in:
Florian Quèze 2021-02-25 22:42:50 +00:00
Родитель 5323d9fe45
Коммит c79a006552
3 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -91,6 +91,8 @@ bool CrashGenerationServer::Stop() {
// static
void *CrashGenerationServer::WaitForMessages(void *server) {
pthread_setname_np("Breakpad CrashGenerationServer");
CrashGenerationServer *self =
reinterpret_cast<CrashGenerationServer*>(server);
while (self->WaitForOneMessage()) {}

Просмотреть файл

@ -511,6 +511,8 @@ kern_return_t ForwardException(mach_port_t task, mach_port_t failed_thread,
// static
void* ExceptionHandler::WaitForMessage(void* exception_handler_class) {
pthread_setname_np("Breakpad ExceptionHandler");
ExceptionHandler* self =
reinterpret_cast<ExceptionHandler*>(exception_handler_class);
ExceptionMessage receive;

Просмотреть файл

@ -398,8 +398,20 @@ bool ExceptionHandler::RequestUpload(DWORD crash_id) {
return crash_generation_client_->RequestUpload(crash_id);
}
// The SetThreadDescription API was brought in version 1607 of Windows 10.
typedef HRESULT(WINAPI* SetThreadDescriptionPtr)(HANDLE hThread,
PCWSTR lpThreadDescription);
// static
DWORD ExceptionHandler::ExceptionHandlerThreadMain(void* lpParameter) {
static auto SetThreadDescriptionFunc =
reinterpret_cast<SetThreadDescriptionPtr>(::GetProcAddress(
::GetModuleHandle(L"Kernel32.dll"), "SetThreadDescription"));
if (SetThreadDescriptionFunc) {
SetThreadDescriptionFunc(::GetCurrentThread(),
L"Breakpad ExceptionHandler");
}
ExceptionHandler* self = reinterpret_cast<ExceptionHandler *>(lpParameter);
assert(self);
assert(self->handler_start_semaphore_ != NULL);