Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ std::vector<ModuleInfo> CrashReportingLinux::GetModules()
moduleBaseAddresses[path] = baseAddress;
}

auto buildId = BuildId::From(path.data());
modules.push_back(ModuleInfo{ start, end, baseAddress, std::move(path), std::move(buildId) });
// @gleocadie [REMOVE COMMENT]
// From now on, we do no need to compute the buildId. This is done by the call to normalize_ips
// So pass an empty Build ID.
// But since libdatadog does not do it for windows (yet), we keep the Build ID in the ModuleInfo
//
modules.push_back(ModuleInfo{ start, end, baseAddress, std::move(path), BuildId() });
}

return modules;
Expand Down Expand Up @@ -248,8 +252,6 @@ std::vector<StackFrame> CrashReportingLinux::GetThreadFrames(int32_t tid, Resolv

stackFrame.isSuspicious = false;

stackFrame.buildId = module->build_id;

fs::path modulePath(module->path);

if (modulePath.has_filename())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,22 +255,21 @@ int32_t CrashReporting::ResolveStacks(int32_t crashingThreadId, ResolveManagedCa
}
}

auto relativeAddress = currentFrame.ip - currentFrame.moduleAddress;
CHECK_RESULT(ddog_crasht_StackFrame_with_ip(&frame, currentFrame.ip));
CHECK_RESULT(ddog_crasht_StackFrame_with_sp(&frame, currentFrame.sp));
CHECK_RESULT(ddog_crasht_StackFrame_with_module_base_address(&frame, currentFrame.moduleAddress));
CHECK_RESULT(ddog_crasht_StackFrame_with_relative_address(&frame, relativeAddress));
#ifdef _WINDOWS
CHECK_RESULT(ddog_crasht_StackFrame_with_relative_address(&frame, currentFrame.ip - currentFrame.moduleAddress));
#endif

CHECK_RESULT(ddog_crasht_StackFrame_with_symbol_address(&frame, currentFrame.symbolAddress));

auto buildId = currentFrame.buildId;
if (buildId.size() != 0)
{
CHECK_RESULT(ddog_crasht_StackFrame_with_build_id(&frame, {buildId.data(), buildId.size()}));
#ifdef _WINDOWS
CHECK_RESULT(ddog_crasht_StackFrame_with_build_id(&frame, {buildId.data(), buildId.size()}));
CHECK_RESULT(ddog_crasht_StackFrame_with_build_id_type(&frame, DDOG_CRASHT_BUILD_ID_TYPE_PDB));
#else
CHECK_RESULT(ddog_crasht_StackFrame_with_build_id_type(&frame, DDOG_CRASHT_BUILD_ID_TYPE_GNU));
#endif
}
CHECK_RESULT(ddog_crasht_StackFrame_with_function(&frame, libdatadog::to_char_slice(currentFrame.method)));
Expand Down Expand Up @@ -327,6 +326,8 @@ int32_t CrashReporting::SetMetadata(const char* libraryName, const char* library

int32_t CrashReporting::Send()
{
// for now we do not call ddog_crasht_CrashInfo_resolve_names because we already do it for linux
// but later we would want to do it
return ExportImpl(nullptr);
}

Expand All @@ -347,6 +348,9 @@ int32_t CrashReporting::ExportImpl(ddog_Endpoint* endpoint)
return 1;
}

#ifdef LINUX
CHECK_RESULT(ddog_crasht_CrashInfo_normalize_ips(&crashInfo, _pid));
#endif
CHECK_RESULT(ddog_crasht_CrashInfo_upload_to_endpoint(&crashInfo, endpoint));

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ struct ResolveMethodData
char symbolName[1024];
};

// @gleocadie Remove this struct when Build IDs are handled completely by libdatadog
//
struct BuildId
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ calloc
clock_gettime
close
closedir
ddog_crasht_CrashInfo_normalize_ips
ddog_crasht_CrashInfo_upload_to_endpoint
ddog_crasht_CrashInfoBuilder_build
ddog_crasht_CrashInfoBuilder_new
Expand All @@ -29,12 +30,9 @@ ddog_crasht_CrashInfoBuilder_with_thread
ddog_crasht_CrashInfoBuilder_with_timestamp_now
ddog_crasht_demangle
ddog_crasht_StackFrame_new
ddog_crasht_StackFrame_with_build_id
ddog_crasht_StackFrame_with_build_id_type
ddog_crasht_StackFrame_with_function
ddog_crasht_StackFrame_with_ip
ddog_crasht_StackFrame_with_module_base_address
ddog_crasht_StackFrame_with_relative_address
ddog_crasht_StackFrame_with_sp
ddog_crasht_StackFrame_with_symbol_address
ddog_crasht_StackTrace_new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ceill
clock_gettime
close
closedir
ddog_crasht_CrashInfo_normalize_ips
ddog_crasht_CrashInfo_upload_to_endpoint
ddog_crasht_CrashInfoBuilder_build
ddog_crasht_CrashInfoBuilder_new
Expand All @@ -31,12 +32,9 @@ ddog_crasht_CrashInfoBuilder_with_thread
ddog_crasht_CrashInfoBuilder_with_timestamp_now
ddog_crasht_demangle
ddog_crasht_StackFrame_new
ddog_crasht_StackFrame_with_build_id
ddog_crasht_StackFrame_with_build_id_type
ddog_crasht_StackFrame_with_function
ddog_crasht_StackFrame_with_ip
ddog_crasht_StackFrame_with_module_base_address
ddog_crasht_StackFrame_with_relative_address
ddog_crasht_StackFrame_with_sp
ddog_crasht_StackFrame_with_symbol_address
ddog_crasht_StackTrace_new
Expand Down
Loading