Breakpoints...Again

While I feel like I got a lot of work done today, this past week was unfortunately much like the last: frustrating. Implementing breakpoints has turned out to be a lot more...interesting...than I had expected. And to what do I owe this great frustration? Why IMCC of course! For those of you who are unfamiliar with this, IMCC stands for "I Make Coders Cry."

Here's why:

A very simple algorithm for creating a breakpoint would look like this:

1. User enters command breakpoint 12
2. Store line number 12 somehwere
3. Run code
4. If current line number is equal to 12 then break
5. Q.E.D.

A very simple algorithm for creating a breakpoint using Parrot_sub_get_line_from_pc() (courtesy of IMCC) would look like this:

1. User enters command breakpoint 12
2. Store line number 12 somehwere
3. Run code
4. If current line nu-1 -1 -1 -1 -1 -1 -1 -1

Apparently, this was been an issue (among many others) with IMCC for some time. Unfortunately, this creates a bit of a catch 22. In order to have proper support for PIR code, I need to use what's given to me by IMCC. "IMCC is giving you problems? No big deal. Use line annotations!" Well, if I use line annotations then I only have support for HLL's that use PCT. "Isn't that the goal of you're project though?" Yes, but so is support for PIR code.

In an attempt to preserve the last bit of my sanity, I decided to put breakpoints on hold. Not forever. Just for a few days. I decided to work on some small things like adding support for non-pbc files by compiling the source code first and adding a few small command-line switches. Throwing in some more comments, a little extra perldocs. Easy stuff.

This afternoon sorear threw me a much needed life preserver by pointing out the incredibly obvious (or at least what should have been): line numbers aren't the only thing a debugger can set a breakpoint at! Given what I have now, the easiest thing to break at would be the instruction pointer. Sure, that may seem kinda strange to do now before I can even break at something as simple as line numbers. In sorear's words, "do the possible now, do the impossible later." That's absolutely true. +1 to you, sorear. :)

So now that I've taken a small break 1 day, I feel that I can now continue. Hopefully, this will be the last of the "I'm still working on breakpoints" blog posts. :)