Bug 5585 – bad debug line number info for return statements with enumerator expressions

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-02-15T00:19:00Z
Last change time
2011-07-17T12:32:00Z
Keywords
patch
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2011-02-15T00:19:07Z
When compiled by dmd with debug information, stepping through the following code in a debugger enum { Success, Failure } int main() { return Success; } makes the debugger jump to the enumerator declaration when the instruction pointer is in fact at the return statement. This can be very annoying because there is no information of the actual line of execution, you have to guess from the disassembly. This is happening because the line info is taken from the first expression of the return statement, which is the initializer expression of the enum identifier. I suggest forcing the line number to the statement instead. *** src\s2ir.c 2011-02-14 19:56:09.000000000 +-0100 --- src\s2ir.c 2011-02-07 01:49:13.000000000 +-0100 *************** *** 1287,1298 **** --- 1287,1299 ---- else { e = exp->toElem(irs); assert(e); } + elem_setLoc(e, loc); block_appendexp(blx->curblock, e); block_next(blx, BCretexp, NULL); } else block_next(blx, BCret, NULL); } This is under Windows, but I guess it also applies to other OS supported by dmd.
Comment #1 by r.sagitario — 2011-07-17T01:47:36Z
Comment #2 by bugzilla — 2011-07-17T12:32:00Z