www.digitalmars.com         C & C++   DMDScript  

D - Exceptions

reply "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
Walter, your exception stuff shows up very wierd in the Visual Studio .NET
debugger.  ;)

Any chance you can insert some line number info inside of the app's D code?
All I get is RTL stuff.  ;)

Lots of cleanup I see has been done to the Windows.d.  Lots more left to do
also. hehehe  Do you want my winbase.d, wingdi.d, and winuser.d?  They fill
in a few holes in Win32 support.  I'm sure nobody else wants to declare
their own winapi stuff anymore than they have to.

Until then I'm not sure what's crashing.  I'll go poke around on the stack
for a bit and see what I can come up with.

If I can get a good D testbed going with good debugger integration I think I

hate C++ lately so doing my own stuff in it seems like a chore.  I'd rather
code in D at this point I think.  But D has a ways to go before it will be
usable for my main line of work for a while.  C++ is the only viable
alternative for games work right now.  Other languages sacrifice too much
performance.   <sigh>

I hear some people want to hook up a C++ engine to a Python game core.  I'd
rather just write the whole thing in D, and I don't see why we can't come up
with something that powerful.

Sean


  TestVector.exe!_d_newclass(void * ci=0x00414f24)  Line 82 + 0x17 C
  TestVector.exe!_d_create_exception_object(ClassInfo * ci=0x00415364, char
* msg=0x0041544c)  Line 222 + 0x8 C
  TestVector.exe!_d_translate_se_to_d_exception(_EXCEPTION_RECORD *
exception_record=0x00031428)  Line 256 + 0xf C
  TestVector.exe!_d_framehandler(_EXCEPTION_RECORD *
exception_record=0x00031428, DEstablisherFrame * frame=0x0012ff74, _CONTEXT
context={...}, void * dispatcher_context=0x69616d64)  Line 149 + 0x8 C
  NTDLL.DLL!77f8e440()
  NTDLL.DLL!77f8e4db()
  NTDLL.DLL!77fa0316()
 TestVector.exe!_d_create_exception_object(ClassInfo * ci=0x00415364, char
* msg=0x0041544c) Line 222 + 0x8 C TestVector.exe!_d_translate_se_to_d_exception(_EXCEPTION_RECORD * exception_record=0x00031850) Line 256 + 0xf C TestVector.exe!_d_framehandler(_EXCEPTION_RECORD * exception_record=0x00031850, DEstablisherFrame * frame=0x0012ff74, _CONTEXT context={...}, void * dispatcher_context=0x69616d64) Line 149 + 0x8 C NTDLL.DLL!77f8e440() NTDLL.DLL!77f8e4db() NTDLL.DLL!77fa0316() TestVector.exe!_d_create_exception_object(ClassInfo * ci=0x00415364, char * msg=0x0041544c) Line 222 + 0x8 C TestVector.exe!_d_translate_se_to_d_exception(_EXCEPTION_RECORD * exception_record=0x00031c78) Line 256 + 0xf C TestVector.exe!_d_framehandler(_EXCEPTION_RECORD * exception_record=0x00031c78, DEstablisherFrame * frame=0x0012ff74, _CONTEXT context={...}, void * dispatcher_context=0x69616d64) Line 149 + 0x8 C NTDLL.DLL!77f8e440() NTDLL.DLL!77f8e4db() NTDLL.DLL!77fa0316() TestVector.exe!_d_create_exception_object(ClassInfo * ci=0x00415364, char * msg=0x0041544c) Line 222 + 0x8 C TestVector.exe!_d_translate_se_to_d_exception(_EXCEPTION_RECORD * exception_record=0x000320a0) Line 256 + 0xf C TestVector.exe!_d_framehandler(_EXCEPTION_RECORD * exception_record=0x000320a0, DEstablisherFrame * frame=0x0012ff74, _CONTEXT context={...}, void * dispatcher_context=0x69616d64) Line 149 + 0x8 C NTDLL.DLL!77f8e440() NTDLL.DLL!77f8e4db() NTDLL.DLL!77fa0316() TestVector.exe!_d_create_exception_object(ClassInfo * ci=0x00415364, char * msg=0x0041544c) Line 222 + 0x8 C TestVector.exe!_d_translate_se_to_d_exception(_EXCEPTION_RECORD * exception_record=0x000324c8) Line 256 + 0xf C TestVector.exe!_d_framehandler(_EXCEPTION_RECORD * exception_record=0x000324c8, DEstablisherFrame * frame=0x0012ff74, _CONTEXT context={...}, void * dispatcher_context=0x69616d64) Line 149 + 0x8 C NTDLL.DLL!77f8e440() NTDLL.DLL!77f8e4db() NTDLL.DLL!77fa0316() TestVector.exe!_d_create_exception_object(ClassInfo * ci=0x00415364, char * msg=0x0041544c) Line 222 + 0x8 C TestVector.exe!_d_translate_se_to_d_exception(_EXCEPTION_RECORD * exception_record=0x000328f0) Line 256 + 0xf C TestVector.exe!_d_framehandler(_EXCEPTION_RECORD * exception_record=0x000328f0, DEstablisherFrame * frame=0x0012ff74, _CONTEXT context={...}, void * dispatcher_context=0x69616d64) Line 149 + 0x8 C NTDLL.DLL!77f8e440() NTDLL.DLL!77f8e4db() NTDLL.DLL!77fa0316() TestVector.exe!_d_create_exception_object(ClassInfo * ci=0x00415364, char * msg=0x0041545d) Line 222 + 0x8 C TestVector.exe!_d_translate_se_to_d_exception(_EXCEPTION_RECORD * exception_record=0x00032d18) Line 260 + 0xf C TestVector.exe!_d_framehandler(_EXCEPTION_RECORD * exception_record=0x00032d18, DEstablisherFrame * frame=0x0012ff74, _CONTEXT context={...}, void * dispatcher_context=0x00032ffc) Line 149 + 0x8 C NTDLL.DLL!77f8e440() NTDLL.DLL!77f8e4db() NTDLL.DLL!77fa0316() TestVector.exe!_Dmain(unsigned __int64 args=0x0012ff3800000001) Line 785 + 0x5 C TestVector.exe!main(int argc=0x00000001, void * argv=0x009213d8) Line 48 + 0x7 C TestVector.exe!_mainCRTStartup() + 0x8a KERNEL32.DLL!77e9ca90()
Oct 19 2002
next sibling parent reply "Walter" <walter digitalmars.com> writes:
"Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
news:aor2fk$111u$1 digitaldaemon.com...
 Walter, your exception stuff shows up very wierd in the Visual Studio .NET
 debugger.  ;)
