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
2 changes: 1 addition & 1 deletion ddprof-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ tasks.register('scanBuild', Exec) {
args "-o", "${projectDir}/build/reports/scan-build",
"--force-analyze-debug-code",
"--use-analyzer", "/usr/bin/clang++",
"make", "-j4", "clean", "all"
"make", "-j4", "all"
}

tasks.withType(Test) {
Expand Down
6 changes: 3 additions & 3 deletions ddprof-lib/src/main/cpp/flightRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ MethodInfo *Lookup::resolveMethod(ASGCT_CallFrame &frame) {
// Layout: pc_offset (44 bits) | mark (3 bits) | lib_index (15 bits)
unsigned long packed_remote_frame = frame.packed_remote_frame;
uintptr_t pc_offset = Profiler::RemoteFramePacker::unpackPcOffset(packed_remote_frame);
char mark = Profiler::RemoteFramePacker::unpackMark(packed_remote_frame);
[[maybe_unused]] char mark = Profiler::RemoteFramePacker::unpackMark(packed_remote_frame);
uint32_t lib_index = Profiler::RemoteFramePacker::unpackLibIndex(packed_remote_frame);

TEST_LOG("Unpacking remote frame: packed=0x%zx, pc_offset=0x%lx, mark=%d, lib_index=%u",
Expand Down Expand Up @@ -672,7 +672,7 @@ void Recording::cleanupUnreferencedMethods() {
const int AGE_THRESHOLD = 3; // Remove after 3 consecutive chunks without reference
size_t removed_count = 0;
size_t removed_with_line_tables = 0;
size_t total_before = _method_map.size();
[[maybe_unused]] size_t total_before = _method_map.size();

for (MethodMap::iterator it = _method_map.begin(); it != _method_map.end(); ) {
MethodInfo& mi = it->second;
Expand Down Expand Up @@ -705,7 +705,7 @@ void Recording::cleanupUnreferencedMethods() {
removed_count, AGE_THRESHOLD, removed_with_line_tables, total_before, _method_map.size());

// Log current count of live line number tables
long long live_tables = Counters::getCounter(LINE_NUMBER_TABLES);
[[maybe_unused]] long long live_tables = Counters::getCounter(LINE_NUMBER_TABLES);
TEST_LOG("Live line number tables after cleanup: %lld", live_tables);
}
}
Expand Down
5 changes: 4 additions & 1 deletion ddprof-lib/src/main/cpp/javaApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ extern "C" DLLEXPORT jstring JNICALL
Java_com_datadoghq_profiler_JavaProfiler_getStatus0(JNIEnv* env,
jclass unused) {
char msg[2048];
int ret = Profiler::instance()->status((char*)msg, sizeof(msg) - 1);
Profiler::instance()->status((char*)msg, sizeof(msg) - 1);
return env->NewStringUTF(msg);
}

Expand Down Expand Up @@ -473,6 +473,9 @@ Java_com_datadoghq_profiler_OTelContext_setProcessCtx0(JNIEnv *env,
};

otel_process_ctx_result result = otel_process_ctx_publish(&data);
if (!result.success) {
Log::warn("Failed to publish process context: %s", result.error_message);
}
}

extern "C" DLLEXPORT jobject JNICALL
Expand Down
1 change: 1 addition & 0 deletions ddprof-lib/src/main/cpp/libraryPatcher_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void LibraryPatcher::patch_library_unlocked(CodeCache* lib) {
char* resolved_path = realpath(lib->name(), path);
if (resolved_path == nullptr) {
// virtual file, e.g. [vdso], etc.
// scan-build false positive: resolved_path is used at line 96
resolved_path = (char*)lib->name();
} else {
// Don't patch self
Expand Down
3 changes: 3 additions & 0 deletions ddprof-lib/src/main/cpp/profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,9 @@ Error Profiler::runInternal(Arguments &args, std::ostream &out) {
}
case ACTION_STOP: {
Error error = stop();
if (error) {
return error;
}
break;
}

Expand Down
8 changes: 0 additions & 8 deletions ddprof-lib/src/main/cpp/stackWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,14 +571,6 @@ __attribute__((no_sanitize("address"))) int StackWalker::walkVM(void* ucontext,
fp = (uintptr_t)SafeAccess::load((void**)(sp + f.fp_off));
}

if (EMPTY_FRAME_SIZE > 0 || f.pc_off != DW_LINK_REGISTER) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this dead code ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's duplicated a few lines below. This looks like some automerge mess-up :/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I had missed that, sorry

pc = stripPointer(SafeAccess::load((void**)(sp + f.pc_off)));
} else if (depth == 1) {
pc = (const void*)frame.link();
} else {
break;
}

if (EMPTY_FRAME_SIZE > 0 || f.pc_off != DW_LINK_REGISTER) {
pc = stripPointer(*(void**)(sp + f.pc_off));
} else if (depth == 1) {
Expand Down
4 changes: 2 additions & 2 deletions ddprof-lib/src/main/cpp/vmStructs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,8 @@ void VMStructs::checkNativeBinding(jvmtiEnv *jvmti, JNIEnv *jni,
jmethodID method, void *address) {
char *method_name;
char *method_sig;
int error = 0;
if ((error = jvmti->GetMethodName(method, &method_name, &method_sig, NULL)) == 0) {
int error = jvmti->GetMethodName(method, &method_name, &method_sig, NULL);
if (error == 0) {
if (strcmp(method_name, "getMemoryUsage0") == 0 &&
strcmp(method_sig, "(Z)Ljava/lang/management/MemoryUsage;") == 0) {
_memory_usage_func = (MemoryUsageFunc)address;
Expand Down
2 changes: 1 addition & 1 deletion ddprof-lib/src/test/make/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ all: $(OBJDIR) $(OBJS)
$(OBJDIR):
mkdir -p $(OBJDIR)

$(OBJDIR)/%.o : ${SRCDIR}/%.cpp
$(OBJDIR)/%.o : ${SRCDIR}/%.cpp | $(OBJDIR)
${CC} ${CFLAGS} -DEBUG -DPROFILER_VERSION=\"snapshot\" ${INCLUDES} -c $< -o $@

clean :
Expand Down
Loading