debug icon indicating copy to clipboard operation
debug copied to clipboard

Debugging all callers of a function?

Open jackfirth opened this issue 8 years ago • 2 comments
trafficstars

Sometimes I don't want to debug an expression, I want to debug all calls to a particular function. Would that belong in this package or a different library?

I'm imagining something like define/debug that works just like define but acts as if all callsites are wrapped in #R.

jackfirth avatar Jul 21 '17 07:07 jackfirth

That would fit fine in this package. Although it won't be able to print out the expression of the callsite like #R would, and I'm not sure how a user would find which call it came from... If we do this, should define/debug define a function-like macro (sort of like rackunit does) so that it can save the source location and the expression?

AlexKnauth avatar Jul 21 '17 14:07 AlexKnauth

I think a function-like macro like rackunit checks is a fine idea. Here's an idea for naming:

  • (define#R (foo arg ...) body ...) Records callsite information in the same way as wrapping callsites with #R
  • (define#RR (foo arg ...) body ...) Callsites recorded with #RR
  • (define#RRR (foo arg ...) body ...) Callsites recorded with #RRR

define/debug seems too long to type.

jackfirth avatar Jul 21 '17 18:07 jackfirth