# Debug configuration options
# Copyright (c) 2015 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0
menu "System Monitoring Options"
bool "Enable Thread analyzer"
Enable thread analyzer functionality and all the required modules.
This module may be used to debug thread configuration issues, e.g.
stack size configuration to find stack overflow or to find stacks
which may be optimized.
module = THREAD_ANALYZER
module-str = thread analyzer
prompt "Thread analysis print mode"
bool "Use logger output"
Use logger output to print thread information.
bool "Use printk function"
Use kernel printk function to print thread information.
bool "Run analysis with interrupts unlocked"
The thread analysis takes quite a long time.
Every thread it finds is analyzed word by word to find any that
does not match the magic number.
Normally while thread are analyzed the k_thread_foreach function
While this is a safe run from the thread list perspective it may lock
the interrupts for a long time - long enough to disconnect when
Bluetooth communication is used.
Setting this flag will force thread analyzer to use
the k_thread_foreach_unlocked function.
This will allow the interrupts to be processed while the thread is
For the limitation of such configuration see the k_thread_foreach
bool "Run periodic thread analysis in a thread"
Run the thread analyzer automatically, without the need to add
any code to the application.
Thread analysis would be called periodically.
int "Thread analysis interval"
range 5 3600
The time in seconds to call thread analyzer periodic printing function.
int "Stack size for the periodic thread analysis thread"
endif # THREAD_ANALYZER_AUTO
endif # THREAD_ANALYZER
menu "Debugging Options"
bool "Build kernel with debugging enabled"
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.
bool "Build with address sanitizer"
depends on ARCH_POSIX
Builds Zephyr with Address Sanitizer enabled. This is currently
only supported by boards based on the posix architecture, and requires a
recent-ish compiler with the ``-fsanitize=address`` command line option,
and the libasan library.
Note that at exit leak detection is disabled for 64-bit boards when
GCC is used due to potential risk of a deadlock in libasan.
This behavior can be changes by adding leak_check_at_exit=1 to the
environment variable ASAN_OPTIONS.
bool "Override host OS dlclose() with a NOP"
default y if HAS_SDL
depends on ASAN
Override host OS dlclose() with a NOP.
This NOP implementation is needed as workaround for a known limitation in
LSAN (leak sanitizer) that if dlcose is called before performing the leak
check, "<unknown module>" is reported in the stack traces during the leak
check and these can not be suppressed, see
https://github.com/google/sanitizers/issues/89 for more info.
bool "Build with undefined behavior sanitizer"
depends on ARCH_POSIX
Builds Zephyr with Undefined Behavior Sanitizer enabled.
This is currently only supported by boards based on the posix
architecture, and requires a recent-ish compiler with the
``-fsanitize=undefined`` command line option.
bool "Generate stack usage information"
Generate an extra file that specifies the maximum amount of stack used,
on a per-function basis.
bool "Enable stack sentinel"
depends on !USERSPACE
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
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
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.
bool "Send printk() to console"
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.
int "printk() buffer size"
depends on PRINTK
depends on USERSPACE
If userspace is enabled, printk() calls are buffered so that we do
not have to make a system call for every character emitted. Specify
the size of this buffer.
bool "Send stdout at the earliest stage possible"
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.
bool "Enable __ASSERT() macro"
default y if TEST
This enables the __ASSERT() macro in the kernel code. If an assertion
fails, the policy for what to do is controlled by the implementation
of the assert_post_action() function, which by default will trigger
a fatal error.
Disabling this option will cause assertions to compile to nothing,
improving performance and system footprint.
int "__ASSERT() level"
range 0 2
depends on ASSERT
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
bool "Enable spinlock validation"
depends on ASSERT
depends on MULTITHREADING
depends on MP_NUM_CPUS <= 4
default y if !FLASH || FLASH_SIZE > 32
There's a spinlock validation framework available when asserts are
enabled. It adds a relatively hefty overhead (about 3k or so) to
kernel code size, don't use on platforms known to be small.
bool "Force-disable no assertions"
This boolean option disables Zephyr assertion testing even
in circumstances (twister) where it is enabled via
CFLAGS and not Kconfig. Added solely to be able to work
around compiler bugs for specific tests.
bool "Enable verbose assertions"
This option enables printing an assert message with information about
the assertion that occurred. This includes printing the location,
the conditional expression and additional message specific to the
bool "Disable file info for asserts"
This option removes the name and the path of the source file
in which the assertion occurred. Enabling this will save
target code space, and thus may be necessary for tiny targets.
bool "Disable condition info for asserts"
This option removes the assert condition from the printed assert
message. Enabling this will save target code space, and thus may be
necessary for tiny targets. It is recommended to disable condition
info before disabling file info since the condition can be found in
the source using file info.
bool "Disable message for asserts"
This option removes the additional message from the printed assert.
Enabling this will save target code space, and thus may be
necessary for tiny targets. It is recommended to disable message
before disabling file info since the message can be found in the
source using file info.
bool "Override compiler defaults for -fomit-frame-pointer"
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
Choose Y if you want to override the default frame pointer behavior
of your compiler, otherwise choose N.
bool "Omit frame pointer"
depends on OVERRIDE_FRAME_POINTER_DEFAULT
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.
# Generic Debugging Options
bool "Enable system debugging information"
This option enables the addition of various information that can be
used by debuggers in debugging the system, or enable additional
debugging information to be reported at runtime.
bool "Attempt to print stack traces upon exceptions"
depends on PRINTK
depends on DEBUG_INFO
depends on !OMIT_FRAME_POINTER
If the architecture fatal handling code supports it, attempt to
print a stack trace of function memory addresses when an
exception is reported.
# Miscellaneous debugging options
bool "OpenOCD support (DEPRECATED)"
This is deprecated, please use DEBUG_THREAD_INFO instead.
bool "Thread awareness support"
depends on !SMP
This option exports an array of offsets to kernel structs to allow
for debugger RTOS plugins to determine the state of running threads.
bool "GDB remote serial protocol support [EXPERIMENTAL]"
depends on ARCH_HAS_GDBSTUB
This option enable support the target using GDB, or any other
application that supports GDB protocol.
prompt "GDB backend"
bool "Use serial backend"
depends on SERIAL
Use serial as backenf for GDB
string "Serial Name"
depends on GDBSTUB_SERIAL_BACKEND
Use serial as backenf for GDB