[Issue 5585] New: bad debug line number info for return statements with enumerator expressions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 15 00:21:39 PST 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 at puremagic.com
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at 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: -------


More information about the Digitalmars-d-bugs mailing list