maxima debug feature? - or how to accomplish same



 On 10/10/10 5:56 AM, Max B wrote:
>
> Hi,
>
> Thanks for Maxima - it is a great tool!  :)
Glad it's working out for you!
>
> I am curious about how it operates; function call tree etc.  For
> example: identify the functions that are called when the user inputs
> '2+2;', or 'collectterms(expand(sbs));'.  Unfortunately, maxima is
> written in lisp and I can't seem to debug it.   Tools with which I am
> familiar include gdb, the printf function, and the cpp macros __LINE__
> etc.
>
To debug a language, you need to know a little about the language.  You
can google for lisp tutorials, or look for the online book "Practical
Common Lisp".  That, however, only gets you part way to debugging maxima.

First, the easy part.  If you already know what function you want to
debug, you can insert things like

(format t "Here in routine x~%")

Then you can do :lisp (load "path/to/file/just/modified") to get your
changes loaded.  (No need to recompile all of maxima to get this.)

Figuring out what function you want to look at is much harder. 
Sometimes, like expand, you can grep for $expand in the sources.  For
others you have to know how simplification is done.  So for a+b, you
need to find simplus.  I think it might be easiest for everyone if you
asked specific questions.
>
> Is there a not-for-public-release 'debug' version of the source code
> with this type of code present? 
I'm not aware of any such thing.  Some code, though, has debugging
support already which can be enabled by setting some internal flag. 
Then the routines will print out information as the algorithm
progresses.  But most of the code base doesn't have anything like that.

Ray