Message Boards Message Boards

Debugger controls for Wolfram Language code?

Posted 4 years ago

The Wolfram desktop contains something called Debugger and familiar Debugger Controls. But I cannot find any description of that, and I have no idea if and how it works. At least it does not work like the tons of debuggers in other languages we are used to.

This seems to be a very old, but constantly neglected feature within the Wolfram world.

Can somebody point me to some current description or article about this feature?

POSTED BY: Werner Geiger
3 Replies

To create a breakpoint, one must select the WHOLE command. Just double clicking on the command name will do. Then you press the "Break at Selection" button in the debugger control panel. I still have no clear understanding what is considered a whole command from the Mathematica point of view.

Posted 4 years ago

@Jalil

"Again, I think you're looking for a debugger, but it's not exactly what you need. 
With trace and sow/reap, you can easily find what you're looking for."

I don't share your opinion in any way. Mathematica is undoubtedly constructed completely different from common programming languages, but that doesn't change anything about debugging requirements.

Sow/Reap are very useful language constructs for collecting intermediate results during repeated calculations. But they have as little to do with a debugger as Monitor, Trace, Echo, Print.

Any kind of code instrumentation is not what is meant by debugging with a debugger. Rather, it is a matter of going through the unchanged source code step by step, or in pieces, up to certain points or events and looking at the state of interesting data there, or even changing it.

As far as I have understood, the "Debugger" in Mathematica Desktop is not suitable for this and you need an additional IDE (Eclipse) for debugging.

POSTED BY: Werner Geiger
Posted 4 years ago

So Wolfram isn't a standard imperative language where there is a notion of a state and steps. It's a term-rewriting system. In these systems, debuggers aren't necessarily what you need to figure out, "What is the state at this step."

One way most people do this is to use Sow/Reap combinations. An expression is evaluated at certain points, and you can collect values of the expression and show what those values are at that point.

Another is to use Trace, which shows the raw steps used in the evaluation.

Again, I think you're looking for a debugger, but it's not exactly what you need. With trace and sow/reap, you can easily find what you're looking for.

POSTED BY: Jalil F
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract