HP IA-64, Ski Simulator manual Debugging, Changing Registers and Memory with Assignment Commands

Page 75

Ski IA-64 Simulator Reference Manual 1.0L

8

Debugging

 

 

 

 

The simulator provides many facilities to help you debug your programs. You can modify the current state of the simu- lated processor, set program breakpoints, trace program execution, and dump a memory image into a file.

8.1Changing Registers and Memory with Assignment Commands

Use the = command to assign a value to a register. The = command takes two arguments: the first is the name of a register and the second is the value to be assigned.

To change the contents of memory, you use one of five different commands, depending on whether you want to set a byte, two bytes, four bytes, eight bytes, or a C-language string (a sequence of bytes terminated by a byte with the value zero, the “null” byte). The commands are =1, =2, =4, =8, and =s respectively. Each command takes at least two arguments (some take more): an address or symbol or expression resolving to an address, and the new value you want placed there.

8.1.1Summary of Assignment Commands

=register_name value

The value is assigned to the register specified by register_name. The old value is lost. Unless a modifying prefix such as 0d, 0b, or 0o is used, value will be treated as a hexadecimal number. Floating point registers must be set piecewise, using the register name (f2 through f127) followed by a .s to set the sign, .m to set the mantissa, or .e to set the exponent. The first general register, r0, is “hardwired” to 0 and any attempt to assign to it will be rejected. Similarly, floating registers f0 and f1 are “hardwired” to be 0.0 and 1.0, respectively, and predicate register p0 is “hardwired” to 1 and they too cannot be changed. Some IA-64 registers are read-only according to the IA-64 architecture specification, but all non-hardwired reg- isters are writable with Ski’s = command to assist your debugging.

=1 address value+

=2 address value+

=4 address value+

=8 address value+

The value is assigned to the specified location in memory. The old value at the location is lost. The location may be on any allocated page, including instruction pages, as discussed in Section 8.1.3.3, “Page Allocation”. Multiple values, separated by spaces, may be supplied; if so, they will be assigned to sequential memory addresses. Unless a modifying prefix such as 0d, 0b, or 0o is used, value will be treated as a hexadecimal number.

The =1 command truncates any extra high-order bytes of the value to make a single byte. The =2 command truncates or pads (with zero) the high order bytes of the value as necessary to make a two-byte quantity. Similarly, the =4 and =8 commands truncate or pad high order bytes to make four- and eight-byte quantities, respectively.

The =2, =4, and =8 commands respect the current value of the psr.be bit, which controls whether multi-byte data memory references are big-endian (if the bit is set) or little-endian (if the bit is clear). The bit also controls the format of data display in the Data Window (see Section 3.6, “The Data Window”). You can set the psr.be bit with the command “ = psr.be 1” and you can clear it with “ = psr.be 0”.

Ski supports physical and virtual addressing. For more information, see Section 4.4.1.3, “Addresses”.

=s address string_without_spaces+

The string_without_spaces is assigned to memory locations starting at the location specified by address. A null byte is added to the end of the string automatically. The old value at the location is lost. The location may be on any allocated page, including instruction pages, as discussed in Section 8.1.3.3, “Page Allocation”. Multiple values may be supplied, separated by a space. The strings may not contain spaces and quoting it is not a workaround.

8.1.2Examples of Assignment Commands

= r1 1234

Copyright © 2000 Hewlett-Packard Co.

Debugging

8-1

Image 75
Contents Copyright 2000 Hewlett-Packard Co Ski IA-64 Simulator Reference ManualTrademarks Printing HistorySyntax Conventions How to Use This ManualPreface Font 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 Starting xski How to Run an IA-64 Application ProgramGetting Started a Ski Tutorial Ski SimulatorStarting 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 Defects and Defect Reporting OverviewIntroduction What You Need to Know to Use This ManualSki 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 Sequences, Repetition, and Abbreviation Command LanguageCommand Entry Command ArgumentsExpressions Argument SpecificationNumeric Arguments Numbers and CountsXski Evaluating Expressions Ski Simulator Arithmetic and Logic OperatorsSymbolic Arguments Program-Defined SymbolsAddresses Filenames Resolving Ambiguous Symbols and NumbersInternal Variables LabelsSki IA-64 Simulator Reference Manual 1.0L Xski Register Window Commands Screen Manipulation CommandsRegister Window Commands Summary of 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 WindowDf count Data Window CommandsSummary of Data Window Commands Dj addressDd startingaddress endingaddress filename Xski Showing Data in Raw Hexadecimal and AsciiSki Support for System-Mode Programs Program SimulationApplication-Mode and System-Mode Simulation Ski Support for Application-Mode ProgramsSystem-Mode TLB Simulation Summary of TLB Display CommandsSystem-Mode IA-64 Programs System-Mode IA-32 ProgramsMisaligned Data Access Trap How to Load a ProgramProgram Loading Creating the argc, argv, and envp Parameters Summary of Program Loading CommandsLoad filename args+ Adding Information after LoadingProgram 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 Debugging Changing Registers and Memory with Assignment CommandsSummary of Assignment Commands Examples of Assignment CommandsOriginal Program Loaded in ski Allocation Bit-encoded RegistersProgram Breakpoints Summary of The eval CommandSetting Program Breakpoints Evaluating Formulas and Formatting DataListing Program Breakpoints Deleting Program BreakpointsSummary of Program Breakpoint Commands Unexpected BreakpointsBs address Deleting Data Breakpoints Setting Data BreakpointsSummary of Data Breakpoint Commands Data BreakpointsDumping Registers and Memory to a File Symbol Table CommandsSummary of Save and Restore Commands Summary of Symbol CommandsIsyms filename Symlist Output from xskiSki IA-64 Simulator Reference Manual 1.0L Debugging Initialization File Command FilesLabels and Control Flow in Command Files Goto Command and LabelsComments in Command Files An Example Command FileIf Command Label Summary of Command File Commandsfilename # commentSki 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