add callback invocation from OP_DEBUG

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-01-23 15:08:38 +09:00
parent 92570a96b0
commit e0e5aebc66
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -156,6 +156,7 @@ typedef struct mrb_state {
#ifdef ENABLE_DEBUG
void (*code_fetch_hook)(struct mrb_state* mrb, struct mrb_irep *irep, mrb_code *pc, mrb_value *regs);
void (*debug_op_hook)(struct mrb_state* mrb, struct mrb_irep *irep, mrb_code *pc, mrb_value *regs);
#endif
struct RClass *eException_class;
+4
View File
@@ -2113,10 +2113,14 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int
CASE(OP_DEBUG) {
/* A debug print R(A),R(B),R(C) */
#ifdef ENABLE_DEBUG
mrb->debug_op_hook(mrb, irep, pc, regs);
#else
#ifdef ENABLE_STDIO
printf("OP_DEBUG %d %d %d\n", GETARG_A(i), GETARG_B(i), GETARG_C(i));
#else
abort();
#endif
#endif
NEXT;
}