pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:833:    ptrdiff_t mark_stack;   };      struct backlog backlog[BACKLOG];   int backlogp=BACKLOG-1;         // begining of debugging state. we obviously will need better data structures for this.   THREAD_T stepping_thread = NULL;   int stepping_mode = 0; - struct svalue * debugger_server = NULL; + struct svalue debugger_server = SVALUE_INIT_FREE;      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;   #ifdef PIKE_DEBUG    if((stepping_mode != 0 && stepping_thread == th_self()) || (bp = Pike_fp->context->prog->breakpoints) != NULL)    {
pike.git/src/interpret.c:883: Inside #if defined(PIKE_DEBUG)
   pause_here = 1;    break;    }    bp = bp->next;    };    }    if(pause_here) {    printf("got a match!\n");    stepping_thread = th_self();    -  if(debugger_server == NULL) { +  if(TYPEOF(debugger_server) == PIKE_T_FREE) {       push_text("Debug.Debugger.get_debugger_handler");    SAFE_APPLY_MASTER("resolv", 1 );       // look up the function    safe_apply_svalue(Pike_sp-1, 0, 1);       if(TYPEOF(Pike_sp[-1]) != T_FUNCTION) {    Pike_error("Could not get debugger for breakpoint.\n");    }    -  // TODO check we actually got the memory. -  debugger_server = malloc(sizeof(struct svalue)); +  assign_svalue(&debugger_server, Pike_sp-1);    -  assign_svalue_no_free((debugger_server), Pike_sp-1); -  add_ref_svalue((debugger_server)); -  +     pop_stack();    pop_stack();    }       filep = get_line(Pike_fp->pc,Pike_fp->context->prog,&linep);       ref_push_string(filep);    push_int(linep);    push_text(get_opcode_name(instr));       ref_push_object(Pike_fp->current_object);       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); +  safe_apply_svalue(&debugger_server, 5, 1);       if(TYPEOF(*(Pike_sp - 1)) != T_INT)    {    pop_stack();    Pike_error("Wrong return type from debug callback.\n");    } else {    debug_retval = (*(Pike_sp - 1)).u.integer;    }    pop_stack();   
pike.git/src/interpret.c:3813:    POP_PIKE_FRAME();       reset_evaluator();       low_cleanup_interpret(&Pike_interpreter);   }      void really_clean_up_interpret(void)   {   #ifdef DO_PIKE_CLEANUP +  free_svalue(&debugger_server);   #if 0    struct pike_frame_block *p;    int e;    for(p=pike_frame_blocks;p;p=p->next)    for(e=0;e<128;e++)    debug_malloc_dump_references( p->x + e);   #endif    free_callback_list (&evaluator_callbacks);    free_all_pike_frame_blocks();    free_all_catch_context_blocks();   #endif   }