Go to Google Groups Home    perl.perl6.internals
Debug ops?

Dan Sugalski <d...@sidhe.org>

I'm considering adding in some new ops and a command-line switch to
help debug parrot code, but before I did I figured I'd better throw
it out to the list for some debugging. (This seems like something
which could be of good general use, and as such I'd like to hash it
out, do it once, and do it right)

As I've been writing library code in pir, I'm finding I've got a
*lot* of commented-out printerr sections, as well as a fair amount of
intermediate code to generate the data to be printed. What would be
useful would be a relatively fast and simple way to leave these in
and just skip over them, or have them not execute. As such I'm
thinking we could use:

  dprinterr [PISN]x - Like printerr, but only when running in debug mode
  ifdebug label - If debug's on, branch to label
  unlessdebug label - branch to label unless debugging's on
  debugbsr label - do a bsr to the label if debugging's on

As well as making the current debug status part of the interpreter
info section which can be queried and branched on as needed. I can
certainly see skipping the if/unlessdebug stuff, though the print
only if debugging would make the code a lot cleaner, such as it is.
(I'm also thinking that a conditional bsr would be useful, but I'm
not sure it'd be useful *enough*) If it'd make the JIT unhappy to
have more branching ops they can be left out.
--
                                Dan

--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
d...@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk