Example #1
0
static void
disas_dump(PARROT_INTERP, const PackFile_Segment *self)
{
    const opcode_t *pc = self->data;

    Parrot_io_printf(interp, "%Ss => [ # %d ops at offs 0x%x\n",
            self->name, (int)self->size, (int)self->file_offset + 4);

    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->op_info_table[*pc].op_count;
        size_t i;

        /* trace_op_dump(interp, self->pf->src, pc); */
        Parrot_io_printf(interp, " %04x:  ", (int)(pc - self->data));

        for (i = 0; i < 6; ++i)
            if (i < n)
                Parrot_io_printf(interp, "%08lx ", (unsigned long)pc[i]);
            else
                Parrot_io_printf(interp, "         ");

        Parrot_io_printf(interp, "%s\n",
                interp->op_info_table[*pc].full_name);

        ADD_OP_VAR_PART(interp, interp->code, pc, n);
        pc += n;
    }

    Parrot_io_printf(interp, "]\n");
}
Example #2
0
static void
disas_dump(PARROT_INTERP, const PackFile_Segment *self)
{
    const opcode_t *pc = self->data;
    const PackFile_ByteCode_OpMapping *map = &((const 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, lib_num, table_num;
        PackFile_ByteCode_OpMappingEntry *entry = &map->libs[i];
        Parrot_io_printf(interp, "  map #%d => [\n", i);
        Parrot_io_printf(interp, "    oplib: \"%s\" version %d.%d.%d (%d ops)\n",
                entry->lib->name,
                entry->lib->major_version,
                entry->lib->minor_version,
                entry->lib->patch_version,
                entry->n_ops);

        for (j = 0; j < map->libs[i].n_ops; j++) {
            lib_num    = entry->lib_ops[j];
            table_num  = entry->table_ops[j];
            Parrot_io_printf(interp, "    %08lx => %08lx (%s)\n", table_num, lib_num,
                    entry->lib->op_info_table[lib_num].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;
        size_t i;

        /* trace_op_dump(interp, self->pf->src, pc); */
        Parrot_io_printf(interp, " %04x:  ", (int)(pc - self->data));

        for (i = 0; i < 6; ++i)
            if (i < n)
                Parrot_io_printf(interp, "%08lx ", (unsigned long)pc[i]);
            else
                Parrot_io_printf(interp, "         ");

        Parrot_io_printf(interp, "%s\n",
                interp->code->op_info_table[*pc]->full_name);

        ADD_OP_VAR_PART(interp, interp->code, pc, n);
        pc += n;
    }

    Parrot_io_printf(interp, "]\n");
}
Example #3
0
static void
nums_dump(PARROT_INTERP, const PackFile_Segment *self)
{
    const STRING           *debug_name = Parrot_str_concat(interp, self->name,
            Parrot_str_new_constant(interp, "_DB"));
    const PackFile_Segment *debug      = PackFile_find_segment(interp,
                                            self->dir, debug_name, 1);

    opcode_t   * pc            = self->data;
    opcode_t   * debug_ops     = debug->data;
    op_info_t ** const op_info = interp->code->op_info_table;

    while (pc < self->data + self->size) {
        /* n can't be const; the ADD_OP_VAR_PART macro increments it */
        size_t n = (size_t)op_info[*pc]->op_count;

        Parrot_io_printf(interp, " %04x:  %s\n",
            *(debug_ops++), op_info[*pc]->full_name);

        ADD_OP_VAR_PART(interp, interp->code, pc, n);
        pc += n;
    }
}