1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_dump.c (rb_vmdebug_debug_print_pre): Bugfix. Get PC directly.

PC is cached into local stack and cfp->pc is incorrent at next of
	  branch or jump.
	* vm_exec.h (DEBUG_ENTER_INSN): catch up this change.
	* vm_core.h: update signature of rb_vmdebug_debug_print_pre.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tarui 2013-11-29 12:01:18 +00:00
parent 511cc1db8c
commit 44cb6eaef9
4 changed files with 15 additions and 5 deletions

View file

@ -1,6 +1,14 @@
Fri Nov 29 20:59:39 2013 Masaya Tarui <tarui@ruby-lang.org>
* vm_dump.c (rb_vmdebug_debug_print_pre): Bugfix. Get PC directly.
PC is cached into local stack and cfp->pc is incorrent at next of
branch or jump.
* vm_exec.h (DEBUG_ENTER_INSN): catch up this change.
* vm_core.h: update signature of rb_vmdebug_debug_print_pre.
Fri Nov 29 20:43:57 2013 Masaya Tarui <tarui@ruby-lang.org> Fri Nov 29 20:43:57 2013 Masaya Tarui <tarui@ruby-lang.org>
* compile.c : Bugsfix for dump_disasm_list. * compile.c: Bugsfix for dump_disasm_list.
rb_inspect denies a hidden object. So, insert rapper that creates rb_inspect denies a hidden object. So, insert rapper that creates
the unhidden one. the unhidden one.
adjust->label is null sometimes. adjust->label is null sometimes.

View file

@ -840,7 +840,7 @@ VALUE rb_proc_alloc(VALUE klass);
/* for debug */ /* for debug */
extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *); extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
extern void rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp); extern void rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp, VALUE *_pc);
extern void rb_vmdebug_debug_print_post(rb_thread_t *th, rb_control_frame_t *cfp); extern void rb_vmdebug_debug_print_post(rb_thread_t *th, rb_control_frame_t *cfp);
#define SDR() rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp) #define SDR() rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)

View file

@ -349,19 +349,21 @@ rb_vmdebug_thread_dump_regs(VALUE thval)
} }
void void
rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp) rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp,VALUE *_pc)
{ {
rb_iseq_t *iseq = cfp->iseq; rb_iseq_t *iseq = cfp->iseq;
if (iseq != 0) { if (iseq != 0) {
VALUE *seq = iseq->iseq; VALUE *seq = iseq->iseq;
ptrdiff_t pc = cfp->pc - iseq->iseq_encoded; ptrdiff_t pc = _pc - iseq->iseq_encoded;
int i; int i;
for (i=0; i<(int)VM_CFP_CNT(th, cfp); i++) { for (i=0; i<(int)VM_CFP_CNT(th, cfp); i++) {
printf(" "); printf(" ");
} }
printf("| "); printf("| ");
if(0)printf("[%03ld] ",cfp->sp - th->stack);
/* printf("%3"PRIdPTRDIFF" ", VM_CFP_CNT(th, cfp)); */ /* printf("%3"PRIdPTRDIFF" ", VM_CFP_CNT(th, cfp)); */
if (pc >= 0) { if (pc >= 0) {
rb_iseq_disasm_insn(0, seq, (size_t)pc, iseq, 0); rb_iseq_disasm_insn(0, seq, (size_t)pc, iseq, 0);

View file

@ -27,7 +27,7 @@ typedef rb_iseq_t *ISEQ;
#if VMDEBUG > 0 #if VMDEBUG > 0
#define debugs printf #define debugs printf
#define DEBUG_ENTER_INSN(insn) \ #define DEBUG_ENTER_INSN(insn) \
rb_vmdebug_debug_print_pre(th, GET_CFP()); rb_vmdebug_debug_print_pre(th, GET_CFP(),GET_PC());
#if OPT_STACK_CACHING #if OPT_STACK_CACHING
#define SC_REGS() , reg_a, reg_b #define SC_REGS() , reg_a, reg_b