string get_logging_item() { string t, program; mixed *a; int i; a = explode(previous_program(1), "/"); program = a[sizeof(a)-1] + ".c"; i = sizeof(call_trace()); a = call_trace()[i-4]; t = program + "->" + a[TRACE_FUNCTION] + "() (" + a[TRACE_LINE] + ")"; return t; }
static void argcheck(mixed arg, int num, varargs string type) { mixed **trace; if(!arg) { trace = call_trace(); error( MAGIC_ERROR_ARGCHECK + (string) num + " to " + trace[sizeof(trace)-2][2] + ( type ? " (needs " + type + ")" : "" ) ); } }
nomask static string previous_function() { mixed t; int i; t = call_trace(); i = sizeof(t) - 3; if(i < 0) i=0; t = t[i][TRACE_FUNCTION]; return t; }
/** * Stores trace data for the list of events. * * @param[in] events * @param[in] frames * @param[in] nframes */ void TraceData::storeTrace(std::list<CallEvent*>& events, sp_rtrace_btframe_t* frames, int nframes) { if (events.empty()) return; sp_rtrace_ftrace_t trace = {nframes, NULL, NULL}; if (nframes) { trace.frames = new pointer_t[nframes]; trace.resolved_names = new char*[nframes]; for (int i = 0; i < nframes; i++) { trace.frames[i] = frames[i].addr; trace.resolved_names[i] = frames[i].name; } } CallTrace::ptr_t call_trace(new CallTrace(trace)); for (std::list<CallEvent*>::iterator iter = events.begin(); iter != events.end(); iter++) { (*iter)->setTrace(call_trace); } }
static int call_trace_protected(Py_tracefunc func, PyObject *obj, PyThreadState *tstate, PyFrameObject *frame, int what, PyObject *arg) { PyObject *type, *value, *traceback; int err; PyErr_Fetch(&type, &value, &traceback); err = call_trace(func, obj, tstate, frame, what, arg); if (err == 0) { PyErr_Restore(type, value, traceback); return 0; } else { Py_XDECREF(type); Py_XDECREF(value); Py_XDECREF(traceback); return -1; } }