Boo
  1. Boo
  2. BOO-567

emit debug info for separate files

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.7.5
    • Component/s: Emitter
    • Labels:
      None
    • Number of attachments :
      1

      Description

      See http://groups.google.com/group/boolang/msg/1642b080b0556fca

      I don't have a way to test it myself, but I believe this can be implemented by adding a string field to the emitassembly class named _moduleFileName that is set in the InitializeDebugInfoWriter method. Then change the try block in the EmitDebugInfo method to this or something like it:

      if (start.FileName != _moduleFileName)

      { _il.MarkSequencePoint( _moduleBuilder.DefineDocument( start.FileName, Guid.Empty, Guid.Empty, SymDocumentType.Text), start.Line, 0, start.Line+1, 0); }

      else

      { _il.MarkSequencePoint(_symbolDocWriter, start.Line, 0, start.Line+1, 0); }

        Activity

        Hide
        Doug H added a comment -

        A better way is to use a hashtable to store symboldocwriters and clear it after each module. I'll test it with partial classes later.

        Show
        Doug H added a comment - A better way is to use a hashtable to store symboldocwriters and clear it after each module. I'll test it with partial classes later.
        Hide
        Doug H added a comment -

        This allows debugging across multiple files. But I believe boo needs to emit absolute paths for the filename. If you want that, change the ToLexicalInfo method in boo.g and wsaboo.g to return this:

        return new LexicalInfo(System.IO.Path.GetFullPath(token.getFilename()),
        token.getLine(),
        token.getColumn());

        Also this is unrelated but default.build needs this added to the prepare-src-distro target:
        <include name="scripts/Templates/*.cs" />

        Show
        Doug H added a comment - This allows debugging across multiple files. But I believe boo needs to emit absolute paths for the filename. If you want that, change the ToLexicalInfo method in boo.g and wsaboo.g to return this: return new LexicalInfo(System.IO.Path.GetFullPath(token.getFilename()), token.getLine(), token.getColumn()); Also this is unrelated but default.build needs this added to the prepare-src-distro target: <include name="scripts/Templates/*.cs" />
        Hide
        Daniel Grunwald added a comment -

        Yes, .pdb files are expected to contain the fully qualified path.
        The executable and .pdb file isn't always there where the compiler saves it, in the case of MSBuild the file is copied to the output directory after compilation, thus making the relative paths used inside the .pdb file invalid.

        Show
        Daniel Grunwald added a comment - Yes, .pdb files are expected to contain the fully qualified path. The executable and .pdb file isn't always there where the compiler saves it, in the case of MSBuild the file is copied to the output directory after compilation, thus making the relative paths used inside the .pdb file invalid.
        Hide
        Doug H added a comment -

        If you apply this patch, remove this part from emitassembly.Dispose():
        _symbolDocWriters.Clear();
        _symbolDocWriters = null;

        It conflcts with booish. Typing code like this in booish caused an internal error, null ref exception.
        class C:
        pass
        c = C()
        print c

        Updated binaries are in the boo-contrib svn repository.

        Show
        Doug H added a comment - If you apply this patch, remove this part from emitassembly.Dispose(): _symbolDocWriters.Clear(); _symbolDocWriters = null; It conflcts with booish. Typing code like this in booish caused an internal error, null ref exception. class C: pass c = C() print c Updated binaries are in the boo-contrib svn repository.
        Hide
        Doug H added a comment -

        The Path.GetFullPath(token.getFilename()) stuff in boo.g is still conflicting with the interactive interpreter and its _codecomplete_ stuff. So some nant tests for the interpreter fail. I do not know a workaround right now, I'm not familiar with the interpreter's code.

        Show
        Doug H added a comment - The Path.GetFullPath(token.getFilename()) stuff in boo.g is still conflicting with the interactive interpreter and its _ codecomplete _ stuff. So some nant tests for the interpreter fail. I do not know a workaround right now, I'm not familiar with the interpreter's code.
        Hide
        Doug H added a comment -

        Changing the ToLexicalInfo method in boo.g and wsaboo.g to this seems to fix all issues and tests. Also you can put back the " _symbolDocWriters.Clear(); " in the EmitAssembly.Dispose method.

        protected LexicalInfo ToLexicalInfo(antlr.IToken token)
        {
        string fileName = token.getFilename();
        if (System.IO.File.Exists(fileName))

        { fileName = System.IO.Path.GetFullPath(fileName); }

        return new LexicalInfo(fileName,
        token.getLine(),
        token.getColumn());
        }

        Multi-file debugging still works too.
        Binary and source releases with this patch will be available at boo-contrib.

        Show
        Doug H added a comment - Changing the ToLexicalInfo method in boo.g and wsaboo.g to this seems to fix all issues and tests. Also you can put back the " _symbolDocWriters.Clear(); " in the EmitAssembly.Dispose method. protected LexicalInfo ToLexicalInfo(antlr.IToken token) { string fileName = token.getFilename(); if (System.IO.File.Exists(fileName)) { fileName = System.IO.Path.GetFullPath(fileName); } return new LexicalInfo(fileName, token.getLine(), token.getColumn()); } Multi-file debugging still works too. Binary and source releases with this patch will be available at boo-contrib.
        Hide
        Rodrigo B. de Oliveira added a comment -

        I used a variation on the patch. Please check and thanks!

        Show
        Rodrigo B. de Oliveira added a comment - I used a variation on the patch. Please check and thanks!

          People

          • Assignee:
            Rodrigo B. de Oliveira
            Reporter:
            Doug H
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: