Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat test.d 1
- import std.stdio;
- int g(int i) {
- auto l = [1, 2, 3, 4];
- return l[i];
- }
- void f(int i) {
- writeln(g(i));
- }
- void main(string[] args) {
- f(1);
- f(10);
- f(2);
- }
- $ dmd -gc test.d
- $ gdb ./test
- GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 8 20:32:45 UTC 2011)
- Copyright 2004 Free Software Foundation, Inc.
- GDB is free software, covered by the GNU General Public License, and you are
- welcome to change it and/or distribute copies of it under certain conditions.
- Type "show copying" to see the conditions.
- There is absolutely no warranty for GDB. Type "show warranty" for details.
- This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .. done
- (gdb) l
- 1 import std.stdio;
- 2
- 3 int g(int i) {
- 4 auto l = [1, 2, 3, 4];
- 5 return l[i];
- 6 }
- 7
- 8 void f(int i) {
- 9 writeln(g(i));
- 10 }
- (gdb) l
- 11
- 12 void main(string[] args) {
- 13 f(1);
- 14 f(10);
- 15 f(2);
- 16 }
- (gdb) b 14
- No line 14 in file "test.d".
- (gdb) run
- Starting program: /private/tmp/test
- Reading symbols for shared libraries +........................ done
- 2
- core.exception.RangeError@test(5): Range violation
- ----------------
- 5 test 0x0001023a _d_array_bounds + 30
- 6 test 0x00002413 D4test7__arrayZ + 35
- 7 test 0x0000247d int test.g(int) + 101
- 8 test 0x0000249d void test.f(int) + 17
- 9 test 0x000023e2 _Dmain + 26
- 10 test 0x000107b3 extern (C) int rt.dmain2.main(int, char**).void runMain() + 23
- 11 test 0x0001035d extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 29
- 12 test 0x00010800 extern (C) int rt.dmain2.main(int, char**).void runAll() + 64
- 13 test 0x0001035d extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate()) + 29
- 14 test 0x000102f7 main + 179
- 15 test 0x000023bd start + 53
- 16 ??? 0x00000001 0x0 + 1
- ----------------
- Program exited with code 01.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement