fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

`Tracking:` Compiler debuggability improvements

Open vzarytovskii opened this issue 2 years ago • 2 comments

During a compiler debugging session with @dsyme, we've identified a few points which need improvements:

  • reqdTy (may TType instances) is showed as solved with no information, show solution when possible (possibly, show solution depth).

  • NOTE: range's ToString will go to the filesystem and read the file. We can also reduce the text (10 characters?)

  • Debugger is slow expanding object with bunch of properties (for example TType).

  • Search codebase for ToString, have them consistent (having a simple string representing the type).

  • Putting .ToString() with simpler info, consistently across types, rather than type name to:

    • TyparFlags
    • XmlDoc
    • CallerArg
    • CalledArg
    • AssignedCalledArg
    • cenv, TcEnv (inconsistent ToString()), TcGlobals, TcImports, TcState
    • DispayEnv, NameResolutionEnv should deliver a simple string, instead of %A
    • AccessorDomain, AccessibleFrom, CompPath - simpler ToString().
    • ... review types of MethodCalls.fs.
    • Review all of Syn* types.
    • Review test framework ToStrings (e.g. CompilationSource and CompilationUnit).
  • Consider putting DebuggerStepThrough (helps debugging experience by not stepping into functions/methods), DebuggerHidden (hide stack frames) or DebuggerNonUserCode.

    • We need to review current compiler stacktraces and remove higher-order functions, for example:
      • DiagnosticLogger.fs - TryD, MapD, MapD.loop, MapCombineTDC2D, MapCombineTDCD StackGuard.Guard and others.
      • ConstraintSolver - CollectThenUndoOrCommit
  • Consider adding NonUserCode to the library functions (like map, fold, etc.)? This may complicate debugging FSharp.Core itself.

  • Consider using DebuggerHidden and/or NonUserCode on StartWithContinuationsUsingDispatchInfo, StartWithContinuations and StartImmediate.

  • Make _FullList null if the length is <= ListDebugViewMaxLength:

    [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
            member x._FullList = items (count l 0 ListDebugViewMaxFullLength)
    

vzarytovskii avatar Jun 30 '22 16:06 vzarytovskii

NOTE: range's ToString will go to the filesystem and read the file. We can also reduce the text (10 characters?)

It can be very handy when debugging something parser-related, please leave a least some way to keep it like this.

auduchinok avatar Jun 30 '22 16:06 auduchinok

It can be very handy when debugging something parser-related, please leave a least some way to keep it like this.

You we should add a debug property with full text

dsyme avatar Jun 30 '22 16:06 dsyme