Exemplo n.º 1
0
void *breakpoints_new(t_symbol *s, int argc, t_atom *argv)
{
    t_binbuf* d = binbuf_via_atoms(argc,argv);
	t_breakpoints *x = (t_breakpoints *)eobj_new(breakpoints_class);
    if(x && d)
    {
        x->f_outline_mode = 0;
        long flags = 0
        | EBOX_GROWINDI
        ;
        ebox_new((t_ebox *)x, flags);
        
        x->f_out_float = (t_outlet *)floatout(x);
        x->f_out_list = (t_outlet *)listout(x);
        x->f_out_function = (t_outlet *)listout(x);
        
        x->f_number_of_points = 0;
        x->f_point_hover    = -1;
        x->f_point_selected = -1;
        x->f_output_inc     = -1;
        x->f_output_nextprev = 0;
        x->f_point_last_created = -1;
        x->f_mouse.x = -666666;
        x->f_mouse.y = -666666;
        
        x->f_clock = clock_new(x, (t_method)breakpoints_inc);
        
        ebox_attrprocess_viabinbuf(x, d);
        breakpoints_init(x, d);
        ebox_ready((t_ebox *)x);
    }
    
    return (x);
}
Exemplo n.º 2
0
Process *
open_program(char *filename, pid_t pid) {
	Process *proc;
	proc = calloc(sizeof(Process), 1);
	if (!proc) {
		perror("malloc");
		exit(1);
	}
	proc->filename = strdup(filename);
	proc->breakpoints_enabled = -1;
	if (pid) {
		proc->pid = pid;
#if defined(HAVE_LIBUNWIND)
		proc->unwind_priv = _UPT_create(pid);
	} else {
		proc->unwind_priv = NULL;
#endif /* defined(HAVE_LIBUNWIND) */
	}

	breakpoints_init(proc);

	proc->next = list_of_processes;
	list_of_processes = proc;

#if defined(HAVE_LIBUNWIND)
	proc->unwind_as = unw_create_addr_space(&_UPT_accessors, 0);
#endif /* defined(HAVE_LIBUNWIND) */
	return proc;
}
Exemplo n.º 3
0
static void breakpoints_list(t_breakpoints *x,t_symbol* s, int argc,t_atom* argv)
{
	
     breakpoints_init(x,argc,argv);
     if (glist_isvisible(x->w.glist)) {
	  breakpoints_drawme(x, x->w.glist, 0);
     }
}
Exemplo n.º 4
0
static int
process_init_main(struct Process *proc)
{
	if (breakpoints_init(proc) < 0) {
		fprintf(stderr, "failed to init breakpoints %d\n",
			proc->pid);
		return -1;
	}

	return 0;
}
Exemplo n.º 5
0
void breakpoints_function(t_breakpoints *x, t_symbol* s, int argc, t_atom* argv)
{
    t_binbuf* b = binbuf_new();

    if(argc && argv)
    {
        binbuf_addv(b, "s", gensym("@points"));
        binbuf_add(b, argc, argv);
        breakpoints_init(x, b);
        binbuf_free(b);

    }
}
Exemplo n.º 6
0
void breakpoints_read(t_breakpoints *x, t_symbol *s, int argc, t_atom *argv)
{
    t_binbuf *d = binbuf_new();
    if(d && argv && argc && atom_gettype(argv) == A_SYM)
    {
        if(binbuf_read(d, atom_getsym(argv)->s_name, "", 0))
        {
            object_error(x, "breakpoints : %s read failed", atom_getsym(argv)->s_name);
        }
        else
        {
            breakpoints_init(x, d);
        }
    }
    if(d)
        binbuf_free(d);
}
Exemplo n.º 7
0
void
debugger_init( void )
{
	struct sockaddr_un addr;

	/* only enable the debugger nub when it is explicitely requested by the user */
	if( !debugger_enabled() )
		return;
	printm("Debugger nub enabled\n");
	sv.sock = -1;

	/* create a unix socket for the debugger */
	socket_name = molsocket_name();		/* malloced */

	unlink( socket_name );
	if( (sv.sock_listen=socket(PF_UNIX, SOCK_STREAM, 0)) < 0 )
		fatal_err("socket");

	addr.sun_family = AF_UNIX;
	strcpy( addr.sun_path, socket_name );
	if( bind(sv.sock_listen, (struct sockaddr*)&addr, sizeof(addr)) < 0 )
		fatal_err("bind");

	if( listen(sv.sock_listen, 2) < 0 )
		fatal_err("listen");

	sv.hup_count = 0;
	sv.async_listener_id = add_async_handler( sv.sock_listen, POLLIN,
						  nub_rcv_connection, 1 /* SIGIO */ );
	/* initialize debugger */
	nub_inited = 1;
	if( debugger_enabled() ) {
		breakpoints_init();
		add_mmu_cmds();
	}
	set_print_hook( debugger_print );
}
Exemplo n.º 8
0
static void
handle_exec(Event * event) {
	Process * proc = event->proc;
	pid_t saved_pid;

	debug(DEBUG_FUNCTION, "handle_exec(pid=%d)", proc->pid);
	if (proc->state == STATE_IGNORED) {
		untrace_pid(proc->pid);
		remove_process(proc);
		return;
	}
	output_line(proc, "--- Called exec() ---");
	proc->mask_32bit = 0;
	proc->personality = 0;
	proc->arch_ptr = NULL;
	free(proc->filename);
	proc->filename = pid2name(proc->pid);
	saved_pid = proc->pid;
	proc->pid = 0;
	breakpoints_init(proc, 0);
	proc->pid = saved_pid;
	proc->callstack_depth = 0;
	continue_process(proc->pid);
}
Exemplo n.º 9
0
static void *breakpoints_new(t_symbol *s,int argc,t_atom* argv)
{
	
	
	
     t_breakpoints *x = (t_breakpoints *)pd_new(breakpoints_class);
     
     x->borderwidth = 1;
     x->state = 0;
     x->x_f = 0;
     x->args = STATES;
     x->finalvalues = getbytes( x->args*sizeof(t_float));
     x->duration = getbytes( x->args*sizeof(t_float));
#ifdef DEBUG
     post("finalvalues %x",x->finalvalues);
#endif
     /* widget */
     
     x->w.grabbed = 0;
     x->resizing = 0;
     x->resizeable = 0;
     x->w.glist = (t_glist*) canvas_getcurrent();
     
     x->w.width = 200;
     if (argc) x->w.width = atom_getfloat(argv++),argc--;
     x->w.height = 140;
     if (argc) x->w.height = atom_getfloat(argv++),argc--;
     
     t_float initialDuration = 100;
     if (argc) initialDuration = atom_getfloat(argv++),argc--;

     x->r_sym = &s_;
     if (argc) {
       t_symbol* n;

       n = atom_getsymbol(argv++);
       bindsym(&x->x_obj.ob_pd,x->r_sym,n);
       x->r_sym = n;
       argc--;
     }
     #ifdef DEBUG
     post("recv %s",x->r_sym->s_name);
#endif
     x->s_sym = &s_;
     if (argc) x->s_sym = atom_getsymbol(argv++),argc--;
     #ifdef DEBUG
     post("send %s",x->s_sym->s_name);
     #endif
     x->d_sym = &s_;
     if (argc) x->d_sym = atom_getsymbol(argv++),argc--;
     #ifdef DEBUG
     post("send %s",x->d_sym->s_name);
     #endif 
      
      x->c_sym = &s_;
     if (argc) x->c_sym = atom_getsymbol(argv++),argc--;
     #ifdef DEBUG
     post("change %s",x->d_sym->s_name);
     #endif 
      
     if (argc>2)
	  breakpoints_init(x,argc,argv);
     else {
	  t_atom a[5];
	  SETFLOAT(a,0);
	  SETFLOAT(a+1,50);
	  SETFLOAT(a+2,1);
	  SETFLOAT(a+3,50);
	  SETFLOAT(a+4,0);
	  breakpoints_init(x,5,a);
     }	 
     
     x->x_val = 0.0;
     x->x_state = NONE;
     x->sustain_state = SUSTAIN;
     x->x_freeze = 0;
     
     
    breakpoints_totaldur(x,initialDuration);
     
     
     //outlet_new(&x->x_obj, gensym("signal"));
     outlet_new(&x->x_obj, &s_float);
     x->out2 = outlet_new(&x->x_obj, &s_float);
     x->out3 = outlet_new(&x->x_obj, &s_bang);
     
     x->x_clock = clock_new(x, (t_method) breakpoints_tick);
     return (x);
}