1 #error This file is not used.
34 * dis-cil.c: Disassembles CIL byte codes
37 * Miguel de Icaza (miguel@ximian.com)
39 * (C) 2001 Ximian, Inc.
92 ShortInlineBrTarget
= 13,
98 #define OPDEF(a,b,c,d,e,f,g,h,i,j) \
99 { b, c, d, e, g, h, i },
106 unsigned char o1
, o2
;
109 static opcode_t opcodes
[300] = {
110 #include "mono/cil/opcode.def"
114 disassemble_cil (MonoMetadata
*m
, const unsigned char *start
, int size
)
116 const unsigned char *end
= start
+ size
;
117 const unsigned char *ptr
= start
;
123 entry
= &opcodes
[*ptr
+ 256];
125 entry
= &opcodes
[*ptr
];
129 fprintf (output
, "\tIL_%04x: %s ", ptr
- start
, entry
->name
);
130 switch (entry
->argument
){
131 case InlineBrTarget
: {
132 gint target
= *(gint32
*) ptr
;
133 fprintf (output
, "IL_%04x", ptr
+ 4 + target
);
139 token
= *(guint32
*) ptr
;
140 fprintf (output
, "fieldref-0x%08x", token
);
146 int value
= *(int *) ptr
;
148 fprintf (output
, "%d", value
);
154 gint64 top
= *(guint64
*) value
;
156 fprintf (output
, "%ld", top
);
162 token
= *(guint32
*) ptr
;
163 fprintf (output
, "method-0x%08x", token
);
172 double r
= *(double *) ptr
;
173 fprintf (output
, "%g", r
);
179 guint32 token
= *(guint32
*) ptr
;
180 fprintf (output
, "signature-0x%08x", token
);
186 guint32 token
= *(guint32
*) ptr
;
188 fprintf (output
, "string-%0x08x", token
);
194 guint32 count
= *(guint32
*) ptr
;
198 fprintf (output
, "(\n\t\t\t");
199 for (i
= 0; i
< count
; i
++){
200 fprintf (output
, "IL_%x", *(guint32
*) ptr
);
203 fprintf (output
, "\t\t\t)");
208 guint32 token
= *(guint32
*) ptr
;
210 fprintf (output
, "TOKEN_%08x", token
);
216 guint32 token
= *(guint32
*) ptr
;
218 fprintf (output
, "Type-%08x", token
);
224 gint16 var_idx
= *(gint16
*) ptr
;
226 fprintf (output
, "variable-%d\n", var_idx
);
231 case ShortInlineBrTarget
: {
232 signed char x
= *ptr
;
234 fprintf (output
, "IL_%04x", ptr
- start
+ 1 + x
);
242 fprintf (output
, "0x%02x", x
);
248 float f
= *(float *) ptr
;
250 fprintf (output
, "%g", (double) f
);
255 case ShortInlineVar
: {
256 signed char x
= *ptr
;
258 fprintf (output
, "Varidx-%d", (int) x
);
265 fprintf (output
, "\n");