/usr/share/doc/maxima-doc/html/maxima_38.html is in maxima-doc 5.32.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on January, 10 2014 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>
-->
<head>
<title>Maxima 5.32.1 Manual: 38. Debugging</title>
<meta name="description" content="Maxima 5.32.1 Manual: 38. Debugging">
<meta name="keywords" content="Maxima 5.32.1 Manual: 38. Debugging">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body
{
color: black;
background: white;
margin-left: 8%;
margin-right: 13%;
}
h1
{
margin-left: +8%;
font-size: 150%;
font-family: sans-serif
}
h2
{
font-size: 125%;
font-family: sans-serif
}
h3
{
font-size: 100%;
font-family: sans-serif
}
h2,h3,h4,h5,h6 { margin-left: +4%; }
div.textbox
{
border: solid;
border-width: thin;
/* width: 100%; */
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em
}
div.titlebox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(200,255,255);
font-family: sans-serif
}
div.synopsisbox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(255,220,255);
/*background: rgb(200,255,255); */
/* font-family: fixed */
}
pre.example
{
border: 1px solid gray;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 1em;
/* background: rgb(247,242,180); */ /* kind of sandy */
/* background: rgb(200,255,255); */ /* sky blue */
background-color: #F1F5F9; /* light blue-gray */
/* font-family: "Lucida Console", monospace */
}
div.spacerbox
{
border: none;
padding-top: 2em;
padding-bottom: 2em
}
div.image
{
margin: 0;
padding: 1em;
text-align: center;
}
div.categorybox
{
border: 1px solid gray;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 1em;
padding-right: 1em;
background: rgb(247,242,220);
}
-->
</style>
<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Debugging"></a>
<a name="SEC205"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_37.html#SEC204" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC206" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima_37.html#SEC200" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_39.html#SEC209" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 38. Debugging </h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC206">38.1 Source Level Debugging</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC207">38.2 Keyword Commands</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC208">38.3 Functions and Variables for Debugging</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<p><a name="Item_003a-Source-Level-Debugging"></a>
</p><hr size="6">
<a name="Source-Level-Debugging"></a>
<a name="SEC206"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC205" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC207" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC205" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC205" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_39.html#SEC209" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 38.1 Source Level Debugging </h2>
<p>Maxima has a built-in source level debugger.
The user can set a breakpoint at a function,
and then step line by line from there. The call
stack may be examined, together with the variables bound at that level.
</p>
<p>The command <code>:help</code> or <code>:h</code> shows the list of debugger commands.
(In general,
commands may be abbreviated if the abbreviation is unique. If not
unique, the alternatives will be listed.)
Within the debugger, the user can also use any ordinary Maxima
functions to examine, define, and manipulate variables and expressions.
</p>
<p>A breakpoint is set by the <code>:br</code> command at the Maxima prompt.
Within the debugger,
the user can advance one line at a time using the <code>:n</code> ("next") command.
The <code>:bt</code> ("backtrace") command shows a list of stack frames.
The <code>:r</code> ("resume") command exits the debugger and continues with
execution. These commands are demonstrated in the example below.
</p>
<pre class="example">(%i1) load ("/tmp/foobar.mac");
(%o1) /tmp/foobar.mac
(%i2) :br foo
Turning on debugging debugmode(true)
Bkpt 0 for foo (in /tmp/foobar.mac line 1)
(%i2) bar (2,3);
Bkpt 0:(foobar.mac 1)
/tmp/foobar.mac:1::
(dbm:1) :bt <-- :bt typed here gives a backtrace
#0: foo(y=5)(foobar.mac line 1)
#1: bar(x=2,y=3)(foobar.mac line 9)
(dbm:1) :n <-- Here type :n to advance line
(foobar.mac 2)
/tmp/foobar.mac:2::
(dbm:1) :n <-- Here type :n to advance line
(foobar.mac 3)
/tmp/foobar.mac:3::
(dbm:1) u; <-- Investigate value of u
28
(dbm:1) u: 33; <-- Change u to be 33
33
(dbm:1) :r <-- Type :r to resume the computation
(%o2) 1094
</pre>
<p>The file <code>/tmp/foobar.mac</code> is the following:
</p>
<pre class="example">foo(y) := block ([u:y^2],
u: u+3,
u: u^2,
u);
bar(x,y) := (
x: x+2,
y: y+2,
x: foo(y),
x+y);
</pre>
<p>USE OF THE DEBUGGER THROUGH EMACS
</p>
<p>If the user is running the code under GNU emacs in a shell
window (dbl shell), or is running the graphical interface version,
Xmaxima, then if he stops at a break point, he will see his
current position in the source file which will be displayed in the
other half of the window, either highlighted in red, or with a little
arrow pointing at the right line. He can advance single lines at a
time by typing M-n (Alt-n).
</p>
<p>Under Emacs you should run in a <code>dbl</code> shell, which requires the
<code>dbl.el</code> file in the elisp directory.
Make sure you install the elisp files or add the Maxima elisp directory to
your path:
e.g., add the following to your <tt>`.emacs'</tt> file or the <tt>`site-init.el'</tt>
</p>
<pre class="example">(setq load-path (cons "/usr/share/maxima/5.9.1/emacs" load-path))
(autoload 'dbl "dbl")
</pre>
<p>then in emacs
</p>
<pre class="example">M-x dbl
</pre>
<p>should start a shell window in which you can run programs, for example
Maxima, gcl, gdb etc. This shell window also knows about source level
debugging, and display of source code in the other window.
</p>
<p>The user may set a break point at a certain line of the
file by typing <code>C-x space</code>. This figures out which function
the cursor is in, and then it sees which line of that function
the cursor is on. If the cursor is on, say, line 2 of <code>foo</code>, then it will
insert in the other window the command, "<code>:br foo 2</code>", to
break <code>foo</code> at its second line. To have this enabled, the user must have
maxima-mode.el turned on in the window in which the file <code>foobar.mac</code> is
visiting. There are additional commands available in that file window, such as
evaluating the function into the Maxima, by typing <code>Alt-Control-x</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Debugging}
</div>
</p>
<p><a name="Item_003a-Keyword-Commands"></a>
</p><hr size="6">
<a name="Keyword-Commands"></a>
<a name="SEC207"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC206" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC208" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC205" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC205" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_39.html#SEC209" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 38.2 Keyword Commands </h2>
<p>Keyword commands are special keywords which are not interpreted as Maxima
expressions. A keyword command can be entered at the Maxima prompt or the
debugger prompt, although not at the break prompt.
Keyword commands start with a colon, '<code>:</code>'.
For example, to evaluate a Lisp form you
may type <code>:lisp</code> followed by the form to be evaluated.
</p>
<pre class="example">(%i1) :lisp (+ 2 3)
5
</pre>
<p>The number of arguments taken depends on the particular command. Also,
you need not type the whole command, just enough to be unique among
the break keywords. Thus <code>:br</code> would suffice for <code>:break</code>.
</p>
<p>The keyword commands are listed below.
</p>
<dl compact="compact">
<dt> <code>:break F n</code></dt>
<dd><p>Set a breakpoint in function <code>F</code> at line offset <code>n</code>
from the beginning of the function.
If <code>F</code> is given as a string, then it is assumed to be
a file, and <code>n</code> is the offset from the beginning of the file.
The offset is optional. If not given, it is assumed to be zero
(first line of the function or file).
</p></dd>
<dt> <code>:bt</code></dt>
<dd><p>Print a backtrace of the stack frames
</p></dd>
<dt> <code>:continue</code></dt>
<dd><p>Continue the computation
</p></dd>
<dt> <code>:delete</code></dt>
<dd><p>Delete the specified breakpoints, or all if none are specified
</p></dd>
<dt> <code>:disable</code></dt>
<dd><p>Disable the specified breakpoints, or all if none are specified
</p></dd>
<dt> <code>:enable</code></dt>
<dd><p>Enable the specified breakpoints, or all if none are specified
</p></dd>
<dt> <code>:frame n</code></dt>
<dd><p>Print stack frame <code>n</code>, or the current frame if none is specified
</p></dd>
<dt> <code>:help</code></dt>
<dd><p>Print help on a debugger command, or all commands if none is specified
</p></dd>
<dt> <code>:info</code></dt>
<dd><p>Print information about item
</p></dd>
<dt> <code>:lisp some-form</code></dt>
<dd><p>Evaluate <code>some-form</code> as a Lisp form
</p></dd>
<dt> <code>:lisp-quiet some-form</code></dt>
<dd><p>Evaluate Lisp form <code>some-form</code> without any output
</p></dd>
<dt> <code>:next</code></dt>
<dd><p>Like <code>:step</code>, except <code>:next</code> steps over function calls
</p></dd>
<dt> <code>:quit</code></dt>
<dd><p>Quit the current debugger level without completing the computation
</p></dd>
<dt> <code>:resume</code></dt>
<dd><p>Continue the computation
</p></dd>
<dt> <code>:step</code></dt>
<dd><p>Continue the computation until it reaches a new source line
</p></dd>
<dt> <code>:top</code></dt>
<dd><p>Return to the Maxima prompt (from any debugger level) without
completing the computation
</p></dd>
</dl>
<div class=categorybox>
·
<p>@ref{Category: Debugging}
</div>
</p>
<p><a name="Item_003a-Functions-and-Variables-for-Debugging"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-Debugging"></a>
<a name="SEC208"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC207" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maxima_39.html#SEC209" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC205" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC205" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_39.html#SEC209" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 38.3 Functions and Variables for Debugging </h2>
<p><a name="debugmode"></a>
<a name="Item_003a-debugmode"></a>
</p><dl>
<dt><u>Option variable:</u> <b>debugmode</b>
<a name="IDX1605"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When a Maxima error occurs, Maxima will start the debugger if <code>debugmode</code>
is <code>true</code>. The user may enter commands to examine the call stack, set
breakpoints, step through Maxima code, and so on. See <code>debugging</code> for a
list of debugger commands.
</p>
<p>Enabling <code>debugmode</code> will not catch Lisp errors.
</p>
<div class=categorybox>
·
<p>@ref{Category: Debugging} ·
@ref{Category: Global flags}
</div>
</p></dd></dl>
<p><a name="refcheck"></a>
<a name="Item_003a-refcheck"></a>
</p><dl>
<dt><u>Option variable:</u> <b>refcheck</b>
<a name="IDX1606"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>refcheck</code> is <code>true</code>, Maxima prints a message
each time a bound variable is used for the first time in a
computation.
</p>
<div class=categorybox>
·
<p>@ref{Category: Evaluation} ·
@ref{Category: Console interaction} ·
@ref{Category: Global flags}
</div>
</p></dd></dl>
<p><a name="setcheck"></a>
<a name="Item_003a-setcheck"></a>
</p><dl>
<dt><u>Option variable:</u> <b>setcheck</b>
<a name="IDX1607"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>If <code>setcheck</code> is set to a list of variables (which can
be subscripted),
Maxima prints a message whenever the variables, or
subscripted occurrences of them, are bound with the
ordinary assignment operator <code>:</code>, the <code>::</code> assignment
operator, or function argument binding,
but not the function assignment <code>:=</code> nor the macro assignment
<code>::=</code> operators.
The message comprises the name of the variable and the
value it is bound to.
</p>
<p><code>setcheck</code> may be set to <code>all</code> or <code>true</code> thereby
including all variables.
</p>
<p>Each new assignment of <code>setcheck</code> establishes a new list of variables to
check, and any variables previously assigned to <code>setcheck</code> are forgotten.
</p>
<p>The names assigned to <code>setcheck</code> must be quoted if they would otherwise
evaluate to something other than themselves.
For example, if <code>x</code>, <code>y</code>, and <code>z</code> are already bound, then enter
</p>
<pre class="example">setcheck: ['x, 'y, 'z]$
</pre>
<p>to put them on the list of variables to check.
</p>
<p>No printout is generated when a
variable on the <code>setcheck</code> list is assigned to itself, e.g., <code>X: 'X</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Console interaction} ·
@ref{Category: Global flags}
</div>
</p></dd></dl>
<p><a name="setcheckbreak"></a>
<a name="Item_003a-setcheckbreak"></a>
</p><dl>
<dt><u>Option variable:</u> <b>setcheckbreak</b>
<a name="IDX1608"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>setcheckbreak</code> is <code>true</code>,
Maxima will present a break prompt
whenever a variable on the <code>setcheck</code> list is assigned a new value.
The break occurs before the assignment is carried out.
At this point, <code>setval</code> holds the value to which the variable is
about to be assigned.
Hence, one may assign a different value by assigning to <code>setval</code>.
</p>
<p>See also <code>setcheck</code> and <code>setval</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Console interaction} ·
@ref{Category: Global flags}
</div>
</p></dd></dl>
<p><a name="setval"></a>
<a name="Item_003a-setval"></a>
</p><dl>
<dt><u>System variable:</u> <b>setval</b>
<a name="IDX1609"></a>
</dt>
<dd><p>Holds the value to which a variable is about to be set when
a <code>setcheckbreak</code> occurs.
Hence, one may assign a different value by assigning to <code>setval</code>.
</p>
<p>See also <code>setcheck</code> and <code>setcheckbreak</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Console interaction} ·
@ref{Category: Global variables}
</div>
</p></dd></dl>
<p><a name="timer"></a>
<a name="Item_003a-timer"></a>
</p><dl>
<dt><u>Function:</u> <b>timer</b><i> (<var>f_1</var>, …, <var>f_n</var>)</i>
<a name="IDX1610"></a>
</dt>
<dt><u>Function:</u> <b>timer</b><i> (all)</i>
<a name="IDX1611"></a>
</dt>
<dt><u>Function:</u> <b>timer</b><i> ()</i>
<a name="IDX1612"></a>
</dt>
<dd><p>Given functions <var>f_1</var>, …, <var>f_n</var>, <code>timer</code> puts each one on the
list of functions for which timing statistics are collected.
<code>timer(f)$ timer(g)$</code> puts <code>f</code> and then <code>g</code> onto the list;
the list accumulates from one call to the next.
</p>
<p><code>timer(all)</code> puts all user-defined functions (as named by the global
variable <code>functions</code>) on the list of timed functions.
</p>
<p>With no arguments, <code>timer</code> returns the list of timed functions.
</p>
<p>Maxima records how much time is spent executing each function
on the list of timed functions.
<code>timer_info</code> returns the timing statistics, including the
average time elapsed per function call, the number of calls, and the
total time elapsed.
<code>untimer</code> removes functions from the list of timed functions.
</p>
<p><code>timer</code> quotes its arguments.
<code>f(x) := x^2$ g:f$ timer(g)$</code> does not put <code>f</code> on the timer list.
</p>
<p>If <code>trace(f)</code> is in effect, then <code>timer(f)</code> has no effect;
<code>trace</code> and <code>timer</code> cannot both be in effect at the same time.
</p>
<p>See also <code>timer_devalue</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Debugging}
</div>
</p></dd></dl>
<p><a name="untimer"></a>
<a name="Item_003a-untimer"></a>
</p><dl>
<dt><u>Function:</u> <b>untimer</b><i> (<var>f_1</var>, …, <var>f_n</var>)</i>
<a name="IDX1613"></a>
</dt>
<dt><u>Function:</u> <b>untimer</b><i> ()</i>
<a name="IDX1614"></a>
</dt>
<dd><p>Given functions <var>f_1</var>, …, <var>f_n</var>,
<code>untimer</code> removes each function from the timer list.
</p>
<p>With no arguments, <code>untimer</code> removes all functions currently on the timer
list.
</p>
<p>After <code>untimer (f)</code> is executed, <code>timer_info (f)</code> still returns
previously collected timing statistics,
although <code>timer_info()</code> (with no arguments) does not
return information about any function not currently on the timer list.
<code>timer (f)</code> resets all timing statistics to zero
and puts <code>f</code> on the timer list again.
</p>
<div class=categorybox>
·
<p>@ref{Category: Debugging}
</div>
</p></dd></dl>
<p><a name="timer_005fdevalue"></a>
<a name="Item_003a-timer_005fdevalue"></a>
</p><dl>
<dt><u>Option variable:</u> <b>timer_devalue</b>
<a name="IDX1615"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>timer_devalue</code> is <code>true</code>, Maxima subtracts from each timed
function the time spent in other timed functions. Otherwise, the time reported
for each function includes the time spent in other functions.
Note that time spent in untimed functions is not subtracted from the
total time.
</p>
<p>See also <code>timer</code> and <code>timer_info</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Debugging} ·
@ref{Category: Global flags}
</div>
</p></dd></dl>
<p><a name="timer_005finfo"></a>
<a name="Item_003a-timer_005finfo"></a>
</p><dl>
<dt><u>Function:</u> <b>timer_info</b><i> (<var>f_1</var>, ..., <var>f_n</var>)</i>
<a name="IDX1616"></a>
</dt>
<dt><u>Function:</u> <b>timer_info</b><i> ()</i>
<a name="IDX1617"></a>
</dt>
<dd><p>Given functions <var>f_1</var>, ..., <var>f_n</var>, <code>timer_info</code> returns a matrix
containing timing information for each function.
With no arguments, <code>timer_info</code> returns timing information for
all functions currently on the timer list.
</p>
<p>The matrix returned by <code>timer_info</code> contains the function name,
time per function call, number of function calls, total time,
and <code>gctime</code>, which meant "garbage collection time" in the original Macsyma
but is now always zero.
</p>
<p>The data from which <code>timer_info</code> constructs its return value
can also be obtained by the <code>get</code> function:
</p>
<pre class="example">get(f, 'calls); get(f, 'runtime); get(f, 'gctime);
</pre>
<p>See also <code>timer</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Debugging}
</div>
</p></dd></dl>
<p><a name="trace"></a>
<a name="Item_003a-trace"></a>
</p><dl>
<dt><u>Function:</u> <b>trace</b><i> (<var>f_1</var>, …, <var>f_n</var>)</i>
<a name="IDX1618"></a>
</dt>
<dt><u>Function:</u> <b>trace</b><i> (all)</i>
<a name="IDX1619"></a>
</dt>
<dt><u>Function:</u> <b>trace</b><i> ()</i>
<a name="IDX1620"></a>
</dt>
<dd><p>Given functions <var>f_1</var>, …, <var>f_n</var>, <code>trace</code> instructs Maxima to
print out debugging information whenever those functions are called.
<code>trace(f)$ trace(g)$</code> puts <code>f</code> and then <code>g</code> onto the list of
functions to be traced; the list accumulates from one call to the next.
</p>
<p><code>trace(all)</code> puts all user-defined functions (as named by the global
variable <code>functions</code>) on the list of functions to be traced.
</p>
<p>With no arguments,
<code>trace</code> returns a list of all the functions currently being traced.
</p>
<p>The <code>untrace</code> function disables tracing.
See also <code>trace_options</code>.
</p>
<p><code>trace</code> quotes its arguments. Thus,
<code>f(x) := x^2$ g:f$ trace(g)$</code> does not put <code>f</code> on the trace list.
</p>
<p>When a function is redefined, it is removed from the timer list.
Thus after <code>timer(f)$ f(x) := x^2$</code>,
function <code>f</code> is no longer on the timer list.
</p>
<p>If <code>timer (f)</code> is in effect, then <code>trace (f)</code> has no effect;
<code>trace</code> and <code>timer</code> can't both be in effect for the same function.
</p>
<div class=categorybox>
·
<p>@ref{Category: Debugging}
</div>
</p></dd></dl>
<p><a name="trace_005foptions"></a>
<a name="Item_003a-trace_005foptions"></a>
</p><dl>
<dt><u>Function:</u> <b>trace_options</b><i> (<var>f</var>, <var>option_1</var>, …, <var>option_n</var>)</i>
<a name="IDX1621"></a>
</dt>
<dt><u>Function:</u> <b>trace_options</b><i> (<var>f</var>)</i>
<a name="IDX1622"></a>
</dt>
<dd><p>Sets the trace options for function <var>f</var>.
Any previous options are superseded.
<code>trace_options (<var>f</var>, ...)</code> has no effect unless <code>trace (<var>f</var>)</code>
is also called (either before or after <code>trace_options</code>).
</p>
<p><code>trace_options (<var>f</var>)</code> resets all options to their default values.
</p>
<p>The option keywords are:
</p>
<ul>
<li>
<code>noprint</code>
Do not print a message at function entry and exit.
</li><li>
<code>break</code>
Put a breakpoint before the function is entered,
and after the function is exited. See <code>break</code>.
</li><li>
<code>lisp_print</code>
Display arguments and return values as Lisp objects.
</li><li>
<code>info</code>
Print <code>-> true</code> at function entry and exit.
</li><li>
<code>errorcatch</code>
Catch errors, giving the option to signal an error,
retry the function call, or specify a return value.
</li></ul>
<p>Trace options are specified in two forms. The presence of the option
keyword alone puts the option into effect unconditionally.
(Note that option <var>foo</var> is not put into effect by specifying
<code><var>foo</var>: true</code> or a similar form; note also that keywords need not
be quoted.) Specifying the option keyword with a predicate
function makes the option conditional on the predicate.
</p>
<p>The argument list to the predicate function is always
<code>[level, direction, function, item]</code> where <code>level</code> is the recursion
level for the function, <code>direction</code> is either <code>enter</code> or <code>exit</code>,
<code>function</code> is the name of the function, and <code>item</code> is the argument
list (on entering) or the return value (on exiting).
</p>
<p>Here is an example of unconditional trace options:
</p>
<pre class="example">(%i1) ff(n) := if equal(n, 0) then 1 else n * ff(n - 1)$
(%i2) trace (ff)$
(%i3) trace_options (ff, lisp_print, break)$
(%i4) ff(3);
</pre>
<p>Here is the same function, with the <code>break</code> option conditional
on a predicate:
</p>
<pre class="example">(%i5) trace_options (ff, break(pp))$
(%i6) pp (level, direction, function, item) := block (print (item),
return (function = 'ff and level = 3 and direction = exit))$
(%i7) ff(6);
</pre>
<div class=categorybox>
·
<p>@ref{Category: Debugging}
</div>
</p></dd></dl>
<p><a name="untrace"></a>
<a name="Item_003a-untrace"></a>
</p><dl>
<dt><u>Function:</u> <b>untrace</b><i> (<var>f_1</var>, …, <var>f_n</var>)</i>
<a name="IDX1623"></a>
</dt>
<dt><u>Function:</u> <b>untrace</b><i> ()</i>
<a name="IDX1624"></a>
</dt>
<dd><p>Given functions <var>f_1</var>, …, <var>f_n</var>,
<code>untrace</code> disables tracing enabled by the <code>trace</code> function.
With no arguments, <code>untrace</code> disables tracing for all functions.
</p>
<p><code>untrace</code> returns a list of the functions for which
it disabled tracing.
</p>
<div class=categorybox>
·
<p>@ref{Category: Debugging}
</div>
</p></dd></dl>
<p><a name="Item_003a-asympa"></a>
</p><hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC205" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima_39.html#SEC209" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>root</em> on <em>January, 10 2014</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
</font>
<br>
</p>
</body>
</html>
|