HP IA-64 manual Resolving Ambiguous Symbols and Numbers, Internal Variables, Labels, Filenames

Page 57

Ski IA-64 Simulator Reference Manual 1.0L

assigns the value contained in the ip register to general register 31. (For a description of the = command, see Section 8.1, “Changing Registers and Memory with Assignment Commands”.) Wherever the simulator expects you to supply a numeric argument, you can use a register instead. You may only refer to currently-visible registers, according to the stack- ing and rotation mechanisms of the IA-64 architecture.

4.4.2.3Internal Variables

The simulator provides internal variables for you to use in command files (see Chapter 9, “Command Files”). These inter- nal variables are read-only; you cannot change their values. You can refer to an internal variable in any context where you could refer to an IA-64 register. Ski has four internal variables:

$cycles$

The total number of “virtual cycles” simulated. A virtual cycle is a cycle on a machine with an very large number of execution units and very fast memory; a real IA-64 processor may take more cycles. In a command file, you might use this variable to gather statistics about the efficiency of a particular compiler optimization algorithm. The value of $cycles$ is always equal to the value of $insts$ for IA-32 programs.

$exited$

The value 0 until the simulated program exits. Then the variable takes the value 1. In a command file, you would use $exited$ to detect a program termination. Program termination is defined for IA-64 application-mode programs as a call to the exit() function or the receipt of an unhandled signal. For IA-64 system-mode programs, normal termi- nation is defined to be a call to the Simulator System Call exit function or execution of BREAK 0 instruction. This variable is not supported for IA-32 programs in application-mode or system-mode. (See Section 6.1, “Application- Mode and System-Mode Simulation” for details on these modes.)

$heap$

This variable has meaning only for IA-64 programs running in application-mode, as described in Section 6.1, “Application-Mode and System-Mode Simulation”. $heap$ marks the address past the “far end” of the simulated heap, that is, the end farthest from the end of the data section. The heap starts at the first sixteen-byte-aligned address after the data section. Ski updates the $heap$ variable as the program being simulated malloc’s memory (for pro- grams written in C; adapt accordingly for other programming languages). You can use the $heap$ variable to debug wild pointer problems: if your program has a pointer that allegedly points to a malloc’ed data structure, but the pointer value exceeds $heap$, the pointer is invalid. For system-mode programs and IA-32 programs, this variable is meaningless, as there is no malloc support.

$insts$

The number of instructions that have been simulated so far (including any faulting instructions, for programs run- ning in system-mode, described in Section 6.1, “Application-Mode and System-Mode Simulation”). In a command file, you might use this variable to stop simulation after a certain number of instructions. The value of $insts$ is always equal to the value of $cycles$ for IA-32 programs.

4.4.2.4Labels

Labels (see Section 9.2, “Labels and Control Flow in Command Files”) are names which consist of an alpha (upper or lower case alphabetic, $, or _), followed by a sequence of alphas or digits (e.g., abc123, $foo_bar, etc.) and ending with a colon (“ :”). They may be up to 132 characters long. Labels are used in command files as targets of the goto command.

4.4.2.5Filenames

Filenames are subject to the restrictions of the underlying Linux operating system. Ski performs tilde (“ ~”) expansion: if you provide a pathname whose first word starts with a tilde, Ski assumes the word is a username and tries to replace it (and the tilde) with the user’s home directory. For example, “ ~david/hello” might be expanded to “ /home/david/ hello”.

4.4.3Resolving Ambiguous Symbols and Numbers

Some character sequences can be interpreted in more than one way. For example, the character sequence “b3” can be interpreted as a branch register, a program-defined symbol, or a hexadecimal number. To resolve the ambiguity, Ski looks

Copyright © 2000 Hewlett-Packard Co.

Command Language 4-5

