Original URL: | https://blogs.msdn.microsoft.com/alejacma/2009/07/20/managed-debugging-with-windbg-setting-a-breakpoint-part-2/ |
Post name: | MANAGED DEBUGGING with WINDBG. Setting a Breakpoint. Part 2 |
Original author: | Alejandro Campos Magencio |
Posting date: | 2009-07-20T05:40:00+00:00 |
Hi all,
This post is a continuation of MANAGED DEBUGGING with WINDBG. Setting a Breakpoint. Part 1.
SETTING A BREAKPOINT. Part 2
· We set the breakpoint: Regardless if method is jitted, we can set a breakpoint on a method by using its Method Descriptor: 0:004> !BPMD -md 00766d60 MethodDesc = 00766d60 Setting breakpoint: bp 00850A08 [WindowsApplication1.Form1.InitializeComponent()]
If it’s jitted, we can use its jitted code address: 0:004> bp 00850a08
And if we know the name of the method and in which module we can find it, we can set the breakpoint directly like this: 0:004> !BPMD WindowsApplication1 WindowsApplication1.Form1.InitializeComponent Found 1 methods... MethodDesc = 00766d60 Setting breakpoint: bp 00850A08 [WindowsApplication1.Form1.InitializeComponent()]
We can check that the breakpoint has been correctly set: 0:004> bl
0 e 00850a08 0001 (0001) 0:**** WindowsApplication1!WindowsApplication1.Form1.InitializeComponent()
If the method is not jitted, the breakpoint will be set whenever it gets jitted, so it won’t appear in the list of breakpoints until then: 0:004> !BPMD WindowsApplication1 WindowsApplication1.Form1.Button1_Click
Found 1 methods... MethodDesc = 00766db8 Adding pending breakpoints... 0:004> !BPMD -md 00766db8 MethodDesc = 00766db8 Adding pending breakpoints...
· We can enable, disable and remove the breakpoints: 0:004> bl 0 e 00391940 0001 (0001) 0:**** WindowsApplication1!WindowsApplication1.Form1.get_Button6() 1 e 00390a08 0001 (0001) 0:**** WindowsApplication1!WindowsApplication1.Form1.InitializeComponent() 0:004> bd * 0:004> bl 0 d 00391940 0001 (0001) 0:**** WindowsApplication1!WindowsApplication1.Form1.get_Button6() 1 d 00390a08 0001 (0001) 0:**** WindowsApplication1!WindowsApplication1.Form1.InitializeComponent() 0:004> bc 0 0:004> bl 1 d 00390a08 0001 (0001) 0:**** WindowsApplication1!WindowsApplication1.Form1.InitializeComponent() 0:004> be 1 0:004> bl 1 e 00390a08 0001 (0001) 0:**** WindowsApplication1!WindowsApplication1.Form1.InitializeComponent()
Next post: MANAGED DEBUGGING with WINDBG. Setting a Breakpoint. Part 3.
Index: MANAGED DEBUGGING with WINDBG. Introduction and Index.
Regards,
Alex (Alejandro Campos Magencio)
Comments: