Boot Linux faster!

Check our new training course

Boot Linux faster!

Check our new training course
and Creative Commons CC-BY-SA
lecture and lab materials

Bootlin logo

Elixir Cross Referencer

# Kconfig - debug configuration options

#
# Copyright (c) 2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

menu "Debugging Options"

config DEBUG
	bool "Build kernel with debugging enabled"
	default n
	help
	Build a kernel suitable for debugging.  Right now, this option
	only disables optimization, more debugging variants can be selected
	from here to allow more debugging.

config STACK_USAGE
	bool "Generate stack usage information"
	default n
	help
	Generate  an extra file that specifies the maximum amount of stack used,
	on a per-function basis.

config STACK_SENTINEL
	bool "Enable stack sentinel"
	select THREAD_STACK_INFO
	default n
	help
	Store a magic value at the lowest addresses of a thread's stack.
	Periodically check that this value is still present and kill the
	thread gracefully if it isn't. This is currently checked in four
	places:

	1) Upon any context switch for the outgoing thread
	2) Any hardware interrupt that doesn't context switch, the check is
	   performed for the interrupted thread
	3) When a thread returns from its entry point
	4) When a thread calls k_yield() but doesn't context switch

	This feature doesn't prevent corruption and the system may be
	in an unusable state. However, given the bizarre behavior associated
	with stack overflows, knowledge that this is happening is very
	useful.

	This feature is intended for those systems which lack hardware support
	for stack overflow protection, or have insufficient system resources
	to use that hardware support.

config PRINTK
	bool
	prompt "Send printk() to console"
	depends on CONSOLE_HAS_DRIVER
	default y
	help
	This option directs printk() debugging output to the supported
	console device, rather than suppressing the generation
	of printk() output entirely. Output is sent immediately, without
	any mutual exclusion or buffering.

config STDOUT_CONSOLE
	bool
	prompt "Send stdout to console"
	depends on CONSOLE_HAS_DRIVER
	default n
	help
	This option directs standard output (e.g. printf) to the console
	device, rather than suppressing it entirely.

config EARLY_CONSOLE
	bool
	prompt "Send stdout at the earliest stage possible"
	default n
	help
	This option will enable stdout as early as possible, for debugging
	purpose. For instance, in case of STDOUT_CONSOLE being set it will
	initialize its driver earlier than normal, in order to get the stdout
	sent through the console at the earliest stage possible.

config ASSERT
	bool
	prompt "Enable __ASSERT() macro"
	default n
	help
	This enables the __ASSERT() macro in the kernel code. If an assertion
	fails, the calling thread is put on an infinite tight loop. Since
	enabling this adds a significant footprint, it should only be enabled
	in a non-production system.

config ASSERT_LEVEL
	int
	prompt "__ASSERT() level"
	default 2
	range 0 2
	depends on ASSERT
	help
	This option specifies the assertion level used by the __ASSERT()
	macro. It can be set to one of three possible values:

	Level 0: off
	Level 1: on + warning in every file that includes __assert.h
	Level 2: on + no warning

config DEBUG_TRACING_KERNEL_OBJECTS
	bool "Kernel object tracing (deprecated)"
	select OBJECT_TRACING
	default n
	help
	  For backward compatibility only

config OBJECT_TRACING
	bool
	prompt "Kernel object tracing"
	default n
	help
	This option enable the feature for tracing kernel objects. This option
	is for debug purposes and increases the memory footprint of the kernel.

config OVERRIDE_FRAME_POINTER_DEFAULT
	bool
	prompt "Override compiler defaults for -fomit-frame-pointer"
	default n
	help
	Omitting the frame pointer prevents the compiler from putting the stack
	frame pointer into a register. Saves a few instructions in function
	prologues/epilogues and frees up a register for general-purpose use,
	which can provide good performance improvements on register-constrained
	architectures like x86. On some architectures (including x86) omitting
	frame pointers impedes debugging as local variables are harder to
	locate. At -O1 and above gcc will enable -fomit-frame-pointer
	automatically but only if the architecture does not require if for
	effective debugging.

	Choose Y if you want to override the default frame pointer behavior
	of your compiler, otherwise choose N.

