Permalink
Browse files

add next command to mrdb.

  • Loading branch information...
Yuuhei-Okazaki committed Nov 22, 2015
1 parent 7e4a7ab commit e1cc814ec467ab15211a7d2362f461b6b7ece597
@@ -52,3 +52,10 @@ dbgcmd_step(mrb_state *mrb, mrdb_state *mrdb)
mrdb->dbg->xm = DBG_STEP;
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[] = {
{"quit", NULL, 1, 0, 0, DBGCMD_QUIT, dbgcmd_quit}, /* q[uit] */
{"run", NULL, 1, 0, 0, DBGCMD_RUN, dbgcmd_run}, /* r[un] */
{"step", NULL, 1, 0, 1, DBGCMD_STEP, dbgcmd_step}, /* s[tep] */
{"next", NULL, 1, 0, 1, DBGCMD_NEXT, dbgcmd_next}, /* s[tep] */
{NULL}
};
@@ -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->prvfile = NULL;
dbg->prvline = 0;
dbg->prvci = NULL;
dbg->xm = DBG_RUN;
dbg->xphase = DBG_PHASE_RUNNING;
}
@@ -569,14 +571,24 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
switch (dbg->xm) {
case DBG_STEP:
case DBG_NEXT: // temporary
if (!file || (dbg->prvfile == file && dbg->prvline == line)) {
return;
}
dbg->method_bpno = 0;
dbg->bm = BRK_STEP;
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:
bpno = check_method_breakpoint(mrb, irep, pc, regs);
if (bpno > 0) {
@@ -594,6 +606,7 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
}
dbg->prvfile = file;
dbg->prvline = line;
dbg->prvci = mrb->c->ci;
return;
case DBG_INIT:
dbg->root_irep = irep;
@@ -109,6 +109,7 @@ typedef struct mrb_debug_context {
const char *prvfile;
int32_t prvline;
mrb_callinfo *prvci;
mrdb_exemode xm;
mrdb_exephase xphase;
@@ -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_continue(mrb_state*, mrdb_state*);
dbgcmd_state dbgcmd_step(mrb_state*, mrdb_state*);
dbgcmd_state dbgcmd_next(mrb_state*, mrdb_state*);
/* cmdbreak.c */
dbgcmd_state dbgcmd_break(mrb_state*, mrdb_state*);
dbgcmd_state dbgcmd_info_break(mrb_state*, mrdb_state*);

0 comments on commit e1cc814

Please sign in to comment.