Summary: bad debug line number info for return statements with
                    enumerator expressions
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Rainer Schuetze <> 2011-02-15 00:19:07 
PST ---
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 ----
              e = exp->toElem(irs);

+         elem_setLoc(e, loc);
          block_appendexp(blx->curblock, e);
          block_next(blx, BCretexp, NULL);
          block_next(blx, BCret, NULL);

This is under Windows, but I guess it also applies to other OS supported by

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to