Differences From Artifact [02abce9abb958e1c]:
- File
d2stacktrace/stacktrace.d
- 2010-11-07 10:18:02 - part of checkin [423f308350] on branch trunk - Initial commit. Just for setting up the environment. (user: kinaba) [annotate]
To Artifact [059fc11fc8a1312c]:
- File
d2stacktrace/stacktrace.d
- 2010-11-07 14:34:29 - part of checkin [0569f7b8c2] on branch trunk - - Added function literal evaluator (i.e., closure). - Workaround for d2stacktrace's infinite-loop bug. (when std.demangle.demangle use exception inside it, it will go into an infinite loop. to avoid this, I choose to unset TraceHandler during stacktrace generation. This is far from the complete solution, but at least it should work as expected under single-thread environment...) (user: kinaba) [annotate]
232 232 info.length = info.length + 1;
233 233 info[info.length-1] = str;
234 234 }
235 235 }
236 236 }
237 237
238 238 static Throwable.TraceInfo TraceHandler(void* ptr){
239 - StackTrace trace = new StackTrace();
240 - return trace.GetCallstack();
239 + // modified by k.inaba to avoid a throw inside std.demangle.demangle
240 + // not quite thread safe
241 + Runtime.traceHandler(&core.runtime.defaultTraceHandler);
242 + scope(exit) Runtime.traceHandler(&TraceHandler);
243 +
244 + StackTrace trace = new StackTrace();
245 + return trace.GetCallstack();
241 246 }
242 247
243 248 public:
244 249 static this(){
245 250 Runtime.traceHandler(&TraceHandler);
246 251 SetUnhandledExceptionFilter(&UnhandeledExceptionFilterHandler);
247 252 }
................................................................................
360 365 }
361 366 }
362 367
363 368 free(Symbol);
364 369 return stack;
365 370 }
366 371 };
372 +