Skip to content

Commit 5771133

Browse files
committed
Stop using fancy C++ stuff in signal handler
1 parent 3b78d42 commit 5771133

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

ddprof-lib/src/main/cpp/profiler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <algorithm>
3939
#include <dlfcn.h>
4040
#include <fstream>
41-
#include <functional>
4241
#include <memory>
4342
#include <set>
4443
#include <signal.h>
@@ -947,7 +946,7 @@ bool Profiler::crashHandler(int signo, siginfo_t *siginfo, void *ucontext) {
947946
// the following checks require vmstructs and therefore HotSpot
948947

949948
// this check can longjmp to a completely different location - need to call exitCrashHandler() before
950-
StackWalker::checkFault(std::bind(&ProfiledThread::exitCrashHandler, thrd));
949+
StackWalker::checkFault(thrd);
951950

952951
// Workaround for JDK-8313796. Setting cstack=dwarf also helps
953952
if (VMStructs::isInterpretedFrameValidFunc((const void *)pc) &&

ddprof-lib/src/main/cpp/stackWalker.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,11 @@ int StackWalker::walkVM(void *ucontext, ASGCT_CallFrame *frames, int max_depth,
454454
return depth;
455455
}
456456

457-
void StackWalker::checkFault(std::function<void()> cleanup) {
457+
void StackWalker::checkFault(ProfiledThread* thrd) {
458458
VMThread *vm_thread = VMThread::current();
459459
if (vm_thread != NULL && sameStack(vm_thread->exception(), &vm_thread)) {
460-
if (cleanup) {
461-
cleanup();
460+
if (thrd) {
461+
thrd->exitCrashHandler();
462462
}
463463
longjmp(*(jmp_buf *)vm_thread->exception(), 1);
464464
}

ddprof-lib/src/main/cpp/stackWalker.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef _STACKWALKER_H
1818
#define _STACKWALKER_H
1919

20+
#include "thread.h"
2021
#include "vmEntry.h"
2122
#include <functional>
2223
#include <stdint.h>
@@ -43,7 +44,7 @@ class StackWalker {
4344
const void *_termination_frame_begin,
4445
const void *_termination_frame_end);
4546

46-
static void checkFault(std::function<void()> cleanup);
47+
static void checkFault(ProfiledThread* thrd);
4748
};
4849

4950
#endif // _STACKWALKER_H

0 commit comments

Comments
 (0)