//-------------------------------------------------------------------------- bool arm_debmod_t::del_hwbpt(ea_t ea, bpttype_t type) { // msg("del_hwbpt %a\n", ea); if ( databpts[0] == ea && dbptypes[0] == type ) { databpts[0] = BADADDR; dbcon &= ~3; } else if ( databpts[1] == ea && dbptypes[1] == type ) { databpts[1] = BADADDR; dbcon &= ~(3<<2); } else if ( codebpts[0] == ea && cbptypes[0] == type ) { codebpts[0] = BADADDR; } else if ( codebpts[1] == ea && cbptypes[1] == type ) { codebpts[1] = BADADDR; } else { return false; } return enable_hwbpts(); }
//-------------------------------------------------------------------------- static bool wince_load_options(void) { if ( netnode::inited() ) { netnode node; node.create(WINCE_NODE); if ( node != BADNODE ) { node.supval(OPTID_HWBPTS_ENABLED, &hwbpts, sizeof(hwbpts)); enable_hwbpts(hwbpts != 0); } return true; } return false; }
//-------------------------------------------------------------------------- bool arm_debmod_t::add_hwbpt(bpttype_t type, ea_t ea, int len) { // msg("add_hwbpt %d %a %d\n", type, ea, len); if ( !is_xscale || len > 4 ) return false; if ( !init_hwbpt_support() ) return false; if ( type == BPT_EXEC ) { if ( codebpts[0] != BADADDR && codebpts[1] != BADADDR ) return false; int slot = codebpts[0] != BADADDR; codebpts[slot] = ea; cbptypes[slot] = type; } else { if ( databpts[0] != BADADDR && databpts[1] != BADADDR ) return false; int slot = databpts[0] != BADADDR; int bits; switch ( type ) { case BPT_WRITE: bits = 1; // store only break; case BPT_RDWR: bits = 2; // load/store break; // BPT_READ: // load only // bits = 3; // break; default: return false; } databpts[slot] = ea; dbptypes[slot] = type; dbcon |= bits << (slot*2); } return enable_hwbpts(); }
//-------------------------------------------------------------------------- static bool idaapi init_debugger(const char *hostname, int port_num, const char *password) { if ( !s_open_remote(hostname, port_num, password) ) return false; int code = s_init((debug & IDA_DEBUG_DEBUGGER) != 0); if ( code <= 0 ) // (network) error { s_close_remote(); return false; } debugger.process_get_info = (code & 1) ? process_get_info : NULL; debugger.detach_process = (code & 2) ? s_detach_process : NULL; debugger_inited = true; #if DEBUGGER_ID == DEBUGGER_ID_ARM_WINCE_USER slot = BADADDR; netnode n; n.create("$ wince rstub"); enable_hwbpts(n.altval(0)); #endif return true; }
//---------------------------------------------------------------------- static const char *idaapi set_wince_options( const char *keyword, int pri, int value_type, const void *value) { if ( keyword == NULL ) // interactive call { static const char form[] = "Windows CE debugger specific options\n" "\n" " <Enable hardware breakpoints:C>>\n" "\n"; if ( !AskUsingForm_c(form, &hwbpts) ) return IDPOPT_OK; wince_save_options(); } else { if ( *keyword == '\0' ) { // we are done with the .cfg file, time to load parameters stored in // the database wince_load_options(); return IDPOPT_OK; } if ( strcmp(keyword, "HWBPTS_ENABLED") != 0 ) return IDPOPT_BADKEY; if ( value_type != IDPOPT_BIT ) return IDPOPT_BADTYPE; hwbpts = *(int*)value; if ( pri == IDPOPT_PRI_HIGH ) wince_save_options(); } enable_hwbpts(hwbpts != 0); return IDPOPT_OK; }