mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 18:51:28 +00:00
Bug 1374127 (part 6) - Rename FillInRegs(), and introduce a similar function for Windows to avoid repetition. r=mstange.
--HG-- extra : rebase_source : 5dcc319804661858e8d58b41d1f8b8f452d80c2b
This commit is contained in:
parent
5e6717e1af
commit
cc6bc3e49b
@ -76,7 +76,7 @@ Thread::GetCurrentId()
|
||||
}
|
||||
|
||||
static void
|
||||
FillInRegs(Registers& aRegs, ucontext_t* aContext)
|
||||
PopulateRegsFromContext(Registers& aRegs, ucontext_t* aContext)
|
||||
{
|
||||
aRegs.mContext = aContext;
|
||||
mcontext_t& mcontext = aContext->uc_mcontext;
|
||||
@ -359,7 +359,7 @@ Sampler::SuspendAndSampleAndResumeThread(PSLockRef aLock,
|
||||
|
||||
// Extract the current register values.
|
||||
Registers regs;
|
||||
FillInRegs(regs, &sSigHandlerCoordinator->mUContext);
|
||||
PopulateRegsFromContext(regs, &sSigHandlerCoordinator->mUContext);
|
||||
aProcessRegs(regs);
|
||||
|
||||
//----------------------------------------------------------------//
|
||||
@ -533,7 +533,7 @@ void
|
||||
Registers::SyncPopulate()
|
||||
{
|
||||
if (!getcontext(&sSyncUContext)) {
|
||||
FillInRegs(*this, &sSyncUContext);
|
||||
PopulateRegsFromContext(*this, &sSyncUContext);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -38,6 +38,22 @@ Thread::GetCurrentId()
|
||||
return GetCurrentThreadId();
|
||||
}
|
||||
|
||||
static void
|
||||
PopulateRegsFromContext(Registers& aRegs, CONTEXT* aContext)
|
||||
{
|
||||
#if defined(GP_ARCH_amd64)
|
||||
aRegs.mPC = reinterpret_cast<Address>(aContext->Rip);
|
||||
aRegs.mSP = reinterpret_cast<Address>(aContext->Rsp);
|
||||
aRegs.mFP = reinterpret_cast<Address>(aContext->Rbp);
|
||||
#elif defined(GP_ARCH_x86)
|
||||
aRegs.mPC = reinterpret_cast<Address>(aContext->Eip);
|
||||
aRegs.mSP = reinterpret_cast<Address>(aContext->Esp);
|
||||
aRegs.mFP = reinterpret_cast<Address>(aContext->Ebp);
|
||||
#else
|
||||
#error "bad arch"
|
||||
#endif
|
||||
}
|
||||
|
||||
class PlatformData
|
||||
{
|
||||
public:
|
||||
@ -139,16 +155,7 @@ Sampler::SuspendAndSampleAndResumeThread(PSLockRef aLock,
|
||||
// platform-linux-android.cpp for details.
|
||||
|
||||
Registers regs;
|
||||
#if defined(GP_ARCH_amd64)
|
||||
regs.mPC = reinterpret_cast<Address>(context.Rip);
|
||||
regs.mSP = reinterpret_cast<Address>(context.Rsp);
|
||||
regs.mFP = reinterpret_cast<Address>(context.Rbp);
|
||||
#else
|
||||
regs.mPC = reinterpret_cast<Address>(context.Eip);
|
||||
regs.mSP = reinterpret_cast<Address>(context.Esp);
|
||||
regs.mFP = reinterpret_cast<Address>(context.Ebp);
|
||||
#endif
|
||||
|
||||
PopulateRegsFromContext(regs, &context);
|
||||
aProcessRegs(regs);
|
||||
|
||||
//----------------------------------------------------------------//
|
||||
@ -270,16 +277,7 @@ Registers::SyncPopulate()
|
||||
{
|
||||
CONTEXT context;
|
||||
RtlCaptureContext(&context);
|
||||
|
||||
#if defined(GP_ARCH_amd64)
|
||||
mPC = reinterpret_cast<Address>(context.Rip);
|
||||
mSP = reinterpret_cast<Address>(context.Rsp);
|
||||
mFP = reinterpret_cast<Address>(context.Rbp);
|
||||
#elif defined(GP_ARCH_x86)
|
||||
mPC = reinterpret_cast<Address>(context.Eip);
|
||||
mSP = reinterpret_cast<Address>(context.Esp);
|
||||
mFP = reinterpret_cast<Address>(context.Ebp);
|
||||
#endif
|
||||
PopulateRegsFromContext(*this, &context);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user