-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
Emit sequence points in ascending offset order #853
base: master
Are you sure you want to change the base?
Conversation
This is required by the Portable PDB specification, and the sequence point collection in `MethodDebugInfo` does not guarantee it. This also tweaks the writing of hidden sequence points to use two writes of 0 as compressed unsigned integer, instead of a single write of 0 as a plain short, to more closely match the specification. Fixes jbevain#840.
@jbevain Any chance of this landing? |
@Zastai I think the assumption here is that it's on the user to provide a properly sorted SequencePoints collection. Are there cases where we're reading portable pdbs and they end up unsorted in the collection? |
On my phone at the moment (and it's late) so can't check right now, but I assume I couldn't easily get that collection sorted from the client side. Otherwise I expect I would have done that. |
Ah I think I see the issue. My use case was flagging some code I add to a method as hidden, to make for smoother debugging. So I add a sequence point for the first of my newly-created insns. I'm not sure it makes sense for Cecil to allow creation of debug data that violates the specification, so applying the sort as part of the writing seems like a reasonable thing to do. If there is a safe way for me to do the sort myself (maybe preferably by adding a I'd also be fine with a new writer option, to specify whether you want the ensure-valid-sorted-sequence-points, throw-on-out-of-sequence-points, or leave-my-sequence-points-alone behaviour. |
@jbevain Any update on how you want me to proceed on this? |
@jbevain Ping (and slightly disappointed this did not make it into 0.11.5). |
@jbevain Another ping; it's now a year after this initial PR and it's still not clear how you want me to proceed. I see three main options:
|
@jbevain I have tested fix as I started getting wrong info in portable PDB's converted from native. WIth this fix you can roundtrip from native to portable and back to native and sequence points stay consistent.
|
Some further investigation indicated that I was NOT creating sequence points out of order (that would be quite hard with ILGenerator), but were creating duplicate sequence points at the same offset. This is causing the problem. |
This is required by the Portable PDB specification, and the sequence
point collection in
MethodDebugInfo
does not guarantee it.This also tweaks the writing of hidden sequence points to use two
writes of 0 as compressed unsigned integer, instead of a single
write of 0 as a plain short, to more closely match the specification.
Fixes #840.
Note: It would be extremely useful to get a 0.11.5 soon after this lands.