std::string &post_process_fitness_source(std::string &result, const symbol_tablet &st, const goto_functionst &gf, const size_t num_ce_vars, const size_t num_vars, const size_t num_consts, const size_t max_prog_size, const std::string &exec) { const namespacet ns(st); std::stringstream ss; dump_c(gf, true, ns, ss); add_first_prog_offset(result, num_ce_vars); add_assume_implementation(result); add_danger_execute(result, num_vars, num_consts, max_prog_size, exec); return post_process(result, ss); }
static void channel_load_c(struct fs_dma_ctrl *ctrl, int c) { target_phys_addr_t addr = channel_reg(ctrl, c, RW_GROUP_DOWN); /* Load and decode. FIXME: handle endianness. */ cpu_physical_memory_read (addr, (void *) &ctrl->channels[c].current_c, sizeof ctrl->channels[c].current_c); D(dump_c(c, &ctrl->channels[c].current_c)); /* I guess this should update the current pos. */ ctrl->channels[c].regs[RW_SAVED_DATA] = (uint32_t)ctrl->channels[c].current_c.saved_data; ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = (uint32_t)ctrl->channels[c].current_c.saved_data_buf; }
int main(int argc, char *argv[]) { FILE *src; static struct bfop bf[BF_PRGM_SIZE]; struct bfop *end; if (argc == 2) { src = fopen(argv[1], "r"); } else { src = stdin; } if (src == 0) { perror(argv[0]); return 1; } end = bf_parse(bf, bf + BF_PRGM_SIZE, src); dump_c(bf, end, stdout); fprintf(stderr, "stats\nprogram size=%d\n", (int) (end-bf)); return 0; }
int clobber_parse_optionst::doit() { if(cmdline.isset("version")) { std::cout << CBMC_VERSION << std::endl; return 0; } register_language(new_ansi_c_language); register_language(new_cpp_language); // // command line options // optionst options; get_command_line_options(options); eval_verbosity(); goto_functionst goto_functions; if(get_goto_program(options, goto_functions)) return 6; label_properties(goto_functions); if(cmdline.isset("show-properties")) { const namespacet ns(symbol_table); show_properties(ns, get_ui(), goto_functions); return 0; } if(set_properties(goto_functions)) return 7; // do instrumentation try { const namespacet ns(symbol_table); std::ofstream out("simulator.c"); if(!out) throw std::string("failed to create file simulator.c"); dump_c(goto_functions, true, ns, out); status() << "instrumentation complete; compile and execute simulator.c" << eom; return 0; } catch(const std::string error_msg) { error() << error_msg << messaget::eom; return 8; } catch(const char *error_msg) { error() << error_msg << messaget::eom; return 8; } #if 0 // let's log some more statistics debug() << "Memory consumption:" << messaget::endl; memory_info(debug()); debug() << eom; #endif }