int main(int argc, char **argv) { R_PDB pdb; static struct option long_options[] = { {"pdb_file", required_argument, 0, 'f'}, {"print_types", no_argument, 0, 't'}, {"print_globals", required_argument, 0, 'g'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; int option_index = 0; int c = 0; char *pdb_file = 0; while(1) { c = getopt_long (argc, argv, ":f:tg:h", long_options, &option_index); if (c == -1) break; switch (c) { case 'f': pdb_file = optarg; strcpy(&pdb.file_name, optarg); if (!init_pdb_parser(&pdb)) { printf("initialization error of pdb parser\n"); return 0; } pdb.pdb_parse(&pdb); break; case 't': pdb.print_types(&pdb); break; case 'g': pdb.print_gvars(&pdb, *(int *)optarg); break; default: print_usage(); return 0; } } return 0; }
static int bin_pdb(RCore *core, int mode) { R_PDB pdb = {0}; ut64 baddr = r_bin_get_baddr (core->bin); pdb.cb_printf = r_cons_printf; if (!init_pdb_parser (&pdb, core->bin->file)) { return false; } if (!pdb.pdb_parse (&pdb)) { eprintf ("pdb was not parsed\n"); pdb.finish_pdb_parse (&pdb); return false; } if (mode == R_CORE_BIN_JSON) r_cons_printf("["); switch (mode) { case R_CORE_BIN_SET: mode = 's'; r_core_cmd0 (core, ".iP*"); return true; case R_CORE_BIN_JSON: mode = 'j'; break; case '*': case 1: mode = 'r'; break; default: mode = 'd'; // default break; } pdb.print_types (&pdb, mode); if (mode == 'j') r_cons_printf (","); pdb.print_gvars (&pdb, baddr, mode); if (mode == 'j') r_cons_printf ("]"); pdb.finish_pdb_parse (&pdb); return true; }