http://d.puremagic.com/issues/show_bug.cgi?id=4809

           Summary: Stack trace when throwing exception misses location of
                    the throw statement
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: s...@invisibleduck.org
        ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagita...@gmx.de> 2010-09-04 05:51:32 
PDT ---
Under windows, the following code

void func1() {
    throw new Exception("msg");
}

void main() {
    func1();
} 

shows this stack frame (debug info run through cv2pdb) when intercepting
throwing exceptions:

     kernel32.dll!_raiseexcept...@16()  + 0x52 bytes    
     test.exe!_d_throw(Object & h={...})  Line 238    C++
>       testexe!_Dmain()  Line 7 + 0x5 bytes    C++
     test.exe...@dmain2@m...@runmain()  + 0xb bytes    C++
     test.exe...@dmain2@m...@runall()  + 0xe bytes    C++
     test.exe!main(int argc=1, char * * argv=0x008a03c4)  C++
     test.exe!_mainCRTStartup()  + 0xa9 bytes    C++
     kernel32.dll!_baseprocessst...@4()  + 0x23 bytes    

i.e. it is missing the function actually throwing the exception.

This is caused by _d_throw not having a standard stack frame.

_d_throw is defined in deh.c and should be compiled with forcing standard stack
frames using option "-S":

deh.obj : src\rt\deh.c
-    $(CC) -c $(CFLAGS) src\rt\deh.c
+    $(CC) -c $(CFLAGS) -S src\rt\deh.c

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to