summaryrefslogtreecommitdiff
path: root/test/tx/regression/threadx_thread_stack_checking_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/tx/regression/threadx_thread_stack_checking_test.c')
-rw-r--r--test/tx/regression/threadx_thread_stack_checking_test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/tx/regression/threadx_thread_stack_checking_test.c b/test/tx/regression/threadx_thread_stack_checking_test.c
index 9db10d0a..2ef9a2df 100644
--- a/test/tx/regression/threadx_thread_stack_checking_test.c
+++ b/test/tx/regression/threadx_thread_stack_checking_test.c
@@ -9,6 +9,8 @@
/* SPDX-License-Identifier: MIT */
/***************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/* This test is for the thread stack checking services. */
#include <stdio.h>
@@ -200,6 +202,19 @@ TX_THREAD fake_thread;
fake_thread.tx_thread_stack_highest_ptr = TX_NULL;
_tx_thread_stack_analyze(&fake_thread);
+ /* Call the stack analyze with a highest stack pointer below the start of the stack, which is
+ what a stack overflow or a corrupted control block looks like. This used to hang. */
+ fake_thread.tx_thread_id = ((ULONG) 0x54485244);
+ fake_thread.tx_thread_stack_start = (void *) 0x2000;
+ fake_thread.tx_thread_stack_highest_ptr = (void *) 0x1000;
+ _tx_thread_stack_analyze(&fake_thread);
+
+ /* Call the stack analyze with a highest stack pointer equal to the start of the stack. */
+ fake_thread.tx_thread_id = ((ULONG) 0x54485244);
+ fake_thread.tx_thread_stack_start = (void *) 0x2000;
+ fake_thread.tx_thread_stack_highest_ptr = (void *) 0x2000;
+ _tx_thread_stack_analyze(&fake_thread);
+
/* Clear the pattern in thread 2's stack. */
TX_MEMSET(thread_2_stack_start, (CHAR) 0x11, TEST_STACK_SIZE_PRINTF);