From: Angus Gratton Date: Mon, 27 Feb 2017 00:49:46 +0000 (+1100) Subject: freertos: Move the "set debug watchpoint as stack overflow check" out of debugging... X-Git-Tag: v2.1-rc1~290^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47a5851d4599498c5a1f9b612242b9362bb9250f;p=esp-idf freertos: Move the "set debug watchpoint as stack overflow check" out of debugging internals Place it near the other stack overflow kconfig items, instead. --- diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index c28287644d..04821cd5fc 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -76,6 +76,24 @@ config FREERTOS_CHECK_STACKOVERFLOW_CANARY (configCHECK_FOR_STACK_OVERFLOW=2) endchoice +config FREERTOS_WATCHPOINT_END_OF_STACK + bool "Set a debug watchpoint as a stack overflow check" + default n + help + FreeRTOS can check if a stack has overflown its bounds by checking either the value of + the stack pointer or by checking the integrity of canary bytes. (See FREERTOS_CHECK_STACKOVERFLOW + for more information.) These checks only happen on a context switch, and the situation that caused + the stack overflow may already be long gone by then. This option will use the debug memory + watchpoint 1 (the second one) to allow breaking into the debugger (or panic'ing) as soon as any + of the last 32 bytes on the stack of a task are overwritten. The side effect is that using gdb, you + effectively only have one watchpoint; the 2nd one is overwritten as soon as a task switch happens. + + This check only triggers if the stack overflow writes within 4 bytes of the end of the stack, rather than + overshooting further, so it is worth combining this approach with one of the other stack overflow check methods. + + When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no OCD is attached, esp-idf + will panic on an unhandled debug exception. + config FREERTOS_THREAD_LOCAL_STORAGE_POINTERS int "Amount of thread local storage pointers" range 0 256 if !WIFI_ENABLED @@ -203,22 +221,6 @@ config FREERTOS_PORTMUX_DEBUG_RECURSIVE portMUX usage. endif #FREERTOS_UNICORE - -config FREERTOS_WATCHPOINT_END_OF_STACK - bool "Set a debug watchpoint at the end of each stack" - default n - help - FreeRTOS can check if a stack has overflown its bounds by checking either the value of - the stack pointer or by checking the integrity of canary bytes. (See FREERTOS_CHECK_STACKOVERFLOW - for more information.) These checks only happen on a context switch, and the situation that caused - the stack overflow may already be long gone by then. This option will use the debug memory - watchpoint 1 (the second one) to allow breaking into the debugger (or panic'ing) as soon as any - of the last 32 bytes on the stack of a task are overwritten. The side effect is that using gdb, you - effectively only have one watchpoint; the 2nd one is overwritten as soon as a task switch happens. - - When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no OCD is attached, esp-idf - will panic on an unhandled debug exception. - endif # FREERTOS_DEBUG_INTERNALS endmenu