-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICsharpCode.Decompiler integration into VS Debugger #1901
Comments
I had a quick chat with @siegfriedpammer (currently very time-constrained), maybe @dgrunwald can help out. Siegi gave me a few pointers for the second item in your list: We have issue #1245 and comment #1422 (comment) in this area. Given that our output was to be the PDB (without tooling integration), we did hit some hard limits on what we could do (and thus made PDBgen a lower-pri feature). |
As for the status of pdbgen, issues #1422 and #1230 (linked in #1422 but still relevant to point out separately) give a good overview of the status of the feature. To re-review those issues & comments on other issues, I'd like to point out:
In order for the decompiler to produce correct decompilation results, it is very important that we have all transitive compile-time references available when generating the source code or debug info. Otherwise the decompiler will fail to recognize some of the more advanced patterns that rely on well-known types such as In general, the feature ended up on the back burner because most people use ILSpy to look at Release builds, that is what Daniel's comment on #1422 is geared towards - Roslyn simply makes Release builds "un-PDB-able". |
This comment has been minimized.
This comment has been minimized.
I'm (also?) seeing that the Is this because the visitor should be visiting expressions or something else is going on? Or is it because I'm decompiling a .dll compiled in Release mode? |
Yes, this is the exact reason. I have a fix implemented locally, however, I am not done with testing yet... PDBGen tests are almost non-existing and not exactly easy to write, so I will have to perform some more manual testing. |
feel free to send me a branch, I can help with testing |
…xpressionBody and IndexerDeclaration.ExpressionBody in PDB generator.
That's great! Please see https://github.com/icsharpcode/ILSpy/tree/pdbgen-fixes Thank you very much! |
Hmm, I'm still not seeing any sequence points for the property expression body. I'm not even using I'm only getting 4 sequence point sets: for indexer getter and setter, Main itself and the local function. Here's a test program that I'm using: class C
{
int Property => 42;
static void Main()
{
var c = new C();
_ = c.Property;
c[2] = c[1];
Local();
void Local()
{
_ = c.Property;
}
}
C this[int index]
{
get
{
return null;
}
set
{
}
}
} |
Ah, nice, if I add this to public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration)
{
if (propertyDeclaration.ExpressionBody != null)
{
VisitAsSequencePoint(propertyDeclaration.ExpressionBody);
}
else
{
base.VisitPropertyDeclaration(propertyDeclaration);
}
} Unrelatedly, |
I see, |
Sorry, I realize I should have filed a separate issue instead of hijacking this general issue. Did so now in #3031. |
and the PR in #3032 |
I am one of the principal developers on the Visual Studio Debugger and the original developer of several of Visual Studio's core debugging scenarios. The ilspy decompiler is a very impressive piece of technology.
We (Visual Studio) are preparing to release a new feature where the ilspy decompiler is fully integrated into the debugger. This will allow users to produce symbols and source while debugging even in cases where modules only exist in memory (such as dump files that contain module memory) or when a user realizes after starting a debug session that decompilation is required.
We are running into some limitations with the symbol sequence point generation. I have been prototyping fixes for these issues, and I would like to start a conversation around them.
Sequence points seem to be getting emitted at locations where the ilstack is not empty. Anytime this happens, the debugger will be incapable of performing evaluations and many times breakpoints will fail to bind. The CLR will consider the current execution location within a can't stop region. Even in release builds, our compilers still often try to empty the il stack across statement boundaries. Note that this is even happening when decompiling debug builds with nop based sequence points in the il.
Sequence points are missing at opening and closing braces. from some other issues, I believe this has been discussed but was determined to be low priority. However, with the VS integration, this breaks several scenarios such as stepping in to a method with symbols, and then invoking the decompiler. As an example, since C# compilers emit sequence points at the opening braces, the debugger with symbols (but without source) will stop on the opening brace of a function during a stepin. If, after stepping in, the user performs decompilation to produce source, the debugger will complain that the current instruction pointer has no source info since the sequence points emitted by the decompiler will not contain this location.
I hope you are as excited about this scenario as we are on the VS Debugger. Fully integrated decompilation will make my own day-to-day workflow much easier.
The text was updated successfully, but these errors were encountered: