Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


6.2.4 Setting a breakpoint (break command)

The break command sets a breakpoint. The abbreviation for the break command is b.

Numbers are assigned sequentially to the breakpoints as they are set, beginning with 1. Watchpoints that are set are numbered in the same sequence (that is, point number n could be a breakpoint or a watchpoint). When a running job definition script reaches a breakpoint, the command displays information about the breakpoint at the stop location. The following shows the format of the break command:

Specifying a line number
break[ [job-definition-script-file-name:]line-number]

When a line number is specified in the argument, the break command sets a breakpoint at the specified line.

Specifying a function name
break function-name

When a function name is specified in the argument, the break command sets a breakpoint at the specified function.

Specifying a job step name
break -s [job-definition-script-file-name:]job-step-name

When a job step name is specified in the -s option, the command sets a breakpoint at the line on which the specified job step name is defined.

By using a colon (:) in the argument, you can specify a job definition script file name for setting a breakpoint. If you specify a function name, there is no need to specify a file name because only one function that is enabled at that point becomes the target.

The following describes the break command's processing.

When the break command argument is omitted

The command sets a breakpoint at the line at which execution is currently stopped. If the job definition script is not running, the command sets a breakpoint at the first line after line 1 at which execution can stop. The command displays information about the set breakpoint.

When the break command argument is specified

The command processing depends on the specification of the argument. The following provides the details.

  • line-number

    The command sets a breakpoint at the line specified in the argument. The command displays information about the set breakpoint. If the specified line does not exist, an error results.

  • function-name

    The command sets a breakpoint at the function specified in the argument. The command displays information about the set breakpoint. The location of the breakpoint is the first line in the function definition at which execution can stop. If the specified function does not exist, an error results.

  • -s job-step-name

    The command sets a breakpoint at the job step specified in the argument. The command displays information about the set breakpoint. If the specified job step does not exist, an error results.

  • job-definition-script-file-name

    The file name you specify must be the name of a file specified in the command used to execute the batch job or of a file specified in the #-adsh_script extended script command. The command treats the specified file as the target for setting a breakpoint. If no file name is specified, the command assumes that the current file is the target for setting a breakpoint.

Notes:
  • The character string up to the last colon (:) is treated as a job definition script file name.

  • A line number must be specified as 0 or a greater integer. Do not specify a plus sign (+) at the beginning.

  • If the specified line number is outside the permitted range for the int type, the command rounds it to the maximum value for the int type.

  • If there are multiple job steps with the same name, the command sets a breakpoint at all those job steps.

  • The total number of breakpoints and watchpoints combined cannot exceed 999. If this limit has been reached and you want to set a new breakpoint or watchpoint, terminate and restart the debugger. Once the maximum value has been reached, no new breakpoint or watchpoint can be set even if you use the delete command to delete existing breakpoints or watchpoints.

  • You can set a breakpoint at any line that contains at least one command at which execution can stop. If a line contains multiple commands at which execution can stop, execution stops for each command (before each command is executed).

  • If the line specified by its line number contains only commands at which execution cannot be stopped, the break command outputs a warning message and sets a breakpoint at the next line that contains a command at which execution can stop.

    If there is no such line at which execution can stop, the command outputs an error message.

  • If a function name is specified but the specified function contains no command at which execution can stop, the command sets a breakpoint at the first line following the end of the function definition at which execution can stop. If the line containing the function definition also contains a command at which execution can stop, the break command sets a breakpoint at the line containing the function definition, regardless of whether that command is inside the function.

  • If an extended script command defining a job step consists of multiple lines and the job step name is specified for setting a breakpoint, the break command sets a breakpoint at the line number where the first extended script command is specified.

  • You can set a breakpoint in an external script only if the external script is specified in the #-adsh_script extended script command in the job definition script that calls the external script. Execution cannot be stopped within an external script that is not specified in #-adsh_script.

  • Only one breakpoint can be set on any one line. Once a breakpoint is set, no more breakpoints can be set on the same line.

  • If the job definition script that is under debug execution is in one of the following statuses, do not execute the break command without an argument specified:

    [Figure] Execution is stopped at the end of the job definition script (EOF)

    [Figure] Execution is stopped while action of the trap command is executing

Example

This example sets a breakpoint on line 8 in the job definition script and then executes the job definition script. Execution stops before funcA on line 8 is executed.

1: funcA(){
2:   echo "funcA"
3:   num=10
4: }
5:
6: val=1
7: num=2
8: funcA
9: echo $num
 
KNAX7018-I Breakpoint "1": filename="test.ash" line=8
(adshdb) run
KNAX7007-I Execution of the following script will now start: /home/test/test.ash
...
KNAX7018-I Breakpoint "1": filename="test.ash" line=8
KNAX7032-I The script "test.ash" stopped running.
8: funcA
Current: funcA
(adshdb)