diff options
author | Mark Probst <mark.probst@gmail.com> | 2013-07-18 02:28:59 +0400 |
---|---|---|
committer | Mark Probst <mark.probst@gmail.com> | 2013-07-18 03:26:56 +0400 |
commit | 6cd895de20a78a483984028e53de40adebd94a70 (patch) | |
tree | f090e7fef514dda8b0bef0281e7072d7dc14dd66 /tools | |
parent | 645991d36326cab10f994518a190cc852c17c4c7 (diff) |
[sgen] Binary protocol improvements.
Protocol domain unloads, and allow greping for vtable.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/sgen/sgen-grep-binprot.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tools/sgen/sgen-grep-binprot.c b/tools/sgen/sgen-grep-binprot.c index 2ba9325882e..32b3777d85a 100644 --- a/tools/sgen/sgen-grep-binprot.c +++ b/tools/sgen/sgen-grep-binprot.c @@ -46,6 +46,8 @@ read_entry (FILE *in, void **data) case SGEN_PROTOCOL_DISLINK_UPDATE: size = sizeof (SGenProtocolDislinkUpdate); break; case SGEN_PROTOCOL_DISLINK_UPDATE_STAGED: size = sizeof (SGenProtocolDislinkUpdateStaged); break; case SGEN_PROTOCOL_DISLINK_PROCESS_STAGED: size = sizeof (SGenProtocolDislinkProcessStaged); break; + case SGEN_PROTOCOL_DOMAIN_UNLOAD_BEGIN: size = sizeof (SGenProtocolDomainUnload); break; + case SGEN_PROTOCOL_DOMAIN_UNLOAD_END: size = sizeof (SGenProtocolDomainUnload); break; default: assert (0); } @@ -208,6 +210,16 @@ print_entry (int type, void *data) printf ("dislink_process_staged link %p obj %p index %d\n", entry->link, entry->obj, entry->index); break; } + case SGEN_PROTOCOL_DOMAIN_UNLOAD_BEGIN: { + SGenProtocolDomainUnload *entry = data; + printf ("dislink_unload_begin domain %p\n", entry->domain); + break; + } + case SGEN_PROTOCOL_DOMAIN_UNLOAD_END: { + SGenProtocolDomainUnload *entry = data; + printf ("dislink_unload_end domain %p\n", entry->domain); + break; + } default: assert (0); } @@ -231,6 +243,8 @@ is_match (gpointer ptr, int type, void *data) case SGEN_PROTOCOL_THREAD_REGISTER: case SGEN_PROTOCOL_THREAD_UNREGISTER: case SGEN_PROTOCOL_CEMENT_RESET: + case SGEN_PROTOCOL_DOMAIN_UNLOAD_BEGIN: + case SGEN_PROTOCOL_DOMAIN_UNLOAD_END: return TRUE; case SGEN_PROTOCOL_ALLOC: case SGEN_PROTOCOL_ALLOC_PINNED: @@ -309,6 +323,57 @@ is_match (gpointer ptr, int type, void *data) } } +static gboolean +is_vtable_match (gpointer ptr, int type, void *data) +{ + switch (type) { + case SGEN_PROTOCOL_ALLOC: + case SGEN_PROTOCOL_ALLOC_PINNED: + case SGEN_PROTOCOL_ALLOC_DEGRADED: { + SGenProtocolAlloc *entry = data; + return ptr == entry->vtable; + } + case SGEN_PROTOCOL_COPY: { + SGenProtocolCopy *entry = data; + return ptr == entry->vtable; + } + case SGEN_PROTOCOL_PIN: { + SGenProtocolPin *entry = data; + return ptr == entry->vtable; + } + case SGEN_PROTOCOL_SCAN_BEGIN: { + SGenProtocolScanBegin *entry = data; + return ptr == entry->vtable; + } + case SGEN_PROTOCOL_WBARRIER: { + SGenProtocolWBarrier *entry = data; + return ptr == entry->value_vtable; + } + case SGEN_PROTOCOL_GLOBAL_REMSET: { + SGenProtocolGlobalRemset *entry = data; + return ptr == entry->value_vtable; + } + case SGEN_PROTOCOL_PTR_UPDATE: { + SGenProtocolPtrUpdate *entry = data; + return ptr == entry->vtable; + } + case SGEN_PROTOCOL_CLEANUP: { + SGenProtocolCleanup *entry = data; + return ptr == entry->vtable; + } + case SGEN_PROTOCOL_MISSING_REMSET: { + SGenProtocolMissingRemset *entry = data; + return ptr == entry->obj_vtable || ptr == entry->value_vtable; + } + case SGEN_PROTOCOL_CEMENT: { + SGenProtocolCement *entry = data; + return ptr == entry->vtable; + } + default: + return FALSE; + } +} + static gboolean dump_all = FALSE; int @@ -318,13 +383,19 @@ main (int argc, char *argv[]) void *data; int num_args = argc - 1; int num_nums = 0; + int num_vtables = 0; int i; long nums [num_args]; + long vtables [num_args]; for (i = 0; i < num_args; ++i) { char *arg = argv [i + 1]; + char *next_arg = argv [i + 2]; if (!strcmp (arg, "--all")) { dump_all = TRUE; + } else if (!strcmp (arg, "-v") || !strcmp (arg, "--vtable")) { + vtables [num_vtables++] = strtoul (next_arg, NULL, 16); + ++i; } else { nums [num_nums++] = strtoul (arg, NULL, 16); } @@ -338,6 +409,14 @@ main (int argc, char *argv[]) break; } } + if (!match) { + for (i = 0; i < num_vtables; ++i) { + if (is_vtable_match ((gpointer) vtables [i], type, data)) { + match = TRUE; + break; + } + } + } if (dump_all) printf (match ? "* " : " "); if (match || dump_all) |