Branch: Tag:

2018-11-29

2018-11-29 03:13:19 by William Welliver <william@welliver.org>

debugger: multiple breakpoint support, enable/disable support.

844:      static inline void low_debug_instr_prologue (PIKE_INSTR_T instr)   { +  struct debug_breakpoint * bp;    struct pike_string *filep;    INT_TYPE linep;    int debug_retval = 0; -  - if((stepping_mode != 0 && stepping_thread == th_self()) || Pike_fp->context->prog == bp_prog) + #ifdef PIKE_DEBUG +  if((stepping_mode != 0 && stepping_thread == th_self()) || (bp = Pike_fp->context->prog->breakpoints) != NULL)    { -  +     char *file = NULL, *f;    struct pike_string *filep2;   
873:    printf("pro: %p, %p %p, %p\n", bp_prog, Pike_fp->context->prog, bp_offset, Pike_fp->pc - Pike_fp->context->prog->program);    }    -  -  -  if((stepping_mode != 0 && stepping_thread == th_self()) || ((Pike_fp->context->prog == bp_prog) && (bp_offset == (Pike_fp->pc - Pike_fp->context->prog->program)))) { +  if((stepping_mode != 0 && stepping_thread == th_self()) || bp != NULL ) { +  int pause_here = 0; +  if(stepping_mode != 0) { +  pause_here = 1; +  } else { +  while(bp != NULL) { +  if(bp->offset == (Pike_fp->pc - Pike_fp->context->prog->program)) { +  pause_here = 1; +  break; +  } +  bp = bp->next; +  }; +  } +  if(pause_here) {    printf("got a match!\n");    stepping_thread = th_self();   
909:       ref_push_object(Pike_fp->current_object);    -  f_debug_backtrace(0); -  //printf("applying\n"); +  f_cq___debug_backtrace(0);       // we don't want to step though any of the do_breakpoint() instructions that actually wake up the debugger.    // this seems safe for the basic scenario, but perhaps we should do this on another thread altogether?    stepping_mode = 0;       safe_apply_svalue(debugger_server, 5, 1); -  //printf("applied\n"); +     if(TYPEOF(*(Pike_sp - 1)) != T_INT)    {    pop_stack();
929:       if(debug_retval == 1) // single_step    { -  //printf("debug_retval: %d\n", debug_retval); +     stepping_mode = 1; // single_step    } else {    stepping_mode = 0;    stepping_thread = 0;    } -  +  }       } -  + #endif /* PIKE_DEBUG */       -  +     if(Pike_interpreter.trace_level > 2)    {    char *file = NULL, *f;