Comment #0 by bearophile_hugs — 2011-06-27T13:44:30Z
This comes after the closed bug 4911 and a short discussion:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=27836http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=27840http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=27843
Assuming that the file "test.raw" is absent, this program:
import std.stdio: File;
void foo() {
auto f = File("test.raw", "r");
f.write("hello");
}
void bar() {
foo();
}
void main() {
bar();
}
with DMD 2.053 gives at runtime (using -g):
std.exception.ErrnoException@std\stdio.d(286): Cannot open file `test.raw' in mode `r' (No such file or directory)
----------------
...\test.d(8): void test.bar()
...\test.d(10): _Dmain
----------------
While on OS X it's something like this, it shows the name of the function ("foo") where the File contructor is called too:
std.exception.ErrnoException@std/stdio.d(286): Cannot open file
`test.raw' in mode `r' (No such file or directory)
----------------
5 test 0x000347fa @safe
shared(core.stdc.stdio._iobuf)*
std.exception.errnoEnforce!(shared(core.stdc.stdio._iobuf)*,
"std/stdio.d", 286).errnoEnforce(shared(core.stdc.stdio._iobuf)*, lazy
immutable(char)[]) + 90
6 test 0x00033443 ref std.stdio.File
std.stdio.File.__ctor(immutable(char)[], const(char[])) + 87
7 test 0x00002aea void test.foo() + 58
8 test 0x00002b2f void test.bar() + 11
9 test 0x00002aab _Dmain + 11
10 test 0x000146bb extern (C) int
rt.dmain2.main(int, char**).void runMain() + 23
11 test 0x00014265 extern (C) int
rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 29
12 test 0x00014703 extern (C) int
rt.dmain2.main(int, char**).void runAll() + 59
13 test 0x00014265 extern (C) int
rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 29
14 test 0x000141ff main + 179
15 test 0x00002a95 start + 53
----------------
Is is possible for the stack trace on Windows to show the "foo" function too?
Comment #1 by lt.infiltrator — 2015-12-09T12:13:30Z
I know that the stack trace was improved a while ago; but I don't have a windows machine to test on. Could you see whether the trace is satisfactory for you now?
Comment #2 by robert.schadek — 2024-12-07T13:31:30Z