From: Jeff H. <je...@ac...> - 2008-08-06 00:33:47
|
Remigiusz Jan Andrzej Modrzejewski wrote: > Not the first, probably not the last - problem with Tcl_EvalObjv. Now > I've got this here: > http://dev.lrem.net/tcldtrace/browser/trunk/generic/dtrace.c#L680 > When executing this test: > http://dev.lrem.net/tcldtrace/browser/trunk/tests/dtrace.test#L484 > I get a segfault. This is during the second call of callback. Everything > looks quite the same as in the first call. Some gdb dump: 691 static int listProbe ( 692 dtrace_hdl_t *handle, 693 const dtrace_probedesc_t *pdesc, 694 void *varg 695 ) 696 { 697 list_arg *arg = (list_arg*) varg; 698 Tcl_Obj *objv[3]; int i; 699 700 objv[0] = arg->proc; 702 objv[1] = formatProbeDesc(arg->hd, pdesc); 704 objv[2] = arg->args; for (i = 0; i < 3; i++) { Tcl_IncrRefCount(objv[i]); } 706 if (Tcl_EvalObjv(arg->hd->interp, 3, objv, 0) != TCL_OK) { 707 /* What now?! */ Tcl_AddErrorInfo(arg->hd->interp, "\n (running listProbe callback)"); Tcl_BackgroundError(arg->hd->interp); return -1; // ERROR CONDITION RESULT?? 708 } for (i = 0; i < 3; i++) { Tcl_DecrRefCount(objv[i]); } 710 return 0; 711 } > The test should fire the callback two times for probes > syscall::exec:entry and syscall::exec:return. > > BTW - how should I signalize an error within the callback? Like the > failed Tcl_EvalObjv (if it would ever fail without bringing the whole > thing down)? I chose background error as that does the bgerror style reporting, as is probably necessary in this error situation. Otherwise you need to set the interp result and trigger a TCL_ERROR return code. Jeff |