@@ -643,27 +643,19 @@ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_trace_id(struct ddog_cr
643643 * The CharSlice must be valid.
644644 */
645645DDOG_CHECK_RETURN
646- struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_uuid (struct ddog_crasht_Handle_CrashInfoBuilder * builder ,
647- ddog_CharSlice uuid );
646+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_message (struct ddog_crasht_Handle_CrashInfoBuilder * builder ,
647+ ddog_CharSlice message );
648648
649649/**
650650 * # Safety
651651 * The `builder` can be null, but if non-null it must point to a Builder made by this module,
652652 * which has not previously been dropped.
653- * The CharSlice must be valid.
654- */
655- DDOG_CHECK_RETURN
656- struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_uuid_random (struct ddog_crasht_Handle_CrashInfoBuilder * builder );
657-
658- /**
659- * # Safety
660- * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
661- * which has not previously been dropped.
662- * The CharSlice must be valid.
653+ * All arguments must be valid.
654+ * This method requires that the builder has a UUID, siginfo, and metadata set
663655 */
664656DDOG_CHECK_RETURN
665- struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_message (struct ddog_crasht_Handle_CrashInfoBuilder * builder ,
666- ddog_CharSlice message );
657+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_upload_ping_to_endpoint (struct ddog_crasht_Handle_CrashInfoBuilder * builder ,
658+ const struct ddog_Endpoint * endpoint );
667659
668660/**
669661 * Create a new StackFrame, and returns an opaque reference to it.
@@ -884,6 +876,76 @@ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_receiver_entry_point_stdin(
884876DDOG_CHECK_RETURN
885877struct ddog_VoidResult ddog_crasht_receiver_entry_point_unix_socket (ddog_CharSlice socket_path );
886878
879+ /**
880+ * Register a runtime stack collection callback
881+ *
882+ * # Arguments
883+ * - `callback`: The callback function to invoke during crashes
884+ *
885+ * # Returns
886+ * - `CallbackResult::Ok` if registration succeeds
887+ * - `CallbackResult::Error` if registration fails
888+ *
889+ * # Safety
890+ * - The callback must be signal-safe
891+ * - Only one callback can be registered at a time
892+ * - The callback must be registered once on CrashTracker initialization, before any crash occurs
893+ *
894+ * # Example Usage from C
895+ * ```c
896+ * static void my_runtime_callback(
897+ * void (*emit_frame)(const ddog_RuntimeStackFrameFFI*),
898+ * ) {
899+ * // Collect runtime frames and call emit_frame for each one
900+ * const char* function_name = "my_function";
901+ * const char* file_name = "script.rb";
902+ * ddog_CharSlice type_name = DDOG_CHARSLICE_FROM_CSTR("MyModule.MyClass");
903+ * ddog_crasht_RuntimeStackFrameFFI frame = {
904+ * .type_name = type_name,
905+ * .function = DDOG_CHARSLICE_FROM_CSTR(function_name),
906+ * .file = DDOG_CHARSLICE_FROM_CSTR(file_name),
907+ * .line = 42,
908+ * .column = 10
909+ * };
910+ * emit_frame(&frame);
911+ * }
912+ */
913+ enum ddog_crasht_CallbackResult ddog_crasht_register_runtime_frame_callback (ddog_crasht_RuntimeStackFrameCallback callback );
914+
915+ /**
916+ * Register a runtime stacktrace string collection callback
917+ *
918+ * # Arguments
919+ * - `callback`: The callback function to invoke during crashes
920+ *
921+ * # Returns
922+ * - `CallbackResult::Ok` if registration succeeds (replaces any existing callback)
923+ * - `CallbackResult::Error` if registration fails
924+ *
925+ * # Safety
926+ * - The callback must be signal-safe
927+ * - Only one callback can be registered at a time (this replaces any existing one)
928+ */
929+ enum ddog_crasht_CallbackResult ddog_crasht_register_runtime_stacktrace_string_callback (ddog_crasht_RuntimeStacktraceStringCallback callback );
930+
931+ /**
932+ * Returns true if a callback is registered, false otherwise
933+ *
934+ * # Safety
935+ * This function is safe to call at any time
936+ */
937+ bool ddog_crasht_is_runtime_callback_registered (void );
938+
939+ /**
940+ * Get the callback type from the currently registered callback context
941+ *
942+ * # Safety
943+ * - The returned pointer is valid only while the callback remains registered
944+ * - The caller should not free the returned pointer
945+ * - The returned string should be copied if it needs to persist beyond callback lifetime
946+ */
947+ const char * ddog_crasht_get_registered_callback_type (void );
948+
887949#ifdef __cplusplus
888950} // extern "C"
889951#endif // __cplusplus
0 commit comments