Bug 1902847 - Handle non MOZ_PROFILING builds with no stack r=padenot

Differential Revision: https://phabricator.services.mozilla.com/D213920
This commit is contained in:
Alexandre Lissy 2024-06-17 13:28:20 +00:00
parent 2ff4e6d46c
commit da4aaee274
2 changed files with 12 additions and 4 deletions

View File

@ -2839,7 +2839,8 @@ static void DoNativeBacktrace(
void DoNativeBacktraceDirect(const void* stackTop, NativeStack& aNativeStack,
StackWalkControl* aStackWalkControlIfSupported) {
# if defined(USE_FRAME_POINTER_STACK_WALK) || defined(USE_MOZ_STACK_WALK)
# if defined(MOZ_PROFILING)
# if defined(USE_FRAME_POINTER_STACK_WALK) || defined(USE_MOZ_STACK_WALK)
// StackWalkCallback(/* frameNum */ 0, aRegs.mPC, aRegs.mSP, &aNativeStack);
void* previousResumeSp = nullptr;
for (;;) {
@ -2884,12 +2885,16 @@ void DoNativeBacktraceDirect(const void* stackTop, NativeStack& aNativeStack,
previousResumeSp = sp;
}
}
# else // defined(USE_FRAME_POINTER_STACK_WALK) || defined(USE_MOZ_STACK_WALK)
# else // defined(USE_FRAME_POINTER_STACK_WALK) ||
// defined(USE_MOZ_STACK_WALK)
MOZ_CRASH(
"Cannot call DoNativeBacktraceDirect without either "
"USE_FRAME_POINTER_STACK_WALK USE_MOZ_STACK_WALK");
# endif // defined(USE_FRAME_POINTER_STACK_WALK) ||
// defined(USE_MOZ_STACK_WALK)
# endif // defined(USE_FRAME_POINTER_STACK_WALK) ||
// defined(USE_MOZ_STACK_WALK)
# else
aNativeStack.mCount = 0;
# endif
}
#endif

View File

@ -17,6 +17,9 @@ We manage to capture the call stack on the child process and pass that to the
profiler, so hopefully any thread in our child process will report a stack
explaining why the syscall was made.
Capturing the stack might require either a nightly build (opt or debug), or a
beta/release build with debug enabled.
We report markers on the `SandboxProfilerEmitterSyscalls` thread for syscalls
and `SandboxProfilerEmitterLogs` for `SANDBOX_LOG` entries.