mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1699375 - Move MozStackWalkThread to a separate header. r=gerald
It requires including <windows.h>, preventing the inclusion of StackWalk.h from some places (and upcoming changes will make StackWalk.h included in more places). Differential Revision: https://phabricator.services.mozilla.com/D108910
This commit is contained in:
parent
0b398068bf
commit
86270cdf01
@ -48,6 +48,9 @@
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Span.h"
|
||||
#include "mozilla/StackWalk.h"
|
||||
#ifdef XP_WIN
|
||||
# include "mozilla/StackWalkThread.h"
|
||||
#endif
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
@ -11,6 +11,9 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
#include "mozilla/StackWalk.h"
|
||||
#ifdef XP_WIN
|
||||
# include "mozilla/StackWalkThread.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -62,7 +65,7 @@ extern MOZ_EXPORT void* __libc_stack_end; // from ld-linux.so
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if MOZ_STACKWALK_SUPPORTS_WINDOWS
|
||||
#ifdef XP_WIN
|
||||
|
||||
# include <windows.h>
|
||||
# include <process.h>
|
||||
|
@ -44,37 +44,6 @@ typedef void (*MozWalkStackCallback)(uint32_t aFrameNumber, void* aPC,
|
||||
MFBT_API void MozStackWalk(MozWalkStackCallback aCallback, uint32_t aSkipFrames,
|
||||
uint32_t aMaxFrames, void* aClosure);
|
||||
|
||||
#if defined(_WIN32) && (defined(_M_IX86) || defined(_M_AMD64) || \
|
||||
defined(_M_IA64) || defined(_M_ARM64))
|
||||
|
||||
# include <windows.h>
|
||||
|
||||
# define MOZ_STACKWALK_SUPPORTS_WINDOWS 1
|
||||
|
||||
/**
|
||||
* Like MozStackWalk, but walks the stack for another thread.
|
||||
* Call aCallback for each stack frame on the current thread, from
|
||||
* the caller of MozStackWalk to main (or above).
|
||||
*
|
||||
* @param aCallback Same as for MozStackWalk().
|
||||
* @param aMaxFrames Same as for MozStackWalk().
|
||||
* @param aClosure Same as for MozStackWalk().
|
||||
* @param aThread The handle of the thread whose stack is to be walked.
|
||||
* If 0, walks the current thread.
|
||||
* @param aContext A CONTEXT, presumably obtained with GetThreadContext()
|
||||
* after suspending the thread with SuspendThread(). If
|
||||
* null, the CONTEXT will be re-obtained.
|
||||
*/
|
||||
MFBT_API void MozStackWalkThread(MozWalkStackCallback aCallback,
|
||||
uint32_t aMaxFrames, void* aClosure,
|
||||
HANDLE aThread, CONTEXT* aContext);
|
||||
|
||||
#else
|
||||
|
||||
# define MOZ_STACKWALK_SUPPORTS_WINDOWS 0
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
* The name of the shared library or executable containing an
|
||||
|
34
mozglue/misc/StackWalkThread.h
Normal file
34
mozglue/misc/StackWalkThread.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* APIs for getting a stack trace of an arbitrary thread */
|
||||
|
||||
#ifndef mozilla_StackWalkThread_h
|
||||
#define mozilla_StackWalkThread_h
|
||||
|
||||
#include "mozilla/StackWalk.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/**
|
||||
* Like MozStackWalk, but walks the stack for another thread.
|
||||
* Call aCallback for each stack frame on the current thread, from
|
||||
* the caller of MozStackWalk to main (or above).
|
||||
*
|
||||
* @param aCallback Same as for MozStackWalk().
|
||||
* @param aMaxFrames Same as for MozStackWalk().
|
||||
* @param aClosure Same as for MozStackWalk().
|
||||
* @param aThread The handle of the thread whose stack is to be walked.
|
||||
* If 0, walks the current thread.
|
||||
* @param aContext A CONTEXT, presumably obtained with GetThreadContext()
|
||||
* after suspending the thread with SuspendThread(). If
|
||||
* null, the CONTEXT will be re-obtained.
|
||||
*/
|
||||
MFBT_API void MozStackWalkThread(MozWalkStackCallback aCallback,
|
||||
uint32_t aMaxFrames, void* aClosure,
|
||||
HANDLE aThread, CONTEXT* aContext);
|
||||
|
||||
#endif
|
@ -30,6 +30,7 @@ if CONFIG["OS_ARCH"] == "WINNT":
|
||||
EXPORTS.mozilla += [
|
||||
"PreXULSkeletonUI.h",
|
||||
"StackWalk_windows.h",
|
||||
"StackWalkThread.h",
|
||||
"TimeStamp_windows.h",
|
||||
"WindowsDpiAwareness.h",
|
||||
]
|
||||
|
@ -59,6 +59,9 @@
|
||||
#include "mozilla/SchedulerGroup.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StackWalk.h"
|
||||
#ifdef XP_WIN
|
||||
# include "mozilla/StackWalkThread.h"
|
||||
#endif
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
Loading…
Reference in New Issue
Block a user