implementation notes on `line directive

From: Steven Sharp (sharp@cadence.com)
Date: Tue May 04 2004 - 16:05:44 PDT

  • Next message: Shalom.Bresticker@freescale.com: "Re: errata/282: signing"

    Since we are discussing issues with the `line directive, I thought I would
    share something we found when we implemented the directive in our simulator.

    Aside from explicitly describing the effects on VPI, the LRM leaves the
    effects of `line directives on tools rather vague. The examples it
    suggests are error messages and source code debugging. When implementing
    the directive, we actually found it problematic to have it affect those
    things.

    When we issue an error message associated with a particular line in a file,
    the message also provides a pointer to the position in the line where the
    error occurs. However, the `line directive only provides a correspondence
    between the pre- and post-processed filename and line number, with no help
    for position on the line. We only know the character position within the
    post-processed line, which tells us nothing about the equivalent position
    within the pre-processed line. So if we display the pre-processed or
    "original" line, we can't properly display the position in the line. So
    the best we can do is display the actual line compiled, and provide the
    information from the `line directive as an addendum to the error.

    We also have a GUI with a source browser for source code debugging. But
    that GUI also cares about position within a line. For example, identifiers
    within the displayed source can be selected by mouse, and are displayed
    highlighted when selected. But we only have the necessary information about
    the positions of identifiers on lines for the actual source that we compiled,
    not the "original" source referenced by the `line directives. So again,
    this won't work properly if we display the "original" source.

    For both these suggested uses, the `line directive does not provide enough
    information to do what would really be desired. The directive is really
    only adequate for simple line-oriented interfaces. This is not surprising
    since that was probably the only common interface when the similar C
    directives were devised.

    I don't have any suggested ways of overcoming this. Trying to have a
    directive provide corresponding character positions for all textual tokens
    would be too clumsy to be workable. I think we just need to recognize
    that the `line directive is of limited utility with modern tools. That
    might influence how much priority we place on issues related to it.

    Steven Sharp
    sharp@cadence.com



    This archive was generated by hypermail 2.1.4 : Tue May 04 2004 - 15:45:53 PDT and
    sponsored by Boyd Technology, Inc.