Setting watch and unwatch

We can add a watchpoint for a variable or a field so that whenever its value changes, the debugger stops. Each watch item is assigned a number that can be used to delete it from the watch list, using the unwatch command:

  • watch var: Sets watchpoint for variable var
  • unwatch [n]: Unsets the watchpoint specified with number n

Let's set the watchpoint for the variable result in our program calc.awk, which is being debugged, as follows:

gawk> watch result
Watchpoint 4: result

Here, we have set the watchpoint for the variable result, so during execution, whenever its value changes, the debugger will give a notification and stop there.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.17.40