xref: /linux/include/trace/events/coredump.h (revision aec2f682d47c54ef434b2d440992626d80b1ebdc)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2026 Meta Platforms, Inc. and affiliates.
4  * Copyright (c) 2026 Breno Leitao <leitao@debian.org>
5  */
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM coredump
8 
9 #if !defined(_TRACE_COREDUMP_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _TRACE_COREDUMP_H
11 
12 #include <linux/sched.h>
13 #include <linux/tracepoint.h>
14 
15 /**
16  * coredump - called when a coredump starts
17  * @sig: signal number that triggered the coredump
18  *
19  * This tracepoint fires at the beginning of a coredump attempt,
20  * providing a stable interface for monitoring coredump events.
21  */
22 TRACE_EVENT(coredump,
23 
24 	TP_PROTO(int sig),
25 
26 	TP_ARGS(sig),
27 
28 	TP_STRUCT__entry(
29 		__field(int, sig)
30 		__array(char, comm, TASK_COMM_LEN)
31 	),
32 
33 	TP_fast_assign(
34 		__entry->sig = sig;
35 		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
36 	),
37 
38 	TP_printk("sig=%d comm=%s",
39 		  __entry->sig, __entry->comm)
40 );
41 
42 #endif /* _TRACE_COREDUMP_H */
43 
44 /* This part must be outside protection */
45 #include <trace/define_trace.h>
46