16.20 - watch - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Advanced SQL Engine
Teradata Database
Release Number
Release Date
April 2020
Content Type
Programming Reference
Publication ID
English (United States)


This command replaces the standard GDB watch command, which is not suitable for multi-threaded, multi-process, distributed execution. A thread can have up to four watched addresses. Defining a watchpoint uses the next available of the four watch slots. This command directly allocates a hardware debug register for the current thread such that when the condition occurs on the specified address, the thread will stop.

This applies on a per-thread basis. Watchpoints are implicitly removed when the UDF for which they are set exits. They must be reestablished for each UDF, even if it runs on a thread that also ran a previous UDF.


Specifies the kind of memory access to watch for:
  • d deletes a watchpoint
  • r memory read access
  • w memory write access
  • x instruction execute access
The number of bytes to watch defaults to the size of the location specified, but that can be overridden by preceding the mode letter with 1, 2, 4, or 8. Those are the only sizes that can be watched.
A mode of ‘d’ deletes a previously specified watchpoint. Instead of a location to watch, this must be followed by a watchpoint number (0, 1, 2 or 3).
Although hardware execution watchpoints are supported, they are rarely used because normal GDB breakpoints are generally more effective.
An expression that evaluates to the address of the location that is to be monitored.

Usage Notes

You can make watchpoints apply to every UDF with a breakpoint set on entry to the function. This sets the desired watchpoint and continues:

(gdb) break funcname
Breakpoint 1 at ...
(gdb) command 1
> silent
> watch location/w
> continue