I just checked in a debugging aid I created to be able to do some live data inspection in running Pike programs (I used it to find the cause of a deadlock in pgsql).
I'd appreciate feedback on the implementation and usability of Debug.Peek (in Pike 8.1).
To get a rough impression of what it does, here's an excerpt out of the documentation:
------------------------------------------------ Class Debug.Peek
Description Allows for interactive debugging and live data structure inspection in both single- and multi-threaded programs. Creates an independent background thread that every pollinterval will show a list of running threads. Optionally, a triggersignal can be specified which allows the dump to be triggered by signal.
Example: In the program you'd like to inspect, insert the following one-liner:
Debug.Peek("/tmp/test.pike"); Then start the program and keep it running. Next you create a /tmp/test.pike with the following content:
void create() { werror("Only once per modification of test.pike\n"); }
int main() { werror("This will run every iteration\n"); werror("By returning 1 here, we disable the stacktrace dumps\n"); return 0; }
void destroy() { werror("destroy() runs just as often as create()\n"); } Whenever you edit /tmp/test.pike, it will automatically reload the file. ------------------------------------------------