diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2010-09-26 12:05:42 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2010-09-26 12:05:42 +0000 |
commit | 8ff4f1aec9f19613e4f67d2e22ae96bec7657292 (patch) | |
tree | c9e2b19b56375fac35d996fb85d5e3a5802dfc45 /firmware/thread.c | |
parent | 927a7bdb4b91d3a63f014824711f796e5eb4c5ba (diff) | |
download | rockbox-8ff4f1aec9f19613e4f67d2e22ae96bec7657292.tar.gz rockbox-8ff4f1aec9f19613e4f67d2e22ae96bec7657292.zip |
Add optional (define BUFFER_ALLOC_DEBUG to enable it) code to check for code overflowing buffer_alloc()-allocated buffers.
Also add a panicf() if buffer_alloc() doesn't have enough space left to allocate a requested buffer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28173 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r-- | firmware/thread.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/firmware/thread.c b/firmware/thread.c index b3d8ec3970..655af1a940 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "kernel.h" | 27 | #include "kernel.h" |
28 | #include "cpu.h" | 28 | #include "cpu.h" |
29 | #include "string.h" | 29 | #include "string.h" |
30 | #include "buffer.h" | ||
30 | #ifdef RB_PROFILE | 31 | #ifdef RB_PROFILE |
31 | #include <profile.h> | 32 | #include <profile.h> |
32 | #endif | 33 | #endif |
@@ -1160,6 +1161,16 @@ void switch_thread(void) | |||
1160 | if (UNLIKELY(thread->stack[0] != DEADBEEF) && thread->stack_size > 0) | 1161 | if (UNLIKELY(thread->stack[0] != DEADBEEF) && thread->stack_size > 0) |
1161 | thread_stkov(thread); | 1162 | thread_stkov(thread); |
1162 | 1163 | ||
1164 | #ifdef BUFFER_ALLOC_DEBUG | ||
1165 | /* Check if the current thread just did bad things with buffer_alloc()ed | ||
1166 | * memory */ | ||
1167 | { | ||
1168 | static char name[32]; | ||
1169 | thread_get_name(name, 32, thread); | ||
1170 | buffer_alloc_check(name); | ||
1171 | } | ||
1172 | #endif | ||
1173 | |||
1163 | #if NUM_CORES > 1 | 1174 | #if NUM_CORES > 1 |
1164 | /* Run any blocking operations requested before switching/sleeping */ | 1175 | /* Run any blocking operations requested before switching/sleeping */ |
1165 | run_blocking_ops(core, thread); | 1176 | run_blocking_ops(core, thread); |