Beispiel #1
0
void Runtime::Debugger::ProcessBreak(FilePostion* break_command) {
  int line_num = break_command->GetLineNumber();
  if(line_num < 0) {
    line_num = cur_line_num;
  }

  wstring file_name = break_command->GetFileName();
  if(file_name.size() == 0) {
    file_name = cur_file_name;
  }

  const wstring &path = base_path + file_name;
  if(file_name.size() != 0 && FileExists(path)) {
    if(AddBreak(line_num, file_name)) {
      wcout << L"added breakpoint: file='" << file_name << L":" << line_num << L"'" << endl;
    }
    else {
      wcout << L"breakpoint already exist." << endl;
    }
  }
  else {
    wcout << L"file doesn't exist or isn't loaded." << endl;
    is_error = true;
  }
}
Beispiel #2
0
void Trace( struct TDebug *obj )
{
    char Instr[2] = {0, 0};
    int Sel;
    long Offset;

    if( obj->CurrentThread ) {
        Sel = obj->CurrentThread->Cs;
        Offset = obj->CurrentThread->Eip;

        ReadMem( obj->CurrentThread, Sel, Offset, Instr, 2 );

        if ( Instr[0] == 0xF && Instr[1] == 0xB ) {
            Offset += 7;
            AddBreak( obj, Sel, Offset );
            Go( obj );
            ClearBreak( obj, Sel, Offset );
        } else {
            RdosResetSignal( obj->UserSignal );

            SetupTrace( obj->CurrentThread );
            RdosContinueDebugEvent( obj->FHandle, obj->CurrentThread->ThreadID);

            RdosWaitForever( obj->UserWait );
        }
    }
}
Beispiel #3
0
void BreakAllModEntries( mod_handle handle )
{
    name_list   list;
    address     addr;
    int         i;
    bool        have_mod_cue;
    sym_info    sinfo;
    DIPHDL( cue, ch );
    DIPHDL( cue, ch_mod );

    NameListInit( &list, WF_CODE );
    NameListAddModules( &list, handle, false, true );
    have_mod_cue = FindFirstCue( handle, ch_mod );
    for( i = 0; i < NameListNumRows( &list ); ++i ) {
        addr = NameListAddr( &list, i );
        SymInfo( NameListHandle( &list, i ), NULL, &sinfo );
        if( !sinfo.is_global && !sinfo.is_public )
            continue;
        if( have_mod_cue && DeAliasAddrCue( handle, addr, ch ) != SR_NONE ) {
            if( CueFileId( ch ) != CueFileId( ch_mod ) ) {
                continue;
            }
        }
        if( FindBreak( addr ) != NULL ) {
            continue;
        }
        AddBreak( addr );
    }
    NameListFree( &list );
}
Beispiel #4
0
extern void ToggleBreak( address addr )
{
    brkp        *bp;

    if( IS_NIL_ADDR( addr ) ) return;
    bp = FindBreak( addr );
    if( bp == NULL ) {
        AddBreak( addr );
    } else if( bp->status.b.active ) {
        ActPoint( bp, FALSE );
    } else {
        RemovePoint( bp );
    }
}
Beispiel #5
0
int AsyncTrace( struct TDebug *obj, int ms )
{
    char    Instr[2] = {0, 0};
    int     ok = TRUE;
    void    *wait;

    if( obj->CurrentThread ) {
        BreakSel = obj->CurrentThread->Cs;
        BreakOffset = obj->CurrentThread->Eip;

        ReadMem( obj->CurrentThread, BreakSel, BreakOffset, Instr, 2 );

        if ( Instr[0] == 0xF && Instr[1] == 0xB ) {
            BreakOffset += 7;
            AddBreak( obj, BreakSel, BreakOffset, TRUE );
            ok = AsyncGo( obj, ms );
            if( ok ) {
                ClearBreak( obj, BreakSel, BreakOffset );
            } else {
                HasBreak = TRUE;
            }
            return( ok );
        } else {
            RdosResetSignal( obj->UserSignal );
            DoTrace( obj );

            wait = RdosWaitTimeout( obj->UserWait, ms );
            if( wait ) {
                return( TRUE );
            }
            else
                return( FALSE );
        }
    }
    return( TRUE );
}
Beispiel #6
0
void BreakOnExprSP( const char *comment )
{
    address             addr;
    dip_type_info       tinfo;
    tmp_break_struct    s;

    LValue( ExprSP );
    tinfo.size = ExprSP->info.size;
    if( !( ExprSP->flags & SF_LOCATION ) ) {
        tinfo.size = DefaultSize( DK_INT );
    }
    switch( WndGetExprSPInspectType( &addr ) ) {
    case INSP_CODE:
        AddBreak( addr );
        break;
    case INSP_DATA:
    case INSP_RAW_DATA:
        s.addr = addr;
        s.size = tinfo.size;
        s.comment = comment;
        BreakOnAddress( &s );
        break;
    }
}
Beispiel #7
0
static void ParseBreak (void)
{
	LX_Require(";");
	AddBreak();
}