John
John

Reputation: 127

How to view VB6 control-level variables in WinDbg?

I have a crash file where I can see that one of my own VB6 user controls is responsible for the crash; i.e. one of its methods is part of the stack trace and I can see the line responsible.

From here, I'd like to inspect the state of its member variables. How do I do this?

Note: I also have the private symbols for my controls. The problem is being able to inspect "Me". The command !object address_of_Me doesn't seem to do the trick and so I'm at a loss.

Thank you.

Upvotes: 8

Views: 583

Answers (2)

Derek Tomes
Derek Tomes

Reputation: 4007

It's been 10 years since I had to do this in VB6, but I remember a lot of Printer.Print statements in my past life :)

I used to do things like this for debugging (but not for release code)

Sub MySub
    On Error Goto ErrorTrap
    Dim intX as integer
    Dim intY as integer

    ' do some horrible error here

Exit Sub

ErrorTrap:
    Printer.Print "Error"
    Printer.Print intX
    Printer.Print intY
    Printer.Print ...

End Sub

Upvotes: 1

Carlos Cocom
Carlos Cocom

Reputation: 932

well, codeSMART have one option install global handle on your application first call to SetUnhandledExceptionFilter (win api) is should be installed when load your module main or master form when is closing the program so call to SetUnhandledExceptionFilter.

The code is little long so copy methods names y api calls

Public Sub InstallGlobalHandler()
On Error Resume Next

If Not lnFilterInstalled Then
    Call SetUnhandledExceptionFilter(AddressOf GlobalExceptionHandler)
    lnFilterInstalled = True
End If
End Sub

Public Sub UninstallGlobalExceptionHandler()
On Error Resume Next

If lnFilterInstalled Then
    Call SetUnhandledExceptionFilter(0&)
    lnFilterInstalled = False
End If
End Sub

Also here is Record Structure y apis declarations for the module

- CopyMemory 
- SetUnhandledExceptionFilter
- RaiseException
' Public enums
-EExceptionType
-EExceptionHandlerReturn    
-Private Const EXCEPTION_MAXIMUM_PARAMETERS = 15
' Private record structure
-Private Type CONTEXT      
'Structure that describes an exception.
-Private Type EXCEPTION_RECORD
'Structure that contains exception information that can be used by a debugger.
-Private Type EXCEPTION_DEBUG_INFO
-Private Type EXCEPTION_POINTERS

Take a revised that How to route the exe exception back to VB6 app?

Upvotes: 0

Related Questions