Hmm. Try windbg.exe with it (comes on the Digital Mars CD).
 Any chance you can insert some line number info inside of the app's D
code?
 All I get is RTL stuff.  ;)
Compile with -g and line number info should be inserted.
 Lots of cleanup I see has been done to the Windows.d.  Lots more left to
do
 also. hehehe  Do you want my winbase.d, wingdi.d, and winuser.d?  They
fill
 in a few holes in Win32 support.  I'm sure nobody else wants to declare
 their own winapi stuff anymore than they have to.

 Until then I'm not sure what's crashing.  I'll go poke around on the stack
 for a bit and see what I can come up with.
Ok, but if there's a bug in D I need a test case so it can be fixed.
 If I can get a good D testbed going with good debugger integration I think
I

 hate C++ lately so doing my own stuff in it seems like a chore.  I'd
rather
 code in D at this point I think.  But D has a ways to go before it will be
 usable for my main line of work for a while.  C++ is the only viable
 alternative for games work right now.  Other languages sacrifice too much
 performance.   <sigh>
I can fix the bugs, but I need test cases!
Oct 21 2002
parent reply "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
The -g switch helps alot.  ;)

Well this is a big improvement.  Wish I had symbol info inside VS .NET
though.

I have a question... does printf show up in the Output log window (via
OutputDebugString) if you don't have a console open?

Sean



"Walter" <walter digitalmars.com> wrote in message
news:ap0ejq$g4k$1 digitaldaemon.com...
 "Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
 news:aor2fk$111u$1 digitaldaemon.com...
 Walter, your exception stuff shows up very wierd in the Visual Studio
.NET
 debugger.  ;)
Hmm. Try windbg.exe with it (comes on the Digital Mars CD).
 Any chance you can insert some line number info inside of the app's D
code?
 All I get is RTL stuff.  ;)
Compile with -g and line number info should be inserted.
 Lots of cleanup I see has been done to the Windows.d.  Lots more left to
do
 also. hehehe  Do you want my winbase.d, wingdi.d, and winuser.d?  They
fill
 in a few holes in Win32 support.  I'm sure nobody else wants to declare
 their own winapi stuff anymore than they have to.

 Until then I'm not sure what's crashing.  I'll go poke around on the
stack
 for a bit and see what I can come up with.
Ok, but if there's a bug in D I need a test case so it can be fixed.
 If I can get a good D testbed going with good debugger integration I
think
 I

really
 hate C++ lately so doing my own stuff in it seems like a chore.  I'd
rather
 code in D at this point I think.  But D has a ways to go before it will
