(I'm quite new to drupal and no php wizard so i might not know the right wording...)
I'd like to do some cck debugging and trace might be great for that.
As far as i can tell trace can only be configured to listen to "broadcast hooks" and log what is broadcasted.
for instance, trace can dynamically define a function trace_menu which gives us a trace.
from trace.api.inc:170
function trace_hook_define($module, $hook) {
if (!trace_hook_defined($module, $hook)) {
eval("function {$module}_$hook() { trace_hook('$hook'); }");
return TRUE;
}
return FALSE;
}
It would be nice if trace could be configured as to inject log code between content.module and some my.development.module
so trace would re-define my_development_field_info() and log who calls, what is passed, and what back.
(the config might be a primitive "list of observed functions")
something like:
function trace_hook_insert($function) {
if (!trace_hook_inserted($function)) {
eval("
//save original function
\${$function}_saved = {$function};
function {$function}() {
trace_log_backtrace('$function'); //log who calls
trace_log_arguments('$function'); //log arguments passed
\${$function}_saved();
trace_log_arguments('$function'); //log arguments returned
}
");
return TRUE;
}
return FALSE;
}
Comments
Comment #1
geek-merlinTrying to refine the codesnippet above.
learned that php can redefine functions with the runkit_* extension functions.
so we might get something like:
Comment #2
Arto commentedThis feature would be very welcome as a patch for the 6.x branch.