static int do_generate_lib_bin(cpe_dr_generate_ctx_t ctx) { int i; int rv; rv = 0; for(i = 0; i < o_lib_bin->count; ++i) { FILE * fp; fp = file_stream_open(o_lib_bin->filename[i], "w", ctx->m_em); if (fp == NULL) { rv = -1; continue; } if (file_stream_write_from_buf(fp, ctx->m_metalib, dr_lib_size(ctx->m_metalib), ctx->m_em) <= 0) { rv = -1; } file_stream_close(fp, ctx->m_em); } return rv; }
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'); }
size_t size(void) const { return dr_lib_size(*this); }