be
 usable for my main line of work for a while.  C++ is the only viable
 alternative for games work right now.  Other languages sacrifice too
much
 performance.   <sigh>
I can fix the bugs, but I need test cases!
Oct 21 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
news:ap0mft$o3g$1 digitaldaemon.com...
 The -g switch helps alot.  ;)

 Well this is a big improvement.  Wish I had symbol info inside VS .NET
 though.

 I have a question... does printf show up in the Output log window (via
 OutputDebugString) if you don't have a console open?

 Sean
I have no idea. I just use regular printf's and redirect the output to a file. For a GUI app I have a printf that logs to a text file.
Nov 12 2002
parent reply "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
So how do we redirect printf from inside the program?  Is there a hook?

Sean

"Walter" <walter digitalmars.com> wrote in message
news:aqrj7k$nee$1 digitaldaemon.com...
 "Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
 news:ap0mft$o3g$1 digitaldaemon.com...
 The -g switch helps alot.  ;)

 Well this is a big improvement.  Wish I had symbol info inside VS .NET
 though.

 I have a question... does printf show up in the Output log window (via
 OutputDebugString) if you don't have a console open?

 Sean
I have no idea. I just use regular printf's and redirect the output to a file. For a GUI app I have a printf that logs to a text file.
Nov 13 2002
parent reply "Walter" <walter digitalmars.com> writes:
Not that I know of. I've always thought that was a curious bug in Windows.

"Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
news:aqt2bc$5jv$1 digitaldaemon.com...
 So how do we redirect printf from inside the program?  Is there a hook?

 Sean

 "Walter" <walter digitalmars.com> wrote in message
 news:aqrj7k$nee$1 digitaldaemon.com...
 "Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
 news:ap0mft$o3g$1 digitaldaemon.com...
 The -g switch helps alot.  ;)

 Well this is a big improvement.  Wish I had symbol info inside VS .NET
 though.

 I have a question... does printf show up in the Output log window (via
 OutputDebugString) if you don't have a console open?

 Sean
I have no idea. I just use regular printf's and redirect the output to a file. For a GUI app I have a printf that logs to a text file.
Nov 13 2002
next sibling parent reply Lloyd Dupont <lloyd galador.net> writes:
Walter wrote:

 Not that I know of. I've always thought that was a curious bug in Windows.

 "Sean L. Palmer"  wrote in message
 news:aqt2bc$5jv$1 digitaldaemon.com...

So how do we redirect printf from inside the program?  Is there a hook?

Sean

"Walter"  wrote in message
news:aqrj7k$nee$1 digitaldaemon.com...

"Sean L. Palmer"  wrote in message
news:ap0mft$o3g$1 digitaldaemon.com...

The -g switch helps alot.  ;)

Well this is a big improvement.  Wish I had symbol info inside VS .NET
though.

I have a question... does printf show up in the Output log window (via
OutputDebugString) if you don't have a console open?

Sean
I have no idea. I just use regular printf's and redirect the output to a file. For a GUI app I have a printf that logs to a text file.
what about changing stdout with .. I don't remember but there is function for this...
Nov 13 2002
parent reply "Richard Krehbiel" <rich kastle.com> writes:
What you want is freopen, for example freopen("redirect_stdout.txt","w",
stdout);

It's even in the C standard.  (I'm kinda surprised you forgot about this,
Walter.)

"Lloyd Dupont" <lloyd galador.net> wrote in message
news:aqv9cj$81f$1 digitaldaemon.com...
 Walter wrote:

 Not that I know of. I've always thought that was a curious bug in
Windows.
 "Sean L. Palmer"  wrote in message
 news:aqt2bc$5jv$1 digitaldaemon.com...

So how do we redirect printf from inside the program?  Is there a hook?
-- Richard Krehbiel, Arlington, VA, USA rich kastle.com (work) or krehbiel3 comcast.net (personal)
Nov 14 2002
next sibling parent reply "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
I don't wanna send it to a file, I wanna send it to OutputDebugString so it
shows up in the debugger Output window.  Is that so much to ask?

I'm just gonna have to make my own printf function based on sprintf, aren't
I?

Windows is so screwed up.

Sean

"Richard Krehbiel" <rich kastle.com> wrote in message
news:ar0gsi$1jg7$1 digitaldaemon.com...
 What you want is freopen, for example freopen("redirect_stdout.txt","w",
 stdout);

 It's even in the C standard.  (I'm kinda surprised you forgot about this,
 Walter.)
