www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - WinDbg

reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
Short question:

Would it be possible to get WinDbg to do source debugging for D?

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/source-window

What would it take? Possible at all?
Apr 13 2021
next sibling parent reply 12345swordy <alexanderheistermann gmail.com> writes:
On Tuesday, 13 April 2021 at 14:35:15 UTC, Imperatorn wrote:
 Short question:

 Would it be possible to get WinDbg to do source debugging for D?

 https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/source-window

 What would it take? Possible at all?
You should already given that dmd produces the .pdb file when generating debugging symbols for windows. - Alex
Apr 13 2021
parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 14:50:37 UTC, 12345swordy wrote:
 On Tuesday, 13 April 2021 at 14:35:15 UTC, Imperatorn wrote:
 Short question:

 Would it be possible to get WinDbg to do source debugging for 
 D?

 https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/source-window

 What would it take? Possible at all?
You should already given that dmd produces the .pdb file when generating debugging symbols for windows. - Alex
Really? 😱 I thought it couldn't track the sources. Nice
Apr 13 2021
prev sibling parent reply Siemargl <inqnone gmail.com> writes:
On Tuesday, 13 April 2021 at 14:35:15 UTC, Imperatorn wrote:
 Short question:

 Would it be possible to get WinDbg to do source debugging for D?

 https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/source-window

 What would it take? Possible at all?
1.Open .exe file 2.Open .d source file 3.Set breakpoint in source (F9) 4.Go Catching excepions: -for dmd -m64 or -m32mscoff builds >bp _d_throwc -for ldc -g builds >bp d_throw_exception Break start -ldc >bp Dmain
Apr 13 2021
next sibling parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 15:11:08 UTC, Siemargl wrote:
 On Tuesday, 13 April 2021 at 14:35:15 UTC, Imperatorn wrote:
 Short question:

 Would it be possible to get WinDbg to do source debugging for 
 D?

 https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/source-window

 What would it take? Possible at all?
1.Open .exe file 2.Open .d source file 3.Set breakpoint in source (F9) 4.Go Catching excepions: -for dmd -m64 or -m32mscoff builds >bp _d_throwc -for ldc -g builds >bp d_throw_exception Break start -ldc >bp Dmain
Thanks!!! Will try β˜€οΈ
Apr 13 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 15:29:25 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 15:11:08 UTC, Siemargl wrote:
 On Tuesday, 13 April 2021 at 14:35:15 UTC, Imperatorn wrote:
 Short question:

 Would it be possible to get WinDbg to do source debugging for 
 D?

 https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/source-window

 What would it take? Possible at all?
1.Open .exe file 2.Open .d source file 3.Set breakpoint in source (F9) 4.Go Catching excepions: -for dmd -m64 or -m32mscoff builds >bp _d_throwc -for ldc -g builds >bp d_throw_exception Break start -ldc >bp Dmain
Thanks!!! Will try β˜€οΈ
For me, when I try to open I just get an empty window with app.d in it https://ibb.co/jbm7zNs If I rename it to .cpp it opens, but doesn't work (obviously). What am I doing wrong? :(
Apr 13 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 17:08:37 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 15:29:25 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 15:11:08 UTC, Siemargl wrote:
 On Tuesday, 13 April 2021 at 14:35:15 UTC, Imperatorn wrote:
 [...]
1.Open .exe file 2.Open .d source file 3.Set breakpoint in source (F9) 4.Go Catching excepions: -for dmd -m64 or -m32mscoff builds >bp _d_throwc -for ldc -g builds >bp d_throw_exception Break start -ldc >bp Dmain
Thanks!!! Will try β˜€οΈ
For me, when I try to open I just get an empty window with app.d in it https://ibb.co/jbm7zNs If I rename it to .cpp it opens, but doesn't work (obviously). What am I doing wrong? :(
Hmm.. I kind of got it working in the normal version of windbg, but not in the WinDbg Preview version which is what I want. Anyone got that working?
Apr 13 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 17:45:58 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 17:08:37 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 15:29:25 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 15:11:08 UTC, Siemargl wrote:
 [...]
Thanks!!! Will try β˜€οΈ
For me, when I try to open I just get an empty window with app.d in it https://ibb.co/jbm7zNs If I rename it to .cpp it opens, but doesn't work (obviously). What am I doing wrong? :(
Hmm.. I kind of got it working in the normal version of windbg, but not in the WinDbg Preview version which is what I want. Anyone got that working?
Ok, I'm using the "old" WinDbg for now
Apr 13 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 18:21:13 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 17:45:58 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 17:08:37 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 15:29:25 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 15:11:08 UTC, Siemargl wrote:
 [...]
