home *** CD-ROM | disk | FTP | other *** search
- Sherlock - A Programmers helper.
-
-
- Introduction
-
- Trying to debug an application is usually a mystery. Most of the time, the
- debugging is at the developers computer where source code is available and
- source level debuggers are able to quickly and easily locate problems. It is
- relatively easy to find problems and correct them. At this point, there is
- little challenge.
-
- Unfortunately, after a program has gone out the door, it is inevitable that a
- problem occures at the end user's site. If enough information is available,
- some problems can be reproduced on your development machine. Far too often
- an end user's configuration is not the same as yours and reproducing the
- problem is difficult if not impossible. If a trace of what the program is
- currently doing at the customers site was available, then the developer would
- have a better idea of what went wrong and how to fix the problem. What is
- needed is a way to debug the program at the end users site. Giving the user
- access to the original source to run a debugger is usually not desireable.
- And, while reporting the linear address in OS/2 2.0 may make the end user
- feel good, it is useless to the developer since the machine configurations
- may be different and therefore will have different linear addresses. This
- is where programmers have a real mystery. Unfortunately, with so many of
- the pieces missing, the mystery usually cannot be solved.
-
- Sherlock is a program to aid fellow programmers in this remote diagnosis of
- program problems. This is done through an interfaceless debugger. Sherlock
- will load the desired executable for debugging, start the program and then
- continue until an exception occures. When an exception occures, the entire
- program state is dumped. Each thread will have the current register thread
- dumped and then attempt to trace the stack back to the root node of the
- thread.
-
-
- Usage
-
- Usage of SHERLOCK is simple, even for most end users. The target program is
- started as it would normally be started with the addition of listing Sherlock
- ahead of the target application. For example, if you wish to test the
- program xyz.exe with the parameters a b c.
-
- Normal:
- xyz a b c
-
- With Sherlock:
- Sherlock xyz a b c
-
-
- What will I get out of Sherlock?
-
- Sherlock will generate is a log file of what the operator of a debugger would
- see. Sherlock will try to load debugging information for each module which
- is loaded. Sherlock's ability to decode debugging infomation is based upon
- loading a DLL to support each different debugging information format.
- Sherlock is capable of supporting many different debugging formats at the
- same time. Each module which is loaded by the target program will be sent to
- the support DLLs to ask whether it supports the debugging format of the
- module. If it says yes, no other support DLLs will be asked whether they
- support the debugging format of the module.
-
-
- Sample Input
-
- The following is the source to the program used to illistrate the output of Sherlock.
-
- /*
- ** This is a test program for Sherlock.
- */
- #include <os2.h>
-
- int main(int argc, char **argv)
- {
- DosOpen((PSZ) 0, /* pszFileName */
- (PHFILE) 0, /* pHFILE */
- 0, /* pulAction */
- 0, /* cbFile */
- 0, /* ulAttribute */
- 0, /* fsOpenFlags */
- 0, /* fsOpenMode */
- (PEAOP2) 0); /* peop2 */
- }
-
-
- Sample Output
-
- Sherlock will produce a log file named SHERLOCK.LOG in the current directory.
- Each execution of Sherlock will overwrite any existing log file. The output
- will be as described below.
-
- Each exception is logged to the file. Note that there are many types
- of exceptions. Some are diagnostic such as guard page exceptions.
- Other exceptions are fatal, but can be recovered from. Access
- Violations while usually fatal can be recovered from. For example,
- C-Set/2 (Copyright IBM) inserts an exception handler which if not
- overriden will print a register state dump. If overridden, it is
- possible to recover from the exception and continue program
- execution. SherLock will log ALL exceptions to the log file until
- the program has terminated. The information is given as folows:
-
- Exception #[0-3] Debugger exception notification type.
- Addr: xxxxxxxx Linear Address of the exception.
- Excpt: xxxxxxxx Exception ID.
- Except #: ### Name Exception ID and its name if known.
- Flags: ### Exception flags.
- Next Rec: ### Next exception record point.
- Exception in thread # ID of the thread where the exception
- occured.
-
- Execption type 1 at 1a050179
- Except #: c0000005 Access violation
- Flags: 00000000
- Next Rec: 00000000
- Except Addr: 1a050179
- Num Parms: 2
- Except 0: 00000000
- Except 1: ffffffff
- Exception in thread: 1
-
-
- Each thread of execution within the executing program will have its
- entire register set dumped.
-
- Pid: 000000f0 Tid: 00000001
- Cmd: 0 Value: 00716668
- Addr: 0002294c Buffer: 00037fd4
- Len: 00000024 Index: 00000000
- MTE: 0000030c
- EAX: 00172a80 EBX: 00000000 ECX: 00060010 EDX: 00060007
- ESP: 0002291c EBP: 00022ae4 ESI: 00000000 EDI: 00000000
- EIP: 0000c0a0 EFLAGS: 00002206
- Carry Parity Aux Zero Sign Trap IntE Dir OFlow IOPL Nested Resume
- NC PE 0 NE 0 0 1 DN NO 2 0 0
- CSLim 1c000000 CSBase: 00000000 CSAcc: df CSAttr: d0 CS:005b
- DSLim 1c000000 DSBase: 00000000 DSAcc: f3 DSAttr: d0 DS:0053
- ESLim 1c000000 ESBase: 00000000 ESAcc: f3 ESAttr: d0 ES:0053
- FSLim 00000031 FSBase: 00050030 FSAcc: f3 FSAttr: 00 FS:150b
- GSLim 00000000 GSBase: 00000000 GSAcc: 00 GSAttr: 00 GS:0000
- SSLim 1c000000 SSBase: 00000000 SSAcc: f3 SSAttr: d0 SS:0053
-
-
- Stack Trace - EBP, EIP of the current thread given by the register
- dump. Base is the Base offset within the given module. Rel is the
- relative offset of EIP within the Object/Segment. Object is the
- Object/Segment number assigned by the linker. Module is the module
- where execution is currently executing. These three items together
- are what any developer needs to determine where the program is
- currently executing. For unsupported debugging modules, a Hi and
- Lo function marker are also given. These may be helpful or may not
- since these are based upon the exported functions of a module. If a
- module only contians a few functions exported, then the function
- markers will most likely be useless.
-
- EBP: 00022ae4 EIP: 1a02c0a0
- Base: 1a020000 Rel: 0000c0a0 Len: 00010000
- Object: 00000002
- Module: C:\OS2\DLL\DOSCALL1.DLL
- Size: 87884
- Timestamp:Mon Nov 23 08:01:48 1992
-
- Lo Function: DOSREAD
- Hi Function: DOSCOPY
-
- EBP: 00022b14 EIP: 1a02a958
- Base: 1a020000 Rel: 0000a958 Len: 00010000
- Object: 00000002
- Module: C:\OS2\DLL\DOSCALL1.DLL
- Size: 87884
- Timestamp:Mon Nov 23 08:01:48 1992
-
- Lo Function: DOSREAD
- Hi Function: DOSCOPY
-
-
- This entry shows the result of using one of the debugging support
- DLLs. The function, source module and line number are therefore
- accessable and dumped.
-
- EBP: 00022b3c EIP: 00010023
- Base: 00010000 Rel: 00000023 Len: 00010000
- Object: 00000001
- Module: C:\WORK\DEBUG\CATCH.EXE
- Size: 18778
- Timestamp:Sun Sep 27 00:08:00 1992
-
- Function: main
- Source: CATCH.C
- Line: 9
-
-
- This entry shows the same module as the above entry, but the area
- where the stack traced back to does not have debugging information,
- so the bounding functions are dumped.
-
- EBP: 00022b58 EIP: 00010596
- Base: 00010000 Rel: 00000596 Len: 00010000
- Object: 00000001
- Module: C:\WORK\DEBUG\CATCH.EXE
- Size: 18778
- Timestamp:Sun Sep 27 00:08:00 1992
-
- Lo Function: _RunExitList
- Hi Function: UNKNOWN
-
-
- If the exception handler signals that the exception is terminal, then
- the process is given a process termination exception. A similar dump
- to the one above will then be given for the process termination.
-
- EIP: 1a02c0a0, DLL: C:\OS2\DLL\DOSCALL1.DLL Func: DOSREAD
- Execption type 1 at 1a0502f1
- Except #: c0010001 Process terminate
- Flags: 00000001
- Next Rec: c0000005
- Except Addr: 1a0502f1
- Num Parms: 0
- Exception in thread: 1
-
- Pid: 000000f0 Tid: 00000001
- Cmd: 0 Value: 00716668
- Addr: 00022570 Buffer: 00037fd4
- Len: 00000024 Index: 00000000
- MTE: 0000030c
- EAX: 36000017 EBX: 00022970 ECX: 0002294c EDX: 00000007
- ESP: 0002255c EBP: 000226d4 ESI: 00000004 EDI: 00000004
- EIP: 0000c0a0 EFLAGS: 00002206
- Carry Parity Aux Zero Sign Trap IntE Dir OFlow IOPL Nested Resume
- NC PE 0 NE 0 0 1 DN NO 2 0 0
- CSLim 1c000000 CSBase: 00000000 CSAcc: df CSAttr: d0 CS:005b
- DSLim 1c000000 DSBase: 00000000 DSAcc: f3 DSAttr: d0 DS:0053
- ESLim 1c000000 ESBase: 00000000 ESAcc: f3 ESAttr: d0 ES:0053
- FSLim 00000031 FSBase: 00050030 FSAcc: f3 FSAttr: 00 FS:150b
- GSLim 00000000 GSBase: 00000000 GSAcc: 00 GSAttr: 00 GS:0000
- SSLim 1c000000 SSBase: 00000000 SSAcc: f3 SSAttr: d0 SS:0053
- EBP: 000226d4 EIP: 1a02c0a0
- Base: 1a020000 Rel: 0000c0a0 Len: 00010000
- Object: 00000002
- Module: C:\OS2\DLL\DOSCALL1.DLL
- Size: 87884
- Timestamp:Mon Nov 23 08:01:48 1992
-
- Lo Function: DOSREAD
- Hi Function: DOSCOPY
-
- EBP: 000226e4 EIP: 00012a75
- Base: 00010000 Rel: 00002a75 Len: 00010000
- Object: 00000001
- Module: C:\WORK\DEBUG\CATCH.EXE
- Size: 18778
- Timestamp:Sun Sep 27 00:08:00 1992
-
- Lo Function: terminate
- Hi Function: UNKNOWN
-
- EBP: 00022754 EIP: 00011ea5
- Base: 00010000 Rel: 00001ea5 Len: 00010000
- Object: 00000001
- Module: C:\WORK\DEBUG\CATCH.EXE
- Size: 18778
- Timestamp:Sun Sep 27 00:08:00 1992
-
- Lo Function: mig_eib_store
- Hi Function: UNKNOWN
-
- EBP: 00022778 EIP: 000119f4
- Base: 00010000 Rel: 000019f4 Len: 00010000
- Object: 00000001
- Module: C:\WORK\DEBUG\CATCH.EXE
- Size: 18778
- Timestamp:Sun Sep 27 00:08:00 1992
-
- Lo Function: mig_eib_store
- Hi Function: UNKNOWN
-
- EBP: 000227b4 EIP: 00012144
- Base: 00010000 Rel: 00002144 Len: 00010000
- Object: 00000001
- Module: C:\WORK\DEBUG\CATCH.EXE
- Size: 18778
- Timestamp:Sun Sep 27 00:08:00 1992
-
- Lo Function: mig_eib_store
- Hi Function: UNKNOWN
-
- EBP: 00022b50 EIP: 1a02c60f
- Base: 1a020000 Rel: 0000c60f Len: 00010000
- Object: 00000002
- Module: C:\OS2\DLL\DOSCALL1.DLL
- Size: 87884
- Timestamp:Mon Nov 23 08:01:48 1992
-
- Lo Function: DOSREAD
- Hi Function: DOSCOPY
-
- EBP: ffffffff EIP: 0001235c
- Base: 00010000 Rel: 0000235c Len: 00010000
- Object: 00000001
- Module: C:\WORK\DEBUG\CATCH.EXE
- Size: 18778
- Timestamp:Sun Sep 27 00:08:00 1992
-
- Lo Function: mig_eib_store
- Hi Function: UNKNOWN
-
- EIP: 1a02c0a0, DLL: C:\OS2\DLL\DOSCALL1.DLL Func: DOSREAD
- Thread 1 Terminated
- EIP: 1a02c5ad, DLL: C:\OS2\DLL\DOSCALL1.DLL Func: DOSREAD
- Process Terminated
- EIP: 0001051c, DLL: C:\WORK\DEBUG\CATCH.EXE Func: _RunExitList
-
-
- Current Limitations
-
- The current release has the current limitations:
-
- 1) Only the program started will be monitored. Any subprocesses started by
- the program will not be monitored.
-
- 2) The shareware version does not have the debugging DLLs.
-
- 3) The first release has an annoying flashing effect. I am still working
- to find why this is happening. Hopefully the next version will have
- this fixed.
-
- 4) Crossing 16-32 bit function calls is not currently supported for the
- stack trace.
-
- 5) Tracing of 16 bit stacks may be incorrect for code with near calls in
- the trace.
-
-
- Copyright and Legal Information
-
- Sherlock is Copyrighted (c) 1992 by Harfmann Software. All rights reserved.
-
- Sherlock is not public domain or free software.
-
- Sherlock is distributed under the Shareware concept. Non-registered users of
- Sherlock are granted a limited license to use Sherlock for a trial period of
- 2 weeks in order to determine whether Sherlock suits their needs. Under no
- circumstances can an un-registered version of Sherlock be used by a business,
- organization, or institution of any kind after the trial period.
-
- All users are granted a limited license to distribute shareware versions of
- Sherlock subject to the following restrictions:
-
- - Sherlock is distributed in unmodified form, along with all program,
- documentation, and any other files present in the original package.
- - Sherlock is not bundled with any other product.
- - No distribution fee is charged other than cost of materials.
-
- Registered copies are NEITHER free software nor shareware. Users are granted
- unlimited use of registered copies of Sherlock subject to the following
- restrictions:
-
- - Sherlock once registered may be installed and used on only one machine at a
- time.
-
- - Users are not free to copy, modify, or redistribute registered copies of
- Sherlock IN ANY WAY whatsoever.
-
- Bulletin Board Services are free to post Sherlock for downloading to
- prospective users, providing that no fee is charged for such downloading,
- aside from possible connect charges.
-
- Any other groups, companies, or organizations who wish to distribute Sherlock
- must obtain prior written approval from Harfmann Software.
-
- There is no warranty for the program, to the extent permitted by applicable
- law. This program is provided "as is" without warranty of any kind, either
- expressed or implied, including, but not limited to, theimplied warranties
- of merchantability and fitness for a particular purpose. The entire risk
- as to the quality and performance of the program is with you. Should the
- program prove defective, you assume the cost of all necessary servicing,
- repair or correction.
-
- In no event unless required by applicable law or agreed to in writing
- will any copyright holder, or any other party who may modify and/or
- redistribute the program as permitted above, be liable to you for damages,
- including any general, special, incidental or consequential damages arising
- out of the use or inability to use the program (including but not limited
- to loss of data or data being rendered inaccurate or losses sustained by
- you or third parties or a failure of the program to operate with any other
- programs), even if such holder or other party has been advised of the
- possibility of such damages.
-
-
- Registration and Ordering Information
-
- Registering Sherlock will entitle you to continued use of Sherlock beyond the
- trial period. Furthermore, it will entitle you to receive, free of charge, the
- latest upgrade to Sherlock. You will also receive a set of DLLs to support
- debugging information.
-
- To register your copy of Sherlock, fill out the order form on the following
- page, and send it, along with a check or money order for $25 in U.S. funds to:
-
- Harfmann Software
- 607 South 19th
- Lafayette, IN 47905
-
- Corporate users and other institutions should inquire at the above address
- regarding charges for site licensing of Sherlock.
-
- Note that continued use of an unregistered copy is a violation of the
- licensing agreement. Support Shareware-register your copy today!
-
-
-
- Sherlock
-
-
-
- Order Form
-
-
- Sherlock version 1.00
- ------------------------------------------------------------
-
- Sherlock 1.00 (includes program disk & registration)
-
- ____ @ $25 U.S. ______
-
- Please make checks or money orders payable in U.S. funds
-
-
- Name ________________________________________________
-
- Company ________________________________________________
-
- Address ________________________________________________
-
- ____________________________________________________
-
- ____________________________________________________
-
- Phone ____________________ Business ______________________
-
-
- Where did you obtain Sherlock?
-
- _____________________________________________________
-
- Comments/Suggestion?
-
- _____________________________________________________
-
- _____________________________________________________
-
- _____________________________________________________
-
- _____________________________________________________
-