Discussion:
[ddbg] wrong line numbers with unhandled exception
ore-sama
2008-10-10 13:22:38 UTC
Permalink
Given this code:
--------------------
RunApplication...
30 //somw code;
31 yo(res);
32 return 1;
}
34
void yo(int r)
{
37 int[] s=new int[5];
38 s[6]=0;
39 if(r)throw new Exception("yooo");
}
------------------

ddbg describe exception thrown at line 39 as thrown at line 31:


Unhandled D Exception (object.Exception
"yooo") at KERNEL32.dll (0x77e6d756) thread(1016)
->us
#0 ?? () at tmp.d:31 from KERNEL32.dll
#1 0x00405034 in __d_throw at 4 () at tmp.d:31 from deh
#2 0x004020ad in tmp.RunApplication () at tmp.d:31
#3 0x00402158 in WinMain (cmdShow = 10, cmdLine = 0x00141ee7, dummy = 0x00000000
, instance = 0x00400000) at tmp.d:76
#4 0x0041cf36 in _WinMainCRTStartup () from winstart
#5 0x77e7eb69 in ?? () from KERNEL32.dll


while exception at line 38 is desribed correctly as thrown at line 38:

Unhandled D Exception (std.array.ArrayBoundsError
"ArrayBoundsError tmp.d(38)") at KERNEL32.dll (0x77e6d756) thread(1348)
->us
#0 ?? () at tmp.d:38 from KERNEL32.dll
#1 0x00405070 in __d_throw at 4 () at tmp.d:38 from deh
#2 0x004020e1 in tmp.yo () at tmp.d:38
#3 0x004020ad in tmp.RunApplication () at tmp.d:31
#4 0x00402174 in WinMain (cmdShow = 10, cmdLine = 0x00141ee7, dummy = 0x00000000
, instance = 0x00400000) at tmp.d:76
#5 0x0041d026 in _WinMainCRTStartup () from winstart
#6 0x77e7eb69 in ?? () from KERNEL32.dll

dmd 2.019, ddbg 0.11.3 beta.
ore-sama
2008-10-10 13:54:10 UTC
Permalink
For some reason it losts functions from stacktrace
When explicit throw occurs, RunApplication calls yo, yo calls _d_throw directly, yo is lost. On ArrayBoundsError yo calls _array, _array calls _d_array_bounds, _d_array_bounds calls _d_throw; _array and _d_array_bounds are lost.
Loading...