Thanks!!! Will try β˜€οΈ
For me, when I try to open I just get an empty window with app.d in it https://ibb.co/jbm7zNs If I rename it to .cpp it opens, but doesn't work (obviously). What am I doing wrong? :(
Hmm.. I kind of got it working in the normal version of windbg, but not in the WinDbg Preview version which is what I want. Anyone got that working?
Ok, I'm using the "old" WinDbg for now
**UPDATE** It was the debugging client and debugger engine that was outdated. And going to the MS store and doing "update" did *not* update it. I had to uninstall WinDbg Preview and then install it again to update it. The previous version that didn't work was: Client: 1.0.2007.06001 Engine: 10.0.20153.1000 And the new version that works is: Client: 1.2103.01004.0 Engine: 10.0.21306.1007
Apr 13 2021
parent reply Siemargl <inqnone gmail.com> writes:
On Tuesday, 13 April 2021 at 19:45:28 UTC, Imperatorn wrote:

 And going to the MS store and doing "update" did *not* update 
 it.
 I had to uninstall WinDbg Preview and then install it again to 
 update it.

 The previous version that didn't work was:
 Client: 1.0.2007.06001
 Engine: 10.0.20153.1000

 And the new version that works is:
 Client: 1.2103.01004.0
 Engine: 10.0.21306.1007
I've used regular windbg64 from windows10 sdk. version 10.0.19041.685
Apr 13 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 20:18:54 UTC, Siemargl wrote:
 On Tuesday, 13 April 2021 at 19:45:28 UTC, Imperatorn wrote:

 And going to the MS store and doing "update" did *not* update 
 it.
 I had to uninstall WinDbg Preview and then install it again to 
 update it.

 The previous version that didn't work was:
 Client: 1.0.2007.06001
 Engine: 10.0.20153.1000

 And the new version that works is:
 Client: 1.2103.01004.0
 Engine: 10.0.21306.1007
I've used regular windbg64 from windows10 sdk. version 10.0.19041.685
Yes, I did get the regular version to work. But I wanted the preview version. But now it works 😁
Apr 13 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 21:40:33 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 20:18:54 UTC, Siemargl wrote:
 On Tuesday, 13 April 2021 at 19:45:28 UTC, Imperatorn wrote:

 And going to the MS store and doing "update" did *not* update 
 it.
 I had to uninstall WinDbg Preview and then install it again 
 to update it.

 The previous version that didn't work was:
 Client: 1.0.2007.06001
 Engine: 10.0.20153.1000

 And the new version that works is:
 Client: 1.2103.01004.0
 Engine: 10.0.21306.1007
I've used regular windbg64 from windows10 sdk. version 10.0.19041.685
Yes, I did get the regular version to work. But I wanted the preview version. But now it works 😁
With this working, there should be no one saying we don't have good debuggers for Windows. https://en.wikipedia.org/wiki/WinDbg https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-using-windbg-preview
Apr 18 2021
parent reply Andre Pany <andre s-e-a-p.de> writes:
On Sunday, 18 April 2021 at 09:14:58 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 21:40:33 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 20:18:54 UTC, Siemargl wrote:
 On Tuesday, 13 April 2021 at 19:45:28 UTC, Imperatorn wrote:

 And going to the MS store and doing "update" did *not* 
 update it.
 I had to uninstall WinDbg Preview and then install it again 
 to update it.

 The previous version that didn't work was:
 Client: 1.0.2007.06001
 Engine: 10.0.20153.1000

 And the new version that works is:
 Client: 1.2103.01004.0
 Engine: 10.0.21306.1007
I've used regular windbg64 from windows10 sdk. version 10.0.19041.685
Yes, I did get the regular version to work. But I wanted the preview version. But now it works 😁
With this working, there should be no one saying we don't have good debuggers for Windows. https://en.wikipedia.org/wiki/WinDbg https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-using-windbg-preview
I tried WinDbg preview a few days ago. I am not really sure, I needed to press the buttons for "step in" "step over"... always three times. Actually I am not sure whether there is some functional issue or the performance is really bad (high end developer laptop). Did someone else experience this issue or had maybe a smooth experience? (Maybe this issue is occurring due to McAfee virus scanner?) Kind regards Andre
Apr 18 2021
parent reply Andre Pany <andre s-e-a-p.de> writes:
On Sunday, 18 April 2021 at 14:14:53 UTC, Andre Pany wrote:
 On Sunday, 18 April 2021 at 09:14:58 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 21:40:33 UTC, Imperatorn wrote:
 On Tuesday, 13 April 2021 at 20:18:54 UTC, Siemargl wrote:
 On Tuesday, 13 April 2021 at 19:45:28 UTC, Imperatorn wrote:

 [...]
