Copyright (C) 2000-2012 |
GNU Info (emacs-lisp-intro.info)Debugging ExercisesDebugging Exercises =================== * Install the `count-words-region' function and then cause it to enter the built-in debugger when you call it. Run the command on a region containing two words. You will need to press `d' a remarkable number of times. On your system, is a `hook' called after the command finishes? (For information on hooks, see Note: Command Loop Overview.) * Copy `count-words-region' into the `*scratch*' buffer, instrument the function for Edebug, and walk through its execution. The function does not need to have a bug, although you can introduce one if you wish. If the function lacks a bug, the walk-through completes without problems. * While running Edebug, type `?' to see a list of all the Edebug commands. (The `global-edebug-prefix' is usually `C-x X', i.e. `<CTL>-x' followed by an upper case `X'; use this prefix for commands made outside of the Edebug debugging buffer.) * In the Edebug debugging buffer, use the `p' (`edebug-bounce-point') command to see where in the region the `count-words-region' is working. * Move point to some spot further down function and then type the `h' (`edebug-goto-here') command to jump to that location. * Use the `t' (`edebug-trace-mode') command to cause Edebug to walk through the function on its own; use an upper case `T' for `edebug-Trace-fast-mode'. * Set a breakpoint, then run Edebug in Trace mode until it reaches the stopping point. automatically generated by info2www version 1.2.2.9 |