R_API RDebug *r_debug_new(int hard) { RDebug *dbg = R_NEW (RDebug); if (dbg) { // R_SYS_ARCH dbg->arch = r_sys_arch_id (R_SYS_ARCH); // 0 is native by default dbg->bits = R_SYS_BITS; dbg->anal = NULL; dbg->pid = -1; dbg->tid = -1; dbg->graph = r_graph_new (); dbg->swstep = 0; dbg->newstate = 0; dbg->signum = 0; dbg->reason = R_DBG_REASON_UNKNOWN; dbg->stop_all_threads = R_FALSE; dbg->trace = r_debug_trace_new (); dbg->printf = (void *)printf; dbg->reg = r_reg_new (); dbg->h = NULL; /* TODO: needs a redesign? */ dbg->maps = r_debug_map_list_new (); dbg->maps_user = r_debug_map_list_new (); r_debug_signal_init (dbg); if (hard) { dbg->bp = r_bp_new (); r_debug_plugin_init (dbg); dbg->bp->iob.init = R_FALSE; } } return dbg; }
R_API RDebug *r_debug_new(int hard) { RDebug *dbg = R_NEW0 (RDebug); if (!dbg) return NULL; // R_SYS_ARCH dbg->arch = r_sys_arch_id (R_SYS_ARCH); // 0 is native by default dbg->bits = R_SYS_BITS; dbg->trace_forks = 1; dbg->trace_clone = 0; R_FREE (dbg->btalgo); dbg->trace_execs = 0; dbg->anal = NULL; dbg->snaps = r_list_newf (r_debug_snap_free); dbg->pid = -1; dbg->bpsize = 1; dbg->tid = -1; dbg->tree = r_tree_new (); dbg->tracenodes = sdb_new0 (); dbg->swstep = 0; dbg->newstate = 0; dbg->signum = 0; dbg->reason = R_DBG_REASON_UNKNOWN; dbg->stop_all_threads = R_FALSE; dbg->trace = r_debug_trace_new (); dbg->printf = (void *)printf; dbg->reg = r_reg_new (); dbg->num = r_num_new (r_debug_num_callback, dbg); dbg->h = NULL; /* TODO: needs a redesign? */ dbg->maps = r_debug_map_list_new (); dbg->maps_user = r_debug_map_list_new (); r_debug_signal_init (dbg); if (hard) { dbg->bp = r_bp_new (); r_debug_plugin_init (dbg); dbg->bp->iob.init = R_FALSE; } return dbg; }