April 28, 2005
I compiled a simple "Hello world"-app using "dmd -g Hello.d", then opened WinDbg, selected "Hello.exe" and also opened "Hello.d" as the src code file - then I tried adding a breakpoint and it displayed a notice that it couldn't find the symbols and could continue to look for them.

Hitting "Yes" adds the breakpoint and allows me to step through the source code. I added a simple for-loop to it and tried adding the loop's "i" variable to the "Watches"-window - without success.

Is it possible to "watch" D variables using Windbg?

-Andreas

"Andreas Schmid" <monkey@gmx.info> wrote in message news:d4qj4k$k9q$1@digitaldaemon.com...
> Thanks for the detailed instructions!
>
> -Andreas
>
> "Maxime Larose" <mlarose@broadsoft.com> wrote in message news:d4oif6$1it6$1@digitaldaemon.com...
>> About the source code, I'm not sure what you mean... you add files to
>> your
>> VC++ project and they show up if you double-click them...  I have VC++
>> version 6.0.
>>
>> The correct debug info is generated automatically with: dmd -debug -g  (I personally use build; it works too).
>>
>> If you right-click on a source file, you can set its properties. Since D
>> files are non-C(++), they have a "Custom Build" sheet. In the "output"
>> field, put in the name of the .obj file (and directory). VC++ will make
>> the
>> link between the source file and that .obj, and you can then set
>> breakpoints, step through the code, see the disassembly, etc... Like you
>> would with any normal C++ source file.
>>
>> It all works seamlessly... Again the only issue I have seen is that
>> sometimes VC++ will have problems with templates. In these cases, I
>> usually
>> "de-templatize" the code, debug it, and the re-template it again.
>>
>> Hope this helps,
>>
>> Max
>>
>>
>>
>> "Andreas Schmid" <monkey@gmx.info> wrote in message news:d4ofdk$1fts$1@digitaldaemon.com...
>>> Which version do you have? Are there any instructions on how to generate
>> the
>>> correct debug info and load the source code + .obj file in VC++?
>>>
>>> Does it display the D source code correctly, or only parts of it?
>>>
>>> -Andreas
>>>
>>> "Maxime Larose" <mlarose@broadsoft.com> wrote in message news:d4obbc$1bva$1@digitaldaemon.com...
>>> > MSVC++ does it for me. I even have a very old version... (dated 1998 I
>>> > think)
>>> >
>>> > Max
>>> >
>>> >
>>> >
>>> > "Andreas Schmid" <monkey@gmx.info> wrote in message news:d4o8jg$191t$1@digitaldaemon.com...
>>> >> I'm in desperate need of a debugger for Windows that displays the
>>> >> original
>>> >> source code and lets me step through it. Is there anything like that?
>>> >>
>>> >> -Andreas
>>> >>
>>> >>
>>> >
>>> >
>>>
>>>
>>
>>
>
> 


