/* * Add new breakpoint. * arguments: * file - breakpoints filename * line - breakpoints line * condition - breakpoints line * enabled - is new breakpoint enabled * hitscount - breakpoints hitscount */ void breaks_add(const char* file, int line, char* condition, int enabled, int hitscount) { /* do not process async break manipulation on modules that do not support async interuppt */ enum dbs state = debug_get_state(); if (DBS_RUNNING == state && !debug_supports_async_breaks()) return; /* allocate memory */ breakpoint* bp = break_new_full(file, line, condition, enabled, hitscount); /* check whether GTree for this file exists and create if doesn't */ GTree *tree; if (!(tree = g_hash_table_lookup(files, bp->file))) { char *newfile = g_strdup(bp->file); tree = g_tree_new_full(compare_func, NULL, NULL, (GDestroyNotify)g_free); g_hash_table_insert(files, newfile, tree); } /* insert to internal storage */ g_tree_insert(tree, GINT_TO_POINTER(bp->line), bp); /* handle creation instantly if debugger is idle or stopped and request debug module interruption overwise */ if (DBS_IDLE == state) { on_add(bp); config_set_debug_changed(); } else if (DBS_STOPPED == state) breaks_add_debug(bp); else if (DBS_STOP_REQUESTED != state) debug_request_interrupt((bs_callback)breaks_add_debug, (gpointer)bp); }
/* * functions that are called when a breakpoint is altered while debuginng session is active. * Therefore, these functions try to alter break in debug session first and if successful - * do what on_... do or simply call on_... function directly */ static void breaks_add_debug(breakpoint* bp) { if (debug_set_break(bp, BSA_NEW_BREAK)) { /* add markers, update treeview */ on_add(bp); /* mark config for saving */ config_set_debug_changed(); } else dialogs_show_msgbox(GTK_MESSAGE_ERROR, "%s", debug_error_message()); }
void DCAwarePolicy::init(const SharedRefPtr<Host>& connected_host, const HostMap& hosts) { if (local_dc_.empty() && !connected_host->dc().empty()) { LOG_INFO("Using '%s' for the local data center " "(if this is incorrect, please provide the correct data center)", connected_host->dc().c_str()); local_dc_ = connected_host->dc(); } for (HostMap::const_iterator i = hosts.begin(), end = hosts.end(); i != end; ++i) { on_add(i->second); } }
void Session::on_control_connection_ready() { // No hosts lock necessary (only called on session thread and read-only) load_balancing_policy_->init(control_connection_.connected_host(), hosts_); load_balancing_policy_->register_handles(loop()); for (IOWorkerVec::iterator it = io_workers_.begin(), end = io_workers_.end(); it != end; ++it) { (*it)->set_protocol_version(control_connection_.protocol_version()); } for (HostMap::iterator it = hosts_.begin(), hosts_end = hosts_.end(); it != hosts_end; ++it) { on_add(it->second, true); } if (config().core_connections_per_host() == 0) { // Special case for internal testing. Not allowed by API LOG_DEBUG("Session connected with no core IO connections"); } }
// Parse an additive expression. // // additive-expr -> additive-expr '*' multiplicative-expr // | additive-expr '/' multiplicative-expr // | multiplicative-expr Expr* Parser::additive_expr() { Expr* e1 = multiplicative_expr(); while (true) { if (match_if(plus_tok)) { Expr* e2 = multiplicative_expr(); e1 = on_add(e1, e2); } else if (match_if(minus_tok)) { Expr* e2 = multiplicative_expr(); e1 = on_sub(e1, e2); } else { break; } } return e1; }
void Session::on_control_connection_ready() { // No hosts lock necessary (only called on session thread and read-only) config().load_balancing_policy()->init(control_connection_.connected_host(), hosts_, random_.get()); config().load_balancing_policy()->register_handles(loop()); for (IOWorkerVec::iterator it = io_workers_.begin(), end = io_workers_.end(); it != end; ++it) { (*it)->set_protocol_version(control_connection_.protocol_version()); } for (HostMap::iterator it = hosts_.begin(), hosts_end = hosts_.end(); it != hosts_end; ++it) { on_add(it->second, true); } if (pending_pool_count_ == 0) { notify_connect_error(CASS_ERROR_LIB_NO_HOSTS_AVAILABLE, "No hosts available for connection using the current load balancing policy"); } if (config().core_connections_per_host() == 0) { // Special case for internal testing. Not allowed by API LOG_DEBUG("Session connected with no core IO connections"); } }
int executer(char order[INPUT_LENGTH]) { char name_newdir[INPUT_LENGTH]; if (strcmp(order, "add") == 0) on_add(); else if (strcmp(order, "addl") == 0) on_addl(); else if (strcmp(order, "import") == 0) { scanf(" %[^\n]", name_newdir); on_import(name_newdir); } else if (strcmp(order, "importl") == 0) { scanf(" %[^\n]", name_newdir); on_importl(name_newdir); } else if (strcmp(order, "order") == 0) on_order(); else if (strcmp(order, "del") == 0 || strcmp(order, "delete") == 0) on_del(); else if (strcmp(order, "delall") == 0 || strcmp(order, "deleteall") == 0) on_delall(); else if (strcmp(order, "help") == 0 || strcmp(order, "?") == 0) on_help(); else if (strcmp(order, "showlist") == 0 || strcmp(order, "show") == 0) on_showlist(); else if (strcmp(order, "play") == 0) { if (on_play('d', 0)) printf ("The songlist cannot be played.Please check the song list\n"); } else if (strcmp(order, "playone") == 0) { int which; scanf("%d", &which); if (on_play('a', which)) printf ("The songlist cannot be played.Please check the song list\n"); } else if (strcmp(order, "save") == 0) on_save_config(); else if (strcmp(order, "up") == 0) on_up(); else if (strcmp(order, "down") == 0) on_down(); else if (strcmp(order, "exit") == 0 || strcmp(order, "quit") == 0 || strcmp(order, "bye") == 0 || strcmp(order, "q") == 0) return 1; else if (strcmp(order, "") == 0) { return 1; //printf("\n"); } else printf("%s%s\n", "Command not found:", order); return 0; }
void DCAwarePolicy::on_up(const SharedRefPtr<Host>& host) { on_add(host); }