Link to home
Start Free TrialLog in
Avatar of jhance
jhance

asked on

Debugging a VB Application

Hello VB gurus....

I'm a user of an application that is written in VB (6.0 I believe) and it is crashing on my system.  I have isolated a few steps that cause the crash and captured a DRWATSON log of the event.  

With this information, I've contacted the company that developed this program.  Since I'm a software developer myself (but typically using VC++) I know that a DRWATSON.LOG file is incredibly useful in pinpointing the location and cause of a crash.

The company of this VB application, however, said:

"The error log dump is useless information for anyone other than a Microsoft engineer familiar with their use of hex addresses.  We do not have a solution for this."

In other words, they don't know how to locate the cause of this problem and therefore cannot fix it.

So my question is:

1) Is it true that the DRWATSON log file is useless to a VB developer?

2) If so, how does a VB developer solve a:

Exception number: c0000005 (access violation)

error in his application?

3) If it is useful, how does one go about using the DRWATSON.LOG (or other debug information) to traceback to the source of the problem?

Below is the rest of the DRWATSON.LOG file for your enjoyment.  Any additional advice would be greatly appreciated....

Thanks.

Application exception occurred:
        App:  (pid=736)
        When: 6/9/2001 @ 17:42:45.009
        Exception number: c0000005 (access violation)

*----> System Information <----*
        Computer Name: TESTBED
        User Name: Administrator
        Number of Processors: 1
        Processor Type: x86 Family 6 Model 8 Stepping 6
        Windows 2000 Version: 5.0
        Current Build: 2195
        Service Pack: 1
        Current Type: Uniprocessor Free
        Registered Organization: JW Hance
        Registered Owner: JW Hance

*----> Task List <----*
   0 Idle.exe
   8 System.exe
 136 smss.exe
 164 csrss.exe
 184 winlogon.exe
 212 services.exe
 224 lsass.exe
 388 svchost.exe
 428 SPOOLSV.exe
 472 svchost.exe
 508 regsvc.exe
 528 mstask.exe
 604 vsmon.exe
 548 winmgmt.exe
 756 minilog.exe
 868 explorer.exe
 964 msmsgs.exe
 972 NETSWT~1.exe
1028 zonealarm.exe
1052 IEXPLORE.exe
 736 swmm.exe
 276 IEXPLORE.exe
 720 drwtsn32.exe
   0 _Total.exe

(00400000 - 012AF000)
(77F80000 - 77FFA000)
(66000000 - 66153000)
(77E80000 - 77F35000)
(77E10000 - 77E74000)
(77F40000 - 77F7C000)
(77DB0000 - 77E0A000)
(77D40000 - 77DB0000)
(77A50000 - 77B45000)
(779B0000 - 77A45000)
(691D0000 - 69255000)
(78000000 - 78046000)
(10000000 - 10043000)
(234C0000 - 234DE000)
(70200000 - 70278000)
(70BD0000 - 70C1C000)
(77530000 - 77552000)
(71700000 - 7178A000)
(02610000 - 02677000)
(6C370000 - 6C462000)
(695E0000 - 69609000)
(02B10000 - 02B4B000)
(02B50000 - 03071000)
(25280000 - 2528B000)
(77800000 - 7781D000)
(752F0000 - 7530F000)
(77820000 - 77827000)
(759B0000 - 759B6000)
(76B30000 - 76B6E000)
(69800000 - 69A42000)
(24100000 - 2414D000)
(77570000 - 775A0000)
(03190000 - 031A1000)
(217A0000 - 217C3000)
(21C10000 - 21C2A000)
(03200000 - 03239000)
(03360000 - 0339E000)
(04470000 - 044FE000)
(78080000 - 78095000)
(780A0000 - 780B2000)
(04000000 - 04134000)
(0F9C0000 - 0FA22000)
(09250000 - 092F8000)
(03CE0000 - 03CEB000)
(0F680000 - 0F698000)
(034C0000 - 034E0000)