I've used regular windbg64 from windows10 sdk. version 10.0.19041.685
Yes, I did get the regular version to work. But I wanted the preview version. But now it works 😁
With this working, there should be no one saying we don't have good debuggers for Windows. https://en.wikipedia.org/wiki/WinDbg https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-using-windbg-preview
I tried WinDbg preview a few days ago. I am not really sure, I needed to press the buttons for "step in" "step over"... always three times. Actually I am not sure whether there is some functional issue or the performance is really bad (high end developer laptop). Did someone else experience this issue or had maybe a smooth experience? (Maybe this issue is occurring due to McAfee virus scanner?) Kind regards Andre
I had a deeper look, actually there is neither a functional nor a performance problem. The debugger steps into DRuntime/photos coding but as the source code is not available, it looks quite strange for beginners. So far I haven't found out how to add the DRuntime/photos source code to WinDbg. Kind regards Andre
Apr 19 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Monday, 19 April 2021 at 15:24:24 UTC, Andre Pany wrote:
 On Sunday, 18 April 2021 at 14:14:53 UTC, Andre Pany wrote:
 [...]
I had a deeper look, actually there is neither a functional nor a performance problem. The debugger steps into DRuntime/photos coding but as the source code is not available, it looks quite strange for beginners. So far I haven't found out how to add the DRuntime/photos source code to WinDbg. Kind regards Andre
Hmm, it should just be to add the source dir
Apr 19 2021
next sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Monday, 19 April 2021 at 17:12:38 UTC, Imperatorn wrote:
 On Monday, 19 April 2021 at 15:24:24 UTC, Andre Pany wrote:
 On Sunday, 18 April 2021 at 14:14:53 UTC, Andre Pany wrote:
 [...]
I had a deeper look, actually there is neither a functional nor a performance problem. The debugger steps into DRuntime/photos coding but as the source code is not available, it looks quite strange for beginners. So far I haven't found out how to add the DRuntime/photos source code to WinDbg. Kind regards Andre
Hmm, it should just be to add the source dir
Well, and the proper symbols ofc
Apr 19 2021
prev sibling parent reply Andre Pany <andre s-e-a-p.de> writes:
On Monday, 19 April 2021 at 17:12:38 UTC, Imperatorn wrote:
 On Monday, 19 April 2021 at 15:24:24 UTC, Andre Pany wrote:
 On Sunday, 18 April 2021 at 14:14:53 UTC, Andre Pany wrote:
 [...]
I had a deeper look, actually there is neither a functional nor a performance problem. The debugger steps into DRuntime/photos coding but as the source code is not available, it looks quite strange for beginners. So far I haven't found out how to add the DRuntime/photos source code to WinDbg. Kind regards Andre
Hmm, it should just be to add the source dir
I am not sure how to do this with WinDbg preview. I can only add single source files. I added from DRuntime the file object.d and from Phobos array.d, but this doesn't help. I wonder whether somehow it is possible to tell the debugger to not jump into DRuntime/Phobos, because most of the time you are not interested in it. For now, while trying to debug my application I am ending in pressing the debugger navigations button 15 times before getting into the method I am interested in: ``` Breakpoint 0 hit dt!D main+0xf: 00007ff6`4335502f 31c9 xor ecx,ecx 0:000> t dt!pe.client.kernel.Kernel.create: 00007ff6`43436f70 55 push rbp 0:000> t dt!pe.client.kernel.Kernel.create+0xe: 00007ff6`43436f7e 48837d1000 cmp qword ptr [rbp+10h],0 ss:00000036`d47af6f0=0000000000000000 0:000> t dt!pe.client.kernel.Kernel.create+0x19: 00007ff6`43436f89 488d0d90b53300 lea rcx,[dt!D3pe6client6kernel6Kernel7__ClassZ (00007ff6`43772520)] 0:000> t dt!d_newclass: 00007ff6`43544870 55 push rbp 0:000> t dt!d_newclass+0x1: 00007ff6`43544871 488bec mov rbp,rsp 0:000> t dt!d_newclass+0x4: 00007ff6`43544874 4883ec50 sub rsp,50h 0:000> t dt!d_newclass+0x8: 00007ff6`43544878 48895dd8 mov qword ptr [rbp-28h],rbx ss:00000036`d47af648=0000000000000000 0:000> t dt!d_newclass+0xc: 00007ff6`4354487c 488975e0 mov qword ptr [rbp-20h],rsi ss:00000036`d47af650=0000000000000000 0:000> t dt!d_newclass+0x10: 00007ff6`43544880 48897de8 mov qword ptr [rbp-18h],rdi ss:00000036`d47af658={dt!_a0_ (00007ff6`43754890)} 0:000> t dt!d_newclass+0x14: 00007ff6`43544884 4889cf mov rdi,rcx 0:000> t dt!d_newclass+0x17: 00007ff6`43544887 488bcf mov rcx,rdi 0:000> t dt!d_newclass+0x1a: 00007ff6`4354488a 488b07 mov rax,qword ptr [rdi] ds:00007ff6`43772520={dt!D14TypeInfo_Class6__vtblZ (00007ff6`43790090)} 0:000> t dt!d_newclass+0x1d: 00007ff6`4354488d 48ff5058 call qword ptr [rax+58h] ds:00007ff6`437900e8={dt!ILT+65715(_D6object14TypeInfo_Class11initial zerMxFNaNbNiNfZAxv) (00007ff6`433410b8)} 0:000> t dt!D6object14TypeInfo_Class11initializerMxFNaNbNiNfZAxv: 00007ff6`4354c490 488b5118 mov rdx,qword ptr [rcx+18h] ds:00007ff6`43772538={dt!D3pe6client6kernel6Kernel6__initZ (00007ff6`437724a0)} 0:000> t dt!D6object14TypeInfo_Class11initializerMxFNaNbNiNfZAxv+0x4: 00007ff6`4354c494 488b4110 mov rax,qword ptr [rcx+10h] ds:00007ff6`43772530=0000000000000068 0:000> t dt!D6object14TypeInfo_Class11initializerMxFNaNbNiNfZAxv+0x8: 00007ff6`4354c498 c3 ret 0:000> t dt!d_newclass+0x21: 00007ff6`43544891 488945f0 mov qword ptr [rbp-10h],rax ss:00000036`d47af660=00000036d47af730 0:000> t dt!d_newclass+0x25: 00007ff6`43544895 488955f8 mov qword ptr [rbp-8],rdx ss:00000036`d47af668=00007ff6435d4369 ``` Kind regards AndrΓ©
Apr 20 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 20 April 2021 at 08:42:37 UTC, Andre Pany wrote:
 On Monday, 19 April 2021 at 17:12:38 UTC, Imperatorn wrote:
 [...]
