Exemplo n.º 1
0
/* RxGetInfo function
 * returns a string in the following format
 * breakpoint status   program state
 * source file name (or NOSOURCE)   address range for source
 * line number range for source
 *
 */
BOOL	RXGetInfo(char *args) {
ULONG addr, line = 0, startaddr, endaddr;
long	info[2];    //	info[0] == lineBeg, info[1] == lineNo
int first = 0, last = 0, type;
short undef = TRUE, i;
DEBUG	*debug;

    if(*args) {
        addr = ParseExp(args, &undef, strlen(args));
    }
    if(undef)addr = programPC;
    debug = FindNearestDebug(addr);

    // give breakpoint info and program status first
    if(IsBreakpoint(addr))sprintf(RexxReplyString,"BP ");
    sprintf(RexxReplyString,"NOBP ");

    strcat(RexxReplyString,StateText(programState));

    if(debug) {	// we have source

        // find end of this source range
        type = CurrentMixedLine(&addr,&line,info);
	if (type == 0)type = NextMixedLine(&addr, &line, info);

        if(type == MIXTYPE_SOURCE) {
	    first = info[1];
	    // find end of range for the target range
	    while(NextMixedLine(&addr,&line,info) == MIXTYPE_SOURCE);
	    last = info[1];
	}

	// now find the address range for this line
	startaddr = endaddr = addr;
	while(NextMixedLine(&addr,&line,info) == MIXTYPE_DISM)endaddr=addr;

	// give source range, then address range
	i = strlen(RexxReplyString);
	sprintf(&RexxReplyString[i]," %d. %d. %08X %08X",first,last,startaddr,endaddr);

	// finally, give the file name
	strcat(RexxReplyString," ");
	strcat(RexxReplyString,DirBuf);
	strcat(RexxReplyString,debug->sourceName);
    }
    else {
	strcat(RexxReplyString," NOSOURCE 0. 0. 0 0 NOSOURCE"); 
    }
    return TRUE;
}
Exemplo n.º 2
0
////////////////////////////////////////////////////////////////////////////////
// OnDebugCommand(wxCommandEvent)
//
//     This function handles the user clicks one of the debugger tools and menus
//     and take care of actions requires. These events are toggle break-point,
//     clear all break-points, debugging continue, step-in, step-over and stop
//     debugging.
//
//  Parameters
//     - event object
//
void frmDebugger::OnDebugCommand(wxCommandEvent &_event)
{
	switch(_event.GetId())
	{
		case MENU_ID_TOGGLE_BREAK:
		{
			int lineNo = GetLineNo();

			// This event should have not been called
			if (lineNo == -1)
				return;

			// The user wants to set or clear a breakpoint at the line that
			// contains the insertion point (the caret)
			if (IsBreakpoint(lineNo))
			{
				m_controller->ClearBreakpoint(lineNo);
			}
			else
			{
				m_controller->SetBreakpoint(lineNo);
			}
			m_controller->UpdateBreakpoints();
		}
		break;

		case MENU_ID_CLEAR_ALL_BREAK:
			// The user wants to clear all the breakpoint
			ClearAllBreakpoints();

			break;

		case MENU_ID_CONTINUE:
			// The user wants to continue execution (as opposed to
			// single-stepping through the code).  Unhilite all
			// variables and tell the debugger server to continue.
			if (m_controller)
			{
				if (m_controller->CanRestart())
				{
					m_controller->Start();
				}
				else
				{
					EnableToolsAndMenus(false);
					LaunchWaitingDialog(_("Waiting for target (continue)..."));
					m_controller->Countinue();
					UnhilightCurrentLine();
				}
			}
			break;

		case MENU_ID_STEP_OVER:
			// The user wants to step-over a function invocation (or
			// just single-step). Unhilite all variables and tell the
			// debugger server to step-over
			EnableToolsAndMenus(false);
			LaunchWaitingDialog(_("Waiting for target (step over)..."));
			m_controller->StepOver();
			UnhilightCurrentLine();

			break;

		case MENU_ID_STEP_INTO:
			// The user wants to step-into a function invocation (or
			// just single-step). Unhilite all variables and tell the
			// debugger server to step-into
			EnableToolsAndMenus(false);
			LaunchWaitingDialog(_("Waiting for target (step into)..."));
			m_controller->StepInto();
			UnhilightCurrentLine();

			break;

		case MENU_ID_STOP:
			EnableToolsAndMenus(false);
			LaunchWaitingDialog(_("Waiting for target to stop execution..."));
			m_controller->Stop();
			UnhilightCurrentLine();

			break;

		default:
			break;
	}
}