Bug 1339695 (part 10) - Rename SPS_* macros as GP_*. r=jseward.

This removes the final mentions of the old "SPS" name.

--HG--
extra : rebase_source : 1bb36686d21ff8376326d35416b497f58e03fcde
This commit is contained in:
Nicholas Nethercote 2017-02-18 00:57:03 +11:00
Родитель 6562cdd851
Коммит 4b44b699f4
22 изменённых файлов: 163 добавлений и 160 удалений

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

@ -3,80 +3,81 @@
* 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/. */
#ifndef SPS_PLATFORM_MACROS_H
#define SPS_PLATFORM_MACROS_H
#ifndef PLATFORM_MACROS_H
#define PLATFORM_MACROS_H
/* Define platform selection macros in a consistent way. Don't add
anything else to this file, so it can remain freestanding. The
primary factorisation is on (ARCH,OS) pairs ("PLATforms") but ARCH_
and OS_ macros are defined too, since they are sometimes
convenient. */
// Define platform selection macros in a consistent way. Don't add anything
// else to this file, so it can remain freestanding. The primary factorisation
// is on (ARCH,OS) pairs ("PLATforms") but ARCH_ and OS_ macros are defined
// too, since they are sometimes convenient.
//
// Note: "GP" is short for "Gecko Profiler".
#undef SPS_PLAT_x86_android
#undef SPS_PLAT_arm_android
#undef SPS_PLAT_x86_linux
#undef SPS_PLAT_amd64_linux
#undef SPS_PLAT_x86_darwin
#undef SPS_PLAT_amd64_darwin
#undef SPS_PLAT_x86_windows
#undef SPS_PLAT_amd64_windows
#undef GP_PLAT_x86_android
#undef GP_PLAT_arm_android
#undef GP_PLAT_x86_linux
#undef GP_PLAT_amd64_linux
#undef GP_PLAT_x86_darwin
#undef GP_PLAT_amd64_darwin
#undef GP_PLAT_x86_windows
#undef GP_PLAT_amd64_windows
#undef SPS_ARCH_x86
#undef SPS_ARCH_amd64
#undef SPS_ARCH_arm
#undef GP_ARCH_x86
#undef GP_ARCH_amd64
#undef GP_ARCH_arm
#undef SPS_OS_android
#undef SPS_OS_linux
#undef SPS_OS_darwin
#undef SPS_OS_windows
#undef GP_OS_android
#undef GP_OS_linux
#undef GP_OS_darwin
#undef GP_OS_windows
// We test __ANDROID__ before __linux__ because __linux__ is defined on both
// Android and Linux, whereas SPS_OS_android is not defined on vanilla Linux.
// Android and Linux, whereas GP_OS_android is not defined on vanilla Linux.
#if defined(__ANDROID__) && defined(__i386__)
# define SPS_PLAT_x86_android 1
# define SPS_ARCH_x86 1
# define SPS_OS_android 1
# define GP_PLAT_x86_android 1
# define GP_ARCH_x86 1
# define GP_OS_android 1
#elif defined(__ANDROID__) && defined(__arm__)
# define SPS_PLAT_arm_android 1
# define SPS_ARCH_arm 1
# define SPS_OS_android 1
# define GP_PLAT_arm_android 1
# define GP_ARCH_arm 1
# define GP_OS_android 1
#elif defined(__linux__) && defined(__i386__)
# define SPS_PLAT_x86_linux 1
# define SPS_ARCH_x86 1
# define SPS_OS_linux 1
# define GP_PLAT_x86_linux 1
# define GP_ARCH_x86 1
# define GP_OS_linux 1
#elif defined(__linux__) && defined(__x86_64__)
# define SPS_PLAT_amd64_linux 1
# define SPS_ARCH_amd64 1
# define SPS_OS_linux 1
# define GP_PLAT_amd64_linux 1
# define GP_ARCH_amd64 1
# define GP_OS_linux 1
#elif defined(__APPLE__) && defined(__i386__)
# define SPS_PLAT_x86_darwin 1
# define SPS_ARCH_x86 1
# define SPS_OS_darwin 1
# define GP_PLAT_x86_darwin 1
# define GP_ARCH_x86 1
# define GP_OS_darwin 1
#elif defined(__APPLE__) && defined(__x86_64__)
# define SPS_PLAT_amd64_darwin 1
# define SPS_ARCH_amd64 1
# define SPS_OS_darwin 1
# define GP_PLAT_amd64_darwin 1
# define GP_ARCH_amd64 1
# define GP_OS_darwin 1
#elif (defined(_MSC_VER) || defined(__MINGW32__)) && \
(defined(_M_IX86) || defined(__i386__))
# define SPS_PLAT_x86_windows 1
# define SPS_ARCH_x86 1
# define SPS_OS_windows 1
# define GP_PLAT_x86_windows 1
# define GP_ARCH_x86 1
# define GP_OS_windows 1
#elif (defined(_MSC_VER) || defined(__MINGW32__)) && \
(defined(_M_X64) || defined(__x86_64__))
# define SPS_PLAT_amd64_windows 1
# define SPS_ARCH_amd64 1
# define SPS_OS_windows 1
# define GP_PLAT_amd64_windows 1
# define GP_ARCH_amd64 1
# define GP_OS_windows 1
#else
# error "Unsupported platform"
# error "Unsupported platform"
#endif
#endif /* ndef SPS_PLATFORM_MACROS_H */
#endif /* ndef PLATFORM_MACROS_H */

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