Nov 14 2002
parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
vsprintf, actually.  Ugly :(

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Nov 14 2002
parent "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
Right.  Oops!  Well that's the way I've always done it in C++ (Usually,
"void DebugPrintf(const char*,...);"), why should D be any different?

I thought Windows apps stubbed out the stdin/stdout/stderr handles;  I
wasn't aware you could redirect to a file.  Good to know.  Still it seems to
make sense to me that if you don't have a console, the output should go
somewhere useful (OutputDebugString) instead of to dev/nul.  Otherwise
newbies will printf a bunch of stuff and wonder why it doesn't show up
anywhere.

Maybe someone could make a redirector that dumps all of stdin to
OutputDebugString, and pipe the app to that.  Sounds easy enough but it
seems like there might be a process boundary issue.  Only one way to find
out!

Sean

"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3DD4169B.BFD7E96E deming-os.org...
 vsprintf, actually.  Ugly :(
Nov 14 2002
prev sibling parent "Walter" <walter digitalmars.com> writes:
I rarely bother with stdio. I tend to use a different set of functions that
call Windows directly.

"Richard Krehbiel" <rich kastle.com> wrote in message
news:ar0gsi$1jg7$1 digitaldaemon.com...
 What you want is freopen, for example freopen("redirect_stdout.txt","w",
 stdout);

 It's even in the C standard.  (I'm kinda surprised you forgot about this,
 Walter.)

 "Lloyd Dupont" <lloyd galador.net> wrote in message
 news:aqv9cj$81f$1 digitaldaemon.com...
 Walter wrote:

 Not that I know of. I've always thought that was a curious bug in
Windows.
 "Sean L. Palmer"  wrote in message
 news:aqt2bc$5jv$1 digitaldaemon.com...

So how do we redirect printf from inside the program?  Is there a
hook?
 --
 Richard Krehbiel, Arlington, VA, USA
 rich kastle.com (work) or krehbiel3 comcast.net  (personal)
Nov 21 2002
prev sibling parent reply "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
Sounds like printf isn't all that, after all.  ;(

Sean

"Walter" <walter digitalmars.com> wrote in message
news:aqua4e$283n$2 digitaldaemon.com...
 Not that I know of. I've always thought that was a curious bug in Windows.

 "Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
 news:aqt2bc$5jv$1 digitaldaemon.com...
 So how do we redirect printf from inside the program?  Is there a hook?

 Sean

 I have no idea. I just use regular printf's and redirect the output to
a
 file. For a GUI app I have a printf that logs to a text file.

 I have a question... does printf show up in the Output log window
(via
 OutputDebugString) if you don't have a console open?

 Sean
Nov 14 2002
parent "Walter" <walter digitalmars.com> writes:
I have my own that writes to a log file. Each line is flushed and the file
closed, so that it is uptodate before the program crashes. I find it
invaluable <g>, and not just for windows. I've used it for shared dlls under
linux, too, where I had no control over stdout.

"Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
news:aqvkt8$khi$1 digitaldaemon.com...
 Sounds like printf isn't all that, after all.  ;(

 Sean

 "Walter" <walter digitalmars.com> wrote in message
 news:aqua4e$283n$2 digitaldaemon.com...
 Not that I know of. I've always thought that was a curious bug in
Windows.
 "Sean L. Palmer" <seanpalmer directvinternet.com> wrote in message
 news:aqt2bc$5jv$1 digitaldaemon.com...
 So how do we redirect printf from inside the program?  Is there a
hook?
 Sean

 I have no idea. I just use regular printf's and redirect the output
to
 a
 file. For a GUI app I have a printf that logs to a text file.

 I have a question... does printf show up in the Output log window
(via
 OutputDebugString) if you don't have a console open?

 Sean
Nov 21 2002
prev sibling parent Evan McClanahan <evan dontSPAMaltarinteractive.com> writes:
Sean L. Palmer wrote:
 If I can get a good D testbed going with good debugger integration I think I

 hate C++ lately so doing my own stuff in it seems like a chore.  I'd rather
 code in D at this point I think.  But D has a ways to go before it will be
 usable for my main line of work for a while.  C++ is the only viable
 alternative for games work right now.  Other languages sacrifice too much
 performance.   <sigh>
 
 I hear some people want to hook up a C++ engine to a Python game core.  I'd
 rather just write the whole thing in D, and I don't see why we can't come up
 with something that powerful.
I've thought of that solution myself, but I really think that it would be lacking in speed, and have a ton of integration issues, as there isn't a clean, automatic way at the moment to integrate python and C++. I'm also in the D games camp (if the d community ever grows large enough for SIGs). I plan, if the tools stabilize quickly enough, to write my next game demo (sample source and what have you) in D. While it's in C++ at the moment, I feel that porting what i have to D will be easy enough, once the tools fall into place, and will also result in a nice readability and code size improvement at the same time. Evan
Oct 22 2002