1# Copyright (c) 2020 Intel Corporation.
2# SPDX-License-Identifier: Apache-2.0
3
4menuconfig DEBUG_COREDUMP
5	bool "Core Dump"
6	depends on ARCH_SUPPORTS_COREDUMP
7	help
8	  Enable core dump so it can be used for offline debugging.
9
10if DEBUG_COREDUMP
11
12choice DEBUG_COREDUMP_BACKEND
13	prompt "Coredump backend"
14	default DEBUG_COREDUMP_BACKEND_LOGGING
15
16config DEBUG_COREDUMP_BACKEND_LOGGING
17	bool "Use Logging subsystem for coredump"
18	select LOG
19	help
20	  Core dump is done via logging subsystem.
21
22config DEBUG_COREDUMP_BACKEND_FLASH_PARTITION
23	bool "Use flash partition for coredump"
24	depends on FLASH
25	select FLASH_MAP
26	select STREAM_FLASH
27	help
28	  Core dump is saved to a flash partition with DTS alias
29	  "coredump-partition".
30
31config DEBUG_COREDUMP_BACKEND_INTEL_ADSP_MEM_WINDOW
32	bool "Use memory window for coredump on Intel ADSP"
33	depends on DT_HAS_INTEL_ADSP_MEM_WINDOW_ENABLED
34	help
35	  Core dump is done via memory window slot[1].
36	  It is Intel ADSP memory region shared with xtensa DSP.
37	  Window 2 slot [1] is reserved for debuging information.
38
39config DEBUG_COREDUMP_BACKEND_OTHER
40	bool "Backend subsystem for coredump defined out of tree"
41	help
42	  Core dump is done via custom mechanism defined out of tree
43
44endchoice
45
46choice DEBUG_COREDUMP_MEMORY_DUMP
47	prompt "Memory dump"
48	default DEBUG_COREDUMP_MEMORY_DUMP_LINKER_RAM
49
50config DEBUG_COREDUMP_MEMORY_DUMP_MIN
51	bool "Minimal"
52	select THREAD_STACK_INFO
53	help
54	  Only dumps the bare minimum memory content.
55	  For example, the thread struct and stack of
56	  the exception thread will be dumped.
57
58	  Don't use this unless you want absolutely
59	  minimum core dump.
60
61config DEBUG_COREDUMP_MEMORY_DUMP_THREADS
62	bool "Threads"
63	depends on !SMP
64	depends on ARCH_SUPPORTS_COREDUMP_THREADS
65	select THREAD_STACK_INFO
66	select DEBUG_THREAD_INFO
67	select DEBUG_COREDUMP_THREADS_METADATA
68	help
69	  Dumps the thread struct and stack of all
70	  threads and all data required to debug threads.
71
72config DEBUG_COREDUMP_MEMORY_DUMP_LINKER_RAM
73	bool "RAM defined by linker section"
74	help
75	  Dumps the memory region between _image_ram_start[]
76	  and _image_ram_end[]. This includes at least data,
77	  noinit, and BSS sections.
78
79	  This is the default.
80
81endchoice
82
83if DEBUG_COREDUMP_BACKEND_FLASH_PARTITION
84
85config DEBUG_COREDUMP_FLASH_CHUNK_SIZE
86	int "Chunk size for flash write operations"
87	default 64
88	help
89	  Larger values can speed up writing due to fewer write operations
90	  being performed in total, but consume more memory.
91
92
93endif # DEBUG_COREDUMP_BACKEND_FLASH_PARTITION
94
95config DEBUG_COREDUMP_SHELL
96	bool "Coredump shell"
97	depends on SHELL
98	help
99	  This shell provides access to coredump and its backends.
100
101config DEBUG_COREDUMP_THREADS_METADATA
102	bool "Threads metadata"
103	depends on !SMP
104	depends on ARCH_SUPPORTS_COREDUMP_THREADS
105	select DEBUG_THREAD_INFO
106	help
107	  Core dump will contain the threads metadata section containing
108	  any necessary data to enable debugging threads
109
110config DEBUG_COREDUMP_DUMP_THREAD_PRIV_STACK
111	bool "Dump privilege stack of user threads"
112	default y
113	depends on ARCH_SUPPORTS_COREDUMP_PRIV_STACKS
114	depends on USERSPACE
115	help
116	  Dump the privilege stack of user threads.
117
118	  Say n to conserve space on coredump backend or if you will never
119	  need to look into the privilege stacks.
120
121endif # DEBUG_COREDUMP
122