Questions about debugging techniques, using the built-in debugger, and/or the Wolfram Workbench debugger.
Questions tagged [debugging]
195 questions
38
votes
4 answers
Debugging with Breakpoints
re: Version 9. I typically write concise code and make a real effort to refactor. As such debugging has tended to take care of itself.
Recently, I've needed to assemble applications of more complexity, in that it they have deeper hierarchies of…
Jagra
- 14,343
- 1
- 39
- 81
25
votes
1 answer
A debug utility to print or extract intermediate data from a program
Is there a way to print variables using their names, or to extract the corresponding information for later analysis ?
faysou
- 10,999
- 3
- 50
- 125
25
votes
1 answer
How to report a bug in Mathematica
I found two bugs in Mathematica (10.3 and 10.1) and I need to report it. Is there any tools to do that or section on Wolfram website?
BetterEnglish
- 2,026
- 13
- 19
22
votes
2 answers
Debugging Mathematica Code
In various integrated development environments, such as Microsoft Visual Studio, there is an integrated debugger where you can step through code sections, examine the state of variables and figure out where things are going wrong. With more complex…
s0rce
- 9,632
- 4
- 45
- 78
12
votes
0 answers
RuntimeTools insight?
Does anyone happen to have some more complete insight into the RuntimeTools package that is used by Debug and Workbench?
I ask because, while I'm familiar with using RuntimeTools`Profile[] for global performance checking, there are times I'd rather…
flip
- 1,800
- 11
- 20
11
votes
3 answers
How can one debug a module more elegant than just with Print?
This question is interesting mainly for beginners, but the answer i wrote to my own question could be also interesting for advanced users.
Introduction: While writing huge blocks of code, especially inside of a Module it can be very hard to debug…
sacratus
- 1,556
- 10
- 18
11
votes
2 answers
How to globally disable and re-enable Echo?
I have Echo's buried in code all over my notebook, I'd like a flag to turn them all on or off globally.
Sure Unprotect[Echo];Echo=Identity would disable them, but then you can't re-enable them
A solution that works for all the various types of…
M.R.
- 31,425
- 8
- 90
- 281
9
votes
3 answers
Metaquestion: how to find out why (e.g.) MatchQ[42, _?Function[x, True]] is False?
Suppose you run into a bewildering Mathematica result (which happens to me several times per Mathematica session, even after a 20-year acquaintance), such as, for example:
MatchQ[42, _?Function[x, True]]
False
So you go pore over the docs, but you…
kjo
- 11,717
- 1
- 30
- 89
8
votes
1 answer
How can I get TracePrint to treat certain functions as atomic?
Consider the following example:
In[1]:= f[x_]:=x+1;g[x_]:=f[2x]
In[2]:= TracePrint[g[1]]
g[1]
g
1
f[2 1]
f
2 1
Times
2
1
2
f[2]
2 + 1
Plus
2
1
3
Out[2]= 3
So far, so good. However I'd now like to instruct TracePrint…
celtschk
- 19,133
- 1
- 51
- 106
8
votes
1 answer
What is missing in this Mathematica Journal Article?
So I had been looking to solve a little tiling problem and Google turned up this Mathematica Journal Article and I noticed the code was both incomplete and incorrect, so... My Question is, What is missing to make this code actually work?
To make…
Nothingtoseehere
- 4,518
- 2
- 30
- 58
5
votes
1 answer
See Local Variable at breakpoint within MODULE?
Within the debugger, can we watch local variables within a Module?
As the screenshot shows, the “i” only display its global value (12) upon a message breakpoint. Is there a way to show its local value?
Clear[i];
i = 12;
f[] := Module[{i},
For[i…
JimmyLin
- 573
- 2
- 11
5
votes
2 answers
Is there a builtin function to turn selective Echos off?
Suppose I have a code block
EchoOff[CompoundExpression[
...,
Echo[...,"echo 1",f],
Echo[...,"echo 2",g],
...
]]
Is there a function EchoOff that can be wrapped around an expression to turn off the output of all Echo…
user13892
- 9,375
- 1
- 13
- 41
4
votes
2 answers
How can I memoize the result of o[i] and at the same time force u to be incremented whenever o[i] is called?
I am working on the following code:
f[1] = Cos[t];
f[2] = Sin[t];
f[3] = 1.2 Cos[1.2 Pi t];
f[4] = 1.2 Sin[1.2 Pi t];
f[5] = 1.7 Cos[1.7 Pi t];
f[6] = 1.7 Sin[1.7 Pi t];
u = 0;
s = 0.1;
o[n_] := (o[n] = Table[{f[2 n - 1], f[2 n]}, {t, 0, 2 Pi, s…
Red Banana
- 5,329
- 2
- 29
- 47
3
votes
1 answer
How to exit TraceDialog?
Nice question brought by my friend.
myFunc[x_] := x + 1; TraceDialog[Map[myFunc, Range[100]], myFunc[___]]
Assume you decide to interrupt after entering the dialog.
Neither Abort[] nor Throw[...] (nor Interrupt) do work in this case. The only…
Pavel Perikov
- 1,345
- 6
- 14
3
votes
0 answers
Displaying outcome of Trace
Is there a better way to display Trace output? Parsing could be provided to separate blocks of the computation by an extra line. Trace produces a large chunk of unbroken output that I copy into a new Mathematica window and need to parse manually to…
ExpressionCoder
- 1,678
- 7
- 15