[ESS] ess-tracebug - feature suggestion

Vitalie S. spinuvit.list at gmail.com
Thu Dec 16 10:23:14 CET 2010

Rainer M Krug <r.m.krug at gmail.com> writes:

> Hi
> I am debugging (again) at the moment, and am wondering, uf it would be
> possible to have conditional breakpoints in ess-tracebug? At the moment,
> I modify the source code with an if statement and put the breakpoint in
> the if :
> if (x==0) {
>   cat(x)   ## Add breakpoint here
> }
> but it would be nice if a conditional breakpoint could be included.
I agree. But, how do you see the work-flow? Here is what I think of it:

M-c B pop-ups a request in the minibuffer for the condition to use, and then insert
the conditional breakpoint.

For time being you can define your custom conditional breakpoints which are

(nconc ess-bp-type-spec-alist '((my-browser "browser(expr = exists(\"a\") && a >.5)" "My-Br>\n" filled-square font-lock-doc-face)))

makes available a conditional breakpoint which tests for a>.5 before being
triggered. You probably already know that it can be set with M-c b b b :)

To remove the appended custom breakpoint use (nbutlast ess-bp-type-spec-alist). 

> Also: would it be possible to define watch variables, whose values are
> shown after each line executed? This could be in a new buffer, as the
> main buffer could become quite cluttered.

Yes, this is a priority now. I have plans for full blown environments navigator
but that will take some time. A basic watch window must be feasible unless there
are some technical issues with sub-process communication during the debugging.

How about this  work flow:

M-c w pops up the minibuffer request for expression to watch for (like str(a),
head(df, 2), a[2:3] etc), and registers it in the list of watched expressions.

Once the list of watched expressions is non empty the watch buffer pop-ups
whenever the debugging is active.

To remove the variables from the watch list, navigate to watch window and kill
lines with "k" key. Navigate in watch window with "p", "n". Move expression
up/down with "u","d".

Some things to think about.
Should watch window be displayed only during the active debugging or all the
time? How the screen should be split? Split only the iESS window, or the whole
screen? May be hide the iESS altogether?  

Any ideas are welcome, since I already forgot the time I last used a watch

> And finally: the tab-completion is not working when debugging, but the
> same applies when using browser() - so it has nothing to do with
> ess-tracebug in particular, but is related to debugging.

It works for me.  The  `ess-complete-object-name` which performs the
completion and should be fine with you as well.

I will get down to conditional breakpoint and watch window in the January.
Hopefully you don't plan to do some heavy debugging  during the Christmas holidays:)

Thanks for the feedback,
> Cheers,
> Rainer

More information about the ESS-help mailing list