diff options
author | Tomasz Malesinski <tomal@rockbox.org> | 2006-02-04 00:04:02 +0000 |
---|---|---|
committer | Tomasz Malesinski <tomal@rockbox.org> | 2006-02-04 00:04:02 +0000 |
commit | ec7e97602695b7e4a49013b525d0bf7a0c8d13fc (patch) | |
tree | a8c60a04068b31614a60dfc89cc0194ef8f650b1 /firmware/debug.c | |
parent | 760fea9ac7b52aa83d88371fac7bf0027cf7fd43 (diff) | |
download | rockbox-ec7e97602695b7e4a49013b525d0bf7a0c8d13fc.tar.gz rockbox-ec7e97602695b7e4a49013b525d0bf7a0c8d13fc.zip |
Added GDB API - a way to call stub procedures from a DEBUG build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8561 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/debug.c')
-rw-r--r-- | firmware/debug.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/firmware/debug.c b/firmware/debug.c index ba19a9616a..4031ba432d 100644 --- a/firmware/debug.c +++ b/firmware/debug.c | |||
@@ -22,6 +22,9 @@ | |||
22 | #include <stdarg.h> | 22 | #include <stdarg.h> |
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "cpu.h" | 24 | #include "cpu.h" |
25 | #ifdef HAVE_GDB_API | ||
26 | #include "gdb_api.h" | ||
27 | #endif | ||
25 | 28 | ||
26 | #ifdef DEBUG | 29 | #ifdef DEBUG |
27 | static char debugmembuf[200]; | 30 | static char debugmembuf[200]; |
@@ -196,6 +199,34 @@ static void debug(const char *msg) | |||
196 | putpacket(debugbuf); | 199 | putpacket(debugbuf); |
197 | } | 200 | } |
198 | #endif /* SH7034 */ | 201 | #endif /* SH7034 */ |
202 | |||
203 | #ifdef HAVE_GDB_API | ||
204 | static void *get_api_function(int n) | ||
205 | { | ||
206 | struct gdb_api *api = (struct gdb_api *)GDB_API_ADDRESS; | ||
207 | if (api->magic == GDB_API_MAGIC) | ||
208 | return api->func[n]; | ||
209 | else | ||
210 | return NULL; | ||
211 | } | ||
212 | |||
213 | void breakpoint(void) | ||
214 | { | ||
215 | void (*f)(void) = get_api_function(0); | ||
216 | if (f) (*f)(); | ||
217 | } | ||
218 | |||
219 | static void debug(char *msg) | ||
220 | { | ||
221 | void (*f)(char *) = get_api_function(1); | ||
222 | if (f) (*f)(msg); | ||
223 | } | ||
224 | |||
225 | void debug_init() | ||
226 | { | ||
227 | } | ||
228 | |||
229 | #endif /* HAVE_GDB_API */ | ||
199 | #endif /* end of DEBUG section */ | 230 | #endif /* end of DEBUG section */ |
200 | 231 | ||
201 | #ifdef __GNUC__ | 232 | #ifdef __GNUC__ |