config OMIT_FRAME_POINTER
	bool
	prompt "Omit frame pointer"
	default n
	depends on OVERRIDE_FRAME_POINTER_DEFAULT
	help
	Choose Y for best performance. On some architectures (including x86)
	this will favor code size and performance over debugability.

	Choose N in you wish to retain the frame pointer. This option may
	be useful if your application uses runtime backtracing and does not
	support parsing unwind tables.

	If unsure, disable OVERRIDE_FRAME_POINTER_DEFAULT to allow the compiler
	to adopt sensible defaults for your architecture.

menu "Safe memory access"

config MEM_SAFE
	bool
	prompt "Enable safe memory access"
	default n
	help
	Add the routines available in mem_safe.h to the system. This is added
	as a kconfig option instead of simply linking against the library
	because some implementations might require initialization.

choice
prompt "Safe memory access implementation"
depends on MEM_SAFE
default MEM_SAFE_CHECK_BOUNDARIES

config MEM_SAFE_CHECK_BOUNDARIES
	bool
	prompt "Software validation of memory access within memory regions"
	help
	This implementation checks the application image's text/rodata
	boundaries for its read-only region and the data/bss/noinit boundaries
	for its read-write region, in software.

	Other regions can be added as needed by using the
	sys_mem_safe_region_add() API. The number of regions that can be added
	is controlled via the MEM_SAFE_NUM_EXTRA_REGIONS kconfig option.

	This implementation requires initialization and thus consumes some boot
	time.

endchoice

config MEM_SAFE_NUM_EXTRA_REGIONS
	int
	prompt "Number of safe memory access regions to be added at runtime"
	depends on MEM_SAFE_CHECK_BOUNDARIES
	default 0
	help
	The functions available in mem_safe.h check if memory is within
	read-only or read-write regions before accessing it instead of crashing.
	The kernel image is added as a valid region automatically, but other
	regions can be added if the application makes access to additional
	memory outside of the image's boundaries.

endmenu

#
# Generic Debugging Options
#
config DEBUG_INFO
	bool "Enable system debugging information"
	default n
	depends on X86
	help
	This option enables the addition of various information that can be used
	by debuggers in debugging the system.

	NOTE: Does not currently work with the x86 IAMCU ABI.

#
# GDB Server options
#

config GDB_SERVER
	bool
	prompt "Enable GDB Server [EXPERIMENTAL]"
	default n
	select CACHE_FLUSHING
	select REBOOT
	select MEM_SAFE
	select DEBUG_INFO
	select UART_CONSOLE_DEBUG_SERVER_HOOKS
	help
	This option enables the GDB Server support.

config GDB_SERVER_MAX_SW_BP
	int "Maximum number of GDB Server Software breakpoints"
	default 100
	depends on GDB_SERVER
	help
	This option specifies the maximum number of Software breakpoints

config GDB_SERVER_INTERRUPT_DRIVEN
	bool
	prompt "Enable GDB interrupt mode"
	default y
	depends on GDB_SERVER
	select CONSOLE_HANDLER
	help
	This option enables interrupt support for GDB Server.

config GDB_REMOTE_SERIAL_EXT_NOTIF_PREFIX_STR
	string
	prompt "Trigger string for remote serial ext. via notifi. packets"
	default "WrCons"
	depends on GDB_SERVER
	help
	The value of this option depends on the string the GDB client use to
	prefix the notification packets.

config GDB_SERVER_BOOTLOADER
	bool
	prompt "Enable the bootloader mode"
	default n
	depends on GDB_SERVER
	help
	This option enables the bootloader mode of the GDB Server.

#
# Miscellaneous debugging options
#

config OPENOCD_SUPPORT
	bool
	prompt "OpenOCD support [EXPERIMENTAL]"
	default n
	select THREAD_MONITOR
	help
	  This option exports an array of offsets to kernel structs, used by
	  OpenOCD to determine the state of running threads.  (This option
	  selects CONFIG_THREAD_MONITOR, so all of its caveats are implied.)

endmenu