home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 16 Announce
/
16-Announce.zip
/
SNGEMI.ZIP
/
ERRORMGR.INF
(
.txt
)
Wrap
OS/2 Help File
|
1993-01-07
|
20KB
|
506 lines
ΓòÉΓòÉΓòÉ 1. About the Error Manager Application Development Tool ΓòÉΓòÉΓòÉ
About the Error Manager Application Development Tool
Error Manager was an idea concieved during an IBM FTN presentation of OS/2 2.0
Developer's Tools. The presenter emphasized that a significant knowledge of
assembler was needed to make use of the debug kernal. It seemed to us that
most OS/2 coding bugs could be found by examining all API return codes without
the hassle of using the debug kernal.
Error Manager (EM) is a runtime API debugger and production code monitor. It
does NOT require the Debug kernel. Even novice OS/2 programmers will find EM
to be a simple yet powerful tool to find elusive OS/2 errors. Additionally,
Testers and Production Managers will be able to monitor software in real user
environments, and report needed fixes back to development teams.
Error Manager acts as an error scanner, checking the return codes of the IBM
toolkit API functions. This provides three simple functions: it frees
developers from testing every API, eliminates the need to search for return
code descriptions and provides a means for coding a centralized error handler.
The Error Manager works in conjuction with the IBM CSET/2 compiler, the OS/2
2.0 Developer's Toolkit and your OS/2 software. It notifies the developer of
errors by either logging to a file, to the Viewer program, to some other
process or internally to a window message loop.
For more information about using the Help facility, select Help For Help in the
Help menu..*
ΓòÉΓòÉΓòÉ 1.1. Trademarks ΓòÉΓòÉΓòÉ
Trademarks
The following terms are considered trademarks of Soft & GUI Incorporated:
Error Manager
ErrorMgr
Command Line
CmdLine
Soft & GUI
S&G
The following terms are registered trademarks of International Business
Machines Corporation:
IBM
OS/2
Presentation Manager
CSET/2
OS/2 2.0 Developer's Toolkit
ΓòÉΓòÉΓòÉ 1.2. Copyright ΓòÉΓòÉΓòÉ
Copyright
Copyright Soft & GUI Incorporated 1992. All rights reserved.
Error Manager is distributed as a tool for use by a single developer. Site
licenses are available under special agreement with Soft & GUI. Additionally,
unlimited distribution rights to the runtime DLL are also available for a
minimal one-time charge.
It is the philosophy of Soft & GUI to overcome piracy by making software
affordable. To that end, we ask that you do your share by purchasing an honest
number of copies. You will find that it is far cheaper than the cost of
installing a new door after the SPA comes busting in.
If you are a small software shop trying to get started and can't afford the
list price, call us and we will work something out.
ΓòÉΓòÉΓòÉ 1.3. Guarantees & Responsibilities ΓòÉΓòÉΓòÉ
Guarantees & Responsibilities
We believe Error Manager will enable you to develop better code, by making you
aware of errors for which you weren't looking and by providing a means for
writing a simple centralized error handling facility, but we don't guarantee
it. We do guarantee that if you find a bug within Error Manager, we will try
to fix it.
Soft & GUI does not assume any responsibility for any problems which arise as a
result of using Error Manager in any phase of the software development, test or
production cycles. Besides, we would rather go out of business than lose a
lawsuit, frivolous or otherwise.
ΓòÉΓòÉΓòÉ 2. Getting Started ΓòÉΓòÉΓòÉ
Getting Started
To install Error Manager, place the diskette in your 3.5" floppy drive.
Copy the contents of the INCLUDE directory of the Error Manager diskette to a
directory on your hard drive. If you create a new directory for this, be sure
to add it to the INCLUDE statement in CONFIG.SYS.
Copy the errormgr.lib file to your hard drive. This is commonly copied into
either the C runtime or Toolkit LIB subdirectories. If you create a new
directory for this, be sure to add it to the LIB statement in CONFIG.SYS.
Copy the errormgr.dll file to your hard drive. This is commonly copied into
either the C runtime or Toolkit DLL subdirectories. If you create a new
directory for this, be sure to add it to the LIBPATH statement in CONFIG.SYS.
Copy the errormgr.inf file to your \OS2\BOOK directory. Of course, you must
have done something like that already if you are reading this text.
While you are in CONFIG.SYS, go ahead and set the ERRORLOG environment variable
to some filename you like.
If you had to update CONFIG.SYS during the install process, you will have to
reboot prior to using Error Manager. By the way, we apologize for not having a
sexy install program, but you are probably a developer and are consequently
above such trivial niceties.
ΓòÉΓòÉΓòÉ 3. How to use the Soft & GUI Error Manager ΓòÉΓòÉΓòÉ
How to use the Soft & GUI Error Manager
Using Error Manager is extremely simple.
1. Insert the following line between the System and Toolkit include files and
the application specific include files in any C source files that are to be
monitored. Be sure that all the EM include files are in the INCLUDE search
path. For Example:
#define INCL_WIN
#include <os2.h>
#include <stdlib.h>
#include <errormgr.h>
#include <myapp.h>
2. Link the application using the ErrorMgr.lib Library file. For Example:
link386 myapp+mysubs,,, errormgr,myapp.def;
3. Set the Error Manager environment variable, ERRORLOG, to indicate the
destination for the notifications. This can be a filename, a named pipe or
even a COM port for those who develop with a debug terminal. This is
usually added to your CONFIG.SYS file. It can be changed within any OS/2
session by issuing a new SET statement. For Example:
set ERRORLOG=errors
Or, have your program be notified internally by using the EMSetWindow()
API. You may also specify a callback function to be invoked when errors
occur by using the EMSetCallbackFn() API.
Just remember to make sure that the Error Manager header file directory is in
your INCLUDE path statement, that the errormgr.lib directory is in the LIB path
statement and that the errormgr.dll directory is in your LIBPATH statement in
CONFIG.SYS.
ΓòÉΓòÉΓòÉ 4. What does Error Manager tell me? ΓòÉΓòÉΓòÉ
What does Error Manager tell me?
First, EM will notify a window of all errors it catches by posting a
WM_ERRORMGR message. The default value of WM_ERRORMGR is 0x2876. If this
value is already used by your application, it may be changed to any non-zero
value using the EMSetMessageValue() function. The window which recieves the
WM_ERRORMGR messages is specified by using the EMSetWindow() call. This
allows the programmer to centralize error handling in a single routine. There
are four values which can be extracted from this message:
usFnNumber = SHORT1FROMMP(mp1)
usErrorNumber = SHORT2FROMMP(mp1)
usModuleNumber = SHORT1FROMMP(mp2)
usLineNumber = SHORT2FROMMP(mp2)
The actual source module name, offending Toolkit function name and error
description can be retrieved using the EMQueryModuleName(), EMQueryFnName()
and EMQueryErrorDesc() functions respectively. Prototypes for these functions
exist in errormgr.h.
Error Manager also generates a notification log of all errors detected to the
file specified in the environment variable, ERRORLOG. If this is not set, no
log will be produced. The following is an example of an actual Error Manager
notification file:
----------------- Session started on 6/9/92 at 15:36:51 ---------------------
WinLoadMenu() generated error 1001 - Invalid window handle (HWND)
in file WNDPROC.C at line 286.
GpiSetBitmap() generated error 207F - Invalid presentation space handle (HPS)
in file WNDPROC.C at line 538. This occurred 3 consecutive times.
The first time an error is detected, a new Session header is appended with the
current date and time. Then, as errors are intercepted, the offending function
and the error number are displayed with a description of the error. The source
file name and line number appear on the next line. If the same error
repeatedly occurs at the same position, a message is displayed with the number
of occurrences, rather than generating redundant notifications.
Finally, programmers may include their own messages into the log by invoking
the EMInsertMessage() API. This is very usful in situations where a
conventional debugging breakpoint would interfere (e.g. time critical
sections).
ΓòÉΓòÉΓòÉ 5. Error Manager Functions ΓòÉΓòÉΓòÉ
Error Manager Functions
The following functions can be used to set error notification destinations and
to extract error information received.
ΓòÉΓòÉΓòÉ 5.1. EMQueryPointerValidity ΓòÉΓòÉΓòÉ
ULONG APIENTRY EMQueryPointerValidity(PVOID ptr, ULONG size);
Determines the number of bytes which could be read without causing a memory
violation. If 0 is returned, the pointer is not valid. The size argument
usually contains the size of some structure or array to be read, but 0 may be
passed to find the total amount of readable memory from the pointer in
question.
Be sure to include the EMCHKPTR.H include file which contains the function
prototype. Additionally, each program using this function will need to add
EMCHKPTR.LIB to the library section of the link386 command.
#define INCL_WIN
#include <os2.h>
#include <stdlib.h>
#include <errormgr.h>
#include <emchkptr.h>
#include <myapp.h>
ΓòÉΓòÉΓòÉ 5.2. EMSetWindow ΓòÉΓòÉΓòÉ
BOOL APIENTRY EMSetWindow(HWND hwnd);
Determines the window (hwnd) which will receive Error Manager notification
messages. This call is frequently made within the WM_CREATE or WM_INITDLG
message processing of the window procedure.
Also see EMGetWindow()
ΓòÉΓòÉΓòÉ 5.3. EMGetWindow ΓòÉΓòÉΓòÉ
HWND APIENTRY EMGetWindow(VOID);
Returns a handle to the window which is currently receiving notification, or
NULL if no window has been set.
Also see EMSetWindow()
ΓòÉΓòÉΓòÉ 5.4. EMSetState ΓòÉΓòÉΓòÉ
BOOL APIENTRY EMSetState(BOOL fState);
Allows developers turn off and on the notification mechanism. This is usually
used around code that produces expected errors. FALSE turns notification off,
TRUE turns it back on again. The default state is on.
Also see EMGetState()
ΓòÉΓòÉΓòÉ 5.5. EMGetState ΓòÉΓòÉΓòÉ
BOOL APIENTRY EMGetState(VOID);
Returns the current state of notification. FALSE indicates that notification
is currently off, while TRUE indicates it is on. The default state is on.
Also see EMSetState()
ΓòÉΓòÉΓòÉ 5.6. EMInsertMessage ΓòÉΓòÉΓòÉ
VOID APIENTRY EMInsertMessage(PSZ pszUserMessage);
Allows the developer to add informational messages to the error log. This will
not generate a PM message to the internal window procedure.
All messages will be prefixed with the string "Programmer Message - ". The
string passed may be up to 272 characters in length. Additional characters
will be truncated.
ΓòÉΓòÉΓòÉ 5.7. EMQueryModuleName ΓòÉΓòÉΓòÉ
VOID APIENTRY EMQueryModuleName(USHORT usModNumber, PCHAR pModName, USHORT
usModNameLen);
Used to extract the offending module name from data received in the WM_ERRORMGR
message. It takes the index number passed within the message, a buffer where
the text should be placed and the size of the buffer.
ΓòÉΓòÉΓòÉ 5.8. EMQueryFnName ΓòÉΓòÉΓòÉ
VOID APIENTRY EMQueryFnName(USHORT usFnNumber, PCHAR pFnName, USHORT
usFnNameLen);
Used to extract the offending API function name from data received in the
WM_ERRORMGR message. It takes the index number passed within the message, a
buffer where the text should be placed and the size of the buffer.
ΓòÉΓòÉΓòÉ 5.9. EMQueryErrorDesc ΓòÉΓòÉΓòÉ
VOID APIENTRY EMQueryErrorDesc(USHORT usErrorNumber, PCHAR pDesc, USHORT
usDescLen);
Used to extract the description of the error from data received in the
WM_ERRORMGR message. It takes the error number passed within the message, a
buffer where the text should be placed and the size of the buffer.
ΓòÉΓòÉΓòÉ 5.10. EMSetMessageValue ΓòÉΓòÉΓòÉ
BOOL APIENTRY EMSetMessageValue(USHORT usNewMessageValue);
Sets a new message value for WM_ERRORMGR. Use this function when your
application already uses a message with this value (unlikely as that may be).
The default value of WM_ERRORMGR is 0x2876.
ΓòÉΓòÉΓòÉ 5.11. EMSetCallbackFn ΓòÉΓòÉΓòÉ
BOOL APIENTRY EMSetCallbackFn(VOID (*pfn)(USHORT, USHORT, USHORT, USHORT));
Specifies a function to be called when an error is detected. The function
should be defined as follows:
VOID APIENTRY MyErrorCallbackFn(USHORT usFunctionNumber, USHORT
usReturnCode, USHORT usModuleNumber, USHORT usLineNumber)
{
:
:
:
}
The actual source module name, offending Toolkit function name and error
description can be retrieved using the EMQueryModuleName(), EMQueryFnName()
and EMQueryErrorDesc() functions respectively. Prototypes for these functions
exist in errormgr.h.
ΓòÉΓòÉΓòÉ 6. Using the Soft & GUI Stream Viewer ΓòÉΓòÉΓòÉ
Using the Soft & GUI Stream Viewer
You may use the Soft & GUI Stream Viewer, SNGVIEW.EXE, to monitor the error
manager output from PM. Simply set the ERRORLOG environment variable to
\PIPE\VIEWER, start SNGVIEW.EXE, and run the program in question. All Error
Manager output will be redirected to the MLE in the viewer, which can be edited
and saved as necessary.
ΓòÉΓòÉΓòÉ 7. Limitations ΓòÉΓòÉΓòÉ
Limitations
Error Manager will handle software which is comprised of an unlimited number of
modules, so long as no more than 100 of said modules produce errors. Errors
from any modules beyond the first 100 will not be reported. If you have more
than 100 modules, we suggest you consider a redesign or make use of DLLs and
libraries.
We limit module names to twelve (12) characters.
We limit programmer messages to 272 characters. See the EMInsertMessage() API
for more details.
Error Manager uses semaphores to control error logging, so multithreaded
applications are fully supported.
ΓòÉΓòÉΓòÉ 8. Unmonitored Functions ΓòÉΓòÉΓòÉ
Unmonitored Functions
The following calls are not monitored by Error Manager. This does not mean
that you can't use them; it only means if they blow up, we won't be telling
you. Some of the APIs are in this list simply because they provide no feedback
of success or failure, such as the DosExit() API.
By the way, if this seems like a long list of 36 functions, we assure you that
the list of fully supported calls is much longer; 950 toolkit APIs are fully
handled!
DevPostDeviceModes()
DosExit()
GetDriverInfo()
GpiQueryColorData()
Gre32Entry10()
Gre32Entry2()
Gre32Entry3()
Gre32Entry4()
Gre32Entry5()
Gre32Entry6()
Gre32Entry7()
Gre32Entry8()
Gre32Entry9()
GreInitialize()
NlsConvertBidiNumerics()
NlsEditShape()
NlsInverseString()
NlsQueryBidiAtt()
NlsSetBidiAtt()
NlsSetBidiPrint()
NlsShapeBidiString()
PostDeviceModes()
PrfCreateGroup()
PrfQueryProgramCategory()
PrfQueryProgramHandle()
PrtAbort()
SetDriverInfo()
SSAllocMem()
SSFreeMem()
VioGlobalReg()
WinDBCSIMEControl()
WinDBCSLoadFontDriver()
WinDBCSModeControl()
WinDBCSQueryFDDescription()
WinDBCSUnloadFontDriver()
WinSetErrorInfo()
ΓòÉΓòÉΓòÉ 9. Troubleshooting ΓòÉΓòÉΓòÉ
Troubleshooting
The following problem situations have been reported by our beta sites, along
with fixes.
ΓòÉΓòÉΓòÉ 9.1. Do not get error descriptions ΓòÉΓòÉΓòÉ
Do not get error descriptions
This is most likely because you are making Win calls without having created an
anchor block. Add WinInitialize(0) to the beginning of your main() function.
This is necessary because we make an internal call to WinGetLastError to
determine the reason for the function failure. Programs which do not use the
Win calls need not be concerned with this.
ΓòÉΓòÉΓòÉ 9.2. Do not get internal notification in my window procedure ΓòÉΓòÉΓòÉ
Do not get internal notification in my window procedure
Call EMSetWindow() with the handle of the window which is to receive
notification.
ΓòÉΓòÉΓòÉ 10. Ordering Information ΓòÉΓòÉΓòÉ
Ordering Information
Error Manager is available directly from Soft & GUI Inc. and through various
software catalogs. Discounts are available to OS/2 users groups. Site licenses
are available. Also, unlimited distribution rights of the runtime DLL are
available for a minimal charge.
List Price: $225 per developer.
Soft & GUI Incorporated
2224 East 21st Street
Brooklyn, New York 11229
(718) 769-8017
Please contact us for quantity discounts and site license information.
ΓòÉΓòÉΓòÉ 11. About Soft & GUI ΓòÉΓòÉΓòÉ
About Soft & GUI
Soft & GUI Incorporated
2224 East 21st Street
Brooklyn, New York 11229
(718) 769-8017
Soft & GUI was founded in 1991, by Arthur Goikhman. In 1992, Steve Dacek came
on board and the two began development of Command Line. The charter was to
make money by venturing into the untamed (and untrampled) regions of OS/2.
Please let us know of features you would like added, or problems you encounter
using Error Manager. Your feedback will drive all future development.
Soft & GUI is currently working on several other projects: Command Line, an
on-demand command prompt, which allows users to execute OS/2 commands or
programs without leaving the active PM application in search of an icon or an
open OS/2 session; and KingMaker, a visual application development environment.