Thread overview
[Issue 5585] New: bad debug line number info for return statements with enumerator expressions
Feb 15, 2011
Rainer Schuetze
Jul 17, 2011
Rainer Schuetze
Jul 17, 2011
Walter Bright
February 15, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5585

           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
        AssignedTo: nobody@puremagic.com
        ReportedBy: r.sagitario@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario@gmx.de> 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 ----
          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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5585



--- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2011-07-17 01:47:36 PDT ---
https://github.com/D-Programming-Language/dmd/pull/258

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5585


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-07-17 12:32:00 PDT ---
https://github.com/D-Programming-Language/dmd/commit/80456938e2302c36de54809af0f171d3becd8840

https://github.com/D-Programming-Language/dmd/commit/17daa94d2137a30cc8f81cc08b28d254c3555204

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------