2 * get.c: Functions to get stringified values from the metadata tables.
5 * Miguel de Icaza (miguel@ximian.com)
7 * (C) 2001 Ximian, Inc.
19 #include <mono/utils/mono-compiler.h>
20 #include <mono/metadata/class.h>
21 #include <mono/metadata/marshal.h>
23 extern gboolean substitute_with_mscorlib_p
;
25 static MonoGenericContainer
*
26 get_memberref_container (MonoImage
*m
, guint32 mrp_token
, MonoGenericContainer
*container
);
29 get_memberref_parent (MonoImage
*m
, guint32 mrp_token
, MonoGenericContainer
*container
);
32 cant_print_generic_param_name (MonoGenericParam
*gparam
);
34 GHashTable
*key_table
= NULL
;
35 GHashTable
*mono_generic_params_with_ambiguous_names
= NULL
;
36 GHashTable
*generic_containers
= NULL
;
37 gboolean show_method_tokens
= FALSE
;
38 gboolean show_tokens
= FALSE
;
41 get_typedef (MonoImage
*m
, int idx
)
43 guint32 cols
[MONO_TYPEDEF_SIZE
];
45 char *tstring
, *result
;
52 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_TYPEDEF
], idx
- 1, cols
, MONO_TYPEDEF_SIZE
);
54 ns
= mono_metadata_string_heap (m
, cols
[MONO_TYPEDEF_NAMESPACE
]);
56 /* Check if this is a nested type */
57 token
= MONO_TOKEN_TYPE_DEF
| (idx
);
58 token
= mono_metadata_nested_in_typedef (m
, token
);
59 tstring
= show_tokens
? g_strdup_printf ("/*%08x*/", token
) : NULL
;
63 outer
= get_typedef (m
, mono_metadata_token_index (token
));
64 result
= g_strdup_printf (
66 mono_metadata_string_heap (m
, cols
[MONO_TYPEDEF_NAME
]),
67 tstring
? tstring
: "");
74 result
= g_strdup_printf (
75 "%s%s%s%s", ns
, *ns
?".":"",
76 mono_metadata_string_heap (m
, cols
[MONO_TYPEDEF_NAME
]),
77 tstring
? tstring
: "");
84 get_module (MonoImage
*m
, int idx
)
86 guint32 cols
[MONO_MODULE_SIZE
];
89 * There MUST BE only one module in the Module table
93 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_MODULE
], idx
- 1, cols
, MONO_MODULE_SIZE
);
95 return get_escaped_name (mono_metadata_string_heap (m
, cols
[MONO_MODULE_NAME
]));
99 get_moduleref (MonoImage
*m
, int idx
)
101 guint32 cols
[MONO_MODULEREF_SIZE
];
103 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_MODULEREF
], idx
- 1, cols
, MONO_MODULEREF_SIZE
);
105 return get_escaped_name (mono_metadata_string_heap (m
, cols
[MONO_MODULEREF_NAME
]));
109 get_assemblyref (MonoImage
*m
, int idx
)
111 guint32 cols
[MONO_ASSEMBLYREF_SIZE
];
113 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_ASSEMBLYREF
], idx
- 1, cols
, MONO_ASSEMBLYREF_SIZE
);
115 return get_escaped_name (mono_metadata_string_heap (m
, cols
[MONO_ASSEMBLYREF_NAME
]));
119 stringify_array (guint32 rank
, guint32 num_sizes
, guint32 num_lo_bounds
, gint32
*sizes
, gint32
*lo_bounds
)
121 GString
*res
= g_string_new ("[");
124 for (i
= 0; i
< rank
; i
++) {
126 g_string_append_c (res
, ',');
127 if (i
< num_lo_bounds
)
128 g_string_sprintfa (res
, "%d...", lo_bounds
[i
]);
130 if (i
< num_lo_bounds
)
131 g_string_sprintfa (res
, "%d", lo_bounds
[i
] + sizes
[i
] - 1);
133 g_string_sprintfa (res
, "%d", sizes
[i
]);
137 g_string_append (res
, "]");
139 return g_string_free (res
, FALSE
);
144 * Returns a string representing the ArrayShape (22.2.16).
147 get_array_shape (MonoImage
*m
, const char *ptr
, char **result
)
149 guint32 rank
, num_sizes
, num_lo_bounds
;
150 gint32
*sizes
= NULL
, *lo_bounds
= NULL
;
153 rank
= mono_metadata_decode_value (ptr
, &ptr
);
154 num_sizes
= mono_metadata_decode_value (ptr
, &ptr
);
157 sizes
= g_new (gint32
, num_sizes
);
159 for (i
= 0; i
< num_sizes
; i
++)
160 sizes
[i
] = mono_metadata_decode_value (ptr
, &ptr
);
162 num_lo_bounds
= mono_metadata_decode_value (ptr
, &ptr
);
163 if (num_lo_bounds
> 0)
164 lo_bounds
= g_new (gint32
, num_lo_bounds
);
166 for (i
= 0; i
< num_lo_bounds
; i
++)
167 lo_bounds
[i
] = mono_metadata_decode_signed_value (ptr
, &ptr
);
169 *result
= stringify_array (rank
, num_sizes
, num_lo_bounds
, sizes
, lo_bounds
);
179 * @m: metadata context
180 * @blob_idx: index into the blob heap
182 * Returns the stringified representation of a TypeSpec signature (22.2.17)
185 get_typespec (MonoImage
*m
, guint32 idx
, gboolean is_def
, MonoGenericContainer
*container
)
187 guint32 cols
[MONO_TYPESPEC_SIZE
];
190 GString
*res
= g_string_new ("");
192 MonoMethodSignature
*sig
;
194 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_TYPESPEC
], idx
-1, cols
, MONO_TYPESPEC_SIZE
);
195 ptr
= mono_metadata_blob_heap (m
, cols
[MONO_TYPESPEC_SIGNATURE
]);
196 len
= mono_metadata_decode_value (ptr
, &ptr
);
200 ptr
= get_custom_mod (m
, ptr
, &s
);
202 g_string_append (res
, s
);
203 g_string_append_c (res
, ' ');
207 if (*ptr
== MONO_TYPE_VOID
)
208 g_string_append (res
, "void");
210 ptr
= get_type (m
, ptr
, &s
, is_def
, container
);
212 g_string_append (res
, s
);
214 g_string_append (res
, "*");
217 case MONO_TYPE_FNPTR
:
218 sig
= mono_metadata_parse_method_signature_full (m
, container
, 0, ptr
, &ptr
);
219 s
= dis_stringify_function_ptr (m
, sig
);
220 g_string_append (res
, "method ");
221 g_string_append (res
, s
);
225 case MONO_TYPE_ARRAY
:
226 ptr
= get_type (m
, ptr
, &s
, is_def
, container
);
227 g_string_append (res
, s
);
229 g_string_append_c (res
, ' ');
230 ptr
= get_array_shape (m
, ptr
, &s
);
231 g_string_append (res
, s
);
235 case MONO_TYPE_SZARRAY
:
236 ptr
= get_custom_mod (m
, ptr
, &s
);
238 g_string_append (res
, s
);
239 g_string_append_c (res
, ' ');
242 ptr
= get_type (m
, ptr
, &s
, is_def
, container
);
243 g_string_append (res
, s
);
244 g_string_append (res
, "[]");
249 ptr
= get_type (m
, ptr
- 1, &s
, is_def
, container
);
250 g_string_append (res
, s
);
256 int token
= mono_metadata_make_token (MONO_TABLE_TYPESPEC
, idx
);
257 result
= g_strdup_printf ("%s/*%08x*/", res
->str
, token
);
261 g_string_free (res
, FALSE
);
267 get_typeref (MonoImage
*m
, int idx
)
269 guint32 cols
[MONO_TYPEREF_SIZE
];
272 guint32 rs_idx
, table
;
274 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_TYPEREF
], idx
- 1, cols
, MONO_TYPEREF_SIZE
);
276 t
= mono_metadata_string_heap (m
, cols
[MONO_TYPEREF_NAME
]);
277 s
= mono_metadata_string_heap (m
, cols
[MONO_TYPEREF_NAMESPACE
]);
279 rs_idx
= cols
[MONO_TYPEREF_SCOPE
] >> MONO_RESOLTION_SCOPE_BITS
;
280 table
= cols
[MONO_TYPEREF_SCOPE
] & MONO_RESOLTION_SCOPE_MASK
;
283 case MONO_RESOLTION_SCOPE_MODULE
: /* Module */
284 x
= get_module (m
, rs_idx
);
285 ret
= g_strdup_printf ("[%s] %s%s%s", x
, s
, *s
?".":"", t
);
289 case MONO_RESOLTION_SCOPE_MODULEREF
: /* ModuleRef */
290 x
= get_moduleref (m
, rs_idx
);
291 ret
= g_strdup_printf ("[.module %s]%s%s%s", x
, s
, *s
? "." : "", t
);
294 case MONO_RESOLTION_SCOPE_ASSEMBLYREF
: /*
295 * AssemblyRef (ECMA docs claim it is 3, but it looks to
296 * me like it is 2 (tokens are prefixed with 0x23)
298 x
= get_assemblyref (m
, rs_idx
);
299 ret
= g_strdup_printf ("[%s]%s%s%s", x
, s
, *s
?".":"", t
);
303 case MONO_RESOLTION_SCOPE_TYPEREF
: /* TypeRef */
304 x
= get_typeref (m
, rs_idx
);
305 ret
= g_strdup_printf ("%s/%s", x
, t
);
310 ret
= g_strdup_printf ("Unknown table in TypeRef %d", table
);
314 int token
= mono_metadata_make_token (MONO_TABLE_TYPEREF
, idx
);
315 char *temp
= g_strdup_printf ("%s/*%08x*/", ret
, token
);
324 * get_typedef_or_ref:
325 * @m: metadata context
326 * @dor_token: def or ref encoded index
328 * Low two bits contain table to lookup from
329 * high bits contain the index into the def or ref table
331 * Returns: a stringified version of the MethodDef or MethodRef
332 * at (dor_token >> 2)
335 get_typedef_or_ref (MonoImage
*m
, guint32 dor_token
, MonoGenericContainer
*container
)
337 char *temp
= NULL
, *s
= NULL
;
341 * low 2 bits contain encoding
343 table
= dor_token
& MONO_TYPEDEFORREF_MASK
;
344 idx
= dor_token
>> MONO_TYPEDEFORREF_BITS
;
347 case 0: /* TypeDef */
348 temp
= get_typedef (m
, idx
);
349 s
= g_strdup_printf ("%s", temp
);
352 case 1: /* TypeRef */
353 temp
= get_typeref (m
, idx
);
354 s
= g_strdup_printf ("%s", temp
);
357 case 2: /* TypeSpec */
358 s
= get_typespec (m
, idx
, FALSE
, container
);
362 g_error ("Unhandled encoding for typedef-or-ref coded index 0x%08x", dor_token
);
373 * get_type_or_methdef
374 * @m: metadata context
375 * @dor_token: type or method def encoded index
377 * Low bit contains the table to lookup from
378 * high bits contain the index into the type def or method def table
380 * Returns: a stringified version of the TypeOrMethodDef token
383 get_type_or_methdef (MonoImage
*m
, guint32 dor_token
)
385 if (dor_token
& MONO_TYPEORMETHOD_METHOD
) /* MethodDef */
386 return get_methoddef (m
, dor_token
>> MONO_TYPEORMETHOD_BITS
);
388 return get_typedef (m
, dor_token
>> MONO_TYPEORMETHOD_BITS
);
392 * get_encoded_typedef_or_ref:
393 * @m: metadata context
394 * @ptr: location to decode from.
395 * @result: pointer to string where resulting decoded string is stored
397 * result will point to a g_malloc()ed string.
399 * Returns: the new ptr to continue decoding
402 get_encoded_typedef_or_ref (MonoImage
*m
, const char *ptr
, char **result
)
406 token
= mono_metadata_decode_value (ptr
, &ptr
);
408 *result
= get_typedef_or_ref (m
, token
, NULL
);
416 * Decodes a CustomMod (22.2.7)
418 * Returns: updated pointer location
421 get_custom_mod (MonoImage
*m
, const char *ptr
, char **return_value
)
426 *return_value
= NULL
;
427 while ((*ptr
== MONO_TYPE_CMOD_OPT
) ||
428 (*ptr
== MONO_TYPE_CMOD_REQD
)) {
429 mod
= (*ptr
== MONO_TYPE_CMOD_REQD
) ? "modreq" : "modopt";
431 ptr
= get_encoded_typedef_or_ref (m
, ptr
, &s
);
433 if (*return_value
== NULL
)
434 *return_value
= g_strconcat (" ", mod
, " (", s
, ")", NULL
);
436 *return_value
= g_strconcat (*return_value
, " ", mod
, " (", s
, ")", NULL
);
443 static dis_map_t element_type_map
[] = {
444 { MONO_TYPE_END
, "end" },
445 { MONO_TYPE_VOID
, "void" },
446 { MONO_TYPE_BOOLEAN
, "bool" },
447 { MONO_TYPE_CHAR
, "char" },
448 { MONO_TYPE_I1
, "int8" },
449 { MONO_TYPE_U1
, "unsigned int8" },
450 { MONO_TYPE_I2
, "int16" },
451 { MONO_TYPE_U2
, "unsigned int16" },
452 { MONO_TYPE_I4
, "int32" },
453 { MONO_TYPE_U4
, "unsigned int32" },
454 { MONO_TYPE_I8
, "int64" },
455 { MONO_TYPE_U8
, "unsigned int64" },
456 { MONO_TYPE_R4
, "float32" },
457 { MONO_TYPE_R8
, "float64" },
458 { MONO_TYPE_STRING
, "string" },
459 { MONO_TYPE_TYPEDBYREF
, "typedref" },
460 { MONO_TYPE_I
, "native int" },
461 { MONO_TYPE_U
, "native unsigned int" },
462 { MONO_TYPE_OBJECT
, "object" },
466 static dis_map_t call_conv_type_map
[] = {
467 { MONO_CALL_DEFAULT
, "default" },
468 { MONO_CALL_C
, "unmanaged cdecl" },
469 { MONO_CALL_STDCALL
, "unmanaged stdcall" },
470 { MONO_CALL_THISCALL
, "unmanaged thiscall" },
471 { MONO_CALL_FASTCALL
, "unmanaged fastcall" },
472 { MONO_CALL_VARARG
, "vararg" },
477 dis_stringify_token (MonoImage
*m
, guint32 token
)
479 guint idx
= token
& 0xffffff;
480 switch (token
>> 24) {
481 case MONO_TABLE_TYPEDEF
: return get_typedef (m
, idx
);
482 case MONO_TABLE_TYPEREF
: return get_typeref (m
, idx
);
483 case MONO_TABLE_TYPESPEC
: return get_typespec (m
, idx
, FALSE
, NULL
);
487 return g_strdup_printf("0x%08x", token
);
491 dis_stringify_array (MonoImage
*m
, MonoArrayType
*array
, gboolean is_def
)
493 char *type
, *arr_str
, *ret
;
495 type
= dis_stringify_type (m
, &array
->eklass
->byval_arg
, is_def
);
496 arr_str
= stringify_array (array
->rank
, array
->numsizes
, array
->numlobounds
, array
->sizes
, array
->lobounds
);
498 ret
= g_strconcat (type
, arr_str
, NULL
);
506 dis_stringify_modifiers (MonoImage
*m
, int n
, MonoCustomMod
*mod
)
508 GString
*s
= g_string_new("");
511 for (i
= 0; i
< n
; ++i
) {
512 char *tok
= dis_stringify_token (m
, mod
[i
].token
);
514 g_string_sprintfa (s
, " ");
515 g_string_sprintfa (s
, " %s (%s)", mod
[i
].required
? "modreq": "modopt", tok
);
518 g_string_append_c (s
, ' ');
520 g_string_free (s
, FALSE
);
525 dis_stringify_param (MonoImage
*m
, MonoType
*param
)
530 const char *in
= param
->attrs
& PARAM_ATTRIBUTE_IN
? "[in]" : "";
531 const char *out
= param
->attrs
& PARAM_ATTRIBUTE_OUT
? "[out]": "";
532 const char *opt
= param
->attrs
& PARAM_ATTRIBUTE_OPTIONAL
? "[opt]": "";
533 attribs
= g_strconcat(in
, out
, opt
, NULL
);
534 t
= dis_stringify_type (m
, param
, TRUE
);
535 result
= g_strjoin(attribs
[0] ? " ":"", attribs
, t
, NULL
);
542 dis_stringify_variant_type (MonoMarshalVariant variant
)
545 case MONO_VARIANT_EMPTY
:
546 return g_strdup ("");
547 case MONO_VARIANT_NULL
:
548 return g_strdup ("null");
549 case MONO_VARIANT_I2
:
550 return g_strdup ("int16");
551 case MONO_VARIANT_I4
:
552 return g_strdup ("int32");
553 case MONO_VARIANT_R4
:
554 return g_strdup ("float32");
555 case MONO_VARIANT_R8
:
556 return g_strdup ("float64");
557 case MONO_VARIANT_CY
:
558 return g_strdup ("currency");
559 case MONO_VARIANT_DATE
:
560 return g_strdup ("date");
561 case MONO_VARIANT_BSTR
:
562 return g_strdup ("bstr");
563 case MONO_VARIANT_DISPATCH
:
564 return g_strdup ("idispatch");
565 case MONO_VARIANT_ERROR
:
566 return g_strdup ("error");
567 case MONO_VARIANT_BOOL
:
568 return g_strdup ("bool");
569 case MONO_VARIANT_VARIANT
:
570 return g_strdup ("variant");
571 case MONO_VARIANT_UNKNOWN
:
572 return g_strdup ("iunknown");
573 case MONO_VARIANT_DECIMAL
:
574 return g_strdup ("decimal");
575 case MONO_VARIANT_I1
:
576 return g_strdup ("int8");
577 case MONO_VARIANT_UI1
:
578 return g_strdup ("unsigned int8");
579 case MONO_VARIANT_UI2
:
580 return g_strdup ("unsigned int16");
581 case MONO_VARIANT_UI4
:
582 return g_strdup ("unsigned int32");
583 case MONO_VARIANT_I8
:
584 return g_strdup ("int64");
585 case MONO_VARIANT_UI8
:
586 return g_strdup ("unsigned int64");
587 case MONO_VARIANT_INT
:
588 return g_strdup ("int");
589 case MONO_VARIANT_UINT
:
590 return g_strdup ("unsigned int");
591 case MONO_VARIANT_VOID
:
592 return g_strdup ("void");
593 case MONO_VARIANT_HRESULT
:
594 return g_strdup ("hresult");
595 case MONO_VARIANT_PTR
:
596 return g_strdup ("*");
597 case MONO_VARIANT_SAFEARRAY
:
598 return g_strdup ("safearray");
599 case MONO_VARIANT_CARRAY
:
600 return g_strdup ("carray");
601 case MONO_VARIANT_USERDEFINED
:
602 return g_strdup ("userdefined");
603 case MONO_VARIANT_LPSTR
:
604 return g_strdup ("lpstr");
605 case MONO_VARIANT_LPWSTR
:
606 return g_strdup ("lpwstr");
607 case MONO_VARIANT_RECORD
:
608 return g_strdup ("record");
609 case MONO_VARIANT_FILETIME
:
610 return g_strdup ("filetime");
611 case MONO_VARIANT_BLOB
:
612 return g_strdup ("blob");
613 case MONO_VARIANT_STREAM
:
614 return g_strdup ("stream");
615 case MONO_VARIANT_STORAGE
:
616 return g_strdup ("storage");
617 case MONO_VARIANT_STREAMED_OBJECT
:
618 return g_strdup ("streamed_object");
619 case MONO_VARIANT_STORED_OBJECT
:
620 return g_strdup ("stored_object");
621 case MONO_VARIANT_BLOB_OBJECT
:
622 return g_strdup ("blob_object");
623 case MONO_VARIANT_CF
:
624 return g_strdup ("cf");
625 case MONO_VARIANT_CLSID
:
626 return g_strdup ("clsid");
627 case MONO_VARIANT_VECTOR
:
628 /* FIXME: output: <v_type> vector */
629 return g_strdup ("vector");
630 case MONO_VARIANT_ARRAY
:
631 /* FIXME: output: <v_type> [ ] */
632 return g_strdup ("[]");
633 case MONO_VARIANT_BYREF
:
634 /* FIXME: output: <v_type> & */
635 return g_strdup ("&");
637 return g_strdup ("unknown");
642 dis_stringify_native_type (MonoMarshalNative native
)
645 case MONO_NATIVE_BOOLEAN
:
646 return g_strdup ("bool");
648 return g_strdup ("int8");
650 return g_strdup ("unsigned int8");
652 return g_strdup ("int16");
654 return g_strdup ("unsigned int16");
656 return g_strdup ("int32");
658 return g_strdup ("unsigned int32");
660 return g_strdup ("int64");
662 return g_strdup ("unsigned int64");
664 return g_strdup ("float32");
666 return g_strdup ("float64");
667 case MONO_NATIVE_CURRENCY
:
668 return g_strdup ("currency");
669 case MONO_NATIVE_BSTR
:
670 return g_strdup ("bstr");
671 case MONO_NATIVE_LPSTR
:
672 return g_strdup ("lpstr");
673 case MONO_NATIVE_LPWSTR
:
674 return g_strdup ("lpwstr");
675 case MONO_NATIVE_LPTSTR
:
676 return g_strdup ("lptstr");
677 case MONO_NATIVE_IUNKNOWN
:
678 return g_strdup ("iunknown");
679 case MONO_NATIVE_IDISPATCH
:
680 return g_strdup ("idispatch");
681 case MONO_NATIVE_STRUCT
:
682 return g_strdup ("struct");
683 case MONO_NATIVE_INTERFACE
:
684 return g_strdup ("interface");
685 case MONO_NATIVE_SAFEARRAY
:
686 return g_strdup ("safearray");
687 case MONO_NATIVE_INT
:
688 return g_strdup ("int");
689 case MONO_NATIVE_UINT
:
690 return g_strdup ("unsigned int");
691 case MONO_NATIVE_VBBYREFSTR
:
692 return g_strdup ("vbbyrefstr");
693 case MONO_NATIVE_ANSIBSTR
:
694 return g_strdup ("ansi bstr");
695 case MONO_NATIVE_TBSTR
:
696 return g_strdup ("tbstr");
697 case MONO_NATIVE_VARIANTBOOL
:
698 return g_strdup ("variant bool");
699 case MONO_NATIVE_FUNC
:
700 return g_strdup ("method");
701 case MONO_NATIVE_ASANY
:
702 return g_strdup ("as any");
703 case MONO_NATIVE_LPSTRUCT
:
704 return g_strdup ("lpstruct");
705 case MONO_NATIVE_CUSTOM
:
706 return g_strdup ("custom");
707 case MONO_NATIVE_ERROR
:
708 return g_strdup ("error");
709 case MONO_NATIVE_MAX
:
710 return g_strdup ("");
712 return g_strdup ("unknown");
717 dis_stringify_marshal_spec (MonoMarshalSpec
*spec
)
719 switch (spec
->native
) {
720 case MONO_NATIVE_BYVALTSTR
:
721 return g_strdup_printf (" marshal (fixed sysstring [%d])", spec
->data
.array_data
.num_elem
);
722 case MONO_NATIVE_BYVALARRAY
:
723 return g_strdup_printf (" marshal (fixed array [%d])", spec
->data
.array_data
.num_elem
);
724 case MONO_NATIVE_LPARRAY
: {
725 char *elem_type
, *elems
, *ret
;
726 guint32 num_elem
= spec
->data
.array_data
.num_elem
;
727 guint32 param_num
= spec
->data
.array_data
.param_num
;
729 elem_type
= dis_stringify_native_type (spec
->data
.array_data
.elem_type
);
730 if (num_elem
== -1 && param_num
== -1)
731 elems
= g_strdup ("");
732 else if ((param_num
== -1) || (spec
->data
.array_data
.elem_mult
== 0))
733 elems
= g_strdup_printf ("%d", num_elem
);
734 else if ((num_elem
== -1) || (num_elem
== 0))
735 elems
= g_strdup_printf ("+ %d", param_num
);
737 elems
= g_strdup_printf ("%d + %d", num_elem
, param_num
);
739 ret
= g_strdup_printf (" marshal (%s[%s])", elem_type
, elems
);
744 case MONO_NATIVE_SAFEARRAY
: {
745 char *elem_type
= NULL
, *ret
;
747 if (spec
->data
.safearray_data
.elem_type
!= 0)
748 elem_type
= dis_stringify_variant_type (spec
->data
.safearray_data
.elem_type
);
749 ret
= g_strdup_printf (" marshal (safearray %s)", elem_type
? elem_type
: "");
754 case MONO_NATIVE_CUSTOM
:
755 return g_strdup_printf (" marshal (custom (\"%s\", \"%s\"))",
756 spec
->data
.custom_data
.custom_name
? spec
->data
.custom_data
.custom_name
: "",
757 spec
->data
.custom_data
.cookie
? spec
->data
.custom_data
.cookie
: "");
759 char *native_type
, *ret
;
760 native_type
= dis_stringify_native_type (spec
->native
);
761 ret
= g_strdup_printf (" marshal (%s)", native_type
);
762 g_free (native_type
);
770 * @m: metadata context
771 * @table_type: The type of table we are getting generics for (0 for typedef, 1 for method)
772 * @row: The row in the table
774 * Returns: Allocated stringified generic parameters
777 get_generic_param (MonoImage
*m
, MonoGenericContainer
*container
)
786 result
= g_string_new ("");
788 g_string_append_c (result
, '<');
789 for (i
= 0; i
< container
->type_argc
; i
++) {
790 MonoGenericParam
*param
= &container
->type_params
[i
];
797 g_string_append (result
, ",");
799 flags
= param
->flags
& GENERIC_PARAMETER_ATTRIBUTE_VARIANCE_MASK
;
800 if ((flags
& GENERIC_PARAMETER_ATTRIBUTE_COVARIANT
) == GENERIC_PARAMETER_ATTRIBUTE_COVARIANT
)
801 g_string_append (result
, "+ ");
802 if ((flags
& GENERIC_PARAMETER_ATTRIBUTE_CONTRAVARIANT
) == GENERIC_PARAMETER_ATTRIBUTE_CONTRAVARIANT
)
803 g_string_append (result
, "- ");
805 flags
= param
->flags
& GENERIC_PARAMETER_ATTRIBUTE_SPECIAL_CONSTRAINTS_MASK
;
806 if ((flags
& GENERIC_PARAMETER_ATTRIBUTE_REFERENCE_TYPE_CONSTRAINT
) == GENERIC_PARAMETER_ATTRIBUTE_REFERENCE_TYPE_CONSTRAINT
)
807 g_string_append (result
, "class ");
808 if ((flags
& GENERIC_PARAMETER_ATTRIBUTE_VALUE_TYPE_CONSTRAINT
) == GENERIC_PARAMETER_ATTRIBUTE_VALUE_TYPE_CONSTRAINT
)
809 g_string_append (result
, "valuetype ");
810 if ((flags
& GENERIC_PARAMETER_ATTRIBUTE_CONSTRUCTOR_CONSTRAINT
) == GENERIC_PARAMETER_ATTRIBUTE_CONSTRUCTOR_CONSTRAINT
)
811 g_string_append (result
, ".ctor ");
813 for (constr
= param
->constraints
; constr
&& *constr
; constr
++) {
817 g_string_append_c (result
, '(');
820 g_string_append (result
, ", ");
821 sig
= dis_stringify_type (m
, &((*constr
)->byval_arg
), TRUE
);
822 g_string_append (result
, sig
);
827 g_string_append (result
, ") ");
829 esname
= get_escaped_name (param
->name
);
830 g_string_append (result
, esname
);
834 g_string_append_c (result
, '>');
836 retval
= result
->str
;
837 g_string_free (result
, FALSE
);
842 dis_stringify_method_signature (MonoImage
*m
, MonoMethodSignature
*method
, int methoddef_row
,
843 MonoGenericContainer
*container
, gboolean fully_qualified
)
845 return dis_stringify_method_signature_full (m
, method
, methoddef_row
, container
, fully_qualified
, TRUE
);
849 * @m: metadata context
850 * @method: MonoMethodSignature to dis-stringify
851 * @methoddef_row: row index in the Method table
852 * @context: generic context, generic method's context in case of a Generic method
853 * or a generic type's context. if !@context, treats it as a non-generic method
854 * @fully_qualified: TRUE to print type name also.
856 * Returns: Allocated stringified method signature
859 dis_stringify_method_signature_full (MonoImage
*m
, MonoMethodSignature
*method
, int methoddef_row
,
860 MonoGenericContainer
*container
, gboolean fully_qualified
, gboolean with_marshal_info
)
862 guint32 cols
[MONO_METHOD_SIZE
];
863 guint32 pcols
[MONO_PARAM_SIZE
];
864 guint32 param_index
= 0, next_param_index
= 0;
865 gboolean has_param_row
;
866 const char *method_name
= "";
868 char *retval
, *esname
;
870 char *marshal_info
= NULL
, *ret_marshal_info
= NULL
;
871 char *gen_param
= NULL
;
872 GString
*result
= g_string_new ("");
873 GString
*result_ret
= g_string_new ("");
876 g_assert (method
|| methoddef_row
);
879 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_METHOD
], methoddef_row
-1, cols
, MONO_METHOD_SIZE
);
881 type
= get_typedef (m
, mono_metadata_typedef_from_method (m
, methoddef_row
));
882 method_name
= mono_metadata_string_heap (m
, cols
[MONO_METHOD_NAME
]);
883 param_index
= cols
[MONO_METHOD_PARAMLIST
];
885 const char *sig
= mono_metadata_blob_heap (m
, cols
[MONO_METHOD_SIGNATURE
]);
887 container
= mono_metadata_load_generic_params (m
, MONO_TOKEN_METHOD_DEF
| methoddef_row
, container
);
889 mono_metadata_load_generic_param_constraints (m
, MONO_TOKEN_METHOD_DEF
| methoddef_row
, container
);
891 mono_metadata_decode_blob_size (sig
, &sig
);
892 method
= mono_metadata_parse_method_signature_full (m
, container
, methoddef_row
, sig
, &sig
);
896 if (container
&& container
->is_method
)
897 gen_param
= get_generic_param (m
, container
);
899 if (methoddef_row
< m
->tables
[MONO_TABLE_METHOD
].rows
) {
900 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_METHOD
], methoddef_row
, cols
, MONO_METHOD_SIZE
);
901 next_param_index
= cols
[MONO_METHOD_PARAMLIST
];
903 next_param_index
= m
->tables
[MONO_TABLE_PARAM
].rows
+ 1;
907 start
= method
->hasthis
? 0 : 1;
908 for (i
= 0; i
< method
->param_count
+ 1; ++i
) {
910 has_param_row
= param_index
&& param_index
< next_param_index
;
913 if (method
->param_count
== 0 && !has_param_row
)
914 /* method has zero parameters, and no row for return val in the PARAM table */
918 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_PARAM
], param_index
- 1, pcols
, MONO_PARAM_SIZE
);
920 if (has_param_row
&& i
== pcols
[MONO_PARAM_SEQUENCE
]) {
922 esname
= get_escaped_name (
923 mono_metadata_string_heap (m
, pcols
[MONO_PARAM_NAME
]));
925 if (with_marshal_info
&& (pcols
[MONO_PARAM_FLAGS
] & PARAM_ATTRIBUTE_HAS_FIELD_MARSHAL
)) {
927 MonoMarshalSpec
*spec
;
928 tp
= mono_metadata_get_marshal_info (m
, param_index
- 1, FALSE
);
930 spec
= mono_metadata_parse_marshal_spec (m
, tp
);
933 marshal_info
= dis_stringify_marshal_spec (spec
);
935 ret_marshal_info
= dis_stringify_marshal_spec (spec
);
940 /* A_[0-9]* does not require escaping */
941 esname
= g_strdup_printf ("A_%i", i
- start
);
948 g_string_append (result
, ", ");
950 retval
= dis_stringify_param (m
, method
->params
[i
- 1]);
952 g_string_append_printf (result
, "%s%s %s", retval
, marshal_info
? marshal_info
: "", esname
);
955 g_free (marshal_info
);
957 g_string_append (result
, ") ");
959 retval
= dis_stringify_param (m
, method
->ret
);
962 g_string_append (result_ret
, "instance ");
963 g_string_append (result_ret
, map (method
->call_convention
, call_conv_type_map
));
964 g_string_sprintfa (result_ret
, " %s%s ", retval
, ret_marshal_info
? ret_marshal_info
:"");
965 g_free (ret_marshal_info
);
967 char *estype
= get_escaped_name (type
);
968 g_string_sprintfa (result_ret
, "%s::", estype
);
972 esname
= get_escaped_name (method_name
);
973 g_string_append (result_ret
, esname
);
976 g_string_append (result_ret
, gen_param
);
979 g_string_append (result_ret
, " (");
982 g_string_prepend (result
, result_ret
->str
);
983 g_string_free (result_ret
, FALSE
);
985 if (show_method_tokens
&& methoddef_row
)
986 g_string_append_printf (result
, " /* 0x%X */ ",
987 (methoddef_row
>> MONO_TYPEORMETHOD_BITS
) | MONO_TOKEN_METHOD_DEF
);
990 mono_metadata_free_method_signature (method
);
991 retval
= result
->str
;
992 g_string_free (result
, FALSE
);
998 dis_stringify_function_ptr (MonoImage
*m
, MonoMethodSignature
*method
)
1001 GString
*result
= g_string_new ("");
1006 g_string_append (result
, map (method
->call_convention
, call_conv_type_map
));
1008 retval
= dis_stringify_param (m
, method
->ret
);
1009 g_string_sprintfa (result
, " %s ", retval
);
1012 g_string_append (result
, " *(");
1013 for (i
= 0; i
< method
->param_count
; ++i
) {
1015 g_string_append (result
, ", ");
1016 retval
= dis_stringify_param (m
, method
->params
[i
]);
1017 g_string_append (result
, retval
);
1020 g_string_append (result
, ") ");
1022 retval
= result
->str
;
1023 g_string_free (result
, FALSE
);
1029 get_escaped_class_name (MonoClass
*c
)
1031 char *result
, *esname
;
1033 if (c
->type_token
== mono_metadata_make_token (MONO_TABLE_TYPEDEF
, 1))
1037 if (c
->rank
|| c
->byval_arg
.type
== MONO_TYPE_PTR
)
1040 esname
= get_escaped_name (c
->name
);
1043 char *part_a
= get_escaped_class_name (c
->nested_in
);
1045 result
= g_strdup_printf ("%s/%s", part_a
, esname
);
1047 } else if (*c
->name_space
)
1048 result
= g_strdup_printf ("%s.%s", c
->name_space
, esname
);
1050 result
= g_strdup (esname
);
1057 dis_stringify_object_with_class (MonoImage
*m
, MonoClass
*c
, gboolean prefix
, gboolean is_def
)
1059 /* FIXME: handle MONO_TYPE_OBJECT ... */
1060 MonoType
*type
= &c
->byval_arg
;
1061 const char *otype
= type
->type
== MONO_TYPE_VALUETYPE
? "valuetype " : "class " ;
1062 char *assemblyref
= NULL
, *result
, *esname
, *generic
= NULL
;
1064 if (c
->type_token
== mono_metadata_make_token (MONO_TABLE_TYPEDEF
, 1))
1068 if (m
!= c
->image
) {
1069 if (c
->image
->assembly_name
) {
1071 if (substitute_with_mscorlib_p
&& !strcmp ("corlib", c
->image
->assembly_name
))
1072 assemblyref
= g_strdup_printf ("[%s]", "mscorlib");
1074 char *esc
= get_escaped_name (c
->image
->assembly
->aname
.name
);
1076 assemblyref
= g_strdup_printf ("[%s]", esc
);
1080 assemblyref
= g_strdup_printf ("[.module %s]", c
->image
->module_name
);
1084 esname
= get_escaped_class_name (c
);
1086 if (c
->generic_class
) {
1087 MonoGenericClass
*gclass
= c
->generic_class
;
1088 MonoGenericInst
*inst
= gclass
->context
.class_inst
;
1089 GString
*str
= g_string_new ("");
1092 for (i
= 0; i
< inst
->type_argc
; i
++){
1093 char *t
= dis_stringify_type (m
, inst
->type_argv
[i
], is_def
);
1095 g_string_append (str
, t
);
1096 if (i
+1 != inst
->type_argc
)
1097 g_string_append (str
, ", ");
1100 generic
= g_strdup_printf ("<%s>", str
->str
);
1101 g_string_free (str
, TRUE
);
1105 result
= g_strdup_printf ("%s%s%s%s", prefix
? otype
: "", assemblyref
?assemblyref
:"",
1106 esname
, generic
?generic
:"");
1109 g_free (assemblyref
);
1116 dis_stringify_object (MonoImage
*m
, MonoType
*type
, gboolean is_def
)
1118 MonoClass
*c
= mono_class_from_mono_type (type
);
1119 return dis_stringify_object_with_class (m
, c
, TRUE
, is_def
);
1123 dis_stringify_type (MonoImage
*m
, MonoType
*type
, gboolean is_def
)
1125 const char *pinned
= "", *byref
= "";
1126 char *bare
= NULL
, *mods
= NULL
;
1130 mods
= dis_stringify_modifiers (m
, type
->num_mods
, type
->modifiers
);
1132 switch (type
->type
){
1133 case MONO_TYPE_BOOLEAN
:
1134 case MONO_TYPE_CHAR
:
1147 case MONO_TYPE_STRING
:
1148 case MONO_TYPE_OBJECT
:
1149 case MONO_TYPE_TYPEDBYREF
:
1150 bare
= g_strdup (map (type
->type
, element_type_map
));
1153 case MONO_TYPE_VALUETYPE
:
1154 case MONO_TYPE_CLASS
:
1155 bare
= dis_stringify_object (m
, type
, is_def
);
1157 case MONO_TYPE_FNPTR
: {
1159 child_type
= dis_stringify_function_ptr (m
, type
->data
.method
);
1160 bare
= g_strdup_printf ("method %s", child_type
);
1161 g_free (child_type
);
1164 case MONO_TYPE_PTR
: {
1166 child_type
= dis_stringify_type (m
, type
->data
.type
, is_def
);
1168 bare
= g_strdup_printf ("%s*", child_type
);
1169 g_free (child_type
);
1172 case MONO_TYPE_SZARRAY
: {
1174 child_type
= dis_stringify_type (m
, &type
->data
.klass
->byval_arg
, is_def
);
1176 bare
= g_strdup_printf ("%s[]", child_type
);
1177 g_free (child_type
);
1180 case MONO_TYPE_ARRAY
:
1181 bare
= dis_stringify_array (m
, type
->data
.array
, is_def
);
1183 case MONO_TYPE_VOID
:
1184 bare
= g_strdup ("void");
1186 case MONO_TYPE_MVAR
:
1187 if (is_def
&& !cant_print_generic_param_name (type
->data
.generic_param
))
1188 bare
= g_strdup_printf ("!!%s", get_escaped_name (type
->data
.generic_param
->name
));
1190 bare
= g_strdup_printf ("!!%d", type
->data
.generic_param
->num
);
1193 if (is_def
&& !cant_print_generic_param_name (type
->data
.generic_param
))
1194 bare
= g_strdup_printf ("!%s", get_escaped_name (type
->data
.generic_param
->name
));
1196 bare
= g_strdup_printf ("!%d", type
->data
.generic_param
->num
);
1198 case MONO_TYPE_GENERICINST
: {
1199 GString
*str
= g_string_new ("");
1200 MonoGenericInst
*inst
;
1202 char *generic_type
= dis_stringify_type (
1203 m
, &type
->data
.generic_class
->container_class
->byval_arg
, is_def
);
1204 inst
= type
->data
.generic_class
->context
.class_inst
;
1205 for (i
= 0; i
< inst
->type_argc
; i
++){
1206 char *t
= dis_stringify_type (m
, inst
->type_argv
[i
], is_def
);
1208 g_string_append (str
, t
);
1209 if (i
+1 != inst
->type_argc
)
1210 g_string_append (str
, ", ");
1213 bare
= g_strdup_printf ("%s<%s>", generic_type
, str
->str
);
1214 g_string_free (str
, TRUE
);
1219 g_error ("Do not know how to stringify type 0x%x", type
->type
);
1229 /* bare is NULL, for <Module> */
1232 result
= g_strconcat (bare
, byref
, pinned
, mods
? mods
: "", NULL
);
1241 * @m: metadata context
1242 * @ptr: location to decode from.
1243 * @result: pointer to string where resulting decoded string is stored
1245 * This routine returs in @result the stringified type pointed by @ptr.
1248 * Returns: the new ptr to continue decoding
1251 get_type (MonoImage
*m
, const char *ptr
, char **result
, gboolean is_def
, MonoGenericContainer
*container
)
1253 const char *start
= ptr
;
1257 if (*ptr
== MONO_TYPE_BYREF
)
1260 type
= mono_metadata_decode_value (ptr
, &ptr
);
1263 case MONO_TYPE_VALUETYPE
:
1264 case MONO_TYPE_CLASS
: {
1265 guint32 token
= mono_metadata_parse_typedef_or_ref (m
, ptr
, &ptr
);
1266 MonoClass
*klass
= mono_class_get (m
, token
);
1267 char *temp
= dis_stringify_object_with_class (m
, klass
, TRUE
, FALSE
);
1270 *result
= g_strdup_printf ("%s/*%08x*/", temp
, token
);
1277 case MONO_TYPE_GENERICINST
: {
1278 GString
*str
= g_string_new ("");
1282 ptr
= get_type (m
, ptr
, &temp
, is_def
, container
);
1283 g_string_append (str
, temp
);
1286 count
= mono_metadata_decode_value (ptr
, &ptr
);
1287 g_string_append (str
, "<");
1289 for (i
= 0; i
< count
; i
++) {
1291 g_string_append (str
, ",");
1292 ptr
= get_type (m
, ptr
, &temp
, is_def
, container
);
1293 g_string_append (str
, temp
);
1296 g_string_append (str
, ">");
1298 g_string_free (str
, FALSE
);
1303 t
= mono_metadata_parse_type_full (m
, container
, MONO_PARSE_TYPE
, 0, start
, &ptr
);
1304 *result
= dis_stringify_type (m
, t
, is_def
);
1313 * Returns a stringified representation of a FieldSig (22.2.4)
1316 get_field_signature (MonoImage
*m
, guint32 blob_signature
, MonoGenericContainer
*container
)
1318 char *allocated_modifier_string
, *allocated_type_string
;
1319 const char *ptr
= mono_metadata_blob_heap (m
, blob_signature
);
1324 len
= mono_metadata_decode_value (ptr
, &ptr
);
1327 g_assert (*ptr
== 0x06);
1328 /* hex_dump (ptr, 0, len); */
1331 ptr
= get_custom_mod (m
, ptr
, &allocated_modifier_string
);
1332 ptr
= get_type (m
, ptr
, &allocated_type_string
, FALSE
, container
);
1334 res
= g_strdup_printf (
1336 allocated_type_string
,
1337 allocated_modifier_string
? allocated_modifier_string
: "");
1339 if (allocated_modifier_string
)
1340 g_free (allocated_modifier_string
);
1341 if (allocated_type_string
)
1342 g_free (allocated_type_string
);
1348 get_field_literal_type (MonoImage
*m
, guint32 blob_signature
)
1350 const char *ptr
= mono_metadata_blob_heap (m
, blob_signature
);
1352 char *allocated_modifier_string
;
1354 len
= mono_metadata_decode_value (ptr
, &ptr
);
1357 g_assert (*ptr
== 0x06);
1360 ptr
= get_custom_mod (m
, ptr
, &allocated_modifier_string
);
1361 if (allocated_modifier_string
)
1362 g_free (allocated_modifier_string
);
1364 return (MonoTypeEnum
) *ptr
;
1370 * @m: metadata context
1371 * @token: token to decode
1373 * decodes the literal indexed by @token.
1376 decode_literal (MonoImage
*m
, guint32 token
)
1378 return g_strdup ("LITERAL_VALUE");
1383 * @m: metadata context
1384 * @ptr: location to decode from.
1385 * @result: pointer to string where resulting decoded string is stored
1387 * This routine returns in @result the stringified RetType (22.2.11)
1389 * Returns: the new ptr to continue decoding.
1392 get_ret_type (MonoImage
*m
, const char *ptr
, char **ret_type
, MonoGenericContainer
*container
)
1394 GString
*str
= g_string_new ("");
1396 char *allocated_type_string
;
1399 ptr
= get_custom_mod (m
, ptr
, &mod
);
1401 if (*ptr
== MONO_TYPE_TYPEDBYREF
){
1402 g_string_append (str
, "typedref");
1404 } else if (*ptr
== MONO_TYPE_VOID
){
1405 g_string_append (str
, "void");
1408 if (*ptr
== MONO_TYPE_BYREF
){
1413 ptr
= get_type (m
, ptr
, &allocated_type_string
, FALSE
, container
);
1414 g_string_append (str
, allocated_type_string
);
1416 g_string_append (str
, "& ");
1417 g_free (allocated_type_string
);
1421 g_string_append (str
, mod
);
1422 g_string_append_c (str
, ' ');
1426 *ret_type
= str
->str
;
1427 g_string_free (str
, FALSE
);
1434 * @m: metadata context
1435 * @ptr: location to decode from.
1436 * @result: pointer to string where resulting decoded string is stored
1438 * This routine returns in @result the stringified Param (22.2.10)
1440 * Returns: the new ptr to continue decoding.
1443 get_param (MonoImage
*m
, const char *ptr
, char **retval
, MonoGenericContainer
*container
)
1445 GString
*str
= g_string_new ("");
1446 char *allocated_mod_string
, *allocated_type_string
;
1448 ptr
= get_custom_mod (m
, ptr
, &allocated_mod_string
);
1450 if (*ptr
== MONO_TYPE_TYPEDBYREF
){
1451 g_string_append (str
, " typedref ");
1454 gboolean by_ref
= 0;
1455 if (*ptr
== MONO_TYPE_BYREF
){
1456 g_string_append (str
, "[out] ");
1460 ptr
= get_type (m
, ptr
, &allocated_type_string
, FALSE
, container
);
1461 g_string_append (str
, allocated_type_string
);
1463 g_string_append_c (str
, '&');
1464 g_free (allocated_type_string
);
1467 if (allocated_mod_string
){
1468 g_string_append (str
, allocated_mod_string
);
1469 g_string_append_c (str
, ' ');
1470 g_free (allocated_mod_string
);
1474 g_string_free (str
, FALSE
);
1481 * @str: string to process
1482 * @list: list of chars to escape
1484 * Returns: an allocated escaped string.
1487 str_escape (const char *str
, const char *list
)
1489 const char *p
= str
;
1492 res
= g_string_sized_new (strlen (str
));
1495 while (*p
&& !strchr (list
, *p
))
1497 g_string_append_len (res
, str
, p
- str
);
1500 g_string_append_c (res
, '\\');
1505 return g_string_free (res
, FALSE
);
1511 * Returns: An allocated escaped name. A name needs to be escaped
1512 * because it might be an ilasm keyword.
1515 get_escaped_name (const char *name
)
1523 g_assert (key_table
);
1525 if (strlen (name
) == 0)
1526 return g_strdup (name
);
1528 for (s
= name
; *s
; s
++) {
1529 char *first
, *result
;
1534 first
= g_strndup (name
, s
-name
);
1535 result
= g_strdup_printf ("%s/%s", get_escaped_name (first
), get_escaped_name (s
+1));
1541 for (s
= name
; *s
; s
++) {
1542 if (isalnum (*s
) || *s
== '_' || *s
== '$' || *s
== '@' ||
1543 *s
== '?' || (*s
== '.' && s
!= name
) || *s
== 0 || *s
== '!' || *s
== '`')
1546 esc
= str_escape (name
, "'\\");
1547 ret
= g_strdup_printf ("'%s'", esc
);
1552 if (g_hash_table_lookup (key_table
, name
))
1553 return g_strdup_printf ("'%s'", name
);
1555 return str_escape (name
, "'\\");
1558 static dis_map_t param_map
[] = {
1559 { PARAM_ATTRIBUTE_IN
, "[in] " },
1560 { PARAM_ATTRIBUTE_OUT
, "[out] " },
1561 { PARAM_ATTRIBUTE_OPTIONAL
, "optional " },
1562 { PARAM_ATTRIBUTE_HAS_DEFAULT
, "hasdefault " },
1563 { PARAM_ATTRIBUTE_HAS_FIELD_MARSHAL
, "fieldmarshal " },
1568 param_flags (guint32 f
)
1570 return g_strdup (flags (f
, param_map
));
1573 static dis_map_t field_access_map
[] = {
1574 { FIELD_ATTRIBUTE_COMPILER_CONTROLLED
, "privatescope " },
1575 { FIELD_ATTRIBUTE_PRIVATE
, "private " },
1576 { FIELD_ATTRIBUTE_FAM_AND_ASSEM
, "famandassem " },
1577 { FIELD_ATTRIBUTE_ASSEMBLY
, "assembly " },
1578 { FIELD_ATTRIBUTE_FAMILY
, "family " },
1579 { FIELD_ATTRIBUTE_FAM_OR_ASSEM
, "famorassem " },
1580 { FIELD_ATTRIBUTE_PUBLIC
, "public " },
1584 static dis_map_t field_flags_map
[] = {
1585 { FIELD_ATTRIBUTE_STATIC
, "static " },
1586 { FIELD_ATTRIBUTE_INIT_ONLY
, "initonly " },
1587 { FIELD_ATTRIBUTE_LITERAL
, "literal " },
1588 { FIELD_ATTRIBUTE_NOT_SERIALIZED
, "notserialized " },
1589 { FIELD_ATTRIBUTE_SPECIAL_NAME
, "specialname " },
1590 { FIELD_ATTRIBUTE_PINVOKE_IMPL
, "FIXME:pinvokeimpl " },
1591 { FIELD_ATTRIBUTE_RT_SPECIAL_NAME
, "rtspecialname " },
1592 /*{ FIELD_ATTRIBUTE_HAS_FIELD_MARSHAL, "hasfieldmarshal " },*/
1599 * Returns a stringified version of a Field's flags
1602 field_flags (guint32 f
)
1605 int access
= f
& FIELD_ATTRIBUTE_FIELD_ACCESS_MASK
;
1609 strcat (buffer
, map (access
, field_access_map
));
1610 strcat (buffer
, flags (f
, field_flags_map
));
1611 return g_strdup (buffer
);
1615 * Returns a stringifed representation of a MethodRefSig (22.2.2)
1618 get_methodref_signature (MonoImage
*m
, guint32 blob_signature
, const char *fancy_name
)
1620 GString
*res
= g_string_new ("");
1621 const char *ptr
= mono_metadata_blob_heap (m
, blob_signature
);
1622 char *allocated_ret_type
, *s
;
1623 const char *cconv_str
;
1624 gboolean seen_vararg
= 0;
1625 int param_count
, signature_len
;
1626 int i
, gen_count
= 0;
1629 signature_len
= mono_metadata_decode_value (ptr
, &ptr
);
1633 g_string_append (res
, "explicit-this ");
1635 g_string_append (res
, "instance "); /* has-this */
1640 cconv
= *ptr
& 0x0f;
1641 cconv_str
= map (cconv
, call_conv_type_map
);
1642 if (strcmp (cconv_str
, "default") != 0) {
1643 g_string_append (res
, cconv_str
);
1644 g_string_append (res
, " ");
1649 gen_count
= mono_metadata_decode_value (ptr
, &ptr
);
1650 param_count
= mono_metadata_decode_value (ptr
, &ptr
);
1652 ptr
= get_ret_type (m
, ptr
, &allocated_ret_type
, NULL
);
1653 g_string_append (res
, allocated_ret_type
);
1654 g_free (allocated_ret_type
);
1658 g_string_append_c (res
, ' ');
1659 g_string_append (res
, fancy_name
);
1662 g_string_append (res
, "(");
1665 * param_count describes parameters *before* and *after*
1666 * the vararg sentinel
1668 for (i
= 0; i
< param_count
; i
++){
1672 * If ptr is a SENTINEL
1676 g_string_append (res
, "..., ");
1683 ptr
= get_param (m
, ptr
, ¶m
, NULL
);
1684 g_string_append (res
, param
);
1685 if (i
+1 != param_count
)
1686 g_string_append (res
, ", ");
1689 g_string_append (res
, ")");
1692 * cleanup and return
1695 g_string_free (res
, FALSE
);
1700 * Returns a stringifed representation of a field ref
1703 get_fieldref_signature (MonoImage
*m
, int idx
, MonoGenericContainer
*container
)
1705 guint32 cols
[MONO_MEMBERREF_SIZE
];
1706 MonoGenericContainer
*new_container
;
1707 char *type
, *esname
;
1711 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_MEMBERREF
],
1712 idx
- 1, cols
, MONO_MEMBERREF_SIZE
);
1714 new_container
= get_memberref_container (m
, cols
[MONO_MEMBERREF_CLASS
], container
);
1715 sig
= get_field_signature (m
, cols
[MONO_MEMBERREF_SIGNATURE
], new_container
);
1717 type
= get_memberref_parent (m
, cols
[MONO_MEMBERREF_CLASS
], container
);
1718 esname
= get_escaped_name (mono_metadata_string_heap (m
, cols
[MONO_MEMBERREF_NAME
]));
1720 full_sig
= g_strdup_printf ("%s %s%s%s",
1734 * @m: metadata context
1735 * @token: a FIELD_DEF token
1737 * This routine has to locate the TypeDef that "owns" this Field.
1738 * Since there is no backpointer in the Field table, we have to scan
1739 * the TypeDef table and locate the actual "owner" of the field
1742 get_field (MonoImage
*m
, guint32 token
, MonoGenericContainer
*container
)
1744 int idx
= mono_metadata_token_index (token
);
1745 guint32 cols
[MONO_FIELD_SIZE
];
1746 char *sig
, *res
, *type
, *estype
, *esname
;
1750 * We can get here also with a MenberRef token (for a field
1751 * defined in another module/assembly, just like in get_method ()
1753 if (mono_metadata_token_code (token
) == MONO_TOKEN_MEMBER_REF
) {
1754 return get_fieldref_signature (m
, idx
, container
);
1756 g_assert (mono_metadata_token_code (token
) == MONO_TOKEN_FIELD_DEF
);
1758 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_FIELD
], idx
- 1, cols
, MONO_FIELD_SIZE
);
1759 sig
= get_field_signature (m
, cols
[MONO_FIELD_SIGNATURE
], container
);
1762 * To locate the actual "container" for this field, we have to scan
1763 * the TypeDef table. LAME!
1765 type_idx
= mono_metadata_typedef_from_field (m
, idx
);
1767 type
= get_typedef (m
, type_idx
);
1768 estype
= get_escaped_name (type
);
1769 esname
= get_escaped_name (mono_metadata_string_heap (m
, cols
[MONO_FIELD_NAME
]));
1770 res
= g_strdup_printf ("%s %s%s%s",
1772 estype
? estype
: "",
1784 static MonoGenericContainer
*
1785 get_memberref_container (MonoImage
*m
, guint32 mrp_token
, MonoGenericContainer
*container
)
1790 * mrp_index is a MemberRefParent coded index
1792 guint32 table
= mrp_token
& 7;
1793 guint32 idx
= mrp_token
>> 3;
1796 case 0: /* TypeDef */
1797 return mono_metadata_load_generic_params (m
, MONO_TOKEN_TYPE_DEF
| idx
, NULL
);
1799 case 1: /* TypeRef */
1802 case 4: /* TypeSpec */
1803 klass
= mono_class_get_full (m
, MONO_TOKEN_TYPE_SPEC
| idx
, (MonoGenericContext
*) container
);
1805 return klass
->generic_class
? klass
->generic_class
->container_class
->generic_container
: NULL
;
1807 g_assert_not_reached ();
1812 get_memberref_parent (MonoImage
*m
, guint32 mrp_token
, MonoGenericContainer
*container
)
1815 * mrp_index is a MemberRefParent coded index
1817 guint32 table
= mrp_token
& 7;
1818 guint32 idx
= mrp_token
>> 3;
1821 case 0: /* TypeDef */
1822 return get_typedef (m
, idx
);
1824 case 1: /* TypeRef */
1825 return get_typeref (m
, idx
);
1827 case 2: /* ModuleRef */
1828 return g_strdup_printf ("TODO:MemberRefParent-ModuleRef");
1830 case 3: /* MethodDef */
1831 return g_strdup ("TODO:MethodDef");
1833 case 4: /* TypeSpec */
1834 return get_typespec (m
, idx
, FALSE
, container
);
1836 g_assert_not_reached ();
1842 * @m: metadata context
1843 * @token: a METHOD_DEF or MEMBER_REF token
1845 * This routine has to locate the TypeDef that "owns" this Field.
1846 * Since there is no backpointer in the Field table, we have to scan
1847 * the TypeDef table and locate the actual "owner" of the field
1850 get_method_core (MonoImage
*m
, guint32 token
, gboolean fullsig
, MonoGenericContainer
*container
)
1852 int idx
= mono_metadata_token_index (token
);
1853 guint32 member_cols
[MONO_MEMBERREF_SIZE
], method_cols
[MONO_METHOD_SIZE
];
1854 char *sig
= NULL
, *esname
;
1858 MonoGenericContainer
*type_container
= container
;
1860 mh
= mono_get_method_full (m
, token
, NULL
, (MonoGenericContext
*) container
);
1862 if (mono_method_signature (mh
)->is_inflated
)
1863 container
= mono_method_get_generic_container (((MonoMethodInflated
*) mh
)->declaring
);
1864 esname
= get_escaped_name (mh
->name
);
1865 sig
= dis_stringify_type (m
, &mh
->klass
->byval_arg
, TRUE
);
1867 name
= g_strdup_printf ("%s/*%08x*/%s%s", sig
? sig
: "", token
, sig
? "::" : "", esname
);
1869 name
= g_strdup_printf ("%s%s%s", sig
? sig
: "", sig
? "::" : "", esname
);
1875 switch (mono_metadata_token_code (token
)){
1876 case MONO_TOKEN_METHOD_DEF
:
1877 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_METHOD
],
1878 idx
- 1, method_cols
, MONO_METHOD_SIZE
);
1880 sig
= get_methodref_signature (m
, method_cols
[MONO_METHOD_SIGNATURE
], name
);
1883 case MONO_TOKEN_MEMBER_REF
: {
1884 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_MEMBERREF
],
1885 idx
- 1, member_cols
, MONO_MEMBERREF_SIZE
);
1887 char *parent
= get_memberref_parent (m
, member_cols
[MONO_MEMBERREF_CLASS
], container
);
1888 name
= g_strdup_printf ("%s%s%s",
1889 parent
? parent
: "",
1891 mono_metadata_string_heap (m
, member_cols
[MONO_MEMBERREF_NAME
]));
1898 arity
= mono_method_get_generic_container (mh
)->type_argc
;
1900 if (mh
->is_inflated
&& ((MonoMethodInflated
*)mh
)->declaring
->is_generic
)
1901 arity
= mono_method_get_generic_container (((MonoMethodInflated
*) mh
)->declaring
)->type_argc
;
1904 char *str
= g_strdup_printf ("%s <[%d]>", name
, arity
);
1910 sig
= get_methodref_signature (
1911 m
, member_cols
[MONO_MEMBERREF_SIGNATURE
], name
);
1914 case MONO_TOKEN_METHOD_SPEC
: {
1915 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_METHODSPEC
],
1916 idx
- 1, member_cols
, MONO_METHODSPEC_SIZE
);
1917 token
= member_cols
[MONO_METHODSPEC_METHOD
];
1918 sig
= get_methodspec (m
, idx
, token
, name
, type_container
);
1923 g_assert_not_reached ();
1934 char *retval
= g_strdup_printf ("%s /* %08x */", sig
, token
);
1942 get_method (MonoImage
*m
, guint32 token
, MonoGenericContainer
*container
)
1944 return get_method_core (m
, token
, TRUE
, container
);
1949 * @m: metadata context
1950 * @idx: index into the method table
1952 * Returns: A stringified version of the method signature.
1955 get_methoddef (MonoImage
*m
, guint32 idx
)
1957 guint32 cols
[MONO_METHOD_SIZE
];
1963 mh
= mono_get_method (m
, MONO_TOKEN_METHOD_DEF
| idx
, NULL
);
1965 sig
= dis_stringify_type (m
, &mh
->klass
->byval_arg
, FALSE
);
1966 name
= g_strdup_printf ("%s%s%s",
1973 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_METHOD
],
1974 idx
- 1, cols
, MONO_METHOD_SIZE
);
1975 sig
= get_methodref_signature (m
, cols
[MONO_METHOD_SIGNATURE
], name
);
1981 get_method_type_param (MonoImage
*m
, guint32 blob_signature
, MonoGenericContainer
*container
)
1983 GString
*res
= g_string_new ("");
1984 const char *ptr
= mono_metadata_blob_heap (m
, blob_signature
);
1989 mono_metadata_decode_value (ptr
, &ptr
);
1991 param_count
= mono_metadata_decode_value (ptr
, &ptr
);
1993 g_string_append_c (res
, '<');
1995 for (i
= 0; i
< param_count
; i
++){
1998 ptr
= get_param (m
, ptr
, ¶m
, container
);
1999 g_string_append (res
, param
);
2000 if (i
+1 != param_count
)
2001 g_string_append (res
, ", ");
2004 g_string_append_c (res
, '>');
2007 g_string_free (res
, FALSE
);
2014 * Returns: An allocated stringified version of the methodspec signature.
2018 get_methodspec (MonoImage
*m
, int idx
, guint32 token
, const char *fancy_name
, MonoGenericContainer
*type_container
)
2020 GString
*res
= g_string_new ("");
2021 guint32 member_cols
[MONO_MEMBERREF_SIZE
], method_cols
[MONO_METHOD_SIZE
];
2022 char *s
, *type_param
;
2025 int param_count
, cconv
, i
, gen_count
= 0;
2026 MonoGenericContainer
*container
;
2027 MonoMethod
*mh
= NULL
;
2029 switch (token
& MONO_METHODDEFORREF_MASK
) {
2030 case MONO_METHODDEFORREF_METHODDEF
:
2031 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_METHOD
],
2032 (token
>> MONO_METHODDEFORREF_BITS
) - 1,
2033 method_cols
, MONO_METHOD_SIZE
);
2034 sig
= method_cols
[MONO_METHOD_SIGNATURE
];
2036 case MONO_METHODDEFORREF_METHODREF
:
2037 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_MEMBERREF
],
2038 (token
>> MONO_METHODDEFORREF_BITS
) - 1,
2039 member_cols
, MONO_MEMBERREF_SIZE
);
2040 sig
= member_cols
[MONO_MEMBERREF_SIGNATURE
];
2043 g_assert_not_reached ();
2046 ptr
= mono_metadata_blob_heap (m
, sig
);
2047 mono_metadata_decode_value (ptr
, &ptr
);
2049 mh
= mono_get_method_full (m
, method_dor_to_token (token
), NULL
, (MonoGenericContext
*) type_container
);
2051 container
= mono_method_get_generic_container (mh
);
2053 container
= type_container
;
2057 g_string_append (res
, "explicit-this ");
2059 g_string_append (res
, "instance "); /* has-this */
2064 cconv
= *ptr
& 0x0f;
2067 gen_count
= mono_metadata_decode_value (ptr
, &ptr
);
2068 param_count
= mono_metadata_decode_value (ptr
, &ptr
);
2070 char *allocated_ret_type
;
2071 ptr
= get_ret_type (m
, ptr
, &allocated_ret_type
, container
);
2072 g_string_append (res
, allocated_ret_type
);
2073 g_free (allocated_ret_type
);
2077 g_string_append_c (res
, ' ');
2078 g_string_append (res
, fancy_name
);
2081 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_METHODSPEC
],
2082 idx
- 1, member_cols
, MONO_METHODSPEC_SIZE
);
2083 token
= member_cols
[MONO_METHODSPEC_SIGNATURE
];
2084 type_param
= get_method_type_param (m
, token
, type_container
);
2085 g_string_append (res
, type_param
);
2086 g_string_append (res
, " (");
2089 * methodspecs can not be varargs so we don't need to worry about that here
2092 for (i
= 0; i
< param_count
; i
++){
2095 ptr
= get_param (m
, ptr
, ¶m
, container
);
2096 g_string_append (res
, param
);
2097 if (i
+1 != param_count
)
2098 g_string_append (res
, ", ");
2101 g_string_append (res
, ")");
2104 * cleanup and return
2107 g_string_free (res
, FALSE
);
2112 * get_encoded_user_string_bytearray:
2113 * @ptr: pointer into the US heap
2114 * @len: length of string in the heap.
2116 * Strings on the US heap are encoded using UTF-16. Print a bytearray.
2119 get_encoded_user_string_bytearray (const unsigned char* ptr
, int len
)
2122 int i
, j
, tspaces
= (len
% 16);
2126 return g_strdup_printf ("\"\"");
2128 res
= g_string_new ("bytearray (\n\t");
2130 for (i
= 1; i
<= len
; ++i
) {
2131 g_string_append_printf (res
, "%02x ", ptr
[i
-1]);
2135 g_string_append (res
, ")// ");
2137 g_string_append (res
, " // ");
2139 for(j
= i
- 16; j
< i
; ++j
)
2140 g_string_append_printf (res
, "%c", isprint (ptr
[j
]) ? ptr
[j
] : '.');
2141 g_string_append (res
, "\n\t");
2146 g_string_append (res
, ") ");
2147 for (i
= tspaces
+ 1; i
< 16; ++i
)
2148 g_string_append_printf (res
, " ");
2150 g_string_append (res
, " // ");
2151 for(i
= len
- tspaces
; i
< len
; ++i
)
2152 g_string_append_printf (res
, "%c", isprint (ptr
[i
]) ? ptr
[i
] : '.');
2153 g_string_append (res
, "\n\t");
2157 g_string_free (res
, FALSE
);
2162 * get_encoded_user_string_or_bytearray:
2163 * @ptr: pointer into the US heap
2165 * Strings on the US heap are encoded using UTF-16. Print as string
2166 * if possible, else emit a bytearray.
2169 get_encoded_user_string_or_bytearray (const unsigned char *ptr
, int len
)
2171 char *res
, *eres
, *result
;
2174 res
= g_malloc ((len
>> 1) + 1);
2177 * I should really use some kind of libunicode here
2179 for (i
= 0; i
+ 1 < len
; i
+= 2) {
2181 (!isprint (ptr
[i
]) && ptr
[i
] != '\\' && ptr
[i
] != '"' &&
2182 ptr
[i
] != '\r' && ptr
[i
] != '\n' && ptr
[i
] != '\t')) {
2184 return get_encoded_user_string_bytearray (ptr
, len
);
2187 res
[i
>> 1] = ptr
[i
];
2192 eres
= g_strescape (res
, NULL
);
2193 result
= g_strdup_printf ("\"%s\"", eres
);
2201 stringify_double (double r
)
2205 ret
= g_strdup_printf ("%.17g.", r
);
2206 ptr
= ret
+ strlen (ret
) - 1;
2207 if (strpbrk (ret
, ".eE") != ptr
)
2215 * @m: metadata context
2216 * @blob_index: index into the blob where the constant is stored
2218 * Returns: An allocated value representing a stringified version of the
2222 get_constant (MonoImage
*m
, MonoTypeEnum t
, guint32 blob_index
)
2224 const char *ptr
= mono_metadata_blob_heap (m
, blob_index
);
2227 len
= mono_metadata_decode_value (ptr
, &ptr
);
2230 case MONO_TYPE_BOOLEAN
:
2231 return g_strdup_printf ("%s", *ptr
? "bool(true)" : "bool(false)");
2233 case MONO_TYPE_CHAR
:
2234 return g_strdup_printf ("char(0x%04x)", read16(ptr
));
2238 return g_strdup_printf ("int8(0x%02x)", (int) ((*ptr
) & 0xFF));
2243 return g_strdup_printf ("int16(0x%08x)", (int) read16 (ptr
));
2247 return g_strdup_printf ("int32(0x%08x)", read32 (ptr
));
2250 case MONO_TYPE_I8
: {
2253 high
= read32 (ptr
+ 4);
2254 return g_strdup_printf ("int64(0x%08x%08x)", high
, low
);
2256 case MONO_TYPE_R4
: {
2261 /* Crazy solaris systems doesn't have isnormal */
2263 normal
= finite (r
);
2265 normal
= isnormal (r
);
2268 return g_strdup_printf ("float32(0x%08x)", read32 (ptr
));
2270 char *str
= stringify_double ((double) r
);
2271 char *ret
= g_strdup_printf ("float32(%s)", str
);
2276 case MONO_TYPE_R8
: {
2281 /* Crazy solaris systems doesn't have isnormal */
2283 normal
= finite (r
);
2285 normal
= isnormal (r
);
2290 high
= read32 (ptr
+ 4);
2291 return g_strdup_printf ("float64(0x%08x%08x)", high
, low
);
2293 char *str
= stringify_double (r
);
2294 char *ret
= g_strdup_printf ("float64(%s)", str
);
2299 case MONO_TYPE_STRING
:
2300 return get_encoded_user_string_or_bytearray ((const guchar
*)ptr
, len
);
2302 case MONO_TYPE_CLASS
:
2303 return g_strdup ("nullref");
2306 g_error ("Unknown MONO_TYPE (%d) on constant at Blob index (0x%08x)\n",
2307 (int) *ptr
, blob_index
);
2308 return g_strdup_printf ("Unknown");
2315 * @m: metadata context
2316 * @token: token that we want to decode.
2318 * Returns: An allocated value representing a stringified version of the
2322 get_token (MonoImage
*m
, guint32 token
, MonoGenericContainer
*container
)
2324 char *temp
, *result
;
2325 guint32 idx
= mono_metadata_token_index (token
);
2327 switch (mono_metadata_token_code (token
)){
2328 case MONO_TOKEN_FIELD_DEF
:
2329 temp
= get_field (m
, token
, container
);
2330 result
= g_strdup_printf ("field %s", temp
);
2333 case MONO_TOKEN_METHOD_DEF
:
2334 temp
= get_method (m
, token
, container
);
2335 result
= g_strdup_printf ("method %s", temp
);
2338 case MONO_TOKEN_TYPE_DEF
:
2339 temp
= get_typedef (m
, idx
);
2340 result
= get_escaped_name (temp
);
2343 case MONO_TOKEN_TYPE_REF
:
2344 return get_typeref (m
, idx
);
2345 case MONO_TOKEN_TYPE_SPEC
:
2346 return get_typespec (m
, idx
, TRUE
, container
);
2347 case MONO_TOKEN_MEMBER_REF
: {
2348 guint32 cols
[MONO_MEMBERREF_SIZE
];
2350 mono_metadata_decode_row (&m
->tables
[MONO_TABLE_MEMBERREF
], mono_metadata_token_index (token
) - 1, cols
, MONO_MEMBERREF_SIZE
);
2351 sig
= mono_metadata_blob_heap (m
, cols
[MONO_MEMBERREF_SIGNATURE
]);
2352 mono_metadata_decode_blob_size (sig
, &sig
);
2353 if (*sig
== 0x6) { /* it's a field */
2354 temp
= get_field (m
, token
, container
);
2355 result
= g_strdup_printf ("field %s", temp
);
2359 temp
= get_method (m
, token
, container
);
2360 result
= g_strdup_printf ("method %s", temp
);
2367 g_error ("Do not know how to decode tokens of type 0x%08x", token
);
2370 g_assert_not_reached ();
2371 return g_strdup ("ERROR");
2376 * @m: metadata context
2377 * @token: the token can belong to any of the following tables:
2378 * MONO_TOKEN_TYPE_REF, MONO_TOKEN_TYPE_DEF, MONO_TOKEN_TYPE_SPEC
2380 * Returns: a stringified version of the MethodDef or MethodRef or TypeSpecn
2381 * at (token & 0xffffff)
2384 get_token_type (MonoImage
*m
, guint32 token
, MonoGenericContainer
*container
)
2386 char *temp
= NULL
, *s
= NULL
;
2389 idx
= mono_metadata_token_index (token
);
2391 switch (mono_metadata_token_code (token
)){
2392 case MONO_TOKEN_TYPE_DEF
:
2393 temp
= get_typedef (m
, idx
);
2394 s
= g_strdup_printf ("%s", temp
);
2397 case MONO_TOKEN_TYPE_REF
:
2398 temp
= get_typeref (m
, idx
);
2399 s
= g_strdup_printf ("%s", temp
);
2402 case MONO_TOKEN_TYPE_SPEC
:
2403 s
= get_typespec (m
, idx
, FALSE
, container
);
2407 g_error ("Unhandled encoding for token 0x%08x", token
);
2418 get_guid (MonoImage
*m
, guint32 guid_index
)
2420 const unsigned char *guid
;
2423 guid
= (const guchar
*)mono_metadata_guid_heap (m
, guid_index
);
2425 result
= g_strdup_printf ("{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
2426 guid
[3], guid
[2], guid
[1], guid
[0], guid
[5], guid
[4], guid
[7], guid
[6],
2427 guid
[8], guid
[9], guid
[10], guid
[11], guid
[12], guid
[13], guid
[14], guid
[15]);
2432 dis_get_custom_attrs (MonoImage
*m
, guint32 token
)
2435 guint32 idx
, i
, len
, mtoken
;
2436 guint32 cols
[MONO_CUSTOM_ATTR_SIZE
];
2442 idx
= mono_metadata_token_index (token
);
2443 idx
<<= MONO_CUSTOM_ATTR_BITS
;
2445 switch (mono_metadata_token_table (token
)) {
2446 case MONO_TABLE_TYPEDEF
:
2447 idx
|= MONO_CUSTOM_ATTR_TYPEDEF
;
2449 case MONO_TABLE_ASSEMBLY
:
2450 idx
|= MONO_CUSTOM_ATTR_ASSEMBLY
;
2452 case MONO_TABLE_ASSEMBLYREF
:
2453 idx
|= MONO_CUSTOM_ATTR_ASSEMBLYREF
;
2455 case MONO_TABLE_MODULE
:
2456 idx
|= MONO_CUSTOM_ATTR_MODULE
;
2458 case MONO_TABLE_PROPERTY
:
2459 idx
|= MONO_CUSTOM_ATTR_PROPERTY
;
2461 case MONO_TABLE_EVENT
:
2462 idx
|= MONO_CUSTOM_ATTR_EVENT
;
2464 case MONO_TABLE_FIELD
:
2465 idx
|= MONO_CUSTOM_ATTR_FIELDDEF
;
2467 case MONO_TABLE_METHOD
:
2468 idx
|= MONO_CUSTOM_ATTR_METHODDEF
;
2470 case MONO_TABLE_PARAM
:
2471 idx
|= MONO_CUSTOM_ATTR_PARAMDEF
;
2473 case MONO_TABLE_GENERICPARAM
:
2474 idx
|= MONO_CUSTOM_ATTR_GENERICPAR
;
2477 g_print ("Missing custom attr get support for token 0x%08x\n", token
);
2481 ca
= &m
->tables
[MONO_TABLE_CUSTOMATTRIBUTE
];
2482 /* the table is not sorted */
2483 for (i
= 0; i
< ca
->rows
; ++i
) {
2485 mono_metadata_decode_row (ca
, i
, cols
, MONO_CUSTOM_ATTR_SIZE
);
2486 if (cols
[MONO_CUSTOM_ATTR_PARENT
] != idx
)
2488 mtoken
= cols
[MONO_CUSTOM_ATTR_TYPE
] >> MONO_CUSTOM_ATTR_TYPE_BITS
;
2489 switch (cols
[MONO_CUSTOM_ATTR_TYPE
] & MONO_CUSTOM_ATTR_TYPE_MASK
) {
2490 case MONO_CUSTOM_ATTR_TYPE_METHODDEF
:
2491 mtoken
|= MONO_TOKEN_METHOD_DEF
;
2493 case MONO_CUSTOM_ATTR_TYPE_MEMBERREF
:
2494 mtoken
|= MONO_TOKEN_MEMBER_REF
;
2497 g_error ("Unknown table for custom attr type %08x", cols
[MONO_CUSTOM_ATTR_TYPE
]);
2500 method
= get_method (m
, mtoken
, NULL
);
2501 val
= mono_metadata_blob_heap (m
, cols
[MONO_CUSTOM_ATTR_VALUE
]);
2502 len
= mono_metadata_decode_value (val
, &val
);
2503 attr
= g_string_new (".custom ");
2504 dump
= data_dump (val
, len
, "\t\t");
2505 g_string_sprintfa (attr
, "%s = %s", method
, dump
);
2507 list
= g_list_append (list
, attr
->str
);
2508 g_string_free (attr
, FALSE
);
2515 get_marshal_info (MonoImage
*m
, const char *blob
) {
2518 len
= mono_metadata_decode_blob_size (blob
, &blob
);
2521 case MONO_NATIVE_BOOLEAN
:
2522 return g_strdup ("bool");
2523 case MONO_NATIVE_I1
:
2524 return g_strdup ("int8");
2525 case MONO_NATIVE_U1
:
2526 return g_strdup ("unsigned int8");
2527 case MONO_NATIVE_I2
:
2528 return g_strdup ("int16");
2529 case MONO_NATIVE_U2
:
2530 return g_strdup ("unsigned int16");
2531 case MONO_NATIVE_I4
:
2532 return g_strdup ("int32");
2533 case MONO_NATIVE_U4
:
2534 return g_strdup ("unsigned int32");
2535 case MONO_NATIVE_I8
:
2536 return g_strdup ("int64");
2537 case MONO_NATIVE_U8
:
2538 return g_strdup ("unsigned int64");
2539 case MONO_NATIVE_R4
:
2540 return g_strdup ("float32");
2541 case MONO_NATIVE_R8
:
2542 return g_strdup ("float64");
2543 case MONO_NATIVE_CURRENCY
:
2544 return g_strdup ("currency");
2545 case MONO_NATIVE_BSTR
:
2546 return g_strdup ("bstr");
2547 case MONO_NATIVE_LPSTR
:
2548 return g_strdup ("lpstr");
2549 case MONO_NATIVE_LPWSTR
:
2550 return g_strdup ("lpwstr");
2551 case MONO_NATIVE_LPTSTR
:
2552 return g_strdup ("lptstr");
2553 case MONO_NATIVE_BYVALTSTR
:
2554 size
= mono_metadata_decode_value (blob
+ 1, &blob
);
2555 return g_strdup_printf ("fixed sysstring [%d]", size
);
2556 case MONO_NATIVE_IUNKNOWN
:
2557 return g_strdup ("iunknown");
2558 case MONO_NATIVE_IDISPATCH
:
2559 return g_strdup ("idispatch");
2560 case MONO_NATIVE_STRUCT
:
2561 return g_strdup ("struct");
2562 case MONO_NATIVE_INTERFACE
:
2563 return g_strdup ("interface");
2564 case MONO_NATIVE_SAFEARRAY
:
2565 return g_strdup ("safearray");
2566 case MONO_NATIVE_BYVALARRAY
:
2567 size
= mono_metadata_decode_value (blob
+ 1, &blob
);
2568 return g_strdup_printf ("fixed array [%d]", size
);
2569 case MONO_NATIVE_INT
:
2570 return g_strdup ("int");
2571 case MONO_NATIVE_UINT
:
2572 return g_strdup ("unsigned int");
2573 case MONO_NATIVE_VBBYREFSTR
:
2574 return g_strdup ("vbbyrefstr");
2575 case MONO_NATIVE_ANSIBSTR
:
2576 return g_strdup ("ansi bstr");
2577 case MONO_NATIVE_TBSTR
:
2578 return g_strdup ("tbstr");
2579 case MONO_NATIVE_VARIANTBOOL
:
2580 return g_strdup ("variant bool");
2581 case MONO_NATIVE_FUNC
:
2582 return g_strdup ("method");
2583 case MONO_NATIVE_ASANY
:
2584 return g_strdup ("as any");
2585 case MONO_NATIVE_LPARRAY
:
2586 return g_strdup ("[]");
2587 case MONO_NATIVE_LPSTRUCT
:
2588 return g_strdup ("lpstruct");
2589 case MONO_NATIVE_CUSTOM
:
2590 return g_strdup ("custom");
2591 case MONO_NATIVE_ERROR
:
2592 return g_strdup ("error");
2594 return g_strdup ("unknown");
2599 init_key_table (void)
2601 key_table
= g_hash_table_new (g_str_hash
, g_str_equal
);
2603 g_hash_table_insert (key_table
, (char *) "9", GINT_TO_POINTER (TRUE
));
2604 g_hash_table_insert (key_table
, (char *) "abstract", GINT_TO_POINTER (TRUE
));
2605 g_hash_table_insert (key_table
, (char *) "add", GINT_TO_POINTER (TRUE
));
2606 g_hash_table_insert (key_table
, (char *) "add.ovf", GINT_TO_POINTER (TRUE
));
2607 g_hash_table_insert (key_table
, (char *) "add.ovf.un", GINT_TO_POINTER (TRUE
));
2608 g_hash_table_insert (key_table
, (char *) "algorithm", GINT_TO_POINTER (TRUE
));
2609 g_hash_table_insert (key_table
, (char *) "alignment", GINT_TO_POINTER (TRUE
));
2610 g_hash_table_insert (key_table
, (char *) "and", GINT_TO_POINTER (TRUE
));
2611 g_hash_table_insert (key_table
, (char *) "ansi", GINT_TO_POINTER (TRUE
));
2612 g_hash_table_insert (key_table
, (char *) "any", GINT_TO_POINTER (TRUE
));
2613 g_hash_table_insert (key_table
, (char *) "arglist", GINT_TO_POINTER (TRUE
));
2614 g_hash_table_insert (key_table
, (char *) "array", GINT_TO_POINTER (TRUE
));
2615 g_hash_table_insert (key_table
, (char *) "as", GINT_TO_POINTER (TRUE
));
2616 g_hash_table_insert (key_table
, (char *) "assembly", GINT_TO_POINTER (TRUE
));
2617 g_hash_table_insert (key_table
, (char *) "assert", GINT_TO_POINTER (TRUE
));
2618 g_hash_table_insert (key_table
, (char *) "at", GINT_TO_POINTER (TRUE
));
2619 g_hash_table_insert (key_table
, (char *) "autochar", GINT_TO_POINTER (TRUE
));
2620 g_hash_table_insert (key_table
, (char *) "auto", GINT_TO_POINTER (TRUE
));
2621 g_hash_table_insert (key_table
, (char *) "beforefieldinit", GINT_TO_POINTER (TRUE
));
2622 g_hash_table_insert (key_table
, (char *) "bestfit", GINT_TO_POINTER (TRUE
));
2623 g_hash_table_insert (key_table
, (char *) "beq", GINT_TO_POINTER (TRUE
));
2624 g_hash_table_insert (key_table
, (char *) "beq.s", GINT_TO_POINTER (TRUE
));
2625 g_hash_table_insert (key_table
, (char *) "bge", GINT_TO_POINTER (TRUE
));
2626 g_hash_table_insert (key_table
, (char *) "bge.s", GINT_TO_POINTER (TRUE
));
2627 g_hash_table_insert (key_table
, (char *) "bge.un", GINT_TO_POINTER (TRUE
));
2628 g_hash_table_insert (key_table
, (char *) "bge.un.s", GINT_TO_POINTER (TRUE
));
2629 g_hash_table_insert (key_table
, (char *) "bgt", GINT_TO_POINTER (TRUE
));
2630 g_hash_table_insert (key_table
, (char *) "bgt.s", GINT_TO_POINTER (TRUE
));
2631 g_hash_table_insert (key_table
, (char *) "bgt.un", GINT_TO_POINTER (TRUE
));
2632 g_hash_table_insert (key_table
, (char *) "bgt.un.s", GINT_TO_POINTER (TRUE
));
2633 g_hash_table_insert (key_table
, (char *) "ble", GINT_TO_POINTER (TRUE
));
2634 g_hash_table_insert (key_table
, (char *) "ble.s", GINT_TO_POINTER (TRUE
));
2635 g_hash_table_insert (key_table
, (char *) "ble.un", GINT_TO_POINTER (TRUE
));
2636 g_hash_table_insert (key_table
, (char *) "ble.un.s", GINT_TO_POINTER (TRUE
));
2637 g_hash_table_insert (key_table
, (char *) "blob", GINT_TO_POINTER (TRUE
));
2638 g_hash_table_insert (key_table
, (char *) "blob_object", GINT_TO_POINTER (TRUE
));
2639 g_hash_table_insert (key_table
, (char *) "blt", GINT_TO_POINTER (TRUE
));
2640 g_hash_table_insert (key_table
, (char *) "blt.s", GINT_TO_POINTER (TRUE
));
2641 g_hash_table_insert (key_table
, (char *) "blt.un", GINT_TO_POINTER (TRUE
));
2642 g_hash_table_insert (key_table
, (char *) "blt.un.s", GINT_TO_POINTER (TRUE
));
2643 g_hash_table_insert (key_table
, (char *) "bne.un", GINT_TO_POINTER (TRUE
));
2644 g_hash_table_insert (key_table
, (char *) "bne.un.s", GINT_TO_POINTER (TRUE
));
2645 g_hash_table_insert (key_table
, (char *) "bool", GINT_TO_POINTER (TRUE
));
2646 g_hash_table_insert (key_table
, (char *) "box", GINT_TO_POINTER (TRUE
));
2647 g_hash_table_insert (key_table
, (char *) "break", GINT_TO_POINTER (TRUE
));
2648 g_hash_table_insert (key_table
, (char *) "brfalse", GINT_TO_POINTER (TRUE
));
2649 g_hash_table_insert (key_table
, (char *) "brfalse.s", GINT_TO_POINTER (TRUE
));
2650 g_hash_table_insert (key_table
, (char *) "br", GINT_TO_POINTER (TRUE
));
2651 g_hash_table_insert (key_table
, (char *) "brinst", GINT_TO_POINTER (TRUE
));
2652 g_hash_table_insert (key_table
, (char *) "brinst.s", GINT_TO_POINTER (TRUE
));
2653 g_hash_table_insert (key_table
, (char *) "brnull", GINT_TO_POINTER (TRUE
));
2654 g_hash_table_insert (key_table
, (char *) "brnull.s", GINT_TO_POINTER (TRUE
));
2655 g_hash_table_insert (key_table
, (char *) "br.s", GINT_TO_POINTER (TRUE
));
2656 g_hash_table_insert (key_table
, (char *) "brtrue", GINT_TO_POINTER (TRUE
));
2657 g_hash_table_insert (key_table
, (char *) "brtrue.s", GINT_TO_POINTER (TRUE
));
2658 g_hash_table_insert (key_table
, (char *) "brzero", GINT_TO_POINTER (TRUE
));
2659 g_hash_table_insert (key_table
, (char *) "brzero.s", GINT_TO_POINTER (TRUE
));
2660 g_hash_table_insert (key_table
, (char *) "bstr", GINT_TO_POINTER (TRUE
));
2661 g_hash_table_insert (key_table
, (char *) "bytearray", GINT_TO_POINTER (TRUE
));
2662 g_hash_table_insert (key_table
, (char *) "byvalstr", GINT_TO_POINTER (TRUE
));
2663 g_hash_table_insert (key_table
, (char *) "call", GINT_TO_POINTER (TRUE
));
2664 g_hash_table_insert (key_table
, (char *) "callconv", GINT_TO_POINTER (TRUE
));
2665 g_hash_table_insert (key_table
, (char *) "calli", GINT_TO_POINTER (TRUE
));
2666 g_hash_table_insert (key_table
, (char *) "callmostderived", GINT_TO_POINTER (TRUE
));
2667 g_hash_table_insert (key_table
, (char *) "callvirt", GINT_TO_POINTER (TRUE
));
2668 g_hash_table_insert (key_table
, (char *) "carray", GINT_TO_POINTER (TRUE
));
2669 g_hash_table_insert (key_table
, (char *) "castclass", GINT_TO_POINTER (TRUE
));
2670 g_hash_table_insert (key_table
, (char *) "catch", GINT_TO_POINTER (TRUE
));
2671 g_hash_table_insert (key_table
, (char *) "cdecl", GINT_TO_POINTER (TRUE
));
2672 g_hash_table_insert (key_table
, (char *) "ceq", GINT_TO_POINTER (TRUE
));
2673 g_hash_table_insert (key_table
, (char *) "cf", GINT_TO_POINTER (TRUE
));
2674 g_hash_table_insert (key_table
, (char *) "cgt", GINT_TO_POINTER (TRUE
));
2675 g_hash_table_insert (key_table
, (char *) "cgt.un", GINT_TO_POINTER (TRUE
));
2676 g_hash_table_insert (key_table
, (char *) "char", GINT_TO_POINTER (TRUE
));
2677 g_hash_table_insert (key_table
, (char *) "charmaperror", GINT_TO_POINTER (TRUE
));
2678 g_hash_table_insert (key_table
, (char *) "cil", GINT_TO_POINTER (TRUE
));
2679 g_hash_table_insert (key_table
, (char *) "ckfinite", GINT_TO_POINTER (TRUE
));
2680 g_hash_table_insert (key_table
, (char *) "class", GINT_TO_POINTER (TRUE
));
2681 g_hash_table_insert (key_table
, (char *) "clsid", GINT_TO_POINTER (TRUE
));
2682 g_hash_table_insert (key_table
, (char *) "clt", GINT_TO_POINTER (TRUE
));
2683 g_hash_table_insert (key_table
, (char *) "clt.un", GINT_TO_POINTER (TRUE
));
2684 g_hash_table_insert (key_table
, (char *) "Compilercontrolled", GINT_TO_POINTER (TRUE
));
2685 g_hash_table_insert (key_table
, (char *) "const", GINT_TO_POINTER (TRUE
));
2686 g_hash_table_insert (key_table
, (char *) "conv.i1", GINT_TO_POINTER (TRUE
));
2687 g_hash_table_insert (key_table
, (char *) "conv.i2", GINT_TO_POINTER (TRUE
));
2688 g_hash_table_insert (key_table
, (char *) "conv.i4", GINT_TO_POINTER (TRUE
));
2689 g_hash_table_insert (key_table
, (char *) "conv.i8", GINT_TO_POINTER (TRUE
));
2690 g_hash_table_insert (key_table
, (char *) "conv.i", GINT_TO_POINTER (TRUE
));
2691 g_hash_table_insert (key_table
, (char *) "conv.ovf.i1", GINT_TO_POINTER (TRUE
));
2692 g_hash_table_insert (key_table
, (char *) "conv.ovf.i1.un", GINT_TO_POINTER (TRUE
));
2693 g_hash_table_insert (key_table
, (char *) "conv.ovf.i2", GINT_TO_POINTER (TRUE
));
2694 g_hash_table_insert (key_table
, (char *) "conv.ovf.i2.un", GINT_TO_POINTER (TRUE
));
2695 g_hash_table_insert (key_table
, (char *) "conv.ovf.i4", GINT_TO_POINTER (TRUE
));
2696 g_hash_table_insert (key_table
, (char *) "conv.ovf.i4.un", GINT_TO_POINTER (TRUE
));
2697 g_hash_table_insert (key_table
, (char *) "conv.ovf.i8", GINT_TO_POINTER (TRUE
));
2698 g_hash_table_insert (key_table
, (char *) "conv.ovf.i8.un", GINT_TO_POINTER (TRUE
));
2699 g_hash_table_insert (key_table
, (char *) "conv.ovf.i", GINT_TO_POINTER (TRUE
));
2700 g_hash_table_insert (key_table
, (char *) "conv.ovf.i.un", GINT_TO_POINTER (TRUE
));
2701 g_hash_table_insert (key_table
, (char *) "conv.ovf.u1", GINT_TO_POINTER (TRUE
));
2702 g_hash_table_insert (key_table
, (char *) "conv.ovf.u1.un", GINT_TO_POINTER (TRUE
));
2703 g_hash_table_insert (key_table
, (char *) "conv.ovf.u2", GINT_TO_POINTER (TRUE
));
2704 g_hash_table_insert (key_table
, (char *) "conv.ovf.u2.un", GINT_TO_POINTER (TRUE
));
2705 g_hash_table_insert (key_table
, (char *) "conv.ovf.u4", GINT_TO_POINTER (TRUE
));
2706 g_hash_table_insert (key_table
, (char *) "conv.ovf.u4.un", GINT_TO_POINTER (TRUE
));
2707 g_hash_table_insert (key_table
, (char *) "conv.ovf.u8", GINT_TO_POINTER (TRUE
));
2708 g_hash_table_insert (key_table
, (char *) "conv.ovf.u8.un", GINT_TO_POINTER (TRUE
));
2709 g_hash_table_insert (key_table
, (char *) "conv.ovf.u", GINT_TO_POINTER (TRUE
));
2710 g_hash_table_insert (key_table
, (char *) "conv.ovf.u.un", GINT_TO_POINTER (TRUE
));
2711 g_hash_table_insert (key_table
, (char *) "conv.r4", GINT_TO_POINTER (TRUE
));
2712 g_hash_table_insert (key_table
, (char *) "conv.r8", GINT_TO_POINTER (TRUE
));
2713 g_hash_table_insert (key_table
, (char *) "conv.r.un", GINT_TO_POINTER (TRUE
));
2714 g_hash_table_insert (key_table
, (char *) "conv.u1", GINT_TO_POINTER (TRUE
));
2715 g_hash_table_insert (key_table
, (char *) "conv.u2", GINT_TO_POINTER (TRUE
));
2716 g_hash_table_insert (key_table
, (char *) "conv.u4", GINT_TO_POINTER (TRUE
));
2717 g_hash_table_insert (key_table
, (char *) "conv.u8", GINT_TO_POINTER (TRUE
));
2718 g_hash_table_insert (key_table
, (char *) "conv.u", GINT_TO_POINTER (TRUE
));
2719 g_hash_table_insert (key_table
, (char *) "cpblk", GINT_TO_POINTER (TRUE
));
2720 g_hash_table_insert (key_table
, (char *) "cpobj", GINT_TO_POINTER (TRUE
));
2721 g_hash_table_insert (key_table
, (char *) "currency", GINT_TO_POINTER (TRUE
));
2722 g_hash_table_insert (key_table
, (char *) "custom", GINT_TO_POINTER (TRUE
));
2723 g_hash_table_insert (key_table
, (char *) "date", GINT_TO_POINTER (TRUE
));
2724 g_hash_table_insert (key_table
, (char *) "decimal", GINT_TO_POINTER (TRUE
));
2725 g_hash_table_insert (key_table
, (char *) "default", GINT_TO_POINTER (TRUE
));
2726 g_hash_table_insert (key_table
, (char *) "demand", GINT_TO_POINTER (TRUE
));
2727 g_hash_table_insert (key_table
, (char *) "deny", GINT_TO_POINTER (TRUE
));
2728 g_hash_table_insert (key_table
, (char *) "div", GINT_TO_POINTER (TRUE
));
2729 g_hash_table_insert (key_table
, (char *) "div.un", GINT_TO_POINTER (TRUE
));
2730 g_hash_table_insert (key_table
, (char *) "dup", GINT_TO_POINTER (TRUE
));
2731 g_hash_table_insert (key_table
, (char *) "endfault", GINT_TO_POINTER (TRUE
));
2732 g_hash_table_insert (key_table
, (char *) "endfilter", GINT_TO_POINTER (TRUE
));
2733 g_hash_table_insert (key_table
, (char *) "endfinally", GINT_TO_POINTER (TRUE
));
2734 g_hash_table_insert (key_table
, (char *) "endmac", GINT_TO_POINTER (TRUE
));
2735 g_hash_table_insert (key_table
, (char *) "enum", GINT_TO_POINTER (TRUE
));
2736 g_hash_table_insert (key_table
, (char *) "error", GINT_TO_POINTER (TRUE
));
2737 g_hash_table_insert (key_table
, (char *) "explicit", GINT_TO_POINTER (TRUE
));
2738 g_hash_table_insert (key_table
, (char *) "extends", GINT_TO_POINTER (TRUE
));
2739 g_hash_table_insert (key_table
, (char *) "extern", GINT_TO_POINTER (TRUE
));
2740 g_hash_table_insert (key_table
, (char *) "false", GINT_TO_POINTER (TRUE
));
2741 g_hash_table_insert (key_table
, (char *) "famandassem", GINT_TO_POINTER (TRUE
));
2742 g_hash_table_insert (key_table
, (char *) "family", GINT_TO_POINTER (TRUE
));
2743 g_hash_table_insert (key_table
, (char *) "famorassem", GINT_TO_POINTER (TRUE
));
2744 g_hash_table_insert (key_table
, (char *) "fastcall", GINT_TO_POINTER (TRUE
));
2745 g_hash_table_insert (key_table
, (char *) "fault", GINT_TO_POINTER (TRUE
));
2746 g_hash_table_insert (key_table
, (char *) "field", GINT_TO_POINTER (TRUE
));
2747 g_hash_table_insert (key_table
, (char *) "filetime", GINT_TO_POINTER (TRUE
));
2748 g_hash_table_insert (key_table
, (char *) "filter", GINT_TO_POINTER (TRUE
));
2749 g_hash_table_insert (key_table
, (char *) "final", GINT_TO_POINTER (TRUE
));
2750 g_hash_table_insert (key_table
, (char *) "finally", GINT_TO_POINTER (TRUE
));
2751 g_hash_table_insert (key_table
, (char *) "fixed", GINT_TO_POINTER (TRUE
));
2752 g_hash_table_insert (key_table
, (char *) "flags", GINT_TO_POINTER (TRUE
));
2753 g_hash_table_insert (key_table
, (char *) "float32", GINT_TO_POINTER (TRUE
));
2754 g_hash_table_insert (key_table
, (char *) "float64", GINT_TO_POINTER (TRUE
));
2755 g_hash_table_insert (key_table
, (char *) "float", GINT_TO_POINTER (TRUE
));
2756 g_hash_table_insert (key_table
, (char *) "forwardref", GINT_TO_POINTER (TRUE
));
2757 g_hash_table_insert (key_table
, (char *) "fromunmanaged", GINT_TO_POINTER (TRUE
));
2758 g_hash_table_insert (key_table
, (char *) "handler", GINT_TO_POINTER (TRUE
));
2759 g_hash_table_insert (key_table
, (char *) "hidebysig", GINT_TO_POINTER (TRUE
));
2760 g_hash_table_insert (key_table
, (char *) "hresult", GINT_TO_POINTER (TRUE
));
2761 g_hash_table_insert (key_table
, (char *) "idispatch", GINT_TO_POINTER (TRUE
));
2762 g_hash_table_insert (key_table
, (char *) "il", GINT_TO_POINTER (TRUE
));
2763 g_hash_table_insert (key_table
, (char *) "illegal", GINT_TO_POINTER (TRUE
));
2764 g_hash_table_insert (key_table
, (char *) "implements", GINT_TO_POINTER (TRUE
));
2765 g_hash_table_insert (key_table
, (char *) "implicitcom", GINT_TO_POINTER (TRUE
));
2766 g_hash_table_insert (key_table
, (char *) "implicitres", GINT_TO_POINTER (TRUE
));
2767 g_hash_table_insert (key_table
, (char *) "import", GINT_TO_POINTER (TRUE
));
2768 g_hash_table_insert (key_table
, (char *) "in", GINT_TO_POINTER (TRUE
));
2769 g_hash_table_insert (key_table
, (char *) "inheritcheck", GINT_TO_POINTER (TRUE
));
2770 g_hash_table_insert (key_table
, (char *) "initblk", GINT_TO_POINTER (TRUE
));
2771 g_hash_table_insert (key_table
, (char *) "init", GINT_TO_POINTER (TRUE
));
2772 g_hash_table_insert (key_table
, (char *) "initobj", GINT_TO_POINTER (TRUE
));
2773 g_hash_table_insert (key_table
, (char *) "initonly", GINT_TO_POINTER (TRUE
));
2774 g_hash_table_insert (key_table
, (char *) "instance", GINT_TO_POINTER (TRUE
));
2775 g_hash_table_insert (key_table
, (char *) "int16", GINT_TO_POINTER (TRUE
));
2776 g_hash_table_insert (key_table
, (char *) "int32", GINT_TO_POINTER (TRUE
));
2777 g_hash_table_insert (key_table
, (char *) "int64", GINT_TO_POINTER (TRUE
));
2778 g_hash_table_insert (key_table
, (char *) "int8", GINT_TO_POINTER (TRUE
));
2779 g_hash_table_insert (key_table
, (char *) "interface", GINT_TO_POINTER (TRUE
));
2780 g_hash_table_insert (key_table
, (char *) "internalcall", GINT_TO_POINTER (TRUE
));
2781 g_hash_table_insert (key_table
, (char *) "int", GINT_TO_POINTER (TRUE
));
2782 g_hash_table_insert (key_table
, (char *) "isinst", GINT_TO_POINTER (TRUE
));
2783 g_hash_table_insert (key_table
, (char *) "iunknown", GINT_TO_POINTER (TRUE
));
2784 g_hash_table_insert (key_table
, (char *) "jmp", GINT_TO_POINTER (TRUE
));
2785 g_hash_table_insert (key_table
, (char *) "lasterr", GINT_TO_POINTER (TRUE
));
2786 g_hash_table_insert (key_table
, (char *) "lcid", GINT_TO_POINTER (TRUE
));
2787 g_hash_table_insert (key_table
, (char *) "ldarg.0", GINT_TO_POINTER (TRUE
));
2788 g_hash_table_insert (key_table
, (char *) "ldarg.1", GINT_TO_POINTER (TRUE
));
2789 g_hash_table_insert (key_table
, (char *) "ldarg.2", GINT_TO_POINTER (TRUE
));
2790 g_hash_table_insert (key_table
, (char *) "ldarg.3", GINT_TO_POINTER (TRUE
));
2791 g_hash_table_insert (key_table
, (char *) "ldarga", GINT_TO_POINTER (TRUE
));
2792 g_hash_table_insert (key_table
, (char *) "ldarga.s", GINT_TO_POINTER (TRUE
));
2793 g_hash_table_insert (key_table
, (char *) "ldarg", GINT_TO_POINTER (TRUE
));
2794 g_hash_table_insert (key_table
, (char *) "ldarg.s", GINT_TO_POINTER (TRUE
));
2795 g_hash_table_insert (key_table
, (char *) "ldc.i4.0", GINT_TO_POINTER (TRUE
));
2796 g_hash_table_insert (key_table
, (char *) "ldc.i4.1", GINT_TO_POINTER (TRUE
));
2797 g_hash_table_insert (key_table
, (char *) "ldc.i4.2", GINT_TO_POINTER (TRUE
));
2798 g_hash_table_insert (key_table
, (char *) "ldc.i4.3", GINT_TO_POINTER (TRUE
));
2799 g_hash_table_insert (key_table
, (char *) "ldc.i4.4", GINT_TO_POINTER (TRUE
));
2800 g_hash_table_insert (key_table
, (char *) "ldc.i4.5", GINT_TO_POINTER (TRUE
));
2801 g_hash_table_insert (key_table
, (char *) "ldc.i4.6", GINT_TO_POINTER (TRUE
));
2802 g_hash_table_insert (key_table
, (char *) "ldc.i4.7", GINT_TO_POINTER (TRUE
));
2803 g_hash_table_insert (key_table
, (char *) "ldc.i4.8", GINT_TO_POINTER (TRUE
));
2804 g_hash_table_insert (key_table
, (char *) "ldc.i4", GINT_TO_POINTER (TRUE
));
2805 g_hash_table_insert (key_table
, (char *) "ldc.i4.m1", GINT_TO_POINTER (TRUE
));
2806 g_hash_table_insert (key_table
, (char *) "ldc.i4.M1", GINT_TO_POINTER (TRUE
));
2807 g_hash_table_insert (key_table
, (char *) "ldc.i4.s", GINT_TO_POINTER (TRUE
));
2808 g_hash_table_insert (key_table
, (char *) "ldc.i8", GINT_TO_POINTER (TRUE
));
2809 g_hash_table_insert (key_table
, (char *) "ldc.r4", GINT_TO_POINTER (TRUE
));
2810 g_hash_table_insert (key_table
, (char *) "ldc.r8", GINT_TO_POINTER (TRUE
));
2811 g_hash_table_insert (key_table
, (char *) "ldelem", GINT_TO_POINTER (TRUE
));
2812 g_hash_table_insert (key_table
, (char *) "ldelema", GINT_TO_POINTER (TRUE
));
2813 g_hash_table_insert (key_table
, (char *) "ldelem.i1", GINT_TO_POINTER (TRUE
));
2814 g_hash_table_insert (key_table
, (char *) "ldelem.i2", GINT_TO_POINTER (TRUE
));
2815 g_hash_table_insert (key_table
, (char *) "ldelem.i4", GINT_TO_POINTER (TRUE
));
2816 g_hash_table_insert (key_table
, (char *) "ldelem.i8", GINT_TO_POINTER (TRUE
));
2817 g_hash_table_insert (key_table
, (char *) "ldelem.i", GINT_TO_POINTER (TRUE
));
2818 g_hash_table_insert (key_table
, (char *) "ldelem.r4", GINT_TO_POINTER (TRUE
));
2819 g_hash_table_insert (key_table
, (char *) "ldelem.r8", GINT_TO_POINTER (TRUE
));
2820 g_hash_table_insert (key_table
, (char *) "ldelem.ref", GINT_TO_POINTER (TRUE
));
2821 g_hash_table_insert (key_table
, (char *) "ldelem.u1", GINT_TO_POINTER (TRUE
));
2822 g_hash_table_insert (key_table
, (char *) "ldelem.u2", GINT_TO_POINTER (TRUE
));
2823 g_hash_table_insert (key_table
, (char *) "ldelem.u4", GINT_TO_POINTER (TRUE
));
2824 g_hash_table_insert (key_table
, (char *) "ldelem.u8", GINT_TO_POINTER (TRUE
));
2825 g_hash_table_insert (key_table
, (char *) "ldflda", GINT_TO_POINTER (TRUE
));
2826 g_hash_table_insert (key_table
, (char *) "ldfld", GINT_TO_POINTER (TRUE
));
2827 g_hash_table_insert (key_table
, (char *) "ldftn", GINT_TO_POINTER (TRUE
));
2828 g_hash_table_insert (key_table
, (char *) "ldind.i1", GINT_TO_POINTER (TRUE
));
2829 g_hash_table_insert (key_table
, (char *) "ldind.i2", GINT_TO_POINTER (TRUE
));
2830 g_hash_table_insert (key_table
, (char *) "ldind.i4", GINT_TO_POINTER (TRUE
));
2831 g_hash_table_insert (key_table
, (char *) "ldind.i8", GINT_TO_POINTER (TRUE
));
2832 g_hash_table_insert (key_table
, (char *) "ldind.i", GINT_TO_POINTER (TRUE
));
2833 g_hash_table_insert (key_table
, (char *) "ldind.r4", GINT_TO_POINTER (TRUE
));
2834 g_hash_table_insert (key_table
, (char *) "ldind.r8", GINT_TO_POINTER (TRUE
));
2835 g_hash_table_insert (key_table
, (char *) "ldind.ref", GINT_TO_POINTER (TRUE
));
2836 g_hash_table_insert (key_table
, (char *) "ldind.u1", GINT_TO_POINTER (TRUE
));
2837 g_hash_table_insert (key_table
, (char *) "ldind.u2", GINT_TO_POINTER (TRUE
));
2838 g_hash_table_insert (key_table
, (char *) "ldind.u4", GINT_TO_POINTER (TRUE
));
2839 g_hash_table_insert (key_table
, (char *) "ldind.u8", GINT_TO_POINTER (TRUE
));
2840 g_hash_table_insert (key_table
, (char *) "ldlen", GINT_TO_POINTER (TRUE
));
2841 g_hash_table_insert (key_table
, (char *) "ldloc.0", GINT_TO_POINTER (TRUE
));
2842 g_hash_table_insert (key_table
, (char *) "ldloc.1", GINT_TO_POINTER (TRUE
));
2843 g_hash_table_insert (key_table
, (char *) "ldloc.2", GINT_TO_POINTER (TRUE
));
2844 g_hash_table_insert (key_table
, (char *) "ldloc.3", GINT_TO_POINTER (TRUE
));
2845 g_hash_table_insert (key_table
, (char *) "ldloca", GINT_TO_POINTER (TRUE
));
2846 g_hash_table_insert (key_table
, (char *) "ldloca.s", GINT_TO_POINTER (TRUE
));
2847 g_hash_table_insert (key_table
, (char *) "ldloc", GINT_TO_POINTER (TRUE
));
2848 g_hash_table_insert (key_table
, (char *) "ldloc.s", GINT_TO_POINTER (TRUE
));
2849 g_hash_table_insert (key_table
, (char *) "ldnull", GINT_TO_POINTER (TRUE
));
2850 g_hash_table_insert (key_table
, (char *) "ldobj", GINT_TO_POINTER (TRUE
));
2851 g_hash_table_insert (key_table
, (char *) "ldsflda", GINT_TO_POINTER (TRUE
));
2852 g_hash_table_insert (key_table
, (char *) "ldsfld", GINT_TO_POINTER (TRUE
));
2853 g_hash_table_insert (key_table
, (char *) "ldstr", GINT_TO_POINTER (TRUE
));
2854 g_hash_table_insert (key_table
, (char *) "ldtoken", GINT_TO_POINTER (TRUE
));
2855 g_hash_table_insert (key_table
, (char *) "ldvirtftn", GINT_TO_POINTER (TRUE
));
2856 g_hash_table_insert (key_table
, (char *) "leave", GINT_TO_POINTER (TRUE
));
2857 g_hash_table_insert (key_table
, (char *) "leave.s", GINT_TO_POINTER (TRUE
));
2858 g_hash_table_insert (key_table
, (char *) "linkcheck", GINT_TO_POINTER (TRUE
));
2859 g_hash_table_insert (key_table
, (char *) "literal", GINT_TO_POINTER (TRUE
));
2860 g_hash_table_insert (key_table
, (char *) "localloc", GINT_TO_POINTER (TRUE
));
2861 g_hash_table_insert (key_table
, (char *) "lpstr", GINT_TO_POINTER (TRUE
));
2862 g_hash_table_insert (key_table
, (char *) "lpstruct", GINT_TO_POINTER (TRUE
));
2863 g_hash_table_insert (key_table
, (char *) "lptstr", GINT_TO_POINTER (TRUE
));
2864 g_hash_table_insert (key_table
, (char *) "lpvoid", GINT_TO_POINTER (TRUE
));
2865 g_hash_table_insert (key_table
, (char *) "lpwstr", GINT_TO_POINTER (TRUE
));
2866 g_hash_table_insert (key_table
, (char *) "managed", GINT_TO_POINTER (TRUE
));
2867 g_hash_table_insert (key_table
, (char *) "marshal", GINT_TO_POINTER (TRUE
));
2868 g_hash_table_insert (key_table
, (char *) "method", GINT_TO_POINTER (TRUE
));
2869 g_hash_table_insert (key_table
, (char *) "mkrefany", GINT_TO_POINTER (TRUE
));
2870 g_hash_table_insert (key_table
, (char *) "modopt", GINT_TO_POINTER (TRUE
));
2871 g_hash_table_insert (key_table
, (char *) "modreq", GINT_TO_POINTER (TRUE
));
2872 g_hash_table_insert (key_table
, (char *) "mul", GINT_TO_POINTER (TRUE
));
2873 g_hash_table_insert (key_table
, (char *) "mul.ovf", GINT_TO_POINTER (TRUE
));
2874 g_hash_table_insert (key_table
, (char *) "mul.ovf.un", GINT_TO_POINTER (TRUE
));
2875 g_hash_table_insert (key_table
, (char *) "native", GINT_TO_POINTER (TRUE
));
2876 g_hash_table_insert (key_table
, (char *) "neg", GINT_TO_POINTER (TRUE
));
2877 g_hash_table_insert (key_table
, (char *) "nested", GINT_TO_POINTER (TRUE
));
2878 g_hash_table_insert (key_table
, (char *) "newarr", GINT_TO_POINTER (TRUE
));
2879 g_hash_table_insert (key_table
, (char *) "newobj", GINT_TO_POINTER (TRUE
));
2880 g_hash_table_insert (key_table
, (char *) "newslot", GINT_TO_POINTER (TRUE
));
2881 g_hash_table_insert (key_table
, (char *) "noappdomain", GINT_TO_POINTER (TRUE
));
2882 g_hash_table_insert (key_table
, (char *) "noinlining", GINT_TO_POINTER (TRUE
));
2883 g_hash_table_insert (key_table
, (char *) "nomachine", GINT_TO_POINTER (TRUE
));
2884 g_hash_table_insert (key_table
, (char *) "nomangle", GINT_TO_POINTER (TRUE
));
2885 g_hash_table_insert (key_table
, (char *) "nometadata", GINT_TO_POINTER (TRUE
));
2886 g_hash_table_insert (key_table
, (char *) "noncasdemand", GINT_TO_POINTER (TRUE
));
2887 g_hash_table_insert (key_table
, (char *) "noncasinheritance", GINT_TO_POINTER (TRUE
));
2888 g_hash_table_insert (key_table
, (char *) "noncaslinkdemand", GINT_TO_POINTER (TRUE
));
2889 g_hash_table_insert (key_table
, (char *) "nop", GINT_TO_POINTER (TRUE
));
2890 g_hash_table_insert (key_table
, (char *) "noprocess", GINT_TO_POINTER (TRUE
));
2891 g_hash_table_insert (key_table
, (char *) "not", GINT_TO_POINTER (TRUE
));
2892 g_hash_table_insert (key_table
, (char *) "not_in_gc_heap", GINT_TO_POINTER (TRUE
));
2893 g_hash_table_insert (key_table
, (char *) "notremotable", GINT_TO_POINTER (TRUE
));
2894 g_hash_table_insert (key_table
, (char *) "notserialized", GINT_TO_POINTER (TRUE
));
2895 g_hash_table_insert (key_table
, (char *) "null", GINT_TO_POINTER (TRUE
));
2896 g_hash_table_insert (key_table
, (char *) "nullref", GINT_TO_POINTER (TRUE
));
2897 g_hash_table_insert (key_table
, (char *) "object", GINT_TO_POINTER (TRUE
));
2898 g_hash_table_insert (key_table
, (char *) "objectref", GINT_TO_POINTER (TRUE
));
2899 g_hash_table_insert (key_table
, (char *) "off", GINT_TO_POINTER (TRUE
));
2900 g_hash_table_insert (key_table
, (char *) "on", GINT_TO_POINTER (TRUE
));
2901 g_hash_table_insert (key_table
, (char *) "opt", GINT_TO_POINTER (TRUE
));
2902 g_hash_table_insert (key_table
, (char *) "optil", GINT_TO_POINTER (TRUE
));
2903 g_hash_table_insert (key_table
, (char *) "or", GINT_TO_POINTER (TRUE
));
2904 g_hash_table_insert (key_table
, (char *) "out", GINT_TO_POINTER (TRUE
));
2905 g_hash_table_insert (key_table
, (char *) "permitonly", GINT_TO_POINTER (TRUE
));
2906 g_hash_table_insert (key_table
, (char *) "pinned", GINT_TO_POINTER (TRUE
));
2907 g_hash_table_insert (key_table
, (char *) "pinvokeimpl", GINT_TO_POINTER (TRUE
));
2908 g_hash_table_insert (key_table
, (char *) "pop", GINT_TO_POINTER (TRUE
));
2909 g_hash_table_insert (key_table
, (char *) "prefix1", GINT_TO_POINTER (TRUE
));
2910 g_hash_table_insert (key_table
, (char *) "prefix2", GINT_TO_POINTER (TRUE
));
2911 g_hash_table_insert (key_table
, (char *) "prefix3", GINT_TO_POINTER (TRUE
));
2912 g_hash_table_insert (key_table
, (char *) "prefix4", GINT_TO_POINTER (TRUE
));
2913 g_hash_table_insert (key_table
, (char *) "prefix5", GINT_TO_POINTER (TRUE
));
2914 g_hash_table_insert (key_table
, (char *) "prefix6", GINT_TO_POINTER (TRUE
));
2915 g_hash_table_insert (key_table
, (char *) "prefix7", GINT_TO_POINTER (TRUE
));
2916 g_hash_table_insert (key_table
, (char *) "prefixref", GINT_TO_POINTER (TRUE
));
2917 g_hash_table_insert (key_table
, (char *) "prejitdeny", GINT_TO_POINTER (TRUE
));
2918 g_hash_table_insert (key_table
, (char *) "prejitgrant", GINT_TO_POINTER (TRUE
));
2919 g_hash_table_insert (key_table
, (char *) "preservesig", GINT_TO_POINTER (TRUE
));
2920 g_hash_table_insert (key_table
, (char *) "private", GINT_TO_POINTER (TRUE
));
2921 g_hash_table_insert (key_table
, (char *) "privatescope", GINT_TO_POINTER (TRUE
));
2922 g_hash_table_insert (key_table
, (char *) "property", GINT_TO_POINTER (TRUE
));
2923 g_hash_table_insert (key_table
, (char *) "protected", GINT_TO_POINTER (TRUE
));
2924 g_hash_table_insert (key_table
, (char *) "public", GINT_TO_POINTER (TRUE
));
2925 g_hash_table_insert (key_table
, (char *) "readonly", GINT_TO_POINTER (TRUE
));
2926 g_hash_table_insert (key_table
, (char *) "record", GINT_TO_POINTER (TRUE
));
2927 g_hash_table_insert (key_table
, (char *) "refany", GINT_TO_POINTER (TRUE
));
2928 g_hash_table_insert (key_table
, (char *) "refanytype", GINT_TO_POINTER (TRUE
));
2929 g_hash_table_insert (key_table
, (char *) "refanyval", GINT_TO_POINTER (TRUE
));
2930 g_hash_table_insert (key_table
, (char *) "rem", GINT_TO_POINTER (TRUE
));
2931 g_hash_table_insert (key_table
, (char *) "rem.un", GINT_TO_POINTER (TRUE
));
2932 g_hash_table_insert (key_table
, (char *) "reqmin", GINT_TO_POINTER (TRUE
));
2933 g_hash_table_insert (key_table
, (char *) "reqopt", GINT_TO_POINTER (TRUE
));
2934 g_hash_table_insert (key_table
, (char *) "reqrefuse", GINT_TO_POINTER (TRUE
));
2935 g_hash_table_insert (key_table
, (char *) "reqsecobj", GINT_TO_POINTER (TRUE
));
2936 g_hash_table_insert (key_table
, (char *) "request", GINT_TO_POINTER (TRUE
));
2937 g_hash_table_insert (key_table
, (char *) "ret", GINT_TO_POINTER (TRUE
));
2938 g_hash_table_insert (key_table
, (char *) "rethrow", GINT_TO_POINTER (TRUE
));
2939 g_hash_table_insert (key_table
, (char *) "retval", GINT_TO_POINTER (TRUE
));
2940 g_hash_table_insert (key_table
, (char *) "rtspecialname", GINT_TO_POINTER (TRUE
));
2941 g_hash_table_insert (key_table
, (char *) "runtime", GINT_TO_POINTER (TRUE
));
2942 g_hash_table_insert (key_table
, (char *) "safearray", GINT_TO_POINTER (TRUE
));
2943 g_hash_table_insert (key_table
, (char *) "sealed", GINT_TO_POINTER (TRUE
));
2944 g_hash_table_insert (key_table
, (char *) "sequential", GINT_TO_POINTER (TRUE
));
2945 g_hash_table_insert (key_table
, (char *) "serializable", GINT_TO_POINTER (TRUE
));
2946 g_hash_table_insert (key_table
, (char *) "shl", GINT_TO_POINTER (TRUE
));
2947 g_hash_table_insert (key_table
, (char *) "shr", GINT_TO_POINTER (TRUE
));
2948 g_hash_table_insert (key_table
, (char *) "shr.un", GINT_TO_POINTER (TRUE
));
2949 g_hash_table_insert (key_table
, (char *) "sizeof", GINT_TO_POINTER (TRUE
));
2950 g_hash_table_insert (key_table
, (char *) "special", GINT_TO_POINTER (TRUE
));
2951 g_hash_table_insert (key_table
, (char *) "specialname", GINT_TO_POINTER (TRUE
));
2952 g_hash_table_insert (key_table
, (char *) "starg", GINT_TO_POINTER (TRUE
));
2953 g_hash_table_insert (key_table
, (char *) "starg.s", GINT_TO_POINTER (TRUE
));
2954 g_hash_table_insert (key_table
, (char *) "static", GINT_TO_POINTER (TRUE
));
2955 g_hash_table_insert (key_table
, (char *) "stdcall", GINT_TO_POINTER (TRUE
));
2956 g_hash_table_insert (key_table
, (char *) "stelem", GINT_TO_POINTER (TRUE
));
2957 g_hash_table_insert (key_table
, (char *) "stelem.i1", GINT_TO_POINTER (TRUE
));
2958 g_hash_table_insert (key_table
, (char *) "stelem.i2", GINT_TO_POINTER (TRUE
));
2959 g_hash_table_insert (key_table
, (char *) "stelem.i4", GINT_TO_POINTER (TRUE
));
2960 g_hash_table_insert (key_table
, (char *) "stelem.i8", GINT_TO_POINTER (TRUE
));
2961 g_hash_table_insert (key_table
, (char *) "stelem.i", GINT_TO_POINTER (TRUE
));
2962 g_hash_table_insert (key_table
, (char *) "stelem.r4", GINT_TO_POINTER (TRUE
));
2963 g_hash_table_insert (key_table
, (char *) "stelem.r8", GINT_TO_POINTER (TRUE
));
2964 g_hash_table_insert (key_table
, (char *) "stelem.ref", GINT_TO_POINTER (TRUE
));
2965 g_hash_table_insert (key_table
, (char *) "stfld", GINT_TO_POINTER (TRUE
));
2966 g_hash_table_insert (key_table
, (char *) "stind.i1", GINT_TO_POINTER (TRUE
));
2967 g_hash_table_insert (key_table
, (char *) "stind.i2", GINT_TO_POINTER (TRUE
));
2968 g_hash_table_insert (key_table
, (char *) "stind.i4", GINT_TO_POINTER (TRUE
));
2969 g_hash_table_insert (key_table
, (char *) "stind.i8", GINT_TO_POINTER (TRUE
));
2970 g_hash_table_insert (key_table
, (char *) "stind.i", GINT_TO_POINTER (TRUE
));
2971 g_hash_table_insert (key_table
, (char *) "stind.r4", GINT_TO_POINTER (TRUE
));
2972 g_hash_table_insert (key_table
, (char *) "stind.r8", GINT_TO_POINTER (TRUE
));
2973 g_hash_table_insert (key_table
, (char *) "stloc", GINT_TO_POINTER (TRUE
));
2974 g_hash_table_insert (key_table
, (char *) "stobj", GINT_TO_POINTER (TRUE
));
2975 g_hash_table_insert (key_table
, (char *) "storage", GINT_TO_POINTER (TRUE
));
2976 g_hash_table_insert (key_table
, (char *) "stored_object", GINT_TO_POINTER (TRUE
));
2977 g_hash_table_insert (key_table
, (char *) "streamed_object", GINT_TO_POINTER (TRUE
));
2978 g_hash_table_insert (key_table
, (char *) "stream", GINT_TO_POINTER (TRUE
));
2979 g_hash_table_insert (key_table
, (char *) "strict", GINT_TO_POINTER (TRUE
));
2980 g_hash_table_insert (key_table
, (char *) "string", GINT_TO_POINTER (TRUE
));
2981 g_hash_table_insert (key_table
, (char *) "struct", GINT_TO_POINTER (TRUE
));
2982 g_hash_table_insert (key_table
, (char *) "stsfld", GINT_TO_POINTER (TRUE
));
2983 g_hash_table_insert (key_table
, (char *) "sub", GINT_TO_POINTER (TRUE
));
2984 g_hash_table_insert (key_table
, (char *) "sub.ovf", GINT_TO_POINTER (TRUE
));
2985 g_hash_table_insert (key_table
, (char *) "sub.ovf.un", GINT_TO_POINTER (TRUE
));
2986 g_hash_table_insert (key_table
, (char *) "switch", GINT_TO_POINTER (TRUE
));
2987 g_hash_table_insert (key_table
, (char *) "synchronized", GINT_TO_POINTER (TRUE
));
2988 g_hash_table_insert (key_table
, (char *) "syschar", GINT_TO_POINTER (TRUE
));
2989 g_hash_table_insert (key_table
, (char *) "sysstring", GINT_TO_POINTER (TRUE
));
2990 g_hash_table_insert (key_table
, (char *) "tbstr", GINT_TO_POINTER (TRUE
));
2991 g_hash_table_insert (key_table
, (char *) "thiscall", GINT_TO_POINTER (TRUE
));
2992 g_hash_table_insert (key_table
, (char *) "tls", GINT_TO_POINTER (TRUE
));
2993 g_hash_table_insert (key_table
, (char *) "to", GINT_TO_POINTER (TRUE
));
2994 g_hash_table_insert (key_table
, (char *) "true", GINT_TO_POINTER (TRUE
));
2995 g_hash_table_insert (key_table
, (char *) "type", GINT_TO_POINTER (TRUE
));
2996 g_hash_table_insert (key_table
, (char *) "typedref", GINT_TO_POINTER (TRUE
));
2997 g_hash_table_insert (key_table
, (char *) "uint", GINT_TO_POINTER (TRUE
));
2998 g_hash_table_insert (key_table
, (char *) "uint8", GINT_TO_POINTER (TRUE
));
2999 g_hash_table_insert (key_table
, (char *) "uint16", GINT_TO_POINTER (TRUE
));
3000 g_hash_table_insert (key_table
, (char *) "uint32", GINT_TO_POINTER (TRUE
));
3001 g_hash_table_insert (key_table
, (char *) "uint64", GINT_TO_POINTER (TRUE
));
3002 g_hash_table_insert (key_table
, (char *) "unbox", GINT_TO_POINTER (TRUE
));
3003 g_hash_table_insert (key_table
, (char *) "unicode", GINT_TO_POINTER (TRUE
));
3004 g_hash_table_insert (key_table
, (char *) "unmanagedexp", GINT_TO_POINTER (TRUE
));
3005 g_hash_table_insert (key_table
, (char *) "unmanaged", GINT_TO_POINTER (TRUE
));
3006 g_hash_table_insert (key_table
, (char *) "unsigned", GINT_TO_POINTER (TRUE
));
3007 g_hash_table_insert (key_table
, (char *) "userdefined", GINT_TO_POINTER (TRUE
));
3008 g_hash_table_insert (key_table
, (char *) "value", GINT_TO_POINTER (TRUE
));
3009 g_hash_table_insert (key_table
, (char *) "valuetype", GINT_TO_POINTER (TRUE
));
3010 g_hash_table_insert (key_table
, (char *) "vararg", GINT_TO_POINTER (TRUE
));
3011 g_hash_table_insert (key_table
, (char *) "variant", GINT_TO_POINTER (TRUE
));
3012 g_hash_table_insert (key_table
, (char *) "vector", GINT_TO_POINTER (TRUE
));
3013 g_hash_table_insert (key_table
, (char *) "virtual", GINT_TO_POINTER (TRUE
));
3014 g_hash_table_insert (key_table
, (char *) "void", GINT_TO_POINTER (TRUE
));
3015 g_hash_table_insert (key_table
, (char *) "wchar", GINT_TO_POINTER (TRUE
));
3016 g_hash_table_insert (key_table
, (char *) "winapi", GINT_TO_POINTER (TRUE
));
3017 g_hash_table_insert (key_table
, (char *) "with", GINT_TO_POINTER (TRUE
));
3018 g_hash_table_insert (key_table
, (char *) "xor", GINT_TO_POINTER (TRUE
));
3022 method_dor_to_token (guint32 idx
) {
3023 switch (idx
& MONO_METHODDEFORREF_MASK
) {
3024 case MONO_METHODDEFORREF_METHODDEF
:
3025 return MONO_TOKEN_METHOD_DEF
| (idx
>> MONO_METHODDEFORREF_BITS
);
3026 case MONO_METHODDEFORREF_METHODREF
:
3027 return MONO_TOKEN_MEMBER_REF
| (idx
>> MONO_METHODDEFORREF_BITS
);
3033 get_method_override (MonoImage
*m
, guint32 token
, MonoGenericContainer
*container
)
3035 MonoTableInfo
*t
= &m
->tables
[MONO_TABLE_METHODIMPL
];
3038 for (i
= 1; i
<= t
->rows
; i
++){
3039 guint32 cols
[MONO_METHODIMPL_SIZE
];
3042 mono_metadata_decode_row (t
, i
- 1, cols
, MONO_METHODIMPL_SIZE
);
3044 impl
= method_dor_to_token (cols
[MONO_METHODIMPL_BODY
]);
3045 decl
= method_dor_to_token (cols
[MONO_METHODIMPL_DECLARATION
]);
3047 if (token
== impl
) {
3048 MonoMethod
*mh
= NULL
;
3049 mh
= mono_get_method_full (m
, decl
, NULL
, (MonoGenericContext
*) container
);
3051 if (mh
&& (mh
->klass
&& (mh
->klass
->generic_class
|| mh
->klass
->generic_container
))) {
3055 meth_str
= get_method_core (m
, decl
, TRUE
, container
);
3056 ret
= g_strdup_printf ("method %s", meth_str
);
3060 return get_method_core (m
, decl
, FALSE
, container
);
3069 check_ambiguous_genparams (MonoGenericContainer
*container
)
3071 GSList
*dup_list
= NULL
, *l
;
3072 GHashTable
*table
= NULL
;
3079 if (generic_containers
&& g_hash_table_lookup (generic_containers
, container
))
3080 /* Already been checked for ambiguous gen params */
3083 table
= g_hash_table_new (g_str_hash
, g_str_equal
);
3084 for (i
= 0; i
< container
->type_argc
; i
++) {
3085 MonoGenericParam
*param
= &container
->type_params
[i
];
3087 if ((p
= g_hash_table_lookup (table
, param
->name
)))
3088 dup_list
= g_slist_prepend (g_slist_prepend (dup_list
, GUINT_TO_POINTER (i
+ 1)), p
);
3090 g_hash_table_insert (table
, (char*)param
->name
, GUINT_TO_POINTER (i
+ 1));
3094 if (!mono_generic_params_with_ambiguous_names
)
3095 mono_generic_params_with_ambiguous_names
= g_hash_table_new (NULL
, NULL
);
3096 for (l
= dup_list
; l
; l
= l
->next
) {
3097 int param
= GPOINTER_TO_UINT (l
->data
);
3098 g_hash_table_insert (mono_generic_params_with_ambiguous_names
,
3099 &container
->type_params
[param
-1],
3100 &container
->type_params
[param
-1]);
3102 g_slist_free (dup_list
);
3105 if (!generic_containers
)
3106 generic_containers
= g_hash_table_new (NULL
, NULL
);
3108 g_hash_table_insert (generic_containers
, container
, container
);
3109 g_hash_table_destroy (table
);
3113 cant_print_generic_param_name (MonoGenericParam
*gparam
)
3117 check_ambiguous_genparams (gparam
->owner
);
3118 return (!gparam
->owner
|| (mono_generic_params_with_ambiguous_names
&&
3119 g_hash_table_lookup (mono_generic_params_with_ambiguous_names
, gparam
)));