To halt or not to halt: that’s the question!

Hi all!

The reason why I (lamely, yeah) paraphrase Shakespeare on this post’s title, is because I want to introduce you to conditional breakpoints.

So basically I have added the possibility of interrupting the execution when a certain condition is met. And what is a condition, then? It is simply a block or an statement with a boolean value (it will fail with anything other than those).
Once you set the condition, the link that is inserted by the breakpoint API is triggered only when that condition is met. Sweet, uh?

A very simple example:

Let’s suppose I want to halt when the value of a counter is non zero. We can use the counter from our past experiments:

Screen Shot 2014-08-28 at 13.57.32

Now, we set the breakpoint:

Screen Shot 2014-08-28 at 14.08.48

We select “halt on condition” from the following menu:

Screen Shot 2014-08-28 at 14.08.58

And we write down the condition, when prompted:

Screen Shot 2014-08-28 at 14.09.38

Now if we execute the following workspace:

Screen Shot 2014-08-28 at 14.28.31

Nothing happens! And that’s cool, because our counter is still zero… Now, if I increment the counter:

Screen Shot 2014-08-28 at 14.32.20

And we execute the workspace again, we get our halt:

Screen Shot 2014-08-28 at 14.37.33

Quite simple, but imagine that instead of checking out a counter, you inspect the current context… That enables a lot of possibilities, and I have to keep on experimenting in that regard. Also it may be cool to change the menus so to make them simpler to use…

And that’s it for now. As always, stay tuned, there are more interesting things on the way!

Clari

Advertisements
By clariallende

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s