Making your .NET language step correctly in the debugger

前端 未结 2 1756
再見小時候
再見小時候 2021-01-29 23:23

Firstly, I apologize for the length of this question.

I am the author of IronScheme. Recently I have been working hard on emitting decent debug info, so that I can use

相关标签:
2条回答
  • 2021-01-29 23:49

    I am an engineer on the SharpDevelop Debugger team :-)

    Did you solve the problem?

    Did you try to debug it in SharpDevelop? If there is a bug in .NET, I wonder if we need to implement some workaround. I am not aware of this issue.

    Did you try to debug it in ILSpy? Especially without debug symbols. It would debug C# code, but it would tell us if the IL instructions are nicely debugable. (Mind that ILSpy debugger is beta though)

    Quick notes on the original IL code:

    • .line 19,19 : 6,15 '' occurs twice?
    • .line 20,20 : 7,14 '' does not start on implicit sequence point (stack is not empty). I am worried
    • .line 20,20 : 7,14 '' includes the code for "car x" (good) as well as "#f nooo x" (bad?)
    • regarding the nop after ret. What about stloc, ldloc, ret? I think C# uses this trick to make ret a distinct sequence point.

    David

    0 讨论(0)
  • 2021-01-30 00:02

    I am an engineer on the Visual Studio Debugger team.

    Correct me if I am wrong, but it sounds like the only issue left is that when switching from PDBs to the .NET 4 dynamic compile symbol format some breakpoints are being missed.

    We would probably need a repro to exactly diagnose the issue, however here are some notes that might help.

    1. VS (2008+) can-to run as a non-admin
    2. Do any symbols load at all the second time around? You might test by breaking in (through exception or call System.Diagnostic.Debugger.Break())
    3. Assuming that symbols load, is there a repro that you could send us?
    4. The likely difference is that the symbol format for dynamic-compiled code is 100% different between .NET 2 (PDB stream) and .NET 4 (IL DB I think they called it?)
    5. The 'nop's sound about right. See rules for generating implicit sequence points below.
    6. You don't actually need to emit things on different lines. By default, VS will step 'symbol-statements' where, as the compiler writer you get to define what 'symbol-statement' means. So if you want each expression to be a separate thing in the symbol file, that will work just fine.

    The JIT creates an implicit sequence point based on the following rules: 1. IL nop instructions 2. IL stack empty points 3. The IL instruction immediately following a call instruction

    If it turns out we do need a repro to solve your issue, you can file a connect bug and upload files securely through that medium.

    Update:

    We are encouraging other users experiencing this issue to try the Developer Preview of Dev11 from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27543 and comment with any feedback. (Must target 4.5)

    Update 2:

    Leppie has verified the fix to work for him on the Beta version of Dev11 available at http://www.microsoft.com/visualstudio/11/en-us/downloads as noted in the connect bug https://connect.microsoft.com/VisualStudio/feedback/details/684089/.

    Thanks,

    Luke

    0 讨论(0)
提交回复
热议问题