BOOL CRunDlg::OnInitDialog() { CDialog::OnInitDialog(); // Load the current starting address. m_strAddress.Format("0x%08x", starting_address()); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CRunDlg::OnOK() { char * eptr = NULL; mem_addr addr = 0; // Make sure they've specified a valid address. UpdateData(); if (!m_strAddress.IsEmpty()) { if (isdigit(m_strAddress[0])) addr = (mem_addr)strtoul(m_strAddress, &eptr, 0); else { char *szAddress = m_strAddress.GetBuffer(0); addr = find_symbol_address(szAddress); m_strAddress.ReleaseBuffer(); } if (addr == 0) { CString strMsg; strMsg.Format("Please enter an address or symbol at which to begin execution.\n" "Or, leave blank to begin at the default address of 0x%08x", starting_address()); MessageBox(strMsg); return; } char *undefSyms; if (m_checkUndefinedSymbols && (undefSyms = undefined_symbol_string ()) != NULL) { CString strMsg; strMsg.Format("The following symbols are undefined:\n%s\n", undefSyms); int outcome = MessageBox(strMsg, NULL, MB_OKCANCEL); if (outcome == 2) // "Cancel" { OnCancel(); return; } } } CDialog::OnOK(); }
static void run_prompt (Widget button, XtPointer client_data, XtPointer call_data) { char sa[20]; if (run_popup == NULL) { sprintf (sa, "0x%08x", starting_address ()); run_popup = popup_two_field_dialog (button, "run program", "starting address:", sa, "args:", command_line, "ok", run_program_action, NULL, NULL, &run_field1_text, &run_field2_text); XtAddCallback (run_popup, XtNdestroyCallback, run_prompt_destroyed, (XtPointer) 0); } confirmAction = run_program_action; XtPopup (run_popup, XtGrabNone); }
static void step_program_action (Widget w, XtPointer client_data, XtPointer call_data) { Arg args[10]; String st; mem_addr addr; int steps; XtSetArg (args[0], XtNstring, &st); XtGetValues (step_field1_text, args, ONE); steps = atoi (st); free (step_size); step_size = str_copy (st); addr = starting_address (); if (steps > 0 && addr > 0) execute_program (addr, steps, 1, 1); else error ("Cannot step %d steps from 0x%x\n", steps, addr); }