Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ddprof-lib/src/main/cpp/counters.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
X(CODECACHE_RUNTIME_STUBS_SIZE_BYTES, "codecache_runtime_stubs_size_bytes") \
X(AGCT_NOT_REGISTERED_IN_TLS, "agct_not_registered_in_tls") \
X(AGCT_NOT_JAVA, "agct_not_java") \
X(AGCT_NATIVE_NO_JAVA_CONTEXT, "agct_native_no_java_context")
X(AGCT_NATIVE_NO_JAVA_CONTEXT, "agct_native_no_java_context") \
X(HANDLED_SIGSEGV_SAFEFETCH, "handled_sigsegv_safefetch") \
X(HANDLED_SIGSEGV_WALKVM, "handled_sigsegv_walkvm")
#define X_ENUM(a, b) a,
typedef enum CounterId : int {
DD_COUNTER_TABLE(X_ENUM) DD_NUM_COUNTERS
Expand Down
2 changes: 2 additions & 0 deletions ddprof-lib/src/main/cpp/profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ void Profiler::segvHandler(int signo, siginfo_t* siginfo, void* ucontext) {
// Skip the fault instruction, as if it successfully loaded NULL
frame.pc() += length;
frame.retval() = 0;
Counters::increment(HANDLED_SIGSEGV_SAFEFETCH);
return;
}

Expand All @@ -857,6 +858,7 @@ void Profiler::segvHandler(int signo, siginfo_t* siginfo, void* ucontext) {
// Act as if the load returned default_value argument
frame.pc() += length;
frame.retval() = frame.arg1();
Counters::increment(HANDLED_SIGSEGV_SAFEFETCH);
return;
}

Expand Down
1 change: 1 addition & 0 deletions ddprof-lib/src/main/cpp/stackWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ int StackWalker::walkVM(void* ucontext, ASGCT_CallFrame* frames, int max_depth)
void StackWalker::checkFault() {
VMThread* vm_thread = VMThread::current();
if (vm_thread != NULL && sameStack(vm_thread->exception(), &vm_thread)) {
Counters::increment(HANDLED_SIGSEGV_WALKVM);
longjmp(*(jmp_buf*)vm_thread->exception(), 1);
}
}