Exemple #1
0
static void dr_metalib_validate_align_i(error_monitor_t em, LPDRMETALIB metalib) {
    int meta_pos;
    int meta_count;

    meta_count = dr_lib_meta_num(metalib);
    for(meta_pos = 0; meta_pos < meta_count; ++meta_pos) {
        LPDRMETA meta;
        int entry_pos;
        int entry_count;

        meta = dr_lib_meta_at(metalib, meta_pos);
        entry_count = dr_meta_entry_num(meta);

        for(entry_pos = 0; entry_pos < entry_count; ++entry_pos) {
            LPDRMETAENTRY entry = dr_meta_entry_at(meta, entry_pos);
            int align = dr_entry_align(entry);
            if (align != 1 && align != 2 && align != 4 && align != 8) {
                CPE_ERROR(
                    em, "%s.%s: type align %d error",
                    dr_meta_name(meta), dr_entry_name(entry), align);
                continue;
            }

            if ((int)dr_entry_data_start_pos(entry) % align) {
                CPE_ERROR(
                    em, "%s.%s: start pos error, align is %d, startpos is %d",
                    dr_meta_name(meta), dr_entry_name(entry),
                    align, (int)dr_entry_data_start_pos(entry));
                continue;
            }
        }
    }
}
Exemple #2
0
void dr_lib_dump(write_stream_t stream, LPDRMETALIB metaLib, int ident) {
    int i;
    int meta_count;

    stream_putc_count(stream, ' ', ident);

    if (metaLib == NULL) {
        stream_printf(stream, "invalid METALIB!!!");
        return;
    }

    stream_printf(
        stream, "meta-lib: name=%s, version=%d, build-version=%d, size=%d", 
        dr_lib_name(metaLib), dr_lib_version(metaLib), dr_lib_build_version(metaLib), dr_lib_size(metaLib));

    meta_count = dr_lib_meta_num(metaLib);
    for(i = 0; i < meta_count; ++i) {
        dr_lib_dump_meta(stream, dr_lib_meta_at(metaLib, i), ident + 4);
    }

    stream_putc(stream, '\n');
}