Commit e1cc814e authored by Yuhei Okazaki's avatar Yuhei Okazaki

add next command to mrdb.

parent 7e4a7abf
...@@ -52,3 +52,10 @@ dbgcmd_step(mrb_state *mrb, mrdb_state *mrdb) ...@@ -52,3 +52,10 @@ dbgcmd_step(mrb_state *mrb, mrdb_state *mrdb)
mrdb->dbg->xm = DBG_STEP; mrdb->dbg->xm = DBG_STEP;
return DBGST_CONTINUE; return DBGST_CONTINUE;
} }
dbgcmd_state
dbgcmd_next(mrb_state *mrb, mrdb_state *mrdb)
{
mrdb->dbg->xm = DBG_NEXT;
return DBGST_CONTINUE;
}
...@@ -57,6 +57,7 @@ static const debug_command debug_command_list[] = { ...@@ -57,6 +57,7 @@ static const debug_command debug_command_list[] = {
{"quit", NULL, 1, 0, 0, DBGCMD_QUIT, dbgcmd_quit}, /* q[uit] */ {"quit", NULL, 1, 0, 0, DBGCMD_QUIT, dbgcmd_quit}, /* q[uit] */
{"run", NULL, 1, 0, 0, DBGCMD_RUN, dbgcmd_run}, /* r[un] */ {"run", NULL, 1, 0, 0, DBGCMD_RUN, dbgcmd_run}, /* r[un] */
{"step", NULL, 1, 0, 1, DBGCMD_STEP, dbgcmd_step}, /* s[tep] */ {"step", NULL, 1, 0, 1, DBGCMD_STEP, dbgcmd_step}, /* s[tep] */
{"next", NULL, 1, 0, 1, DBGCMD_NEXT, dbgcmd_next}, /* s[tep] */
{NULL} {NULL}
}; };
...@@ -560,6 +561,7 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg ...@@ -560,6 +561,7 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
dbg->root_irep = irep; dbg->root_irep = irep;
dbg->prvfile = NULL; dbg->prvfile = NULL;
dbg->prvline = 0; dbg->prvline = 0;
dbg->prvci = NULL;
dbg->xm = DBG_RUN; dbg->xm = DBG_RUN;
dbg->xphase = DBG_PHASE_RUNNING; dbg->xphase = DBG_PHASE_RUNNING;
} }
...@@ -569,7 +571,6 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg ...@@ -569,7 +571,6 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
switch (dbg->xm) { switch (dbg->xm) {
case DBG_STEP: case DBG_STEP:
case DBG_NEXT: // temporary
if (!file || (dbg->prvfile == file && dbg->prvline == line)) { if (!file || (dbg->prvfile == file && dbg->prvline == line)) {
return; return;
} }
...@@ -577,6 +578,17 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg ...@@ -577,6 +578,17 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
dbg->bm = BRK_STEP; dbg->bm = BRK_STEP;
break; break;
case DBG_NEXT:
if (!file || (dbg->prvfile == file && dbg->prvline == line)) {
return;
}
if((uint32_t)(dbg->prvci) < (uint32_t)(mrb->c->ci)) {
return;
}
dbg->method_bpno = 0;
dbg->bm = BRK_NEXT;
break;
case DBG_RUN: case DBG_RUN:
bpno = check_method_breakpoint(mrb, irep, pc, regs); bpno = check_method_breakpoint(mrb, irep, pc, regs);
if (bpno > 0) { if (bpno > 0) {
...@@ -594,6 +606,7 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg ...@@ -594,6 +606,7 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
} }
dbg->prvfile = file; dbg->prvfile = file;
dbg->prvline = line; dbg->prvline = line;
dbg->prvci = mrb->c->ci;
return; return;
case DBG_INIT: case DBG_INIT:
dbg->root_irep = irep; dbg->root_irep = irep;
......
...@@ -109,6 +109,7 @@ typedef struct mrb_debug_context { ...@@ -109,6 +109,7 @@ typedef struct mrb_debug_context {
const char *prvfile; const char *prvfile;
int32_t prvline; int32_t prvline;
mrb_callinfo *prvci;
mrdb_exemode xm; mrdb_exemode xm;
mrdb_exephase xphase; mrdb_exephase xphase;
...@@ -146,6 +147,7 @@ typedef dbgcmd_state (*debug_command_func)(mrb_state*, mrdb_state*); ...@@ -146,6 +147,7 @@ typedef dbgcmd_state (*debug_command_func)(mrb_state*, mrdb_state*);
dbgcmd_state dbgcmd_run(mrb_state*, mrdb_state*); dbgcmd_state dbgcmd_run(mrb_state*, mrdb_state*);
dbgcmd_state dbgcmd_continue(mrb_state*, mrdb_state*); dbgcmd_state dbgcmd_continue(mrb_state*, mrdb_state*);
dbgcmd_state dbgcmd_step(mrb_state*, mrdb_state*); dbgcmd_state dbgcmd_step(mrb_state*, mrdb_state*);
dbgcmd_state dbgcmd_next(mrb_state*, mrdb_state*);
/* cmdbreak.c */ /* cmdbreak.c */
dbgcmd_state dbgcmd_break(mrb_state*, mrdb_state*); dbgcmd_state dbgcmd_break(mrb_state*, mrdb_state*);
dbgcmd_state dbgcmd_info_break(mrb_state*, mrdb_state*); dbgcmd_state dbgcmd_info_break(mrb_state*, mrdb_state*);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment