Thread overview
[Issue 2319] New: "Win32 Exception" not very useful
Aug 29, 2008
d-bugmail
Aug 29, 2008
Don
Apr 01, 2009
d-bugmail
Apr 01, 2009
d-bugmail
Apr 02, 2009
d-bugmail
August 29, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2319

           Summary: "Win32 Exception" not very useful
           Product: D
           Version: unspecified
          Platform: PC
               URL: http://msdn.microsoft.com/en-
                    us/library/aa363082(VS.85).aspx
        OS/Version: Windows
            Status: NEW
          Keywords: EH
          Severity: enhancement
          Priority: P3
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: nnbkxozgitfef@mailinator.com


Currently _d_translate_se_to_d_exception() translates almost any Win32 SE (except for divide by zero, access violation and stack overflow) into a simple D Exception with the message set to "Win32 Exception" and no hint what the original exception was or where in the application the exception was raised. This is not at least helpful if you want to locate a bug.

At least D should differentiate between the exceptions here:
http://msdn.microsoft.com/en-us/library/aa363082(VS.85).aspx
...or better get a copy of the original EXCEPTION_RECORD structure, or perhaps
the most significant members like ExceptionCode and ExceptionAddress.


-- 

August 29, 2008
d-bugmail@puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=2319
> 
>            Summary: "Win32 Exception" not very useful
>            Product: D
>            Version: unspecified
>           Platform: PC
>                URL: http://msdn.microsoft.com/en-
>                     us/library/aa363082(VS.85).aspx
>         OS/Version: Windows
>             Status: NEW
>           Keywords: EH
>           Severity: enhancement
>           Priority: P3
>          Component: Phobos
>         AssignedTo: bugzilla@digitalmars.com
>         ReportedBy: nnbkxozgitfef@mailinator.com
> 
> 
> Currently _d_translate_se_to_d_exception() translates almost any Win32 SE
> (except for divide by zero, access violation and stack overflow) into a simple
> D Exception with the message set to "Win32 Exception" and no hint what the
> original exception was or where in the application the exception was raised.
> This is not at least helpful if you want to locate a bug.
> 
> At least D should differentiate between the exceptions here:
> http://msdn.microsoft.com/en-us/library/aa363082(VS.85).aspx
> ...or better get a copy of the original EXCEPTION_RECORD structure, or perhaps
> the most significant members like ExceptionCode and ExceptionAddress.

I added the two most useful ones (DATATYPE_MISALIGNMENT and ARRAY_BOUNDS_EXCEEDED) into my copy of Phobos1 and committed it by mistake. The misalignment one is a *huge* help for rapidly debugging SSE (asm array operations for example <g>) so I'll leave Walter to take it out or copy it to Phobos2.


April 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2319


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from clugdbug@yahoo.com.au  2009-04-01 02:58 -------
DMD 1.042 and 2.027 now generate the full list of exceptions. You won't see "Win32 Exception" any more. There's more that could be done with the EXCEPTION_RECORD structure, ideally a full back-trace -- but that's a different issue.


-- 

April 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2319


torhu@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |torhu@yahoo.com




------- Comment #2 from torhu@yahoo.com  2009-04-01 15:03 -------
Still get "Error: Win32 Exception" with this code:

---
void main()
{
        asm { int 3; }
}
---

No big deal for me, I just tried out of curiousity.  Thought I'd mention it, though.


-- 

April 02, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2319





------- Comment #3 from clugdbug@yahoo.com.au  2009-04-02 02:19 -------
(In reply to comment #2)
> Still get "Error: Win32 Exception" with this code:
> 
> ---
> void main()
> {
>         asm { int 3; }
> }
> ---
> 
> No big deal for me, I just tried out of curiousity.  Thought I'd mention it, though.

Yes, OK, it still generates Win32 exception for the following ones:

        case STATUS_INTEGER_OVERFLOW: // not supported on any x86 processor
        case STATUS_IN_PAGE_ERROR:
        case STATUS_INVALID_DISPOSITION:
        case STATUS_NONCONTINUABLE_EXCEPTION:
        case STATUS_BREAKPOINT:
        case STATUS_SINGLE_STEP:
        // In DMC, but not in Microsoft docs
        case STATUS_GUARD_PAGE_VIOLATION:
        case STATUS_INVALID_HANDLE:

Perhaps the breakpoint one is important enough to treat specially. I'd forgotten that you can generate it without having a debugger attached. I'll add it in. The others can only be generated by compiler/runtime errors, I believe.


--