mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #3057 from yuuu/add_next_command
mrdb: Added 'next' command.
This commit is contained in:
@@ -52,3 +52,11 @@ 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;
|
||||
mrdb->dbg->prvci = mrb->c->ci;
|
||||
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}, /* n[ext] */
|
||||
{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,7 +571,6 @@ 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;
|
||||
}
|
||||
@@ -577,6 +578,18 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
|
||||
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->prvci = NULL;
|
||||
dbg->method_bpno = 0;
|
||||
dbg->bm = BRK_NEXT;
|
||||
break;
|
||||
|
||||
case DBG_RUN:
|
||||
bpno = check_method_breakpoint(mrb, irep, pc, regs);
|
||||
if (bpno > 0) {
|
||||
|
||||
@@ -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*);
|
||||
|
||||
Reference in New Issue
Block a user