[xbuild] Fix bug #671700, resource naming in presence of "Link".
[mono.git] / tools / sgen / sgen-grep-binprot.c
index 67a9b3f211e54743ee69cd975c9bc0f11a852b5a..4e41e8a35732ba1446fbe574865cad18d190a841 100644 (file)
@@ -3,6 +3,9 @@
 #include <assert.h>
 #include <glib.h>
 
+#define SGEN_BINARY_PROTOCOL
+#define MONO_INTERNAL
+
 #include <mono/metadata/sgen-protocol.h>
 
 #define SGEN_PROTOCOL_EOF      255
@@ -18,6 +21,8 @@ read_entry (FILE *in, void **data)
        switch (type) {
        case SGEN_PROTOCOL_COLLECTION: size = sizeof (SGenProtocolCollection); break;
        case SGEN_PROTOCOL_ALLOC: size = sizeof (SGenProtocolAlloc); break;
+       case SGEN_PROTOCOL_ALLOC_PINNED: size = sizeof (SGenProtocolAlloc); break;
+       case SGEN_PROTOCOL_ALLOC_DEGRADED: size = sizeof (SGenProtocolAlloc); break;
        case SGEN_PROTOCOL_COPY: size = sizeof (SGenProtocolCopy); break;
        case SGEN_PROTOCOL_PIN: size = sizeof (SGenProtocolPin); break;
        case SGEN_PROTOCOL_MARK: size = sizeof (SGenProtocolMark); break;
@@ -54,6 +59,16 @@ print_entry (int type, void *data)
                printf ("alloc obj %p vtable %p size %d\n", entry->obj, entry->vtable, entry->size);
                break;
        }
+       case SGEN_PROTOCOL_ALLOC_PINNED: {
+               SGenProtocolAlloc *entry = data;
+               printf ("alloc pinned obj %p vtable %p size %d\n", entry->obj, entry->vtable, entry->size);
+               break;
+       }
+       case SGEN_PROTOCOL_ALLOC_DEGRADED: {
+               SGenProtocolAlloc *entry = data;
+               printf ("alloc degraded obj %p vtable %p size %d\n", entry->obj, entry->vtable, entry->size);
+               break;
+       }
        case SGEN_PROTOCOL_COPY: {
                SGenProtocolCopy *entry = data;
                printf ("copy from %p to %p vtable %p size %d\n", entry->from, entry->to, entry->vtable, entry->size);
@@ -136,7 +151,9 @@ is_match (gpointer ptr, int type, void *data)
        case SGEN_PROTOCOL_THREAD_REGISTER:
        case SGEN_PROTOCOL_THREAD_UNREGISTER:
                return TRUE;
-       case SGEN_PROTOCOL_ALLOC: {
+       case SGEN_PROTOCOL_ALLOC:
+       case SGEN_PROTOCOL_ALLOC_PINNED:
+       case SGEN_PROTOCOL_ALLOC_DEGRADED: {
                SGenProtocolAlloc *entry = data;
                return matches_interval (ptr, entry->obj, entry->size);
        }
@@ -193,7 +210,7 @@ main (int argc, char *argv[])
        long nums [num_nums];
 
        for (i = 0; i < num_nums; ++i)
-               nums [i] = strtol (argv [i + 1], NULL, 16);
+               nums [i] = strtoul (argv [i + 1], NULL, 16);
 
        while ((type = read_entry (stdin, &data)) != SGEN_PROTOCOL_EOF) {
                gboolean match = FALSE;