State Dump for Thread Id 0x200

eax=00000000 ebx=00000000 ecx=03e37124 edx=00000000 esi=ffffff7b edi=03e37120
eip=09288791 esp=0012e838 ebp=0012e854 iopl=0         nv up ei pl zr na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246


function: <nosymbols>
        09288775 c20400           ret     0x4
        09288778 56               push    esi
        09288779 57               push    edi
        0928877a ff74240c         push    dword ptr [esp+0xc]    ss:00babe0f=08558b00
        0928877e e8c041ffff       call    DLLGetDocumentation+0x28f6d (0927c943)
        09288783 8bf8             mov     edi,eax
        09288785 837f0401         cmp    dword ptr [edi+0x4],0x1 ds:048b46f6=????????
        09288789 8d4f04           lea     ecx,[edi+0x4]          ds:048b46f6=????????
        0928878c 7507             jnz     DLLGetDocumentation+0x3d8bf (09291295)
        0928878e 8b4104           mov     eax,[ecx+0x4]          ds:048b46fa=????????
FAULT ->09288791 8b30             mov     esi,[eax]              ds:00000000=????????
        09288793 eb03             jmp     DLLGetDocumentation+0x3d8c2 (09291298)
        09288795 8b7104           mov     esi,[ecx+0x4]          ds:048b46fa=????????
        09288798 e87d45ffff       call    DLLGetDocumentation+0x29344 (0927cd1a)
        0928879d 03473c           add     eax,[edi+0x3c]         ds:048b46f6=????????
        092887a0 5f               pop     edi
        092887a1 d1ee             shr     esi,1
        092887a3 03c6             add     eax,esi
        092887a5 5e               pop     esi
        092887a6 c20400           ret     0x4
        092887a9 56               push    esi
        092887aa ff742408         push    dword ptr [esp+0x8]    ss:00babe0f=08558b00

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
0012E854 09296461 01FFFF7B 0000001F 0000014C 03E31804 !DLLGetDocumentation
0012E890 092964DB FFFFFF7B 00000100 03E31A30 00000200 !DLLGetDocumentation
0012E8E0 09293083 00000003 00000000 03E316B8 00000001 !DLLGetDocumentation
0012E940 0927E3A6 00000415 00000001 00000000 00000415 !DLLGetDocumentation
0012E9CC 09281104 00000415 00000001 00000000 0012EA00 !DLLGetDocumentation
0012E9E0 0927BC58 0012EA14 000603D6 00000415 00000001 !DLLGetDocumentation
0012EA00 77E148DC 000603D6 00000415 00000001 00000000 !DLLGetDocumentation
0012EA20 77E17EF9 0927BC3E 000603D6 00000415 00000001 user32!PtInRect
0012EA44 77E17F75 0927BC3E 000603D6 00000415 00000001 user32!MonitorFromWindow
0012EA64 09255DEA 0927BC3E 000603D6 00000415 00000001 user32!CallWindowProcA
0012EAAC 09258589 000603D6 00000415 00000001 00000000 !DLLGetDocumentation
0012EB00 09260FCC 09339880 093397F0 00000000 091C350C !DLLGetDocumentation
0012EB40 0929F2A1 00000018 00000000 00000000 00000000 !DLLGetDocumentation
0012EB74 0929F35E 00000000 00000000 00000000 00000000 !DllUnregisterServer
0012EBA8 092A8EC6 03E337B8 000000A8 03D51238 00000000 !DllUnregisterServer
0012EBC0 660B3436 03E338D8 00000009 00000001 00000000 !DllUnregisterServer
0012EC1C 660B2A6B 03D4C604 03D4CF0C 03D4CE1C 00000000 MSVBVM60!DllCanUnloadNow
0012ED18 660C4FE0 03D4CE1C 01E51F9C 0000004A 00001011 MSVBVM60!DllCanUnloadNow
0012ED40 660C4DCA 03D4CE1C 03D4CE1C 660C459A 03D4CE1C MSVBVM60!DllCanUnloadNow
0012EDB8 6602364A 03D4CE1C 000603D4 00001011 00000003 MSVBVM60!DllCanUnloadNow
0012EEDC 6605BEE6 03D4CE1C 00000000 00000000 00A6F780 MSVBVM60!EVENT_SINK_AddRef
0012F0B4 6602AEF0 091A5AC8 0012F0D0 0045F096 091A5C38 MSVBVM60!IID_IVbaHost
0012F0C0 0045F096 091A5C38 0045E848 0012F11C 6602AECD MSVBVM60!BASIC_CLASS_Invoke
0012F0D0 6602AECD 0045F096 0012F18C 00000002 00000000 !<nosymbols>
0012F11C 66023162 0012F1CC 0012F18C 00000002 01E55190 MSVBVM60!BASIC_CLASS_Invoke
0012F1F0 66022FF1 03D4B374 03D4B52C 01E55190 00000002 MSVBVM60!EVENT_SINK_AddRef
0012F214 660211BE 03D4B374 0000000A 00000000 77E1571A MSVBVM60!EVENT_SINK_AddRef
0012F278 660205F1 01E55190 000703D2 0000100E 0000000A MSVBVM60!EVENT_SINK_AddRef
0012F3F8 660213A8 03D4B374 000703D2 0000100E 0000000A MSVBVM60!EVENT_SINK_AddRef
0012F420 66020361 03D4B374 000703D2 0000100E 0000000A MSVBVM60!EVENT_SINK_AddRef
0012F47C 77E148DC 000703D2 0000100E 0000000A 00000000 MSVBVM60!EVENT_SINK_AddRef
0012F49C 77E14AA7 660202B7 000703D2 0000100E 0000000A user32!PtInRect
0012F528 77E266FD 0012F54C 00000001 66014979 0012F54C user32!TranslateMessageEx
0012F574 660148B2 00000004 01E5374C 01E5381C 01E53744 user32!DispatchMessageA
0012F5B8 66014790 01E5381C 00000004 000002E0 00000004 MSVBVM60!_vbaInStr
6601A360 66010E00 6601178A 660D41D8 660D4203 66010E93 MSVBVM60!_vbaInStr
660D3526 0C2474FF FF0C408B 8B0C2474 11FF5008 8B000CC2 MSVBVM60!BASIC_CLASS_QueryInterface
0424448B 00000000 00000000 00000000 00000000 00000000 <nosymbols>

