.NET - WinDBG - 字符串的内容

标签 .net debugging windbg

我正在尝试调试大型应用程序中的内存泄漏。我的第一步是熟悉 WinDBG。我在 .NET 中有以下程序:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Try
        Dim HelloWorld As String = "HelloWorld"
        Dim testInt As Integer
        Me.Show()
        For testInt = 0 To 1000000
            TextBox1.Text = testInt 'There is a textbox on the form
            Application.DoEvents() 'So textbox updates on the fly
        Next

    Catch ex As Exception

    End Try
End Sub

我想在WinDbg中查看HelloWorld变量的内容,应该是“HelloWorld”。我已遵循这些说明:

1) 将 WinDBG 附加到可执行文件并启动调试器。

2) 立即中断(在循环结束之前)

3) 通过 sos clr 加载

4) ~0s

5) !clrstack

6) !dumpheap -type WinDBG (名为WinDBGApplication的项目)

输出是这样的:

Statistics:
      MT    Count    TotalSize Class Name
00186f88        1           12     WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[WinDBGTest.My.MyProject+MyWebServices, WinDBGTest]]
00186e80        1           12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[WinDBGTest.My.MyProject+MyForms, WinDBGTest]]
00186e2c        1           12 WinDBGTest.My.MyProject+MyForms
00186d3c        1           12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[Microsoft.VisualBasic.ApplicationServices.User, Microsoft.VisualBasic]]
00186cec        1           12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[WinDBGTest.My.MyComputer, WinDBGTest]]
00186be8        1           12 WinDBGTest.My.MyProject+ThreadSafeObjectProvider`1[[WinDBGTest.My.MyApplication, WinDBGTest]]
00184bf4        1          104 WinDBGTest.My.MyApplication
00187308        1          328 WinDBGTest.Form1
Total 8 objects

没有证据表明存在名为 HelloWorld 的字符串,根据我对低级调试的有限理解,应该存在。我做错了什么?

我已经尝试了 Rockstart 的建议并得到了这个输出:

OS Thread Id: 0x7a0 (0)
ESP/REG  Object   Name
0039E5EC 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E63C 0234dadc System.Windows.Forms.TextBox
0039E658 0234dadc System.Windows.Forms.TextBox
0039E668 0234dadc System.Windows.Forms.TextBox
0039E680 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E698 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E6A8 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E7FC 0234dadc System.Windows.Forms.TextBox
0039E864 02604b10 System.Windows.Forms.Control+MultithreadSafeCallScope
0039E868 02604b68 System.String    26309
0039E878 026049a8 System.String    26310
0039E87C 0234dadc System.Windows.Forms.TextBox
0039E880 026049a8 System.String    26310
0039E884 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E890 0234db94 System.Windows.Forms.Control+ControlNativeWindow
0039E8A0 026049a8 System.String    26310
0039E8AC 0234dadc System.Windows.Forms.TextBox
0039E8B4 0234db84 System.Windows.Forms.PropertyStore
0039E8C8 0234dadc System.Windows.Forms.TextBox
0039E8CC 026049a8 System.String    26310
0039E8DC 026049a8 System.String    26310
0039E8E0 0234dadc System.Windows.Forms.TextBox
0039E8EC 0234dadc System.Windows.Forms.TextBox
0039E8F0 0234dadc System.Windows.Forms.TextBox
0039E904 0234d4e4 WinDBGTest.Form1
0039E940 0234d4e4 WinDBGTest.Form1
0039E944 0234e4c0 System.EventHandler
0039E970 0234a1c4 System.EventArgs
0039E978 0234d4e4 WinDBGTest.Form1
0039E9DC 0234d4e4 WinDBGTest.Form1
0039EA00 0234d4e4 WinDBGTest.Form1
0039EAE0 0234d984 System.Windows.Forms.Control+ControlNativeWindow
0039ED28 0234d4e4 WinDBGTest.Form1
0039ED34 0234d4e4 WinDBGTest.Form1
0039ED3C 0234d4e4 WinDBGTest.Form1
0039ED44 0234d4e4 WinDBGTest.Form1
0039ED4C 0234d4e4 WinDBGTest.Form1
0039EDCC 0234d4e4 WinDBGTest.Form1
0039EE18 023491c8 System.Windows.Forms.Application+ThreadContext
0039EE58 023490c8 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase+WinFormsAppContext
0039EE8C 02348f54 WinDBGTest.My.MyApplication
0039EEA8 02348f54 WinDBGTest.My.MyApplication
0039EEB8 02348f54 WinDBGTest.My.MyApplication
0039F1D8 02348640 System.Object[]    (System.String[])

最佳答案

变量 Helloworld 将存储在堆栈中。因此使用,!dso 来转储堆栈对象。你应该能够看到 Helloworld 字符串

关于.NET - WinDBG - 字符串的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9860372/

相关文章:

debugging - Hudson 和配置(调试、发布、并行等)

java - 有没有一个很好的独立的、轻量级的、基于 GUI 的 mac Java 调试工具?

4.0 和 4.5.1 的 ASP.NET Web Farm 导致无效的回发或回调参数异常

c# - 在 i4o 库中使用可索引属性

javascript - 为什么我的 JavaScript 函数只在调试中找不到?

windbg - 这些问号在 Windbg 中是什么意思?

asp.net - 将外部DLL加载到WinDBG

c# - 可嵌入文件打开对话框

.net - 在 BindingList<T> 中查找

c++ - windows故障转储文件详细内存使用分析?