HPlogo MPE/iX System Utilities Reference > Chapter 22 SOMPATCH

Chapter 22 SOMPATCH

MPE documents

Complete PDF
Table of Contents
Index

Table of Contents
Operation
Interactive patching
; (semicolon)
BACKOUT
Error Messages
DISPLAY
Error Messages
EXIT
FIND
HELP
LIST
LOG
Error Messages
MODIFY
Error Messages
OFFSET
OPEN
PATCHFILE
QUIT
SAVE
SHOW
Error Messages
SOM
SYMBOL
Error Message
USE
VERSION
Use the SOMPATCH utility for binary modification of a native mode spectrum object module (SOM) program or library file. Binary modification is referred to informally as patching.


WARNING! Do not use this utility without service center support. Unauthorized use will void your warranty and may cause data loss.

This utility is capable of tracking all of the modifications that it makes to a SOM file. This history is kept in the SOM file in an unloadable buffer space, which affects neither performance nor memory usage of the program. This buffer space is provided by linking in a ypatch file when the executable SOM file is created.

The ypatch file to be linked into SOM 0 of NL.PUB.SYS creates loadable code because the storage area needs to be in the boot images, and the SAINT utility does not store unloadable spaces in the boot images. This special ypatch file is ypatsom0 and would normally be used only in the NL.

The SOMPATCH utility will accept as input a file not linked with a ypatch file. However, you should use it to build files with the ypatch file, so that at any time you can view and query the file and patch history. If the ypatch file is not linked in, no logging is available. All native-mode system products are required to link with the ypatch file if the product is to be supported in the field to any extent with binary patching.

MPE/iX contains a symbolic debugger that can be used for memory patching or to generate patches that you will permanently apply with the SOMPATCH utility.

To patch compatibility mode files, use the slpatch and patch files.

Input Files

The SOMPATCH utility has one required file and that is the input file to be queried or patched. This file can be a relocatable or executable library SOM or a program SOM. The SOMPATCH utility treats this file as a read-only file. No backup copy is made; however, a QUIT command can be used at any time, with this file remaining unchanged.

The user can also optionally specify a second input file, a script file of modification instructions and logging information, referred to hereafter as a patch file. A patch file is an ASCII file, created by an editor or other text utility, that specifies one or more commands to the SOMPATCH utility. The patch file is given on the command line, or by the USE command, to apply one or more patches. Patches can also be applied interactively. Refer to the paragraph "Interactive Patching" under "Operation."

Error Handling

The input file is maintained in its original state until the user types EXIT or SAVE. If there is a system malfunction between the EXIT command and the colon prompt, purge the possibly modified file and start over with a backup. If no backup is available, redo all patches on the possibly modified input file. (This may cause the oval/verify option on the modify command to generate false error messages). As long as the ypatch file was used, all old patches can be backed out.

Output File

The user can optionally specify an output list file containing all patch instructions issued, any error messages, and any displays. This is saved as a permanent disk file, unless overridden by a user-specified file equation.

The SOMPATCH utility writes to the primary file all patches that did not contain errors. If a patch has several modify instructions, or the count is greater than one for one modify, and one or more generated errors, none of the modifies for that patch are applied. Patches are broken up by LOG commands.

JCW Handling

The SOMPATCH utility sets two JCWs: the system JCW and a private JCW, PATCHJCW. PATCHJCW is set as follows:

  No error -- value of 0
  Nonfatal error -- value of 1
  Fatal error -- value of 2
  Really fatal -- value of 3 (Program will gracefully abort.)

Under these error conditions, the SOMPATCH utility also sets the system JCW to the standard MPE values, OKAY, WARN, and FATAL.

Preparation for Use

Patching modifies object code when a problem cannot be easily or conveniently fixed in source code. The SOMPATCH utility is used to fix a software problem without recompiling or relinking. A patch is usually developed using the symbolic debugger, with the patch applier using the SOMPATCH utility to permanently install a modification in the defective software.

You should link in one of two available ypatch files when you build the product that you are patching. Which one you link depends on how much the product is patched.

When linking a single-SOM library, or a program file, specify the ypatch file you want to use at the end of the source object files for the user's executable SOM. For example:

   link>LINK from=mysomfile,ypatch4.lib.sys; to=myprogfile

When linking a multi-SOM library, specify the desired ypatch file at the end of the source object files for each SOM. For example:

  link>LINK from=mymod1,mymod2,mymod3,ypatch4.lib.sys; to=myint1
  link>LINK from=mymod4,mymod5,mymod6,ypatch4.lib.sys; to=myint2
  link>BUILDXL mynl
  link>LINK from=myint1,myint2; to=mynl

HP product files should contain a minimum of 300 bytes of storage for each anticipated patch. Refer to "Error Handling" in this chapter for information of how to handle errors when this storage area overflows.




Chapter 21 Operation


Chapter 22 Operation