mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1354292: Let the stack walker unwind leaf functions without a function entry. r=njn
This commit is contained in:
parent
e97b534db7
commit
fc18ed5283
@ -357,6 +357,10 @@ WalkStackMain64(struct WalkStackData* aData)
|
|||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _M_AMD64
|
||||||
|
bool firstFrame = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Skip our own stack walking frames.
|
// Skip our own stack walking frames.
|
||||||
int skip = (aData->walkCallingThread ? 3 : 0) + aData->skipFrames;
|
int skip = (aData->walkCallingThread ? 3 : 0) + aData->skipFrames;
|
||||||
|
|
||||||
@ -416,26 +420,29 @@ WalkStackMain64(struct WalkStackData* aData)
|
|||||||
PRUNTIME_FUNCTION runtimeFunction =
|
PRUNTIME_FUNCTION runtimeFunction =
|
||||||
RtlLookupFunctionEntry(context.Rip, &imageBase, NULL);
|
RtlLookupFunctionEntry(context.Rip, &imageBase, NULL);
|
||||||
|
|
||||||
if (!runtimeFunction) {
|
if (runtimeFunction) {
|
||||||
// Alas, this is probably a JIT frame, for which we don't generate unwind
|
PVOID dummyHandlerData;
|
||||||
// info and so we have to give up.
|
ULONG64 dummyEstablisherFrame;
|
||||||
|
RtlVirtualUnwind(UNW_FLAG_NHANDLER,
|
||||||
|
imageBase,
|
||||||
|
context.Rip,
|
||||||
|
runtimeFunction,
|
||||||
|
&context,
|
||||||
|
&dummyHandlerData,
|
||||||
|
&dummyEstablisherFrame,
|
||||||
|
nullptr);
|
||||||
|
} else if (firstFrame) {
|
||||||
|
// Leaf functions can be unwound by hand.
|
||||||
|
context.Rip = *reinterpret_cast<DWORD64*>(context.Rsp);
|
||||||
|
context.Rsp += sizeof(void*);
|
||||||
|
} else {
|
||||||
|
// Something went wrong.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID dummyHandlerData;
|
|
||||||
ULONG64 dummyEstablisherFrame;
|
|
||||||
RtlVirtualUnwind(UNW_FLAG_NHANDLER,
|
|
||||||
imageBase,
|
|
||||||
context.Rip,
|
|
||||||
runtimeFunction,
|
|
||||||
&context,
|
|
||||||
&dummyHandlerData,
|
|
||||||
&dummyEstablisherFrame,
|
|
||||||
nullptr);
|
|
||||||
|
|
||||||
addr = context.Rip;
|
addr = context.Rip;
|
||||||
spaddr = context.Rsp;
|
spaddr = context.Rsp;
|
||||||
|
firstFrame = false;
|
||||||
#else
|
#else
|
||||||
#error "unknown platform"
|
#error "unknown platform"
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user