- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Figure 6-9: Main ILDASM display in Visual C#
Figure 6-9: Main ILDASM display Printing Code 3/9 In C#.NET Using Barcode generator for .NET framework Control to generate, create Code 3/9 image in Visual Studio .NET applications. www.OnBarcode.comCode-39 Reader In Visual C#.NET Using Barcode reader for .NET framework Control to read, scan read, scan image in .NET applications. www.OnBarcode.comTable 6-2: ILDASM Tree Output Descriptions Glyph Text Output [MOD] for heading [NSP] [CLS] [INT] [ENU] [VCL] [MET] module Description Informational directives, class declarations, and manifest information Namespace Class Interface Enumeration Value class Instance method (private, public, or protected) 222 Barcode Encoder In C#.NET Using Barcode printer for .NET framework Control to generate, create bar code image in .NET applications. www.OnBarcode.comRecognize Barcode In C#.NET Using Barcode scanner for .NET Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comTable 6-2: ILDASM Tree Output Descriptions Glyph Text Output [STM] [FLD] [STF] [EVT] [PTY] Description Static method Instance field (private, protected); also assembly Static field Event Property (get and/or set) public, or Code 3 Of 9 Generator In .NET Framework Using Barcode creation for ASP.NET Control to generate, create Code39 image in ASP.NET applications. www.OnBarcode.comDraw Code 39 Full ASCII In .NET Using Barcode creation for .NET framework Control to generate, create USS Code 39 image in .NET applications. www.OnBarcode.comIf you'd like to see more information and statistics about files you're opening, start ILDASM with the /ADV command line option. This turns on advanced display information and appends three new items to the View menu: COR Header lets you view the file header information. Statistics lets you see various statistics concerning size percentages and a breakdown of all metadata in the system. MetaInfo contains a submenu that lets you select specific information to view. Choose the Show! submenu item (or press Ctrl+M) to see that information, which is displayed in a separate MetaInfo window. If you don't select any of the specific information, when you select Show!, you'll see a raw dump of the metadata. If you have source code available for a particular module, you'll certainly want to turn on Show Source Lines on the View menu. Alternatively, you can specify the /SOURCE command line option. When you specify source line display, the disassembly shows the source lines as comments above the MSIL generated for them. To see all the commandline options, specify / on the command line. I use a batch file that contains the following to start instances of ILDASM with the options I want: ildasm /adv /source %1 To see the actual MSIL for a particular item, simply double-click on that item and another window will pop up. Depending on what you double-clicked, you'll see the disassembly, declaration information, or general information for the item. If the window looks like the one in Figure 6-10, you're ready to start learning MSIL. One nice little feature of ILDASM is that it supports drag-and-drop functionality, so you can easily jump between modules. USS Code 39 Drawer In Visual Basic .NET Using Barcode creation for VS .NET Control to generate, create Code-39 image in Visual Studio .NET applications. www.OnBarcode.comCreate PDF 417 In C# Using Barcode generation for .NET Control to generate, create PDF417 image in Visual Studio .NET applications. www.OnBarcode.comFigure 6-10: MSIL for a method The final trick I want to share about ILDASM is how you can see your C#, J#, Managed Extensions for C++, or Visual Basic .NET code and the MSIL all at the same time. If you've looked at the debugger's Disassembly window when debugging a managed application, you've probably seen the .NET language code and only the Intel assembly language. The reason is that the MSIL is just-in-time (JIT) compiled, so you're only executing the native assembly language, never the MSIL. What makes ILDASM really interesting is that it achieves the Holy Grail of disassemblers: it's a true "round-trip" disassembler! With a round-trip disassembler, you can disassemble a binary and immediately run it through an assembler to rebuild the application. Since .NET comes with ILASM, the Microsoft Intermediate Language Assembler, you've got everything you need to see your C#/J#/Managed Extensions for C++/Visual Basic .NET code and MSIL all at the same time. This view allows you to see how things fit together. Disassemble the file with the /SOURCE and /OUT= command-line options to ILDASM, specifying an output file name that ends in .IL. Compile the file with ILASM using the /DEBUG option. Now you'll step through the MSIL with Visual Studio .NET's debugger and see the corresponding C#/J#/Managed Extensions for C++/Visual Basic .NET code as comments. If you want to see it all, simply look at the Disassembly window and you'll see how the high-level language is compiled to MSIL, and how the MSIL is JIT compiled to Intel assembly language. Listing 6-2 shows a method disassembled with the original source embedded as comments from the ShowBPs program, included with this book's sample files. Listing 6-2: Mixed source and MSIL Code 128 Code Set A Encoder In C#.NET Using Barcode maker for Visual Studio .NET Control to generate, create USS Code 128 image in VS .NET applications. www.OnBarcode.comDrawing Bar Code In Visual C# Using Barcode drawer for VS .NET Control to generate, create barcode image in Visual Studio .NET applications. www.OnBarcode.com.method private instance void btnConditionalBreaks_Click(object sender, class [mscorlib]System.EventArgs e) cil managed { // Code size .maxstack 4 139 (0x8b) Printing UCC.EAN - 128 In Visual C# Using Barcode creation for .NET Control to generate, create GS1-128 image in VS .NET applications. www.OnBarcode.com2/5 Interleaved Generator In Visual C#.NET Using Barcode printer for Visual Studio .NET Control to generate, create 2 of 5 Interleaved image in VS .NET applications. www.OnBarcode.com.locals init ([0] int32 i, [1] int32 j, [2] string[] _Vb_t_array_0, [3] class [System.Windows.Forms] System.Windows.Forms.TextBox _Vb_t_ref_0) //000120: //000121: Private Sub btnConditionalBreaks_Click _ // // // IL_0000: //000122: IL_0001: IL_0002: //000123: IL_0003: IL_0004: //000124: //000125: ' Clearn the output edit control. //000126: edtOutput.Clear() IL_0005: IL_0006: ldarg.0 callvirt instance class [System.Windows.Forms]System.Windows.Forms.TextBox ShowBPs.ShowBPsForm::get_edtOutput() IL_000b: callvirt instance void nop Dim i As Integer = 0 ldc.i4.0 stloc.0 Dim j As Integer = 0 ldc.i4.0 stloc.1 ( ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles btnConditionalBreaks.Click Decoding QR Code JIS X 0510 In Java Using Barcode scanner for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comPrinting Bar Code In VB.NET Using Barcode encoder for .NET framework Control to generate, create bar code image in .NET framework applications. www.OnBarcode.com[System.Windows.Forms]System.Windows.Forms.TextBoxBase::Clear() IL_0010: //000127: //000128: ' Both are on one line to show how BPs can apply to part of a line. //000129: For i = 1 To 5 : For j = 1 To 5 IL_0011: ldc.i4.1 225 nop Making Code-128 In None Using Barcode maker for Font Control to generate, create Code 128 Code Set A image in Font applications. www.OnBarcode.comLinear Barcode Maker In VS .NET Using Barcode drawer for ASP.NET Control to generate, create Linear image in ASP.NET applications. www.OnBarcode.comIL_0012: IL_0013: IL_0014: Drawing QR Code 2d Barcode In None Using Barcode encoder for Software Control to generate, create QR Code JIS X 0510 image in Software applications. www.OnBarcode.comGS1 128 Reader In C#.NET Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications. www.OnBarcode.comDraw Barcode In None Using Barcode creator for Font Control to generate, create barcode image in Font applications. www.OnBarcode.comMake GS1 - 12 In None Using Barcode drawer for Online Control to generate, create UPC Code image in Online applications. www.OnBarcode.com |
|