a word on pure mathematics
Pure mathematics consists entirely of assertions to the effect that, if such and such a proposition is true of anything, then such and such another proposition is true of that thing. It is essential not to discuss whether the first proposition is really true, and not to mention what the anything is, of which it is supposed to be true. If our hypothesis is about anything, and not about some one or more particular things, then our deductions constitute mathematics. Thus mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true. People who have been puzzled by the beginnings of mathematics will I hope, find comfort in this definition and will probably agree that it is accurate.
generating runtime callgraphs
This is some proof of concept code to generate runtime callgraphs. An example runtime callgraph of irssi can be found here (NOTE: the file is ~8mb).
Runtime callgraph generator
===========================
First type make to create callgraph.so.
To generate a runtime callgraph of any program, compile it by adding the
-finstrument-functions flag in CFLAGS.
./configure # if needed
. # other crap
make CFLAGS+=-finstrument-functions
Set the environment variable CGRAPH_OUT to the name of the .dot file.
export CGRAPH_OUT=callgraph.dot
At this point you can use LD_PRELOAD to create the callgraph of the program.
LD_PRELOAD=./callgraph.so ./prog [ARGS]
Once the program terminates, you have to feed it to the symbolizer.
./symbolize.sh ./prog
Generate a jpeg of the callgraph.
dot -Tjpg callgraph.dot -o callgraph.jpg
That's it!
inotify fun
I was playing with inotify the other day and this is what I’ve come up with. Watchd is basically a daemon that watches files and directories for events. A client program is used to feed the daemon with paths to watch. The daemon is responsible for calling user-defined scripts for further processing on each event.