【问题标题】:How to view VB6 control-level variables in WinDbg?如何在 WinDbg 中查看 VB6 控件级变量?
【发布时间】:2012-02-12 10:44:08
【问题描述】:

我有一个崩溃文件,我可以在其中看到我自己的一个 VB6 用户控件导致崩溃;即它的一种方法是堆栈跟踪的一部分,我可以看到负责的行。

从这里,我想检查其成员变量的状态。我该怎么做?

注意:我的控件也有私有符号。问题是能够检查“我”。命令 !object address_of_Me 似乎没有奏效,所以我不知所措。

谢谢。

【问题讨论】:

  • +1 我也很想知道怎么做

标签: com vb6 activex windbg


【解决方案1】:

自从我不得不在 VB6 中这样做已经有 10 年了,但我记得我前世的很多 Printer.Print 语句:)

我曾经做过这样的事情来调试(但不是为了发布代码)

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

【讨论】:

    【解决方案2】:

    好吧,codeSMART 有一个选项,在您的应用程序上安装全局句柄,第一次调用 SetUnhandledExceptionFilter (win api) 应该在加载模块主窗体或主窗体时安装,然后在关闭程序时调用 SetUnhandledExceptionFilter。

    代码有点长,所以复制方法名称和 api 调用

    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
    

    这里还有模块的记录结构和 API 声明

    - 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
    

    修改一下How to route the exe exception back to VB6 app?

    【讨论】:

      猜你喜欢
      • 2013-07-17
      • 1970-01-01
      • 1970-01-01
      • 2020-04-13
      • 1970-01-01
      • 2013-08-15
      • 1970-01-01
      • 1970-01-01
      • 2020-03-16
      相关资源
      最近更新 更多