source: EcnlProtoTool/trunk/prototool/src/cmdrun.c@ 279

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

ファイルを追加、更新。

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 1.3 KB
Line 
1/*
2** cmdrun.c - mruby debugger run command functions
3**
4*/
5
6#include <stdlib.h>
7
8#include "mruby/opcode.h"
9#include "mrdb.h"
10
11dbgcmd_state
12dbgcmd_run(mrb_state *mrb, mrdb_state *mrdb)
13{
14 mrb_debug_context *dbg = mrdb->dbg;
15
16 if (dbg->xm == DBG_INIT) {
17 InterlockedExchange(&dbg->xm, DBG_RUN);
18 }
19 else {
20 InterlockedExchange(&dbg->xm, DBG_QUIT);
21 if (dbg->xphase == DBG_PHASE_RUNNING) {
22 struct RClass *exc;
23 puts("Start it from the beginning.");
24 exc = mrb_define_class(mrb, "DebuggerRestart", mrb_class_get(mrb, "Exception"));
25 mrb_raise(mrb, exc, "Restart mrdb.");
26 }
27 }
28
29 return DBGST_RESTART;
30}
31
32dbgcmd_state
33dbgcmd_continue(mrb_state *mrb, mrdb_state *mrdb)
34{
35 mrb_debug_context *dbg = mrdb->dbg;
36 int ccnt = 1;
37
38 if (mrdb->wcnt > 1) {
39 sscanf(mrdb->words[1], "%d", &ccnt);
40 }
41 dbg->ccnt = (uint16_t)(ccnt > 0 ? ccnt : 1); /* count of continue */
42
43 if (dbg->xphase == DBG_PHASE_AFTER_RUN) {
44 puts("The program is not running.");
45 InterlockedExchange(&dbg->xm, DBG_QUIT);
46 }
47 else {
48 InterlockedExchange(&dbg->xm, DBG_RUN);
49 }
50 return DBGST_CONTINUE;
51}
52
53dbgcmd_state
54dbgcmd_step(mrb_state *mrb, mrdb_state *mrdb)
55{
56 InterlockedExchange(&mrdb->dbg->xm, DBG_STEP);
57 return DBGST_CONTINUE;
58}
59
60dbgcmd_state
61dbgcmd_next(mrb_state *mrb, mrdb_state *mrdb)
62{
63 InterlockedExchange(&mrdb->dbg->xm, DBG_NEXT);
64 mrdb->dbg->prvci = mrb->c->ci;
65 return DBGST_CONTINUE;
66}
Note: See TracBrowser for help on using the repository browser.