HP Ski Simulator Dumping Registers and Memory to a File, Saving and Restoring the Simulator State

Page 82

Ski IA-64 Simulator Reference Manual 1.0L

8.5Dumping Registers and Memory to a File

You can dump the registers to a file with the “ rd” command, described in Section 5.1, “Register Window Commands”. You can dump a block of memory into a file in two forms: in hexadecimal or in symbolic disassembled form, correspond- ing (roughly) to the formats in the Data Window and the Program Window, respectively. The commands to do this are

dd” and “ pd” and are described in Section 5.3.1, “Summary of Data Window Commands” and Section 5.2.1, “Summary of Program Window Commands”, respectively.

8.6Saving and Restoring the Simulator State

You may need to interrupt a simulation session and continue it later. For example, you might be tracking down a difficult bug and want to save the state of the simulator just before the bug occurs so you can replay the problem and try different strategies. The save command saves the state of the currently executing program to a named disk file. Later, you restore the saved file with the rest command or the -restcommand line flag (described in Section 2.5.1, “Command Line Flags”).

The save command saves the state of the simulated IA-64 processor, including the overlaid IA-32 registers, the symbol table for program-defined symbols, and memory. Certain simulator state information, in particular the values of internal variables and window-related information, is not saved. Linux and MS-DOS state information such as open file handles and fseek pointers is not currently saved; this will probably change, so you should check the release notes.

8.6.1Summary of Save and Restore Commands

save filename

Saves an image of the machine state (IA-64 and IA-32) in the specified file. rest filename

Restores an image of the machine state (IA-64 and IA-32) from the specified file.

8.7Symbol Table Commands

Ski supports two kinds of symbols: program-defined symbols, which are identifiers provided by a compiler, linker, or human programmer (see Section 4.4.2.1, “Program-Defined Symbols”), and internal symbols, which include register names and internal variables (see Section 4.4.2.2, “Registers” and Section 4.4.2.3, “Internal Variables”). Ski places pro- gram-defined symbols in one symbol table; you can see the contents with the symlist command. For IA-64 programs, the ELF executable file always contains symbols, regardless of whether you used your compiler’s debug symbols flag (typically -g), unless you stripped the symbols. Internal symbols are stored in a second symbol table along with the regis- ter names Ski recognizes, listed in Appendix B, “Register Names”. The isyms command displays the contents of this table.

8.7.1Summary of Symbol Commands

symlist [filename ]

Shows the list of program-defined symbols sorted by ascending address, as seen in Figure 8-5.If filename is given, the list is written to the named file, otherwise the list is written to the screen.

8-8

Debugging

Copyright © 2000 Hewlett-Packard Co.

Image 82
Contents Ski IA-64 Simulator Reference Manual Copyright 2000 Hewlett-Packard CoPrinting History TrademarksFont Conventions How to Use This ManualPreface 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 Ski Simulator How to Run an IA-64 Application ProgramGetting Started a Ski Tutorial 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 What You Need to Know to Use This Manual OverviewIntroduction 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 Arguments Command LanguageCommand Entry Command Sequences, Repetition, and AbbreviationNumbers and Counts Argument SpecificationNumeric Arguments ExpressionsSki Simulator Arithmetic and Logic Operators Xski Evaluating ExpressionsProgram-Defined Symbols Symbolic ArgumentsAddresses Labels Resolving Ambiguous Symbols and NumbersInternal Variables FilenamesSki IA-64 Simulator Reference Manual 1.0L Summary of Register Window Commands Screen Manipulation CommandsRegister 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 filenameDj address Data Window CommandsSummary of Data Window Commands Df countXski Showing Data in Raw Hexadecimal and Ascii Dd startingaddress endingaddress filenameSki Support for Application-Mode Programs Program SimulationApplication-Mode and System-Mode Simulation Ski Support for System-Mode ProgramsSystem-Mode IA-32 Programs Summary of TLB Display CommandsSystem-Mode IA-64 Programs System-Mode TLB SimulationHow to Load a Program Misaligned Data Access TrapProgram Loading Adding Information after Loading Summary of Program Loading CommandsLoad filename args+ 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 Examples of Assignment Commands Changing Registers and Memory with Assignment CommandsSummary of Assignment Commands DebuggingOriginal Program Loaded in ski Bit-encoded Registers AllocationEvaluating Formulas and Formatting Data Summary of The eval CommandSetting Program Breakpoints Program Breakpoints Deleting Program Breakpoints Listing Program BreakpointsUnexpected Breakpoints Summary of Program Breakpoint CommandsBs address Data Breakpoints Setting Data BreakpointsSummary of Data Breakpoint Commands Deleting Data BreakpointsSummary of Symbol Commands Symbol Table CommandsSummary of Save and Restore Commands Dumping Registers and Memory to a FileSymlist Output from xski Isyms filenameSki IA-64 Simulator Reference Manual 1.0L Debugging Goto Command and Labels Command FilesLabels and Control Flow in Command Files Initialization FileAn Example Command File Comments in Command FilesIf Command # comment Summary of Command File Commandsfilename 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