I need to debug a function, and to do it I would like to display variables, do few computations etc while I am at a breakpoint.

But I don't see where I could do that ? I have the stack window opened but I can't write anything in this.

To give you an idea, I have a complex number and I want to understand why it is complex so I would like to check many variables while in debug but I don't want to write things in the function before the debug and then show them.

I want to directly write what I need to display while I am in debug mode without having predicted what I needed to display before launching it.


I really recommend not using the interactive debugger. You may have already noticed that its documentation is prefuctory. I conclude from the lack of full documentation that even Wolfram Research would rather we ignored the interactive debugger.

Mathematica includes an extensive set of debugging tools beyond the interactive debugger. These are described in guide/TuningAndDebugging, which I strong urge you to study.

In particular, I suggest you look at Dialog. It allows the kind of interaction you describe.

  • $\begingroup$ Thank you for your answer. I have put a dialog inside my function that I need to debug but the dialog session seems to work outside of it. For example if I want to show variables inside my functions it doesn't recognize them. Do you know how I could use a dialog inside a function ? $\endgroup$ – StarBucK May 27 '17 at 11:20
  • $\begingroup$ Ok in fact to be exact I give parameters to a function and there is a Module inside of it. I can access to the local values of the module but not to the parameters taken by the function $\endgroup$ – StarBucK May 27 '17 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.