I''m playing around with the approach Bryan suggested at the end of
this thread:
http://opensolaris.org/jive/thread.jspa?threadID=38734&tstart=195
"I would add an additional probe -- function-entry-stack or
something
-- that fires after function-entry and gives you a full string
stack
backtrace as an argument. This would have the added bonus that
(with
some slightly gross string manipulation) one could use them in
predicates -- something we can''t do with ustack today.
Incidentally,
I think we''re going to see more of this (is-enabled probes with
language-
specific semantics), especially as users of higher-level languages
wish to use DTrace to get at/aggregate on function arguments..."
It''s not hard to get a Perl backtrace into a string so I believe this
approach is viable. I have a prototype that dumps the stack to stdout.
So I''ll have these probes:
provider perl {
probe sub__entry(char*, char*, int);
probe sub__stack(char*, char*, int, char *, int);
probe sub__return(char*, char*, int);
};
The __stack probe gets the same information as __entry (sub, file, line)
plus a string containing the formatted stack dump and an integer
indicating the stack depth.
Before I clean it all up and turn it into a patch is there anything
else I should be thinking about? Any obvious caveats? Anyone think it''s
a bad idea?
--
Andy Armstrong, Hexten