manpagez: man pages & more
info gawk
Home | html | info | man

File: gawk.info,  Node: Debugging Terms,  Next: Debugging.php">Awk Debugging,  Prev: Debugging_Concepts.php">Debugging Concepts,  Up: Debugging

14.1.2 Debugging Concepts
-------------------------

Before diving in to the details, we need to introduce several important
concepts that apply to just about all debuggers.  The following list
defines terms used throughout the rest of this major node:

"Stack frame"
     Programs generally call functions during the course of their
     execution.  One function can call another, or a function can call
     itself (recursion).  You can view the chain of called functions
     (main program calls A, which calls B, which calls C), as a stack of
     executing functions: the currently running function is the topmost
     one on the stack, and when it finishes (returns), the next one down
     then becomes the active function.  Such a stack is termed a "call
     stack".

     For each function on the call stack, the system maintains a data
     area that contains the function's parameters, local variables, and
     return value, as well as any other "bookkeeping" information needed
     to manage the call stack.  This data area is termed a "stack
     frame".

     'gawk' also follows this model, and gives you access to the call
     stack and to each stack frame.  You can see the call stack, as well
     as from where each function on the stack was invoked.  Commands
     that print the call stack print information about each stack frame
     (as detailed later on).

"Breakpoint"
     During debugging, you often wish to let the program run until it
     reaches a certain point, and then continue execution from there one
     statement (or instruction) at a time.  The way to do this is to set
     a "breakpoint" within the program.  A breakpoint is where the
     execution of the program should break off (stop), so that you can
     take over control of the program's execution.  You can add and
     remove as many breakpoints as you like.

"Watchpoint"
     A watchpoint is similar to a breakpoint.  The difference is that
     breakpoints are oriented around the code: stop when a certain point
     in the code is reached.  A watchpoint, however, specifies that
     program execution should stop when a _data value_ is changed.  This
     is useful, as sometimes it happens that a variable receives an
     erroneous value, and it's hard to track down where this happens
     just by looking at the code.  By using a watchpoint, you can stop
     whenever a variable is assigned to, and usually find the errant
     code quite quickly.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.