@ -42,7 +42,7 @@
_(UnsharedMemory, double)
// NB: Packing this structure has been shown to cause SIGBUS issues on ARM.
#if !defined(SPS_ARCH_arm)
#if !defined(GP_ARCH_arm)
#pragma pack(push, 1)
#endif
@ -110,7 +110,7 @@ private:
Kind mKind;
};
#if !defined(SPS_ARCH_arm)
#if !defined(GP_ARCH_arm)
#pragma pack(pop)
#endif

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

@ -4,22 +4,24 @@
* 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/. */
#if defined(SPS_OS_darwin)
#include "PlatformMacros.h"
#if defined(GP_OS_darwin)
#include <mach/task.h>
#include <mach/thread_act.h>
#include <pthread.h>
#elif defined(SPS_OS_windows)
#elif defined(GP_OS_windows)
#include <windows.h>
#endif
#include "StackTop.h"
void *GetStackTop(void *guess) {
#if defined(SPS_OS_darwin)
#if defined(GP_OS_darwin)
pthread_t thread = pthread_self();
return pthread_get_stackaddr_np(thread);
#elif defined(SPS_OS_windows)
#if defined(_MSC_VER) && defined(SPS_ARCH_x86)
#elif defined(GP_OS_windows)
#if defined(_MSC_VER) && defined(GP_ARCH_x86)
// offset 0x18 from the FS segment register gives a pointer to
// the thread information block for the current thread
NT_TIB* pTib;
@ -28,7 +30,7 @@ void *GetStackTop(void *guess) {
MOV pTib, EAX
}
return static_cast<void*>(pTib->StackBase);
#elif defined(__GNUC__) && defined(SPS_ARCH_x86)
#elif defined(__GNUC__) && defined(GP_ARCH_x86)
// offset 0x18 from the FS segment register gives a pointer to
// the thread information block for the current thread
NT_TIB* pTib;
@ -36,7 +38,7 @@ void *GetStackTop(void *guess) {
: "=r" (pTib)
);
return static_cast<void*>(pTib->StackBase);
#elif defined(SPS_ARCH_amd64)
#elif defined(GP_ARCH_amd64)
PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb());
return reinterpret_cast<void*>(pTib->StackBase);
#else

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

@ -8,7 +8,7 @@
#include "mozilla/DebugOnly.h"
#if defined(SPS_OS_darwin)
#if defined(GP_OS_darwin)
#include <pthread.h>
#endif
@ -23,7 +23,7 @@ ThreadInfo::ThreadInfo(const char* aName, int aThreadId,
, mStackTop(aStackTop)
, mPendingDelete(false)
, mMutex(MakeUnique<mozilla::Mutex>("ThreadInfo::mMutex"))
#if defined(SPS_OS_linux) || defined(SPS_OS_android)
#if defined(GP_OS_linux) || defined(GP_OS_android)
, mRssMemory(0)
, mUssMemory(0)
#endif
@ -32,7 +32,7 @@ ThreadInfo::ThreadInfo(const char* aName, int aThreadId,
mThread = NS_GetCurrentThread();
// We don't have to guess on mac
#if defined(SPS_OS_darwin)
#if defined(GP_OS_darwin)
pthread_t self = pthread_self();
mStackTop = pthread_get_stackaddr_np(self);
#endif

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

@ -107,7 +107,7 @@ private:
mozilla::UniquePtr<mozilla::Mutex> mMutex;
ThreadResponsiveness mRespInfo;
#if defined(SPS_OS_linux) || defined(SPS_OS_android)
#if defined(GP_OS_linux) || defined(GP_OS_android)
// Only Linux is using a signal sender, instead of stopping the thread, so we
// need some space to store the data which cannot be collected in the signal
// handler code.

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

@ -109,7 +109,7 @@ Thread::GetCurrentId()
return gettid();
}
#if !defined(SPS_OS_android)
#if !defined(GP_OS_android)
// Keep track of when any of our threads calls fork(), so we can
// temporarily disable signal delivery during the fork() call. Not
// doing so appears to cause a kind of race, in which signals keep
@ -144,7 +144,7 @@ static void* setup_atfork() {
pthread_atfork(paf_prepare, paf_parent, NULL);
return NULL;
}
#endif /* !defined(SPS_OS_android) */
#endif /* !defined(GP_OS_android) */
static mozilla::Atomic<ThreadInfo*> gCurrentThreadInfo;
static sem_t gSignalHandlingDone;
@ -154,15 +154,15 @@ static void SetSampleContext(TickSample* sample, void* context)
// Extracting the sample from the context is extremely machine dependent.
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
mcontext_t& mcontext = ucontext->uc_mcontext;
#if defined(SPS_ARCH_x86)
#if defined(GP_ARCH_x86)
sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
#elif defined(SPS_ARCH_amd64)
#elif defined(GP_ARCH_amd64)
sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]);
sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]);
sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]);
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
sample->pc = reinterpret_cast<Address>(mcontext.arm_pc);
sample->sp = reinterpret_cast<Address>(mcontext.arm_sp);
sample->fp = reinterpret_cast<Address>(mcontext.arm_fp);
@ -203,7 +203,7 @@ SigprofHandler(int signal, siginfo_t* info, void* context)
errno = savedErrno;
}
#if defined(SPS_OS_android)
#if defined(GP_OS_android)
#define SYS_tgkill __NR_tgkill
#endif
@ -411,7 +411,7 @@ PlatformStop()
}
}
#if defined(SPS_OS_android)
#if defined(GP_OS_android)
static struct sigaction gOldSigstartHandler;
const int SIGSTART = SIGUSR2;

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

