HP Ski Simulator, IA-64 manual Original Program Loaded in ski

Page 76

Ski IA-64 Simulator Reference Manual 1.0L

The hexadecimal value 0x1234 is assigned to general register 1. The six upper (more significant) bytes are padded with zeroes.

= r1 ip+10

The value in ip added to 0x10 is assigned to general register 1.

= f2.m 1234 ; = f2.s 1 ; = f2.e 10033

The hexadecimal value 0x300330000000000001234 is assigned to floating register 2. The register now encodes the decimal value of -2.2754, approximately. The “ = f2.m 1234” part sets the mantissa (the 64 low-order bits). The “ = f2.s 1” part encodes the mantissa sign (the most significant of the 82 bits). The “ = f2.e 10033” encodes the 17 exponent bits (which fit between the sign bit and mantissa bits), using a bias of 65,535 (0xffff).

=4 __data_start+30 0d10 13feffff b3

The decimal value 10 is assigned to the four bytes starting 48 bytes past the location of the symbol “ __data_start”. Because the value 10 occupies only one byte, three high-order zero bytes will be padded in, so the actual value assigned will be 0x0000000a. The value 13feffff is assigned to the four bytes starting 52 bytes past the location of __data_start. The lower four bytes of branch register 3 will be copied into the four bytes starting 56 bytes past the location of __data_start. (To assign the value 0xb3, use the 0x prefix.)

=s main ThisProgramIsBroken

The string “ ThisProgramIsBroken” with a null byte appended is placed in memory overwriting the instructions at the start of the program, as shown in the “before” and “after” views of Figure 8-1and Figure 8-2.(The symbol “ main” tradi- tionally marks the first instruction of a user program written in the C language.) The instructions previously at that loca- tion are lost. If you attempt to run the program, it will almost certainly fail! Note that the string is not quoted and has no whitespace.

Figure 8-1. The Original Program Loaded in ski

8-2

Debugging

Copyright © 2000 Hewlett-Packard Co.

Image 76
Contents Ski IA-64 Simulator Reference Manual Copyright 2000 Hewlett-Packard CoPrinting History TrademarksHow to Use This Manual PrefaceFont 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 How to Run an IA-64 Application Program Getting Started a Ski TutorialSki Simulator Starting xskiStarting xski From the Command Line Exiting Ski Loading Your ProgramLoading the hello Program Inspecting Data Xski Data WindowChanging the Data Window Display Data Window Showing argv and envp Strings in Hexadecimal Viewing Data in Ascii Looking at CodeViewing Source Code Mixed In with Assembly Code 12. Jumping the Program Window to the Beginning of mainControlling Breakpoints 14. The Program Window Showing a Breakpoint at mainRunning a Program 15. The Breakpoint List WindowSingle-stepping a Program 16. The Terminal Window After the hello Program is RunChanging Registers and Memory 18. The Main Window After Reaching the Breakpoint at main+10Ski 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 Getting Help Next StepsCopyright 2000 Hewlett-Packard Co Overview IntroductionWhat You Need to Know to Use This Manual Defects and Defect ReportingUsing bski for Batch Simulations Ski VariationsX Window System, Motif-based xski Interface Command Line Flags Starting SkiXSki File 1.1 Summary of FlagsQuitting Ski Summary of the Quit CommandQuit expression Ski’s Use of Windows Screen PresentationRegister Window User Registers Pane Register Window in xskiGeneral Registers Pane Floating Point Registers PaneSystem Registers Pane IA-32 Registers PaneResizing Register Window Panes with xski Register Window and skiProgram Window 1 IA-64 Instruction DisplaySki IA-64 Simulator Reference Manual 1.0L 2 IA-32 Instruction Display Changing the Range of Locations Shown in the Program Window Invalid Code and the Program WindowData Window 12. xski’s Program Window Showing Illegal InstructionsChanging the Range of Locations Shown in the Data Window Invalid Code and the Data Window Command/Main WindowXski Main Window Ski Command Window 16. xski’s Main Command Window17. ski’s Command Window at Bottom Other Windows18. xski’s Symbol List Window Copyright 2000 Hewlett-Packard Co Command Language Command EntryCommand Arguments Command Sequences, Repetition, and AbbreviationArgument Specification Numeric ArgumentsNumbers and Counts ExpressionsSki Simulator Arithmetic and Logic Operators Xski Evaluating ExpressionsProgram-Defined Symbols Symbolic ArgumentsAddresses Resolving Ambiguous Symbols and Numbers Internal VariablesLabels FilenamesSki IA-64 Simulator Reference Manual 1.0L Screen Manipulation Commands Register Window CommandsSummary of Register Window Commands Xski Register Window CommandsProgram Window Commands Summary of Program Window CommandsXski’s Program Window Showing IA-64 Assembly Language Code Xski’s Assembly Language Dump Window Pd startingaddress endingaddress filenameData Window Commands Summary of Data Window CommandsDj address Df countXski Showing Data in Raw Hexadecimal and Ascii Dd startingaddress endingaddress filenameProgram Simulation Application-Mode and System-Mode SimulationSki Support for Application-Mode Programs Ski Support for System-Mode ProgramsSummary of TLB Display Commands System-Mode IA-64 ProgramsSystem-Mode IA-32 Programs System-Mode TLB SimulationHow to Load a Program Misaligned Data Access TrapProgram Loading Summary of Program Loading Commands Load filename args+Adding Information after Loading Creating the argc, argv, and envp ParametersSummary of Program Execution Commands Program ExecutionSki IA-64 Simulator Reference Manual 1.0L Program Simulation Interruptions Linux and MS-DOS ABI EmulationLinux Application Environment Linux System Calls Supported by Ski Linux System Calls Accepted but Ignored by SkiProgram I/O MS-DOS Application EnvironmentMS-DOS System Calls in Hexadecimal Supported by Ski Copyright 2000 Hewlett-Packard Co Changing Registers and Memory with Assignment Commands Summary of Assignment CommandsExamples of Assignment Commands DebuggingOriginal Program Loaded in ski Bit-encoded Registers AllocationSummary of The eval Command Setting Program BreakpointsEvaluating Formulas and Formatting Data Program BreakpointsDeleting Program Breakpoints Listing Program BreakpointsUnexpected Breakpoints Summary of Program Breakpoint CommandsBs address Setting Data Breakpoints Summary of Data Breakpoint CommandsData Breakpoints Deleting Data BreakpointsSymbol Table Commands Summary of Save and Restore CommandsSummary of Symbol Commands Dumping Registers and Memory to a FileSymlist Output from xski Isyms filenameSki IA-64 Simulator Reference Manual 1.0L Debugging Command Files Labels and Control Flow in Command FilesGoto Command and Labels Initialization FileAn Example Command File Comments in Command FilesIf Command Summary of Command File Commands filename# comment LabelSki IA-64 Simulator Reference Manual 1.0L Command Files Command Reference =s address stringwithoutspacesDbs address length rwrw Dbd breakpointnumberHelp commandname Eval expressionwithoutspaces+Quit returnvalueforshell Rest filenameStep until expressionwithoutspaces Ski IA-64 Simulator Reference Manual 1.0L Register Names IA-64 RegistersRegister 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 Variable Names Internal VariablesCopyright 2000 Hewlett-Packard Co Simulator Status and Error Messages All breakpoints deletedSimulator 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