HPlogo MPE/iX System Utilities Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 18 PATCH

Operation

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

To invoke PATCH enter:

   PATCH

or

   RUN PATCH.PUB.SYS

PATCH identifies itself, then displays ENTITY=? to request the name of the file you want to list or modify:

   PROGRAM PATCH G.00.00 (C) HEWLETT-PACKARD CO., 1976 

     ENTITY =? 

Enter filename.groupname.accountname, in uppercase letters, of the file whose code you wish to display or change. (PATCH does not immediately verify that the file you specified is a program file, but you will get an error when you attempt to use a command on a nonprogram file.)

When the file name is accepted, PATCH displays the ? prompt, where you enter one of the following four subcommands:

D

Displays code segment contents.

M

Modifies code segment contents.

DG

Displays global area of initial stack.

MG

Modifies global area of initial stack.

After each command, PATCH prompts you for another. To terminate PATCH press Return without entering a command. (An incorrectly entered command also terminates PATCH.)

On the following pages, each of the four PATCH subcommands is explained in detail.

D

The D command displays code segment contents. To invoke this command enter:

   ?D, segnum, address [,numlocations]

Parameters

segnumThe logical segment number to be displayed, found at the top of the PMAP output.
addressThe code segment relative address you wish to display is as follows: add the offset of the instruction within the procedure (an octal value found in your compiler listing) to the procedure start address found in the CODE column of your PMAP output.
numlocationsThe number of words, in octal, to be displayed.

For a list of segment names and their addresses within a program file use the PMAP option of the PREP command.

For information regarding the offsets of instructions and global variables in program files, refer to compiler options for the programming language in which the code was written.

M

The M command modifies code segment contents. To invoke this command enter:

   ?M, segnum, address, [,numlocations]

Parameters

segnumThe logical segment number to be modified, found at the top of the PMAP output.
addressThe address of the code segment you wish to modify, calculated by adding the offset of the instruction within the procedure (an octal value found in your compiler listing) to the procedure start address found in the CODE column of your PMAP output.
numlocationsThe number of words, in octal, to be modified.

When you enter the M command, the contents of the current instruction are displayed followed by a comma. To leave the value unchanged, you must re-enter the contents! If you press RETURN without entering anything the instruction will be set to zeros (%000000, a NOP instruction).

For a list of segment names and their addresses within a program file use the PMAP option of the PREP command.

For information regarding the offsets of instructions and global variables in program files, refer to compiler options for the programming language in which the code was written.

Example

The following example shows you how to use the M and D commands to display and modify the contents of one instruction in the file BIGBUCS.PUB.SALES:

   FILE = ? BIGBUCS.PUB.SALES



   ?D,0,20,1

     031042 

   ?M,0,20,1

     031042, 420031

   ?D,0,20,1

     420031 

   ? 

DG

The DG command displays the global area of the initial stack. To invoke this command enter:

   ?DG, reloffset [,numwords]

Parameters

reloffsetThe DB-relative offset of the word to display, found in your compiler listing. For more information, refer to the compiler options for the programming language in which the code was written.
numwordsThe number of words, in octal, that you wish to display. The default is one.

Example

   FILE? PINITRIN.PUB.TEST



   ?DG,0,4

     000010 

     000015 

     000000 

     000046 

   ? 

MG

The MG command modifies the global area of the intial stack. To invoke this command enter:

   ?MG, reloffset [,numwords]

Parameters

reloffsetThe DB-relative offset of the word to modify, found in your compiler listing.
numwordsThe number of words, in octal, that you wish to modify. The default is one.

The MG command displays the contents of the current stack word, followed by a comma. To leave the value unchanged, you must re-enter the contents! If you press RETURN without entering anything the word will be filled with zeros.

For information regarding the offsets of instructions and global variables in program files, refer to compiler options for the programming language in which the code was written.

Examples

Here is an example of using the MG and DG command. Begin by running PATCH and entering the executable file name. In this example, the file is BIGTECH.PUB.SYS.

   PROGRAM PATCH G.00.00 (C) HEWLETT-PACKARD CO., 1976 

     FILE =?BIGTECH.PUB.SYS

The following displays values in the first five addresses:

   ?DG, 0,5   

     000112 

     000052 

     000064 

     000264 

     000464 

The following would set the first five locations to zero because RETURN is pressed without entering anything after each location is displayed:

   ?MG, 0,5  

     000112, 

     000052, 

     000064, 

     000264, 

     000464, 

The following displays the changes you just made:

   ?DG ,0,5

     000000 

     000000 

     000000 

     000000 

     000000 

The following changes the zeros displayed above to the values shown after each comma:

   ?MG,0,5

     000000,112

     000000,52

     000000,64

     000000,264

     000000,464

The following displays the first changed value:

   ?DG,,1

     000112 

Additional Discussion

For more information on PREP command refer to MPE/iX Commands Reference Manual Volumes 1 and 2 (32650-90003 and 32650-90364). For more information on User Subprogram Library (USL) files refer to MPE Segmenter Reference Manual (30000-90011).

Many compilers produce a listing of global identifiers and their addresses. For more information refer to the reference manual for that compiler's programming language.

Feedback to webmaster