source: EcnlProtoTool/trunk/mruby-1.2.0/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h@ 270

Last change on this file since 270 was 270, checked in by coas-nagasima, 7 years ago

mruby版ECNLプロトタイピング・ツールを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 3.2 KB
Line 
1/*
2** mrdb.h - mruby debugger
3**
4*/
5
6#ifndef MRDB_H
7#define MRDB_H
8
9#include "mruby.h"
10
11#include "mrdbconf.h"
12
13#ifdef _MSC_VER
14# define __func__ __FUNCTION__
15#endif
16
17#define MAX_COMMAND_WORD (16)
18
19typedef enum debug_command_id {
20 DBGCMD_RUN,
21 DBGCMD_CONTINUE,
22 DBGCMD_NEXT,
23 DBGCMD_STEP,
24 DBGCMD_BREAK,
25 DBGCMD_INFO_BREAK,
26 DBGCMD_WATCH,
27 DBGCMD_INFO_WATCH,
28 DBGCMD_ENABLE,
29 DBGCMD_DISABLE,
30 DBGCMD_DELETE,
31 DBGCMD_PRINT,
32 DBGCMD_DISPLAY,
33 DBGCMD_INFO_DISPLAY,
34 DBGCMD_DELETE_DISPLAY,
35 DBGCMD_EVAL,
36 DBGCMD_BACKTRACE,
37 DBGCMD_LIST,
38 DBGCMD_HELP,
39 DBGCMD_QUIT,
40 DBGCMD_UNKNOWN
41} debug_command_id;
42
43typedef enum dbgcmd_state {
44 DBGST_CONTINUE,
45 DBGST_PROMPT,
46 DBGST_COMMAND_ERROR,
47 DBGST_MAX,
48 DBGST_RESTART
49} dbgcmd_state;
50
51typedef enum mrdb_exemode {
52 DBG_INIT,
53 DBG_RUN,
54 DBG_STEP,
55 DBG_NEXT,
56 DBG_QUIT,
57} mrdb_exemode;
58
59typedef enum mrdb_exephase {
60 DBG_PHASE_BEFORE_RUN,
61 DBG_PHASE_RUNNING,
62 DBG_PHASE_AFTER_RUN,
63 DBG_PHASE_RESTART,
64} mrdb_exephase;
65
66typedef enum mrdb_brkmode {
67 BRK_INIT,
68 BRK_BREAK,
69 BRK_STEP,
70 BRK_NEXT,
71 BRK_QUIT,
72} mrdb_brkmode;
73
74typedef enum {
75 MRB_DEBUG_BPTYPE_NONE,
76 MRB_DEBUG_BPTYPE_LINE,
77 MRB_DEBUG_BPTYPE_METHOD,
78} mrb_debug_bptype;
79
80struct mrb_irep;
81struct mrbc_context;
82struct mrb_debug_context;
83
84typedef struct mrb_debug_linepoint {
85 const char *file;
86 uint16_t lineno;
87} mrb_debug_linepoint;
88
89typedef struct mrb_debug_methodpoint {
90 const char *class_name;
91 const char *method_name;
92} mrb_debug_methodpoint;
93
94typedef struct mrb_debug_breakpoint {
95 uint32_t bpno;
96 uint8_t enable;
97 mrb_debug_bptype type;
98 union point {
99 mrb_debug_linepoint linepoint;
100 mrb_debug_methodpoint methodpoint;
101 } point;
102} mrb_debug_breakpoint;
103
104typedef struct mrb_debug_context {
105 struct mrb_irep *root_irep;
106 struct mrb_irep *irep;
107 mrb_code *pc;
108 mrb_value *regs;
109
110 const char *prvfile;
111 int32_t prvline;
112
113 mrdb_exemode xm;
114 mrdb_exephase xphase;
115 mrdb_brkmode bm;
116 int16_t bmi;
117
118 uint16_t ccnt;
119 uint16_t scnt;
120
121 mrb_debug_breakpoint bp[MAX_BREAKPOINT];
122 uint32_t bpnum;
123 int32_t next_bpno;
124 int32_t method_bpno;
125 int32_t stopped_bpno;
126 mrb_bool isCfunc;
127
128 mrdb_exemode (*break_hook)(mrb_state *mrb, struct mrb_debug_context *dbg);
129
130} mrb_debug_context;
131
132typedef struct mrdb_state {
133 char *command;
134 uint8_t wcnt;
135 uint8_t pi;
136 char *words[MAX_COMMAND_WORD];
137 const char *srcpath;
138 uint32_t print_no;
139
140 mrb_debug_context *dbg;
141} mrdb_state;
142
143typedef dbgcmd_state (*debug_command_func)(mrb_state*, mrdb_state*);
144
145/* cmdrun.c */
146dbgcmd_state dbgcmd_run(mrb_state*, mrdb_state*);
147dbgcmd_state dbgcmd_continue(mrb_state*, mrdb_state*);
148dbgcmd_state dbgcmd_step(mrb_state*, mrdb_state*);
149/* cmdbreak.c */
150dbgcmd_state dbgcmd_break(mrb_state*, mrdb_state*);
151dbgcmd_state dbgcmd_info_break(mrb_state*, mrdb_state*);
152dbgcmd_state dbgcmd_delete(mrb_state*, mrdb_state*);
153dbgcmd_state dbgcmd_enable(mrb_state*, mrdb_state*);
154dbgcmd_state dbgcmd_disable(mrb_state*, mrdb_state*);
155/* cmdprint.c */
156dbgcmd_state dbgcmd_print(mrb_state*, mrdb_state*);
157dbgcmd_state dbgcmd_eval(mrb_state*, mrdb_state*);
158/* cmdmisc.c */
159dbgcmd_state dbgcmd_list(mrb_state*, mrdb_state*);
160dbgcmd_state dbgcmd_help(mrb_state*, mrdb_state*);
161dbgcmd_state dbgcmd_quit(mrb_state*, mrdb_state*);
162
163#endif
Note: See TracBrowser for help on using the repository browser.