[Tutor] getting access violation error in kernel32.dll while debugging

alan.gauld@bt.com alan.gauld@bt.com
Wed, 15 May 2002 18:38:44 +0100


> Hmm, after some searching on the web I find out that Dr. Watson comes
> with windows.  

Every version except Win95 for some reason(maybe Me too?)

> thought it was some sort of add-on product.  Funny that users must run
> a program that is installed but not run by default in order to provide
> a mechanism for terminating misbehaving programs without hurting the
> kernel so bad.

It does that by accident, it really is just the tool that 
generates the core dump data.

> Are those boxes well known?  

To professional Windows developers yes. They've been there since 
Windows 3.1 at least.

> Do institutions that use windows teach that to students?  

My school didn't even teach us about debuggers so I doubt it!

> Ahh, but a SIGSEGV delivered to your app shows that your app is
> bugged, and a backtrace of the core file will point you to the line
> where the bad pointer was dereferenced.  Unix doesn't tell you the
> *kernel* just did something fubar.

Oh I dunno. I used to work on a Unix app where if you moved the 
mouse too fast it killed not just X but Unix too - you got back 
to the big white bootup screen on the Sun workstation - scary!

> It should, but when the error occurs in kernel32.dll, how do you work
> through _that_ one?  (unless you can figure out that your program is
> messed somewhere and can then guess where)

The stack trace generated by Dr Watson will normally show where 
it came from - it only captures about 10 levels ISTR but thats 
usually enough.

> | In fact if using the Borland one you can even reverse step back
> | before the error and maybe fix it!  without leaving the program...
> 
> Interesting.  It can "undo" stuff?  How does it do that?  How does it
> know the operations are even reversible?  What if your app sent some
> data to something else (a socket, a file, a pipe, whatever).  Can it
> actually undo that?  I think the idea of "backup and try again slower
> so it can be debugged" is great, it just seems infeasible to me.

Its pretty magical to me too and it does have limits but it 
will record values of some socket calls for example for replay 
purposes or redo the call depending on how you set it up.

I assume they create a virtual machine and log all the steps 
and register values(I do know it operates at the assembler level)

> If the debugger really can "step backwards" that would be an
> improvement, but I'm doubtful that it works for apps that don't stay
> within certain restrictive boundaries.

Its pretty powerful but does impose a noticable performance hit 
over normal debugging.

> on windows, is there an equivalent to the 'host' command for testing
> if DNS works (or just to lookup DNS records)?

What's that then? I don't seem to have it on either of my Unix 
boxes(Solaris and HP/Ux) and its not listed in 'Unix in a Nushell'

Alan g.