watch Command | Command-line Debugging for UDFs | Teradata Vantage - 17.10 - watch - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
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.

Syntax

watch[/modelocation

Syntax Elements

mode
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.
location
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
>end
(gdb)