I am not sure how to do this with WinDbg preview. I can only add single source files. I added from DRuntime the file object.d and from Phobos array.d, but this doesn't help. [...]
Do you have any prior knowledge of WinDbg? Do you know how to use it? Because it takes a while getting used to. I am not experiencing those problems you are experiencing "unfortunately", so I'm not sure how to help. Regarding source directories: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/-srcpath---lsrcpath--set-source-path-
Apr 20 2021
parent reply Andre Pany <andre s-e-a-p.de> writes:
On Tuesday, 20 April 2021 at 11:09:00 UTC, Imperatorn wrote:
 On Tuesday, 20 April 2021 at 08:42:37 UTC, Andre Pany wrote:
 On Monday, 19 April 2021 at 17:12:38 UTC, Imperatorn wrote:
 [...]
I am not sure how to do this with WinDbg preview. I can only add single source files. I added from DRuntime the file object.d and from Phobos array.d, but this doesn't help. [...]
Do you have any prior knowledge of WinDbg? Do you know how to use it? Because it takes a while getting used to. I am not experiencing those problems you are experiencing "unfortunately", so I'm not sure how to help. Regarding source directories: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/-srcpath---lsrcpath--set-source-path-
No, I trying it the first time. I will try to find out whether I am doing s.th. wrong here. Kind regards Andre
Apr 20 2021
parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 20 April 2021 at 15:28:13 UTC, Andre Pany wrote:
 On Tuesday, 20 April 2021 at 11:09:00 UTC, Imperatorn wrote:
 On Tuesday, 20 April 2021 at 08:42:37 UTC, Andre Pany wrote:
 [...]
Do you have any prior knowledge of WinDbg? Do you know how to use it? Because it takes a while getting used to. I am not experiencing those problems you are experiencing "unfortunately", so I'm not sure how to help. Regarding source directories: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/-srcpath---lsrcpath--set-source-path-
No, I trying it the first time. I will try to find out whether I am doing s.th. wrong here. Kind regards Andre
I see. Don't despair. WinDbg can break even the toughest of souls. Imo it takes at least a couple of weeks to understand it well.
Apr 20 2021
prev sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Tuesday, 13 April 2021 at 15:11:08 UTC, Siemargl wrote:
 On Tuesday, 13 April 2021 at 14:35:15 UTC, Imperatorn wrote:
 Short question:

 Would it be possible to get WinDbg to do source debugging for 
 D?

 https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/source-window

 What would it take? Possible at all?
1.Open .exe file 2.Open .d source file 3.Set breakpoint in source (F9) 4.Go Catching excepions: -for dmd -m64 or -m32mscoff builds >bp _d_throwc -for ldc -g builds >bp d_throw_exception Break start -ldc >bp Dmain
But... But... But... If that's already the case, why care people complaining about missing debuggers? πŸ’­
Apr 13 2021