-
-
Notifications
You must be signed in to change notification settings - Fork 607
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
Add ToString() override to Mono.Cecil.Cil.Instruction #14
Comments
Recomputing offsets on the fly is not going to happen. ToString is just a debug helper. If you need to print the instructions for debugging purpose, you can pay the price of recomputing the offsets. |
If it's not going to happen, so be it. It's a shame though. Debugging (by which I mean stepping though code in a debugger, not tracing) is very difficult without a ToString(). And branch instructions are unreadable without a correct offset (and that means correct all the time, not just after I fixed them). To be precise, the offsets don't need to be correct per se, as long as Instruction.Previous.Offset < Instruction.Offset < Instruction.Next.Offset. The index in the collection would be just fine for this purpose, but that is not available in Instruction.ToString(). Anyway, I forked the code. Turns out the offset fixup in InstructionCollection is actually very easy and fast. Looks like I might spend a lot of time merging. But I'm sure I'll still win by being able to debug efficiently. Thanks anyway. |
Of course it's easy, of course it's fast, it's just not necessary for a non debugging scenario. Anyway, this enhancement ticket is about getting an Instruction.ToString, which is in now. |
Update Cecil
It does help a lot when debugging.
One implementation that does seem to work has been suggested already, see
http://permalink.gmane.org/gmane.comp.gnome.mono.cecil/1474
Note that this ToString() method requires instructions offsets to be correct.
Forgive me for repeating an earlier request here: please consider recalculating instruction offsets in the OnX methods of Mono.Cecil.Cil.InstructionCollection
The text was updated successfully, but these errors were encountered: