HP Ski Simulator manual Summary of Program Breakpoint Commands, Unexpected Breakpoints, Bs address

Page 80

Ski IA-64 Simulator Reference Manual 1.0L

Figure 8-4. xski’s Breakpoint List Window Showing IA-64 and IA-32 Breakpoints

8.3.4Notes on Program Breakpoints

8.3.4.1How Ski Implements Breakpoints

Program breakpoints are implemented by replacing the instruction at the address of each breakpoint with an IA-64 BREAK instruction or an IA-32 INT3 instruction. The replacement is done at the time the program is started or restarted (e.g., with cont) and the original instructions are replaced when the program halts. Thus, if your program reads the loca- tion where a breakpoint is set, it will retrieve the BREAK or INT3 instruction instead. Ski detects if your program attempts to write new data into the breakpoint location and automatically reinstalls the breakpoint after such an update.

You need to tell Ski where to set your IA-64 breakpoints but the IA-64 architecture doesn’t provide for addressability of individual instructions. Instead, instructions are bundled. To work around this, Ski “pretends” that the slot 0 instruction of a bundle is in the first four bytes of the bundle’s location, the slot 1 instruction is in the second four bytes of the bundle, and the slot 2 instruction is in the third four bytes of the bundle. You can only set breakpoints at these “pretend” locations. For example, setting a breakpoint at “ main”, “ main+1”, “ main+2”, and “ main+3” all result in the breakpoint being set on the first instruction in the bundle at “ main”. Similarly, “ main+5”, “ main+6”, and “ main+7” all correspond to “ main+4”, and “ main+9”, “ main+a”, and “ main+b” all correspond to “ main+8”, If you try to set a breakpoint at the remaining bytes in the bundle (“ main+c”, “ main+d”, “ main+e”, and “ main+f” in this example), Ski will generate the error message

Illegal slot field in breakpoint address”. Ski can place IA-32 breakpoints at any byte address. If the break- point address doesn’t correspond to the beginning of an IA-32 instruction, Ski’s behavior is undefined.

8.3.4.2Unexpected Breakpoints

The IA-64 breakpoint mechanism uses BREAK.M 0, BREAK.I 0, BREAK.B 0, and BREAK.F 0, and BREAK.X 0 instructions. These are special cases and executing these instructions will not cause “ BREAK instruction trap” interrupts for system- mode programs. The same is true for INT3 instructions in IA-32 code. However, if Ski finds BREAK or INT3 instruction at a location which doesn’t correspond to a breakpoint, Ski’s behavior depends on whether the program is simulating in application-mode or system-mode. Application-mode programs should never generate, or expect to receive, interrupts. If Ski reaches a BREAK or INT3 instruction in an application-mode program at a location which doesn’t correspond to a breakpoint, simulation halts and Ski displays an error message. System-mode IA-64 programs will receive the BREAK interrupt.

8.3.5Summary of Program Breakpoint Commands

bs [address]

Sets an IA-64 breakpoint at the specified address or, if no address is given, at the location pointed to by ip.

8-6

Debugging

Copyright © 2000 Hewlett-Packard Co.

Image 80
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 FlagsQuit expression Summary of the Quit CommandQuitting Ski Register Window Screen PresentationSki’s Use of Windows 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 Xski Main Window Command/Main WindowInvalid Code and the Data 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 ExpressionsAddresses Symbolic ArgumentsProgram-Defined Symbols 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 SimulationProgram Loading Misaligned Data Access TrapHow to Load a Program 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 Linux Application Environment Linux and MS-DOS ABI EmulationInterruptions Linux System Calls Supported by Ski Linux System Calls Accepted but Ignored by SkiMS-DOS System Calls in Hexadecimal Supported by Ski MS-DOS Application EnvironmentProgram I/O 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 BreakpointsBs address Summary of Program Breakpoint CommandsUnexpected Breakpoints 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 FileIf Command Comments in Command FilesAn Example Command File 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