Mercurial > projects > doodle
diff doodle/core/backtrace.d @ 104:ab745d8b10e5
Updated to dmd 2.052
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Sun, 20 Feb 2011 22:24:36 +1030 |
parents | 100dd23c7bdf |
children | 7abaf5c3959f |
line wrap: on
line diff
--- a/doodle/core/backtrace.d Wed Oct 06 13:03:38 2010 +1030 +++ b/doodle/core/backtrace.d Sun Feb 20 22:24:36 2011 +1030 @@ -72,7 +72,15 @@ override string toString() const { return null; } // Why does toString require overriding? - override int opApply(scope int delegate(ref char[]) dg) { + override int opApply( scope int delegate(ref char[]) dg) { + return opApply( (ref size_t, ref char[] buf) + { + return dg( buf ); + } ); + } + + + override int opApply(scope int delegate(ref size_t, ref char[]) dg) { // NOTE: The first 5 frames with the current implementation are // inside core.runtime and the object code, so eliminate // these for readability. @@ -80,17 +88,18 @@ int ret = 0; for(int i = FIRSTFRAME; i < numframes; ++i) { + size_t pos = i - FIRSTFRAME; char[] text = framelist[i][0 .. strlen(framelist[i])]; - int a = text.lastIndexOf('('); - int b = text.lastIndexOf('+'); + auto a = text.lastIndexOf('('); + auto b = text.lastIndexOf('+'); if (a != -1 && b != -1) { ++a; text = format("%s%s%s", text[0..a], demangle(text[a..b].idup), text[b..$]).dup; } - ret = dg(text); + ret = dg(pos, text); if (ret) break; }