*----> Raw Stack Dump <----*
0012e838  00 1c e3 03 7b ff ff ff - d6 63 29 09 7b ff ff ff  ....{....c).{...
0012e848  4c 01 00 00 f5 01 00 00 - 30 1a e3 03 90 e8 12 00  L.......0.......
0012e858  61 64 29 09 7b ff ff 01 - 1f 00 00 00 4c 01 00 00  ad).{.......L...
0012e868  04 18 e3 03 30 1a e3 03 - 00 00 00 00 10 00 00 00  ....0...........
0012e878  08 02 00 00 b3 00 00 00 - 00 00 00 00 10 00 00 00  ................
0012e888  08 02 00 00 b3 00 00 00 - e0 e8 12 00 db 64 29 09  .............d).
0012e898  7b ff ff ff 00 01 00 00 - 30 1a e3 03 00 02 00 00  {.......0.......
0012e8a8  1f 59 25 09 d6 03 06 00 - 8b 04 00 00 00 00 00 00  .Y%.............
0012e8b8  00 00 00 00 00 00 00 00 - 8b 04 00 00 90 7c 35 01  .............|5.
0012e8c8  e8 e8 12 00 85 84 e1 77 - 00 1c e3 03 d0 82 28 09  .......w......(.
0012e8d8  03 00 00 00 00 01 00 00 - 40 e9 12 00 83 30 29 09  ........@....0).
0012e8e8  03 00 00 00 00 00 00 00 - b8 16 e3 03 01 00 00 00  ................
0012e8f8  00 00 00 00 00 00 00 00 - f0 e8 12 00 00 00 00 00  ................
0012e908  98 f0 12 00 43 b5 e3 77 - e0 51 e1 77 28 e9 12 00  ....C..w.Q.w(...
0012e918  04 11 28 09 33 04 00 00 - 00 00 00 00 00 00 00 00  ..(.3...........
0012e928  00 00 00 00 b8 16 e3 03 - 01 00 00 00 b8 16 e3 03  ................
0012e938  b8 16 e3 03 cc e9 12 00 - cc e9 12 00 a6 e3 27 09  ..............'.
0012e948  15 04 00 00 01 00 00 00 - 00 00 00 00 15 04 00 00  ................
0012e958  3e bc 27 09 00 00 00 00 - 3e bc 27 09 cd ab ba dc  >.'.....>.'.....
0012e968  8c e9 12 00 f9 7e e1 77 - 3e bc 27 09 d6 03 06 00  .....~.w>.'.....
ASKER CERTIFIED SOLUTION
Avatar of AzraSound
AzraSound
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
jhance,

Maybe you can point them to some tutorial or book, e.g.
http://www.vb2themax.com/HtmlDoc.asp?Table=Books&ID=3400&Page=1
(It has C++ in title, but it is on VB site)

I would first suggest you to clear your \temp and \tmp folders.
Then I would ask if this started recently - after you installed or reinstalled some other software.
It is good chance some dll is damaged/changed.

Maybe you can ask them to create debug version for you.
In VB IDE, Project properties, on Compile tab, there is checkbutton "Create Symbolic Debug Info".
Then it is possible "function: <nosymbols>" will have some name they will recognize.

In VB code, I would check few things:
- In Class_Terminate events they should use 'On Error Resume Next' error handling.
- if they are saving pointers to objects into non-object variables, they should revise that technique
   (in VB it is not possible to check if pointer points to valid object)
- any CopyMemory, StrPtr, VarPtr or ObjPtr usage, or subclassing
If this happens on any Win2K machine
- some APIs have different declaration for Win2K
Avatar of jhance
jhance

ASKER

>>I would first suggest you to clear your \temp and \tmp folders.

This problem is 100% reproducable and happens in exactly the same way on 3 different systems, but this particular error happens only on W2K systems.  There are similar errors that happen on Win98.

I suspect they are setting an object to "Nothing" and then not re-creating it.  The crash happens if you choose a function in the application that opens a window, you close that window and then open it again.  Then it crashes.  If you open a DIFFERENT window first, then you never see this problem.

So my theory is that the first time you open the window an object get created and a flag is set.  When you close the window the object is destroyed but the flag is not cleared.  Then when you open it again, the flag says the object is already created but it's not really there and so when it gets referenced, BOOM! (At least that my C/C++ centric explanation)  
>This problem is 100% reproducable
Your explanation should be enough for them to fix the problem, maybe you should change your approach.
- send a lovely young girl to ask them very nice to repair it
- sue them if you have warranty or you have maintenance contract
- find another supplier (e.g. ameba won't tell you "We do not have a solution for this" ;-))
Avatar of jhance

ASKER

I sent them the description of how to cause the problem and the DR WATSON log.  And they reply (as I noted above):

"The error log dump is useless information for anyone other than a Microsoft engineer familiar with
their use of hex addresses.  We do not have a solution for this."

They claim not to know how to diagnose this.  If this were a VC++ problem, I would be able to tell them EXACTLY how to backtrack to the line in the source code that caused the fault.  My problem is that I have very limited knowledge of how VB works and how to debug.
>I would be able to tell them EXACTLY how to backtrack to the line in the source code

I'm afraid this cannot be done in VB that easy.
VB IDE will let you change code / add functions while debugging, but VB cannot use its debugger when application is compiled.

There are tools that will add line numbers to vb source, and log everything - as AzraSound mentioned.

If they are willing to work with you/us, ask for
- debug version of EXE - no optimizations
- code of the 'function in the application that opens a window' and code in Form_Load() and Form_Unload() in that window (form).

Maybe you can point them to this topic area.
>>There are tools that will add line numbers to vb source, and log everything - as AzraSound mentioned

actually, the products i mention are more than the typical add-ins using line numbers and Erl for locating errors.  i believe they tap into the realm of true debugging using the debug libraries.  most likely, they implement a lot of what is discussed in these series of "Bugslayer" articles by John Robbins:

http://www.wintellect.com/instructors/robbins/sum.asp
first article of particular interest may be this one:
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0498/bugslayer0498.htm

it comes with a free utility that you may be able to use
ameba said, "- find another supplier (e.g. ameba won't tell you "We do not have a solution for this" ;-)) "

That's pretty much what I was going to suggest.

And I've also never found the DrWatson info to be of any use.

--
In general, you fix a VB bug by either:

1) Guessing as to where the problem is, then fixing things until the problem goes away (the amateur way, which is also useful yo professionals working on unimportant projects.)

2) Adding proper error-trapping to ensure that any error occurs display a decent message and allows the app to either properly shut down or at resume without shutting down.

I suspect that the company you are dealing with fits category #1.  If they don't understand #2, then you probably want to find a new source for your code, even if it means getting it re-written by an expert.

How do you know if someone's an expert?  It's pretty hard, because you generally have to be an expert to know, and then you wouldn't need this person.  However, one approach is to look at references, ask about other projects, and MOST OF ALL, see if they'll give you a straight answer to your questions.  When they start side-stepping your questions, it's time to side-step them as your expert-for-hire.
Avatar of jhance

ASKER

Believe me, I would love to find another supplier.

Unfortunately, this is a commercial application where there is no competition and this is the only choice.

The application is Meet Manager from Hy-Tek Sports, Ltd.:

http://www.hy-tekltd.com/swim/

My kinds are involved in swimming and I (being the skilled computer person that I am) often end up running this program during swim meets.  It is incredibly annoying to have it crash all the time especially since a system reboot is often needed afterwards since parts of the program keep running and it thinks there is already a copy running when you try and restart the application.

These guys are pretty clueless and it would be GREAT if there were an alternative...  But this application is just about the only choice and (worst of all) is probably 99% entrenched in the amateur swimming scene.
Sounds like an opportunity ...

Meanwhile, I guess the best you can do is to try to convince the amateur programming group that this can be fixed by simply adding error trapping...

Do you think they'd be willing to part with the source code so you can fix it yourself?  We tried this with a company once, and they offered to "rent" us the source code as long as we returned it with the fixes so they could sell the new version since they had no intention of upgrading.  We politely told them to shove it and wrote our own version since we had a very good grasp of everything that was needed!

Since you sound quite qualified to handle a project such as that, the only question seems to be whether you have the time and desire to overcome this bug.
Avatar of jhance

ASKER

I agree it's an opportunity. A work-alike program could be a big success.  I think they charge way too much for this app.  A minimal system with all the parts needed for a swim meet is about $800.  I think a competitive program at $400 would sell fast the next time upgrades came out (which are expensive too....) And I'm sure that even converting their database would be relatively trivial as they are all based on MS ACCESS (i.e. mdb files).

What I don't have (and I'm sure you can relate to this) is TIME!  I'm already as busy as I can be....



If you can give me specs, I work with a group that does projects like this, and we may be able to get you a free prototype.  E-mail me at RSpahitz @ yahoo . com
Avatar of jhance

ASKER

Well,  I guess the opinion is that VB programs cannot truly be debugged since the crash data doesn't relate back to anything!  What a sorry state of affairs!!!  

I'm sure glad I never wasted much energy toward learning it...
>I'm sure glad I never wasted much energy toward learning it...

Yeah, right, you are a "Real Programmer".
Well, gee.  It's not VB's fault that Windows talks a different language.  If Windows were written in VB (chuckle) then maybe C would be the one having problems with messaging!