tags:

views:

164

answers:

1

Is there an equivalent of ILDASM for Mono?

+9  A: 

Yes, monodis is Mono's equivalent for ildasm.

$ cat a.cs
    public class Foo
    {
        public static void Main()
        {
            System.Console.WriteLine("Hello world");
        }
    }

$ monodis a.exe
    .assembly extern mscorlib
    {
      .ver 1:0:5000:0
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
    }
    .assembly 'a'
    {
      .hash algorithm 0x00008004
      .ver  0:0:0:0
    }
    .module a.exe // GUID = {034ADE1A-22D2-4B2B-960B-AE9DBFB2FCE7}


      .class public auto ansi beforefieldinit Foo
        extends [mscorlib]System.Object
      {

        // method line 1
        .method public hidebysig  specialname  rtspecialname 
               instance default void '.ctor' ()  cil managed 
        {
            // Method begins at RVA 0x20ec
        // Code size 7 (0x7)
        .maxstack 8
        IL_0000:  ldarg.0 
        IL_0001:  call instance void object::'.ctor'()
        IL_0006:  ret 
        } // end of method Foo::.ctor

        // method line 2
        .method public static  hidebysig 
               default void Main ()  cil managed 
        {
            // Method begins at RVA 0x20f4
        .entrypoint
        // Code size 11 (0xb)
        .maxstack 8
        IL_0000:  ldstr "Hello world"
        IL_0005:  call void class [mscorlib]System.Console::WriteLine(string)
        IL_000a:  ret 
        } // end of method Foo::Main

      } // end of class Foo

Mark Rushakoff