April 28, 2005
You must specify Hello.obj as the object file... somewhere in WinDbg. (Never used WinDbg myself so I wouldn't know where.)

If you don't specify the .obj, how can the debugger know where the symbols are?  It doesn't know what a .d file is, so it will not look for Hello.obj (like it would for a .cpp file).

Max


"Andreas Schmid" <monkey@gmx.info> wrote in message news:d4qm3t$n5c$1@digitaldaemon.com...
> I compiled a simple "Hello world"-app using "dmd -g Hello.d", then opened WinDbg, selected "Hello.exe" and also opened "Hello.d" as the src code file - then I tried adding a breakpoint and it displayed a notice that it couldn't find the symbols and could continue to look for them.
>
> Hitting "Yes" adds the breakpoint and allows me to step through the source code. I added a simple for-loop to it and tried adding the loop's "i" variable to the "Watches"-window - without success.
>
> Is it possible to "watch" D variables using Windbg?
>
> -Andreas
>
> "Andreas Schmid" <monkey@gmx.info> wrote in message news:d4qj4k$k9q$1@digitaldaemon.com...
> > Thanks for the detailed instructions!
> >
> > -Andreas
> >
> > "Maxime Larose" <mlarose@broadsoft.com> wrote in message news:d4oif6$1it6$1@digitaldaemon.com...
> >> About the source code, I'm not sure what you mean... you add files to
> >> your
> >> VC++ project and they show up if you double-click them...  I have VC++
> >> version 6.0.
> >>
> >> The correct debug info is generated automatically with: dmd -debug -g
(I
> >> personally use build; it works too).
> >>
> >> If you right-click on a source file, you can set its properties. Since
D
> >> files are non-C(++), they have a "Custom Build" sheet. In the "output"
> >> field, put in the name of the .obj file (and directory). VC++ will make
> >> the
> >> link between the source file and that .obj, and you can then set
> >> breakpoints, step through the code, see the disassembly, etc... Like
you
> >> would with any normal C++ source file.
> >>
> >> It all works seamlessly... Again the only issue I have seen is that
> >> sometimes VC++ will have problems with templates. In these cases, I
> >> usually
> >> "de-templatize" the code, debug it, and the re-template it again.
> >>
> >> Hope this helps,
> >>
> >> Max
> >>
> >>
> >>
> >> "Andreas Schmid" <monkey@gmx.info> wrote in message news:d4ofdk$1fts$1@digitaldaemon.com...
> >>> Which version do you have? Are there any instructions on how to
generate
> >> the
> >>> correct debug info and load the source code + .obj file in VC++?
> >>>
> >>> Does it display the D source code correctly, or only parts of it?
> >>>
> >>> -Andreas
> >>>
> >>> "Maxime Larose" <mlarose@broadsoft.com> wrote in message news:d4obbc$1bva$1@digitaldaemon.com...
> >>> > MSVC++ does it for me. I even have a very old version... (dated 1998
I
> >>> > think)
> >>> >
> >>> > Max
> >>> >
> >>> >
> >>> >
> >>> > "Andreas Schmid" <monkey@gmx.info> wrote in message news:d4o8jg$191t$1@digitaldaemon.com...
> >>> >> I'm in desperate need of a debugger for Windows that displays the
> >>> >> original
> >>> >> source code and lets me step through it. Is there anything like
that?
> >>> >>
> >>> >> -Andreas
> >>> >>
> >>> >>
> >>> >
> >>> >
> >>>
> >>>
> >>
> >>
> >
> >
>
>


April 28, 2005
WinDbg expects .pdb symbol files, not object files.

Maxime Larose wrote:
> You must specify Hello.obj as the object file... somewhere in WinDbg. (Never
> used WinDbg myself so I wouldn't know where.)
> 
> If you don't specify the .obj, how can the debugger know where the symbols
> are?  It doesn't know what a .d file is, so it will not look for Hello.obj
> (like it would for a .cpp file).
> 
> Max
> 
> 
> "Andreas Schmid" <monkey@gmx.info> wrote in message
> news:d4qm3t$n5c$1@digitaldaemon.com...
> 
>>I compiled a simple "Hello world"-app using "dmd -g Hello.d", then opened
>>WinDbg, selected "Hello.exe" and also opened "Hello.d" as the src code
>>file - then I tried adding a breakpoint and it displayed a notice that it
>>couldn't find the symbols and could continue to look for them.
>>
>>Hitting "Yes" adds the breakpoint and allows me to step through the source
>>code. I added a simple for-loop to it and tried adding the loop's "i"
>>variable to the "Watches"-window - without success.
>>
>>Is it possible to "watch" D variables using Windbg?
>>
>>-Andreas
>>
>>"Andreas Schmid" <monkey@gmx.info> wrote in message
>>news:d4qj4k$k9q$1@digitaldaemon.com...
>>
>>>Thanks for the detailed instructions!
>>>
>>>-Andreas
>>>
>>>"Maxime Larose" <mlarose@broadsoft.com> wrote in message
>>>news:d4oif6$1it6$1@digitaldaemon.com...
>>>
>>>>About the source code, I'm not sure what you mean... you add files to
>>>>your
>>>>VC++ project and they show up if you double-click them...  I have VC++
>>>>version 6.0.
>>>>
>>>>The correct debug info is generated automatically with: dmd -debug -g
> 
> (I
> 
>>>>personally use build; it works too).
>>>>
>>>>If you right-click on a source file, you can set its properties. Since
> 
> D
> 
>>>>files are non-C(++), they have a "Custom Build" sheet. In the "output"
>>>>field, put in the name of the .obj file (and directory). VC++ will make
>>>>the
>>>>link between the source file and that .obj, and you can then set
>>>>breakpoints, step through the code, see the disassembly, etc... Like
> 
> you
> 
>>>>would with any normal C++ source file.
>>>>
>>>>It all works seamlessly... Again the only issue I have seen is that
>>>>sometimes VC++ will have problems with templates. In these cases, I
>>>>usually
>>>>"de-templatize" the code, debug it, and the re-template it again.
>>>>
>>>>Hope this helps,
>>>>
>>>>Max
>>>>
>>>>
>>>>
>>>>"Andreas Schmid" <monkey@gmx.info> wrote in message
>>>>news:d4ofdk$1fts$1@digitaldaemon.com...
>>>>
>>>>>Which version do you have? Are there any instructions on how to
> 
> generate
> 
>>>>the
>>>>
>>>>>correct debug info and load the source code + .obj file in VC++?
>>>>>
>>>>>Does it display the D source code correctly, or only parts of it?
>>>>>
>>>>>-Andreas
>>>>>
>>>>>"Maxime Larose" <mlarose@broadsoft.com> wrote in message
>>>>>news:d4obbc$1bva$1@digitaldaemon.com...
>>>>>
>>>>>>MSVC++ does it for me. I even have a very old version... (dated 1998
> 
> I
> 
>>>>>>think)
>>>>>>
>>>>>>Max
>>>>>>
>>>>>>
>>>>>>
>>>>>>"Andreas Schmid" <monkey@gmx.info> wrote in message
>>>>>>news:d4o8jg$191t$1@digitaldaemon.com...
>>>>>>
>>>>>>>I'm in desperate need of a debugger for Windows that displays the
>>>>>>>original
>>>>>>>source code and lets me step through it. Is there anything like
> 
> that?
> 
>>>>>>>-Andreas
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
> 
> 
April 28, 2005
"Andreas Schmid" <monkey@gmx.info> wrote in message news:d4o8jg$191t$1@digitaldaemon.com...
> I'm in desperate need of a debugger for Windows that displays the original source code and lets me step through it. Is there anything like that?

You can use windbg.exe which comes on the Digital Mars CD.


April 28, 2005
"zwang" <nehzgnaw@gmail.com> wrote in message news:d4qq7a$rfv$1@digitaldaemon.com...
> WinDbg expects .pdb symbol files, not object files.
>
> Maxime Larose wrote:
> > You must specify Hello.obj as the object file... somewhere in WinDbg.
(Never
> > used WinDbg myself so I wouldn't know where.)
> >
> > If you don't specify the .obj, how can the debugger know where the
symbols
> > are?  It doesn't know what a .d file is, so it will not look for
Hello.obj
> > (like it would for a .cpp file).

The windbg.exe that comes on the Digital Mars CD works fine with nothing more than:

dmd foo -g
windbg foo.exe

When the main window opens, use the command:

    g _Dmain

and it'll run to the start of main(). '_Dmain' is the mangled version of D's main, since windbg doesn't know about D name mangling.

You can then step through the source using F10.


April 28, 2005
Walter,

Talking about name mangling, I want to have names unmangled for stack traces.

The function you use is a C function called unmangle_ident. Problem is, it doesn't work. The source is not available. I stepped through the assembly and it seems to want a name starting with "?". Anyway, not quite sure but the fact is that even stopping with the debugger when the same method is called by the profiling functions (something_pro_n...) returns the same result, i.e. nothing is done and the name is still mangled. Looking at the profiler output confirms this.

How course, I could check out the mangling functions and do the reverse, but I'd much rather use something already available. Is there such a function available?

Thanks,

Max





"Walter" <newshound@digitalmars.com> wrote in message news:d4r5j7$19bl$1@digitaldaemon.com...
>
> "zwang" <nehzgnaw@gmail.com> wrote in message news:d4qq7a$rfv$1@digitaldaemon.com...
> > WinDbg expects .pdb symbol files, not object files.
> >
> > Maxime Larose wrote:
> > > You must specify Hello.obj as the object file... somewhere in WinDbg.
> (Never
> > > used WinDbg myself so I wouldn't know where.)
> > >
> > > If you don't specify the .obj, how can the debugger know where the
> symbols
> > > are?  It doesn't know what a .d file is, so it will not look for
> Hello.obj
> > > (like it would for a .cpp file).
>
> The windbg.exe that comes on the Digital Mars CD works fine with nothing more than:
>
> dmd foo -g
> windbg foo.exe
>
> When the main window opens, use the command:
>
>     g _Dmain
>
> and it'll run to the start of main(). '_Dmain' is the mangled version of
D's
> main, since windbg doesn't know about D name mangling.
>
> You can then step through the source using F10.
>
>


April 28, 2005
unmangle_ident's source comes with the Digital Mars CD, but it only unmangles C++ identifiers. I haven't written one for D yet.

"Maxime Larose" <mlarose@broadsoft.com> wrote in message news:d4r75j$1b3v$1@digitaldaemon.com...
> Walter,
>
> Talking about name mangling, I want to have names unmangled for stack traces.
>
> The function you use is a C function called unmangle_ident. Problem is, it doesn't work. The source is not available. I stepped through the assembly and it seems to want a name starting with "?". Anyway, not quite sure but the fact is that even stopping with the debugger when the same method is called by the profiling functions (something_pro_n...) returns the same result, i.e. nothing is done and the name is still mangled. Looking at the profiler output confirms this.
>
> How course, I could check out the mangling functions and do the reverse,
but
> I'd much rather use something already available. Is there such a function available?


April 29, 2005
Walter wrote:
<snip>
> The windbg.exe that comes on the Digital Mars CD works fine with nothing
> more than:
> 
> dmd foo -g
> windbg foo.exe
> 
> When the main window opens, use the command:
> 
>     g _Dmain
> 
> and it'll run to the start of main(). '_Dmain' is the mangled version of D's
> main, since windbg doesn't know about D name mangling.
> 
> You can then step through the source using F10.
> 
> 

I can step through the code using windbg without a problem. The problem is that
no local variables are resolved without a .pdb file, and I can't inspect any
value in the "Watch" window.
April 29, 2005
"zwang" <nehzgnaw@gmail.com> wrote in message news:d4rvhm$24gn$1@digitaldaemon.com...
> I can step through the code using windbg without a problem. The problem is
that
> no local variables are resolved without a .pdb file, and I can't inspect
any
> value in the "Watch" window.

I use windbg.exe 5.1, and doing a "locals" window shows them just fine. There's no .pdb file.


April 29, 2005
"Walter" <newshound@digitalmars.com> wrote in message news:d4spqt$28e$1@digitaldaemon.com...
>
> "zwang" <nehzgnaw@gmail.com> wrote in message news:d4rvhm$24gn$1@digitaldaemon.com...
>> I can step through the code using windbg without a problem. The problem is
> that
>> no local variables are resolved without a .pdb file, and I can't inspect
> any
>> value in the "Watch" window.
>
> I use windbg.exe 5.1, and doing a "locals" window shows them just fine. There's no .pdb file.

Funny, like zwang I've never gotten any locals either. I'm also using 5.1 and compiling with -g. I get stack traces and can step through code but that's it.


1 2 3
Top | Discussion index | About this forum | D home