Reading MSIL

  • Thread starter Thread starter Raymond Lewallen
  • Start date Start date
R

Raymond Lewallen

Is there some article out there that helps in reading MSIL? I've been
looking but can't find anything, and I'm probably just looking in the wrong
spots for the wrong keywords. I understand mov, call, jmp, ptr, dword and
some of the other obvious pieces. I'm looking to understand some of the
less obvious pieces of MSIL so I can better understand how my code is being
constructed in release mode.

TIA,

Raymond Lewallen
Federal Aviation Administration
 
Sorry, should have mentioned that I've searched my entire hard drive for two
files I was told I should have: Partition II Metadata.doc and Partition III
CIL.doc, neither of which I can find.

Raymond Lewallen
 
Raymond Lewallen said:
Is there some article out there that helps in reading MSIL? I've been
looking but can't find anything, and I'm probably just looking in the wrong
spots for the wrong keywords. I understand mov, call, jmp, ptr, dword and
some of the other obvious pieces. I'm looking to understand some of the
less obvious pieces of MSIL so I can better understand how my code is being
constructed in release mode.

TIA,

Raymond Lewallen
Federal Aviation Administration
This is probably far less than what you were hoping for, but this will help
you understand MSIL:

http://msdn.microsoft.com/library/d...y/en-us/cptutorials/html/il_dasm_tutorial.asp

It's a tutorial for the MSIL disassembler.
 
Raymond Lewallen said:
Sorry, should have mentioned that I've searched my entire hard drive for
two
files I was told I should have: Partition II Metadata.doc and Partition
III
CIL.doc, neither of which I can find.

They should be in the <visual studio install folder>\SDK\v1.1\Tool
Developers Guide\docs.

Beyond that, the syntax you showed looks more like x86 assembly, not MSIL.
How are you viewing the IL?
 
ILDASM.EXE is what I used to look at the disassembled code.. I see lots of
ldarg, callvirt, idc.i4.x, nop.... i know what these are, i think, load
arguments to the stack, callvirt is obvious, idc.14.x i have no idea, nop
seems to do nothing, as its always a blank line. I'll have someone with
..NET installed send me these files, or look for them off my installation
CD's.

Thanks,

Raymond Lewallen
 
Raymond Lewallen said:
ILDASM.EXE is what I used to look at the disassembled code.. I see lots
of
ldarg, callvirt, idc.i4.x, nop.... i know what these are, i think, load
arguments to the stack, callvirt is obvious, idc.14.x i have no idea, nop
seems to do nothing, as its always a blank line. I'll have someone with
nop is literally "no op". Its an instruction that does nothing. VB tends to
insert more than C#, but the JIT will probably dump 'em.

ldc.i4.x loads the value of x onto the evaluation stack. There are other
forms of the instruction which goes beyond 9(or whatever the limit is).

Another option might be the framework SDK documentation, look up the OpCodes
class it has a list of opcodes and descriptions which might be
helpful(replace .'s with _ though).
 
Hi,

just want to mention that our LSW DotNet-Lab will contain automatically
rendered Graphical-MSIL
http://www.lesser-software.com/en/content/products/LSW DotNet-Tools/LSW
DotNet-Reflection-Browser/LSW%20Diagrammer.htm
Diagrammer which can convert MSIL into a Graphical format ( EMF,
HTML/VML ) see MSIL Visual Syntaxhttp://www.lesser-software.com/images/Screenshots/LSW_DotNet_Tools/LSW-DNRB/
1.2/HTML-VML/BranchConcurrency.html
latest sample automatically rendered Framework Method containing a switch
statement.

with best regards, Frank Lesser, www.lesser-software.com
 
It's a bit hardcore but it will teach you a lot about IL.

I do not think it's a hardcore. It's quite basic. It even lacks few
important topics. For example, I've found custom attributes described far
too concisely.

Nevertheless, it is a great book.

Regards, Wiktor Zychla
 
Thanks Jakob, I just found the book on Amazon for $2.00 and bought it. I
should have it in a few days :)

Raymond Lewallen

Jakob Christensen said:
Hey Raymond,

I recommend reading Serge Lidin's book "Inside Microsoft .NET IL
Assembler". It's a bit hardcore but it will teach you a lot about IL.
 
Back
Top