Mercurial > projects > ddmd
comparison dbg/CallStackInfo.d @ 79:43073c7c7769
updated to 2.035
also implemented a few missing functions
still crashes in Import.importAll though
author | Trass3r |
---|---|
date | Mon, 30 Aug 2010 03:57:51 +0200 |
parents | 7e0d548de9e6 |
children | a4c9de8e39b3 |
comparison
equal
deleted
inserted
replaced
78:b98fa8a4bf04 | 79:43073c7c7769 |
---|---|
59 } | 59 } |
60 | 60 |
61 Throwable error; | 61 Throwable error; |
62 StackFrameInfo[] frames; | 62 StackFrameInfo[] frames; |
63 | 63 |
64 string toString() { | 64 override string toString() |
65 { | |
65 string text; | 66 string text; |
66 | 67 |
67 if (error !is null) { | 68 if (error !is null) { |
68 text ~= error.toString() ~ "\n"; | 69 text ~= error.toString() ~ "\n"; |
69 } | 70 } |
70 | 71 |
71 text ~= "Stack trace:\n------------------\n"; | 72 text ~= "Stack trace:\n------------------\n"; |
72 char buffer[128]; | 73 char buffer[128]; |
73 foreach(ref frame; frames) { | 74 foreach(ref frame; frames) |
74 with(frame.fileLine) if(line) { | 75 { |
76 with(frame.fileLine) if(line) | |
77 { | |
75 auto len = snprintf(buffer.ptr, buffer.length, "%u", line); | 78 auto len = snprintf(buffer.ptr, buffer.length, "%u", line); |
76 text ~= file ~ ":" ~ buffer[0 .. len] ~ "\r\n"; | 79 text ~= file ~ ":" ~ buffer[0 .. len] ~ "\r\n"; |
77 } | 80 } |
78 } | 81 } |
79 | 82 |
80 text ~= '\0'; | 83 text ~= '\0'; |
81 | 84 |
82 return text; | 85 return text; |
83 } | 86 } |
84 | 87 |
85 void dump() { | 88 void dump() |
89 { | |
86 if (error !is null) { | 90 if (error !is null) { |
87 printf("%.*s\n", error.toString()); | 91 printf("%.*s\n", error.toString()); |
88 } | 92 } |
89 | 93 |
90 printf("Stack trace:\n------------------\n"); | 94 printf("Stack trace:\n------------------\n"); |