* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
- internal const int MINOR_VERSION = 20;
+ internal const int MINOR_VERSION = 21;
enum WPSuspendPolicy {
NONE = 0,
GET_LOCALS_INFO = 5,
GET_INFO = 6,
GET_BODY = 7,
- RESOLVE_TOKEN = 8
+ RESOLVE_TOKEN = 8,
+ GET_CATTRS = 9
}
enum CmdType {
}
}
+ internal CattrInfo[] Method_GetCustomAttributes (long id, long attr_type_id, bool inherit) {
+ PacketReader r = SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_CATTRS, new PacketWriter ().WriteId (id).WriteId (attr_type_id));
+ return ReadCattrs (r);
+ }
+
/*
* THREAD
*/
* Creating the custom attributes themselves could modify the behavior of the
* debuggee, so we return objects similar to the CustomAttributeData objects
* used by the reflection-only functionality on .net.
+ * Since protocol version 2.21
*/
public CustomAttributeDataMirror[] GetCustomAttributes (bool inherit) {
return GetCAttrs (null, inherit);
}
+ /* Since protocol version 2.21 */
public CustomAttributeDataMirror[] GetCustomAttributes (TypeMirror attributeType, bool inherit) {
if (attributeType == null)
throw new ArgumentNullException ("attributeType");
}
CustomAttributeDataMirror[] GetCAttrs (TypeMirror type, bool inherit) {
- if (cattrs == null && Metadata != null && !Metadata.HasCustomAttributes)
+ if (cattrs == null && meta != null && !Metadata.HasCustomAttributes)
cattrs = new CustomAttributeDataMirror [0];
// FIXME: Handle inherit
if (cattrs == null) {
- CattrInfo[] info = vm.conn.Type_GetCustomAttributes (id, 0, false);
+ CattrInfo[] info = vm.conn.Method_GetCustomAttributes (id, 0, false);
cattrs = CustomAttributeDataMirror.Create (vm, info);
}
var res = new List<CustomAttributeDataMirror> ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
+ [StateMachine (typeof (int))]
public static void locals2<T> (string[] args, int arg, T t, ref string rs) {
long i = 42;
string s = "AB";
args = gmd.GetGenericArguments ();
Assert.AreEqual (1, args.Length);
Assert.AreEqual ("T", args [0].Name);
+
+ var attrs = m.GetCustomAttributes (true);
+ Assert.AreEqual (1, attrs.Length);
+ Assert.AreEqual ("StateMachineAttribute", attrs [0].Constructor.DeclaringType.Name);
}
[Test]
#define HEADER_LENGTH 11
#define MAJOR_VERSION 2
-#define MINOR_VERSION 20
+#define MINOR_VERSION 21
typedef enum {
CMD_SET_VM = 1,
CMD_METHOD_GET_INFO = 6,
CMD_METHOD_GET_BODY = 7,
CMD_METHOD_RESOLVE_TOKEN = 8,
+ CMD_METHOD_GET_CATTRS = 9,
} CmdMethod;
typedef enum {
method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, guint8 *p, guint8 *end, Buffer *buf)
{
MonoMethodHeader *header;
+ int err;
switch (command) {
case CMD_METHOD_GET_NAME: {
}
break;
}
+ case CMD_METHOD_GET_CATTRS: {
+ MonoClass *attr_klass;
+ MonoCustomAttrInfo *cinfo;
+
+ attr_klass = decode_typeid (p, &p, end, NULL, &err);
+ /* attr_klass can be NULL */
+ if (err)
+ return err;
+
+ cinfo = mono_custom_attrs_from_method (method);
+
+ buffer_add_cattrs (buf, domain, method->klass->image, attr_klass, cinfo);
+ break;
+ }
default:
return ERR_NOT_IMPLEMENTED;
}