Image 57
Contents Copyright 2000 Hewlett-Packard Co Ski IA-64 Simulator Reference ManualTrademarks Printing HistoryPreface How to Use This ManualFont Conventions Syntax ConventionsItalic+ Table of Contents Ski IA-64 Simulator Reference Manual Vii Ski IA-64 Simulator Reference Manual Viii Table of Contents List of Figures Ski IA-64 Simulator Reference Manual 1.0L List of Tables Ski IA-64 Simulator Reference Manual 1.0L Xii List of Tables Getting Started a Ski Tutorial How to Run an IA-64 Application ProgramSki Simulator Starting xskiStarting xski From the Command Line Loading Your Program Exiting SkiLoading the hello Program Xski Data Window Inspecting DataChanging the Data Window Display Data Window Showing argv and envp Strings in Hexadecimal Looking at Code Viewing Data in Ascii12. Jumping the Program Window to the Beginning of main Viewing Source Code Mixed In with Assembly Code14. The Program Window Showing a Breakpoint at main Controlling Breakpoints15. The Breakpoint List Window Running a Program16. The Terminal Window After the hello Program is Run Single-stepping a Program18. The Main Window After Reaching the Breakpoint at main+10 Changing Registers and MemorySki IA-64 Simulator Reference Manual 1.0L 20. The xski Register Window After Changing the ip Register 21. The xski Data Window Widened to Show Ascii Next Steps Getting HelpCopyright 2000 Hewlett-Packard Co Introduction OverviewWhat You Need to Know to Use This Manual Defects and Defect ReportingSki Variations Using bski for Batch SimulationsX Window System, Motif-based xski Interface Starting Ski Command Line Flags1.1 Summary of Flags XSki FileSummary of the Quit Command Quitting SkiQuit expression Screen Presentation Ski’s Use of WindowsRegister Window Register Window in xski User Registers PaneFloating Point Registers Pane General Registers PaneIA-32 Registers Pane System Registers PaneRegister Window and ski Resizing Register Window Panes with xski1 IA-64 Instruction Display Program WindowSki IA-64 Simulator Reference Manual 1.0L 2 IA-32 Instruction Display Invalid Code and the Program Window Changing the Range of Locations Shown in the Program Window12. xski’s Program Window Showing Illegal Instructions Data WindowChanging the Range of Locations Shown in the Data Window Command/Main Window Invalid Code and the Data WindowXski Main Window 16. xski’s Main Command Window Ski Command WindowOther Windows 17. ski’s Command Window at Bottom18. xski’s Symbol List Window Copyright 2000 Hewlett-Packard Co Command Entry Command LanguageCommand Arguments Command Sequences, Repetition, and AbbreviationNumeric Arguments Argument SpecificationNumbers and Counts ExpressionsXski Evaluating Expressions Ski Simulator Arithmetic and Logic OperatorsSymbolic Arguments Program-Defined SymbolsAddresses Internal Variables Resolving Ambiguous Symbols and NumbersLabels FilenamesSki IA-64 Simulator Reference Manual 1.0L Register Window Commands Screen Manipulation CommandsSummary of Register Window Commands Xski Register Window CommandsSummary of Program Window Commands Program Window CommandsXski’s Program Window Showing IA-64 Assembly Language Code Pd startingaddress endingaddress filename Xski’s Assembly Language Dump WindowSummary of Data Window Commands Data Window CommandsDj address Df countDd startingaddress endingaddress filename Xski Showing Data in Raw Hexadecimal and AsciiApplication-Mode and System-Mode Simulation Program SimulationSki Support for Application-Mode Programs Ski Support for System-Mode ProgramsSystem-Mode IA-64 Programs Summary of TLB Display CommandsSystem-Mode IA-32 Programs System-Mode TLB SimulationMisaligned Data Access Trap How to Load a ProgramProgram Loading Load filename args+ Summary of Program Loading CommandsAdding Information after Loading Creating the argc, argv, and envp ParametersProgram Execution Summary of Program Execution CommandsSki IA-64 Simulator Reference Manual 1.0L Program Simulation Linux and MS-DOS ABI Emulation InterruptionsLinux Application Environment Linux System Calls Accepted but Ignored by Ski Linux System Calls Supported by SkiMS-DOS Application Environment Program I/OMS-DOS System Calls in Hexadecimal Supported by Ski Copyright 2000 Hewlett-Packard Co Summary of Assignment Commands Changing Registers and Memory with Assignment CommandsExamples of Assignment Commands DebuggingOriginal Program Loaded in ski Allocation Bit-encoded RegistersSetting Program Breakpoints Summary of The eval CommandEvaluating Formulas and Formatting Data Program BreakpointsListing Program Breakpoints Deleting Program BreakpointsSummary of Program Breakpoint Commands Unexpected BreakpointsBs address Summary of Data Breakpoint Commands Setting Data BreakpointsData Breakpoints Deleting Data BreakpointsSummary of Save and Restore Commands Symbol Table CommandsSummary of Symbol Commands Dumping Registers and Memory to a FileIsyms filename Symlist Output from xskiSki IA-64 Simulator Reference Manual 1.0L Debugging Labels and Control Flow in Command Files Command FilesGoto Command and Labels Initialization FileComments in Command Files An Example Command FileIf Command filename Summary of Command File Commands# comment LabelSki IA-64 Simulator Reference Manual 1.0L Command Files =s address stringwithoutspaces Command ReferenceDbd breakpointnumber Dbs address length rwrwEval expressionwithoutspaces+ Help commandnameRest filename Quit returnvalueforshellStep until expressionwithoutspaces Ski IA-64 Simulator Reference Manual 1.0L IA-64 Registers Register NamesRegister Names Copyright 2000 Hewlett-Packard Co Register Names B-3 Ski IA-64 Simulator Reference Manual 1.0L Copyright 2000 Hewlett-Packard Co Register Names B-5 Ski IA-64 Simulator Reference Manual 1.0L Register Names Internal Variables Internal Variable NamesCopyright 2000 Hewlett-Packard Co All breakpoints deleted Simulator Status and Error MessagesSimulator Status and Error Messages Expression Help Unknown command %s Missing ELF header Not an IA-64 file Stopping at %s due to unimplemented instruction Usage %s options file args