@ -214,7 +214,7 @@ public:
if (KERN_SUCCESS != thread_suspend(profiled_thread)) return;
#if defined(SPS_ARCH_amd64)
#if defined(GP_ARCH_amd64)
thread_state_flavor_t flavor = x86_THREAD_STATE64;
x86_thread_state64_t state;
mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT;
@ -223,7 +223,7 @@ public:
#else
#define REGISTER_FIELD(name) r ## name
#endif // __DARWIN_UNIX03
#elif defined(SPS_ARCH_x86)
#elif defined(GP_ARCH_x86)
thread_state_flavor_t flavor = i386_THREAD_STATE;
i386_thread_state_t state;
mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;
@ -234,7 +234,7 @@ public:
#endif // __DARWIN_UNIX03
#else
#error Unsupported Mac OS X host architecture.
#endif // SPS_ARCH_*
#endif // GP_ARCH_*
if (thread_get_state(profiled_thread,
flavor,
@ -295,7 +295,7 @@ Thread::GetCurrentId()
void TickSample::PopulateContext(void* aContext)
{
// Note that this asm changes if PopulateContext's parameter list is altered
#if defined(SPS_ARCH_amd64)
#if defined(GP_ARCH_amd64)
asm (
// Compute caller's %rsp by adding to %rbp:
// 8 bytes for previous %rbp, 8 bytes for return address
@ -306,7 +306,7 @@ void TickSample::PopulateContext(void* aContext)
"=r"(sp),
"=r"(fp)
);
#elif defined(SPS_ARCH_x86)
#elif defined(GP_ARCH_x86)
asm (
// Compute caller's %esp by adding to %ebp:
// 4 bytes for aContext + 4 bytes for return address +

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

@ -225,7 +225,7 @@ class SamplerThread
// Using only CONTEXT_CONTROL is faster but on 64-bit it causes crashes in
// RtlVirtualUnwind (see bug 1120126) so we set all the flags.
#if defined(SPS_ARCH_amd64)
#if defined(GP_ARCH_amd64)
context.ContextFlags = CONTEXT_FULL;
#else
context.ContextFlags = CONTEXT_CONTROL;
@ -235,7 +235,7 @@ class SamplerThread
return;
}
#if defined(SPS_ARCH_amd64)
#if defined(GP_ARCH_amd64)
sample->pc = reinterpret_cast<Address>(context.Rip);
sample->sp = reinterpret_cast<Address>(context.Rsp);
sample->fp = reinterpret_cast<Address>(context.Rbp);
@ -307,11 +307,11 @@ void TickSample::PopulateContext(void* aContext)
context = pContext;
RtlCaptureContext(pContext);
#if defined(SPS_ARCH_amd64)
#if defined(GP_ARCH_amd64)
pc = reinterpret_cast<Address>(pContext->Rip);
sp = reinterpret_cast<Address>(pContext->Rsp);
fp = reinterpret_cast<Address>(pContext->Rbp);
#elif defined(SPS_ARCH_x86)
#elif defined(GP_ARCH_x86)
pc = reinterpret_cast<Address>(pContext->Eip);
sp = reinterpret_cast<Address>(pContext->Esp);
fp = reinterpret_cast<Address>(pContext->Ebp);

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

@ -50,17 +50,17 @@
#endif
#if defined(MOZ_PROFILING) && \
(defined(SPS_OS_windows) || defined(SPS_OS_darwin))
(defined(GP_OS_windows) || defined(GP_OS_darwin))
# define USE_NS_STACKWALK
#endif
// This should also work on ARM Linux, but not tested there yet.
#if defined(SPS_arm_android)
#if defined(GP_arm_android)
# define USE_EHABI_STACKWALK
# include "EHABIStackWalk.h"
#endif
#if defined(SPS_PLAT_amd64_linux) || defined(SPS_PLAT_x86_linux)
#if defined(GP_PLAT_amd64_linux) || defined(GP_PLAT_x86_linux)
# define USE_LUL_STACKWALK
# include "lul/LulMain.h"
# include "lul/platform-linux-lul.h"
@ -72,9 +72,9 @@
# define VALGRIND_MAKE_MEM_DEFINED(_addr,_len) ((void)0)
#endif
#if defined(SPS_OS_windows)
#if defined(GP_OS_windows)
typedef CONTEXT tickcontext_t;
#elif defined(SPS_OS_linux) || defined(SPS_OS_android)
#elif defined(GP_OS_linux) || defined(GP_OS_android)
#include <ucontext.h>
typedef ucontext_t tickcontext_t;
#endif
@ -200,7 +200,7 @@ CanNotifyObservers()
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
#if defined(SPS_OS_android)
#if defined(GP_OS_android)
// Android ANR reporter uses the profiler off the main thread.
return NS_IsMainThread();
#else
@ -546,7 +546,7 @@ MergeStacksIntoProfile(ThreadInfo& aInfo, TickSample* aSample,
}
}
#if defined(SPS_OS_windows)
#if defined(GP_OS_windows)
static uintptr_t GetThreadHandle(PlatformData* aData);
#endif
@ -581,7 +581,7 @@ DoNativeBacktrace(ThreadInfo& aInfo, TickSample* aSample)
uint32_t maxFrames = uint32_t(nativeStack.size - nativeStack.count);
#if defined(SPS_OS_darwin) || (defined(SPS_PLAT_x86_windows))
#if defined(GP_OS_darwin) || (defined(GP_PLAT_x86_windows))
void* stackEnd = aSample->threadInfo->StackTop();
if (aSample->fp >= aSample->sp && aSample->fp <= stackEnd) {
FramePointerStackWalk(StackWalkCallback, /* skipFrames */ 0, maxFrames,
@ -682,18 +682,18 @@ DoNativeBacktrace(ThreadInfo& aInfo, TickSample* aSample)
lul::UnwindRegs startRegs;
memset(&startRegs, 0, sizeof(startRegs));
#if defined(SPS_PLAT_amd64_linux)
#if defined(GP_PLAT_amd64_linux)
startRegs.xip = lul::TaggedUWord(mc->gregs[REG_RIP]);
startRegs.xsp = lul::TaggedUWord(mc->gregs[REG_RSP]);
startRegs.xbp = lul::TaggedUWord(mc->gregs[REG_RBP]);
#elif defined(SPS_PLAT_arm_android)
#elif defined(GP_PLAT_arm_android)
startRegs.r15 = lul::TaggedUWord(mc->arm_pc);
startRegs.r14 = lul::TaggedUWord(mc->arm_lr);
startRegs.r13 = lul::TaggedUWord(mc->arm_sp);
startRegs.r12 = lul::TaggedUWord(mc->arm_ip);
startRegs.r11 = lul::TaggedUWord(mc->arm_fp);
startRegs.r7 = lul::TaggedUWord(mc->arm_r7);
#elif defined(SPS_PLAT_x86_linux) || defined(SPS_PLAT_x86_android)
#elif defined(GP_PLAT_x86_linux) || defined(GP_PLAT_x86_android)
startRegs.xip = lul::TaggedUWord(mc->gregs[REG_EIP]);
startRegs.xsp = lul::TaggedUWord(mc->gregs[REG_ESP]);
startRegs.xbp = lul::TaggedUWord(mc->gregs[REG_EBP]);
@ -709,13 +709,13 @@ DoNativeBacktrace(ThreadInfo& aInfo, TickSample* aSample)
lul::StackImage stackImg;
{
#if defined(SPS_PLAT_amd64_linux)
#if defined(GP_PLAT_amd64_linux)
uintptr_t rEDZONE_SIZE = 128;
uintptr_t start = startRegs.xsp.Value() - rEDZONE_SIZE;
#elif defined(SPS_PLAT_arm_android)
#elif defined(GP_PLAT_arm_android)
uintptr_t rEDZONE_SIZE = 0;
uintptr_t start = startRegs.r13.Value() - rEDZONE_SIZE;
#elif defined(SPS_PLAT_x86_linux) || defined(SPS_PLAT_x86_android)
#elif defined(GP_PLAT_x86_linux) || defined(GP_PLAT_x86_android)
uintptr_t rEDZONE_SIZE = 0;
uintptr_t start = startRegs.xsp.Value() - rEDZONE_SIZE;
#else
@ -2494,10 +2494,10 @@ profiler_get_backtrace()
sample.threadInfo = profile;
#if defined(HAVE_NATIVE_UNWIND)
#if defined(SPS_OS_windows) || defined(SPS_OS_linux) || defined(SPS_OS_android)
#if defined(GP_OS_windows) || defined(GP_OS_linux) || defined(GP_OS_android)
tickcontext_t context;
sample.PopulateContext(&context);
#elif defined(SPS_OS_darwin)
#elif defined(GP_OS_darwin)
sample.PopulateContext(nullptr);
#else
# error "unknown platform"
@ -2653,12 +2653,12 @@ void PseudoStack::flushSamplerOnJSShutdown()
// We #include these files directly because it means those files can use
// declarations from this file trivially.
#if defined(SPS_OS_windows)
# include "platform-win32.cc"
#elif defined(SPS_OS_darwin)
# include "platform-macos.cc"
#elif defined(SPS_OS_linux) || defined(SPS_OS_android)
# include "platform-linux.cc"
#if defined(GP_OS_windows)
# include "platform-win32.cpp"
#elif defined(GP_OS_darwin)
# include "platform-macos.cpp"
#elif defined(GP_OS_linux) || defined(GP_OS_android)
# include "platform-linux-android.cpp"
#else
# error "bad platform"
#endif

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

@ -51,7 +51,7 @@ static inline pid_t gettid()
{
return (pid_t) syscall(SYS_gettid);
}
#elif defined(SPS_OS_darwin)
#elif defined(GP_OS_darwin)
#include <unistd.h>
#include <sys/syscall.h>
static inline pid_t gettid()
@ -60,13 +60,13 @@ static inline pid_t gettid()
}
#endif
#if defined(SPS_OS_windows)
#if defined(GP_OS_windows)
#include <windows.h>
#endif
bool profiler_verbose();
#if defined(SPS_OS_android)
#if defined(GP_OS_android)
# include <android/log.h>
# define LOG(text) \
do { if (profiler_verbose()) \
@ -89,7 +89,7 @@ bool profiler_verbose();
#endif
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
#if defined(GP_OS_android) && !defined(MOZ_WIDGET_GONK)
#define PROFILE_JAVA
#endif
@ -125,7 +125,7 @@ public:
class Thread {
public:
#if defined(SPS_OS_windows)
#if defined(GP_OS_windows)
typedef DWORD tid_t;
#else
typedef ::pid_t tid_t;
@ -145,10 +145,10 @@ public:
#undef HAVE_NATIVE_UNWIND
#if defined(MOZ_PROFILING) && \
(defined(SPS_OS_windows) || \
defined(SPS_OS_darwin) || \
defined(SPS_OS_linux) || \
defined(SPS_PLAT_arm_android))
(defined(GP_OS_windows) || \
defined(GP_OS_darwin) || \
defined(GP_OS_linux) || \
defined(GP_PLAT_arm_android))
# define HAVE_NATIVE_UNWIND
#endif

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

@ -42,7 +42,7 @@ static std::string getId(const char *bin_name)
#if !defined(MOZ_WIDGET_GONK)
// TODO fix me with proper include
#include "nsDebug.h"
#if defined(SPS_OS_android)
#if defined(GP_OS_android)
#include "ElfLoader.h" // dl_phdr_info
#else
#include <link.h> // dl_phdr_info
@ -51,7 +51,7 @@ static std::string getId(const char *bin_name)
#include <dlfcn.h>
#include <sys/types.h>
#if defined(SPS_OS_android)
#if defined(GP_OS_android)
extern "C" MOZ_EXPORT __attribute__((weak))
int dl_iterate_phdr(
int (*callback) (struct dl_phdr_info *info,
@ -99,7 +99,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
SharedLibraryInfo info;
#if !defined(MOZ_WIDGET_GONK)
#if defined(SPS_OS_android)
#if defined(GP_OS_android)
if (!dl_iterate_phdr) {
// On ARM Android, dl_iterate_phdr is provided by the custom linker.
// So if libxul was loaded by the system linker (e.g. as part of
@ -107,12 +107,12 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
// not call it.
return info;
}
#endif // defined(SPS_OS_android)
#endif // defined(GP_OS_android)
dl_iterate_phdr(dl_iterate_callback, &info);
#endif // !defined(MOZ_WIDGET_GONK)
#if defined(SPS_OS_android) || defined(MOZ_WIDGET_GONK)
#if defined(GP_OS_android) || defined(MOZ_WIDGET_GONK)
pid_t pid = getpid();
char path[PATH_MAX];
snprintf(path, PATH_MAX, "/proc/%d/maps", pid);
@ -164,7 +164,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
}
count++;
}
#endif // defined(SPS_OS_android) || defined(MOZ_WIDGET_GONK)
#endif // defined(GP_OS_android) || defined(MOZ_WIDGET_GONK)
return info;
}

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

@ -20,7 +20,7 @@
#include "shared-libraries.h"
// Architecture specific abstraction.
#if defined(SPS_ARCH_x86)
#if defined(GP_ARCH_x86)
typedef mach_header platform_mach_header;
typedef segment_command mach_segment_command_type;
#define MACHO_MAGIC_NUMBER MH_MAGIC

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

@ -12,7 +12,7 @@
#include "mozilla/Attributes.h"
#include "PlatformMacros.h"
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
#if defined(GP_OS_android) && !defined(MOZ_WIDGET_GONK)
#define USE_FAULTY_LIB
#endif

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

@ -134,7 +134,7 @@ Summariser::Rule(uintptr_t aAddress, int aNewReg,
// FIXME: factor out common parts of the arch-dependent summarisers.
#if defined(SPS_ARCH_arm)
#if defined(GP_ARCH_arm)
// ----------------- arm ----------------- //
@ -237,7 +237,7 @@ Summariser::Rule(uintptr_t aAddress, int aNewReg,
mCurrRules.mR15expr = LExpr(NODEREF, DW_REG_ARM_R14, 0);
}
#elif defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#elif defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
// ---------------- x64/x86 ---------------- //

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

@ -68,7 +68,7 @@
#include "LulMainInt.h"
#if defined(SPS_PLAT_arm_android) && !defined(SHT_ARM_EXIDX)
#if defined(GP_PLAT_arm_android) && !defined(SHT_ARM_EXIDX)
// bionic and older glibsc don't define it
# define SHT_ARM_EXIDX (SHT_LOPROC + 1)
#endif

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

@ -55,7 +55,7 @@
// elfutils.h: Utilities for dealing with ELF files.
//
#if defined(SPS_OS_android)
#if defined(GP_OS_android)
// From toolkit/crashreporter/google-breakpad/src/common/android/include/elf.h
// The Android headers don't always define this constant.

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

@ -60,11 +60,11 @@ NameOf_DW_REG(int16_t aReg)
{
switch (aReg) {
case DW_REG_CFA: return "cfa";
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
case DW_REG_INTEL_XBP: return "xbp";
case DW_REG_INTEL_XSP: return "xsp";
case DW_REG_INTEL_XIP: return "xip";
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
case DW_REG_ARM_R7: return "r7";
case DW_REG_ARM_R11: return "r11";
case DW_REG_ARM_R12: return "r12";
@ -119,11 +119,11 @@ RuleSet::Print(void(*aLog)(const char*)) const
res += mCfaExpr.ShowRule("cfa");
res += " in";
// For each reg we care about, print the recovery expression.
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
res += mXipExpr.ShowRule(" RA");
res += mXspExpr.ShowRule(" SP");
res += mXbpExpr.ShowRule(" BP");
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
res += mR15expr.ShowRule(" R15");
res += mR7expr .ShowRule(" R7" );
res += mR11expr.ShowRule(" R11");
@ -140,11 +140,11 @@ LExpr*
RuleSet::ExprForRegno(DW_REG_NUMBER aRegno) {
switch (aRegno) {
case DW_REG_CFA: return &mCfaExpr;
# if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
# if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
case DW_REG_INTEL_XIP: return &mXipExpr;
case DW_REG_INTEL_XSP: return &mXspExpr;
case DW_REG_INTEL_XBP: return &mXbpExpr;
# elif defined(SPS_ARCH_arm)
# elif defined(GP_ARCH_arm)
case DW_REG_ARM_R15: return &mR15expr;
case DW_REG_ARM_R14: return &mR14expr;
case DW_REG_ARM_R13: return &mR13expr;
@ -633,7 +633,7 @@ class PriMap {
// |ia| falls within an r-x range. So we can
// safely poke around in [insns_min, insns_max].
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
// Is the previous instruction recognisably a CALL? This is
// common for the 32- and 64-bit versions, except for the
// simm32(%rip) case, which is 64-bit only.
@ -645,7 +645,7 @@ class PriMap {
// logic works for both 32- and 64-bit cases.
uint8_t* p = (uint8_t*)ia;
# if defined(SPS_ARCH_amd64)
# if defined(GP_ARCH_amd64)
// CALL simm32(%rip) == FF15 simm32
if (ia - 6 >= insns_min && p[-6] == 0xFF && p[-5] == 0x15) {
return true;
@ -745,7 +745,7 @@ class PriMap {
return true;
}
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
if (ia & 1) {
uint16_t w0 = 0, w1 = 0;
// The return address has its lowest bit set, indicating a return
@ -1093,11 +1093,11 @@ TaggedUWord EvaluateReg(int16_t aReg, const UnwindRegs* aOldRegs,
{
switch (aReg) {
case DW_REG_CFA: return aCFA;
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
case DW_REG_INTEL_XBP: return aOldRegs->xbp;
case DW_REG_INTEL_XSP: return aOldRegs->xsp;
case DW_REG_INTEL_XIP: return aOldRegs->xip;
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
case DW_REG_ARM_R7: return aOldRegs->r7;
case DW_REG_ARM_R11: return aOldRegs->r11;
case DW_REG_ARM_R12: return aOldRegs->r12;
@ -1285,11 +1285,11 @@ void UseRuleSet(/*MOD*/UnwindRegs* aRegs,
// anew. If we don't even manage to compute a new PC value, then
// the caller will have to abandon the unwind.
// FIXME: Create and use instead: aRegs->SetAllInvalid();
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
aRegs->xbp = TaggedUWord();
aRegs->xsp = TaggedUWord();
aRegs->xip = TaggedUWord();
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
aRegs->r7 = TaggedUWord();
aRegs->r11 = TaggedUWord();
aRegs->r12 = TaggedUWord();
@ -1313,14 +1313,14 @@ void UseRuleSet(/*MOD*/UnwindRegs* aRegs,
// value rules mention the CFA. In any case, compute the new values
// for each register that we're tracking.
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
aRegs->xbp
= aRS->mXbpExpr.EvaluateExpr(&old_regs, cfa, aStackImg, aPfxInstrs);
aRegs->xsp
= aRS->mXspExpr.EvaluateExpr(&old_regs, cfa, aStackImg, aPfxInstrs);
aRegs->xip
= aRS->mXipExpr.EvaluateExpr(&old_regs, cfa, aStackImg, aPfxInstrs);
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
aRegs->r7
= aRS->mR7expr .EvaluateExpr(&old_regs, cfa, aStackImg, aPfxInstrs);
aRegs->r11
@ -1370,7 +1370,7 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
if (DEBUG_MAIN) {
char buf[300];
mLog("\n");
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
SprintfLiteral(buf,
"LoopTop: rip %d/%llx rsp %d/%llx rbp %d/%llx\n",
(int)regs.xip.Valid(), (unsigned long long int)regs.xip.Value(),
@ -1378,7 +1378,7 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
(int)regs.xbp.Valid(), (unsigned long long int)regs.xbp.Value());
buf[sizeof(buf)-1] = 0;
mLog(buf);
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
SprintfLiteral(buf,
"LoopTop: r15 %d/%llx r7 %d/%llx r11 %d/%llx"
" r12 %d/%llx r13 %d/%llx r14 %d/%llx\n",
@ -1395,10 +1395,10 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
#endif
}
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
TaggedUWord ia = regs.xip;
TaggedUWord sp = regs.xsp;
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
TaggedUWord ia = (*aFramesUsed == 0 ? regs.r15 : regs.r14);
TaggedUWord sp = regs.r13;
#else
@ -1503,7 +1503,7 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
// hasn't been rescheduled. The code below doesn't handle that;
// it could easily be made to.
//
#if defined(SPS_PLAT_x86_android) || defined(SPS_PLAT_x86_linux)
#if defined(GP_PLAT_x86_android) || defined(GP_PLAT_x86_linux)
if (!ruleset && *aFramesUsed == 1 && ia.Valid() && sp.Valid()) {
uintptr_t insns_min, insns_max;
uintptr_t eip = ia.Value();
@ -1575,11 +1575,11 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
scan_succeeded = true;
(*aScannedFramesAcquired)++;
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
// The same logic applies for the 32- and 64-bit cases.
// Register names of the form xsp etc refer to (eg) esp in
// the 32-bit case and rsp in the 64-bit case.
# if defined(SPS_ARCH_amd64)
# if defined(GP_ARCH_amd64)
const int wordSize = 8;
# else
const int wordSize = 4;
@ -1619,7 +1619,7 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
// Move on to the next word up the stack
sp = sp + TaggedUWord(wordSize);
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
// Set all registers to be undefined, except for SP(R13) and
// PC(R15).
@ -1686,7 +1686,7 @@ bool GetAndCheckStackTrace(LUL* aLUL, const char* dstring)
// Get hold of the current unwind-start registers.
UnwindRegs startRegs;
memset(&startRegs, 0, sizeof(startRegs));
#if defined(SPS_PLAT_amd64_linux)
#if defined(GP_PLAT_amd64_linux)
volatile uintptr_t block[3];
MOZ_ASSERT(sizeof(block) == 24);
__asm__ __volatile__(
@ -1701,7 +1701,7 @@ bool GetAndCheckStackTrace(LUL* aLUL, const char* dstring)
startRegs.xbp = TaggedUWord(block[2]);
const uintptr_t REDZONE_SIZE = 128;
uintptr_t start = block[1] - REDZONE_SIZE;
#elif defined(SPS_PLAT_x86_linux) || defined(SPS_PLAT_x86_android)
#elif defined(GP_PLAT_x86_linux) || defined(GP_PLAT_x86_android)
volatile uintptr_t block[3];
MOZ_ASSERT(sizeof(block) == 12);
__asm__ __volatile__(
@ -1717,7 +1717,7 @@ bool GetAndCheckStackTrace(LUL* aLUL, const char* dstring)
startRegs.xbp = TaggedUWord(block[2]);
const uintptr_t REDZONE_SIZE = 0;
uintptr_t start = block[1] - REDZONE_SIZE;
#elif defined(SPS_PLAT_arm_android)
#elif defined(GP_PLAT_arm_android)
volatile uintptr_t block[6];
MOZ_ASSERT(sizeof(block) == 24);
__asm__ __volatile__(

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

@ -141,14 +141,14 @@ private:
// The registers, with validity tags, that will be unwound.
struct UnwindRegs {
#if defined(SPS_ARCH_arm)
#if defined(GP_ARCH_arm)
TaggedUWord r7;
TaggedUWord r11;
TaggedUWord r12;
TaggedUWord r13;
TaggedUWord r14;
TaggedUWord r15;
#elif defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#elif defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
TaggedUWord xbp;
TaggedUWord xsp;
TaggedUWord xip;

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

@ -35,7 +35,7 @@ enum DW_REG_NUMBER {
// treat the CFA (Canonical Frame Address) as "just another
// register", though.
DW_REG_CFA = -1,
#if defined(SPS_ARCH_arm)
#if defined(GP_ARCH_arm)
// ARM registers
DW_REG_ARM_R7 = 7,
DW_REG_ARM_R11 = 11,
@ -43,13 +43,13 @@ enum DW_REG_NUMBER {
DW_REG_ARM_R13 = 13,
DW_REG_ARM_R14 = 14,
DW_REG_ARM_R15 = 15,
#elif defined(SPS_ARCH_amd64)
#elif defined(GP_ARCH_amd64)
// Because the X86 (32 bit) and AMD64 (64 bit) summarisers are
// combined, a merged set of register constants is needed.
DW_REG_INTEL_XBP = 6,
DW_REG_INTEL_XSP = 7,
DW_REG_INTEL_XIP = 16,
#elif defined(SPS_ARCH_x86)
#elif defined(GP_ARCH_x86)
DW_REG_INTEL_XBP = 5,
DW_REG_INTEL_XSP = 4,
DW_REG_INTEL_XIP = 8,
@ -264,11 +264,11 @@ public:
LExpr mCfaExpr;
// How to compute caller register values. These may reference the
// value defined by |mCfaExpr|.
#if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
LExpr mXipExpr; // return address
LExpr mXspExpr;
LExpr mXbpExpr;
#elif defined(SPS_ARCH_arm)
#elif defined(GP_ARCH_arm)
LExpr mR15expr; // return address
LExpr mR14expr;
LExpr mR13expr;
@ -284,10 +284,10 @@ public:
// of the set of registers that LUL unwinds on this target.
static inline bool registerIsTracked(DW_REG_NUMBER reg) {
switch (reg) {
# if defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
# if defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
case DW_REG_INTEL_XBP: case DW_REG_INTEL_XSP: case DW_REG_INTEL_XIP:
return true;
# elif defined(SPS_ARCH_arm)
# elif defined(GP_ARCH_arm)
case DW_REG_ARM_R7: case DW_REG_ARM_R11: case DW_REG_ARM_R12:
case DW_REG_ARM_R13: case DW_REG_ARM_R14: case DW_REG_ARM_R15:
return true;

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

@ -26,7 +26,7 @@ read_procmaps(lul::LUL* aLUL)
{
MOZ_ASSERT(aLUL->CountMappings() == 0);
# if defined(SPS_OS_linux) || defined(SPS_OS_android) || defined(SPS_OS_darwin)
# if defined(GP_OS_linux) || defined(GP_OS_android) || defined(GP_OS_darwin)
SharedLibraryInfo info = SharedLibraryInfo::GetInfoForSelf();
for (size_t i = 0; i < info.GetSize(); i++) {

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

@ -21,7 +21,7 @@
#include <stdarg.h>
#if defined(SPS_OS_windows)
#if defined(GP_OS_windows)
#include <windows.h>
#define getpid GetCurrentProcessId
#endif

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

@ -2403,10 +2403,10 @@ TEST_F(LulDwarfExpr, ExpressionOverrun) {
// We'll need to mention specific Dwarf registers in the EvaluatePfxExpr tests,
// and those names are arch-specific, so a bit of macro magic is helpful.
#if defined(SPS_ARCH_arm)
#if defined(GP_ARCH_arm)
# define TESTED_REG_STRUCT_NAME r11
# define TESTED_REG_DWARF_NAME DW_REG_ARM_R11
#elif defined(SPS_ARCH_amd64) || defined(SPS_ARCH_x86)
#elif defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
# define TESTED_REG_STRUCT_NAME xbp
# define TESTED_REG_DWARF_NAME DW_REG_INTEL_XBP
#else