m3dev

cortex m3 debug tools -- superceded by mdebug
git clone http://frotz.net/git/m3dev.git
Log | Files | Refs | README | LICENSE

debugger.h (1940B)


      1 /* debugger.h
      2  *
      3  * Copyright 2011 Brian Swetland <swetland@frotz.net>
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 #ifndef _DEBUGGER_H_
     19 #define _DEBUGGER_H_
     20 
     21 typedef enum {
     22 	XDEFAULT,
     23 	XSWD,		// SWD transport & engine
     24 	XCORE,		// debugger core
     25 	XDATA,		// debugger command response
     26 	XGDB,		// messages from GDB bridge
     27 } xpchan;
     28 
     29 #define printf __use_xprintf_in_debugger__
     30 extern void xprintf(xpchan ch, const char *fmt, ...);
     31 
     32 #define ERROR		-1
     33 #define ERROR_UNKNOWN 	-2
     34 
     35 #define LF_SWD		1
     36 #define LF_GDB		2
     37 
     38 extern unsigned log_flags;
     39 
     40 struct funcline {
     41 	struct funcline *next;
     42 	char text[0];
     43 };
     44 
     45 struct funcinfo {
     46 	struct funcinfo *next;
     47 	struct funcline *lines;
     48 	char name[0];
     49 };
     50 
     51 struct varinfo {
     52 	struct varinfo *next;
     53 	u32 value;
     54 	char name[0];
     55 };
     56 
     57 typedef struct {
     58 	const char *s;
     59 	unsigned n;
     60 } param;
     61 
     62 struct debugger_command {
     63 	const char *name;
     64 	const char *args;
     65 	int (*func)(int argc, param *argv);
     66 	const char *help;
     67 };
     68 
     69 /* provided by debugger-core.c */
     70 int debugger_command(char *line);
     71 int debugger_invoke(const char *cmd, unsigned argc, ...);
     72 int debugger_variable(const char *name, u32 *value);
     73 
     74 /* lock to protect underlying rswdp state */
     75 void debugger_init();
     76 void debugger_lock();
     77 void debugger_unlock();
     78 
     79 /* provided by debugger-commands.c */
     80 extern struct debugger_command debugger_commands[];
     81 int read_register(const char *name, u32 *value);
     82 int read_memory_word(u32 addr, u32 *value);
     83 
     84 #endif
     85