示例#1
0
文件: main.cpp 项目: hetwieg/AWBot
int main(int argc, char **argv)
{
  int rc;
  
  if ((rc = aw_init(AW_BUILD)) != RC_SUCCESS)
    {
      std::cout << "Failed at init: " << rc << std::endl;
      return -1;
    }
  
  aw_term();
  return 0;
}
示例#2
0
// -----------------------------------------------------------------------
int dbg_init()
{
	eprint("Initializing debugger: ");
	// set UI mode
	if (em400_cfg.ui_simple == 1) {
		eprint("simple\n");
		ui_mode = O_STD;
	} else {
		eprint("ncurses\n");
		ui_mode = O_NCURSES;
	}

	if (aw_init(ui_mode, em400_cfg.hist_file) != 0) {
		return E_AW_INIT;
	}

	if ((ui_mode == O_NCURSES) &&  (dbg_ui_init() != 0)) {
		return E_UI_INIT;
	}

	aw_layout_changed = 1;

	// prepare handler for ctrl-c (break emulation, enter debugger loop)
	struct sigaction sa;
	sa.sa_flags = SA_SIGINFO;
	sa.sa_sigaction = _dbg_sigint_handler;

	if (sigemptyset(&sa.sa_mask) != 0) {
		return E_UI_SIG_CTRLC;
	}

	if (sigaction(SIGINT, &sa, NULL) != 0) {
		return E_UI_SIG_CTRLC;
	}

	// register/memory action is none when debugger starts
	dbg_fin_cycle();

	return 0;
}