|
From: Josef W. <Jos...@gm...> - 2006-09-07 01:31:42
|
On Saturday 02 September 2006 09:22, Oswald Buddenhagen wrote: > On Sat, Sep 02, 2006 at 03:18:56AM +0100, Julian Seward wrote: > > Recording program counters without a stack is of limited use, but I > > can't see how to record a complete stack for each first-write without > > huge space/time overheads. It might be possible to devise a highly > > compressed representation for just the PC values, based on the idea > > that each segment is only going to use a tiny subset of the 2^32/2^64 > > possible PC values. > > > i think saving traces in a tree might work. sounds a bit like callgrind. Yes. In callgrind, I always have the shadow call stack. And from this, I make context IDs on the fly, which is a pointer to a struct (similar to your PC). The context specifies the current stack trace up to a given maximal depth (--separate-callers=maxdepth). The structure contains the PCs in the stack trace; contexts are kept in a hash table. Event counters in callgrind are always related to the current context (maxdepth defaults to depth 1, ie. current function). The only problem is that for greater maxdepth, the number of contexts can get quite large. Some time ago I did some measurements; usually, a konqueror run touches around 25000 functions; with --separate-callers=20, I get 500000. Still reasonable. I could try to split the shadow call stack / context generation stuff out of callgrind into some helper module for tools. Note however, that this needs a callback at every BB start (like in callgrind). Josef |