[svn:parrot] r49705 - trunk/src

cotto at svn.parrot.org cotto at svn.parrot.org
Thu Oct 28 01:05:51 UTC 2010


Author: cotto
Date: Thu Oct 28 01:05:51 2010
New Revision: 49705
URL: https://trac.parrot.org/parrot/changeset/49705

Log:
[tools] add op map output to pbc_dump's disassembly output

Modified:
   trunk/src/pbc_dump.c

Modified: trunk/src/pbc_dump.c
==============================================================================
--- trunk/src/pbc_dump.c	Wed Oct 27 22:50:22 2010	(r49704)
+++ trunk/src/pbc_dump.c	Thu Oct 28 01:05:51 2010	(r49705)
@@ -94,10 +94,26 @@
 disas_dump(PARROT_INTERP, const PackFile_Segment *self)
 {
     const opcode_t *pc = self->data;
+    const PackFile_ByteCode_OpMapping *map = &((PackFile_ByteCode *)self)->op_mapping;
+    INTVAL i;
 
     Parrot_io_printf(interp, "%Ss => [ # %d ops at offs 0x%x\n",
             self->name, (int)self->size, (int)self->file_offset + 4);
 
+    for (i = 0; i < map->n_libs; i++) {
+        INTVAL j;
+        PackFile_ByteCode_OpMappingEntry *entry = &map->libs[i];
+        Parrot_io_printf(interp, "  map #%d => [\n", i);
+        Parrot_io_printf(interp, "    oplib: \"%s\" (%d ops)\n",
+                entry->lib->name, entry->n_ops);
+        for (j = 0; j < map->libs[i].n_ops; j++) {
+            Parrot_io_printf(interp, "    %08lx => %08lx (%s)\n",
+                    entry->table_ops[j], entry->lib_ops[j],
+                    entry->lib->op_info_table[ entry->lib_ops[j] ].full_name);
+        }
+        Parrot_io_printf(interp, "  ]\n");
+    }
+
     while (pc < self->data + self->size) {
         /* n can't be const; the ADD_OP_VAR_PART macro increments it */
         size_t n = (size_t)interp->code->op_info_table[*pc]->op_count;


More information about the parrot-commits mailing list