Ski IA-64 Simulator Reference Manual 1.0L

9

Command Files

 

 

 

 

The dot (“ .”) command temporarily redirects command input to the simulator so that input is taken from the file provided as an argument to the command. Into this file (a “command file”), you put commands as if you had typed them from the keyboard. Several commands are specifically applicable to command files and are described below. Command files may be nested; i.e., one command file may invoke another. The maximum nesting depth is operating-system-dependent.

Some syntax rules that apply to keyboard input don’t make sense or would be cumbersome in command files. Most nota- bly, in ski, a shortcut for re-executing the previous command is to hit the enter/return key on an empty line. This rule is removed in command files, so you are free to put in blank lines for readability. You can also indent lines as necessary.

The ability to assign values to registers and memory and the flow control features provide the simulator with a powerful Church-Turing-complete command language; i.e., tasks which can be accomplished in any programming language, sub- ject to memory constraints, can be accomplished in the command language of the simulator. Command files are particu- larly appropriate for initializing the state of the simulator and for implementing complex facilities on top of Ski’s native commands. For example, you can write command files to setup the machine state just before an I/O interrupt, to create sophisticated breakpointing, and to take complex performance measurements.

9.1Initialization File

If you start Ski with a -ioption followed by a filename, the named file will be executed as a command file before the first prompt (see Section 2.5.1, “Command Line Flags”). This feature is particularly important for bski, because without a command file to guide it, bski will only run your program and then quit. If you want to do anything else, you need a command file. When you combine the -ioption with Ski’s ability to load a program on the command line, you can create a powerful debugging environment. For example, this command line:

bski -i test.init -stats -icnt instruction_counts

combined with this test.init command file:

load ia_test 0x26c50

romload test.com etext test.map

uses the command file test.init to load an IA-64 Platform Support File named ia_test (filling in Ski’s symbol table for program-defined symbols), and then loads the IA-32 system-mode program test.com, putting it at the location corre- sponding to the symbol “ etext” in ia_test. The command file finishes and bski automatically executes a run com- mand followed by a quit command. To start the run, the ia_test program receives 0x26c50 as its argv[1] value. This corresponds to the value of the symbol “ etext” and tells ia_test where test.com was loaded. The IA-64 program completes its initialization and transfers control to the IA-32 program, setting the psr.is bit appropriately. When the IA-32 program completes, bski prints out end-of-run performance statistics and writes an instruction frequency count to the file

instruction_counts.

9.2Labels and Control Flow in Command Files

Command files are useful as macro sequences of simple commands and, more interestingly, to create small programs that do useful things for you: create formatted displays of data structures, create complete breakpoints, and gather run-time statistics, for example. Two commands provide the ability to change the flow of control in a command file: goto and if.

9.2.1The goto Command and Labels

A label identifies a particular line in a command file. Labels are defined in Section 4.4.2.4, “Labels”. No other text can appear on a label line.

The goto command takes a label as an argument and searches the command file for a line with that label. Execution resumes at the first command after the label. There is no good reason to have a label appear more than once in a particular command file; if this condition occurs, only the first occurrence of the label will be noticed and all subsequent occurrences will be ignored. The goto command can only be executed in a command file. A goto may go forward or backward. An

Copyright © 2000 Hewlett-Packard Co.

Command Files 9-1

Page 85
Image 85
HP IA-64, Ski Simulator manual Initialization File, Labels and Control Flow in Command Files, Goto Command and Labels