static void FuncSetOptions( a_window *wnd ) { func_window *func = WndFunc( wnd ); func->d2_only = func->is_global && _IsOn( SW_FUNC_D2_ONLY ); FuncNewOptions( wnd ); }
void InitScreen( void ) { if( setpgid( 0, 0 ) != 0 && errno != EPERM ) { StartupErr( "unable to create new process group" ); } if( TryTTY() ) { ConMode = C_TTY; } else if( TryVC() ) { ConMode = C_VC; } else if( TryXWindows() ) { ConMode = C_XWIN; } else { /* backup: just use the current terminal */ ConMode = C_CURTTY; DbgConHandle = -1; } _Free( DbgTerminal ); DbgTerminal = NULL; if ( DbgConHandle != -1 ) { fcntl( DbgConHandle, F_SETFD, (int)FD_CLOEXEC ); UIConFile = fdopen( DbgConHandle, "w+" ); UIConHandle = DbgConHandle; } if( !uistart() ) { StartupErr( "unable to initialize user interface" ); } if( _IsOn( SW_USE_MOUSE ) ) { GUIInitMouse( 1 ); } DebugScreen(); }
void FiniScreen( void ) { if( _IsOn( SW_POWERBUILDER ) ) return; if( IsWindow( FirstForeWnd ) ) { SetForegroundWindow( FirstForeWnd ); } }
void CallConf( void ) { char *ptr; unsigned i; bool first; if( _IsOn( SW_HAVE_SET_CALL ) ) { ptr = TxtBuff; if( DefCallType != MAD_MSTR_NIL ) { *ptr++ = '/'; ptr += MADCli( String )( DefCallType, ptr, TXT_LEN ); } *ptr++ = '('; first = true; for( i = 0; i < MAX_PARMS; ++i ) { if( DefParms[i] != NULL ) { if( !first ) { *ptr++ = ','; } ptr = StrCopy( DefParms[i], ptr ); first = false; } } *ptr++ = ')'; if( DefReturn == NULL ) { *ptr++ = '/'; *ptr = NULLCHAR; } else { StrCopy( DefReturn, ptr ); } ConfigLine( TxtBuff ); } }
static void GetDlgStatus( gui_window *gui ) { long tmp; unsigned old; old = NewCurrRadix( 10 ); _SwitchSet( SW_AUTO_SAVE_CONFIG, GUIIsChecked( gui, CTL_OPT_AUTO ) ); _SwitchSet( SW_BELL, GUIIsChecked( gui, CTL_OPT_BELL ) ); _SwitchSet( SW_IMPLICIT, GUIIsChecked( gui, CTL_OPT_IMPLICIT ) ); _SwitchSet( SW_RECURSE_CHECK, GUIIsChecked( gui, CTL_OPT_RECURSE ) ); _SwitchSet( SW_FLIP, GUIIsChecked( gui, CTL_OPT_FLIP ) ); _SwitchSet( SW_DONT_EXPAND_HEX, GUIIsChecked( gui, CTL_OPT_NOHEX ) ); LookCaseSet( !GUIIsChecked( gui, CTL_OPT_CASE ) ); if( DlgGetLong( gui, CTL_OPT_RADIX, &tmp ) ) { DefaultRadixSet( tmp ); old = NewCurrRadix( 10 ); } if( DlgGetLong( gui, CTL_OPT_DCLICK, &tmp ) ) { WndSetDClick( tmp ); } NewCurrRadix( old ); /* Don't change config if it is just the trap file that does not support the option! */ if( SupportsExactBreakpoints ) { _SwitchSet( SW_BREAK_ON_WRITE, GUIIsChecked( gui, CTL_OPT_BR_ON_WRITE ) ); CapabilitiesSetExactBreakpointSupport( _IsOn( SW_BREAK_ON_WRITE ) ? TRUE : FALSE ); } }
void InitScreen( void ) { if( setpgid( 0, 0 ) != 0 && errno != EPERM ) { StartupErr( "unable to create new process group" ); } if( TryTTY() ) { ConMode = C_TTY; } else if( TryQConsole() ) { ConMode = C_QCON; } else if( TryXWindows() ) { ConMode = C_XWIN; } else { StartupErr( "unable to initialize debugger screen" ); } _Free( DbgTerminal ); DbgTerminal = NULL; fcntl( DbgConHandle, F_SETFD, (int)FD_CLOEXEC ); UIConHandle = DbgConHandle; if( !uistart() ) { StartupErr( "unable to initialize user interface" ); } if( _IsOn( SW_USE_MOUSE ) ) GUIInitMouse( 1 ); DebugScreen(); }
bool IsExactBreakpointsSupported( void ) { if( SupportsExactBreakpoints ) { return( _IsOn( SW_BREAK_ON_WRITE ) ); } else { return( FALSE ); } }
void FiniScreen( void ) { SetConsoleTitle( OldTitle ); DebugScreen(); if( _IsOn( SW_USE_MOUSE ) ) GUIFiniMouse(); uistop(); }
void FiniScreen( void ) { if( _IsOn( SW_USE_MOUSE ) ) GUIFiniMouse(); uistop(); if( FlipMech == FLIP_SWAP ) { FiniSwapper(); InvalidateRect( HWND_DESKTOP, NULL, TRUE ); } }
bool UserScreen() { if( ScreenState == USER_SCREEN ) return( FALSE ); if( _IsOn( SW_POWERBUILDER ) ) return( FALSE ); if( WndMain ) { ScreenState = USER_SCREEN; if( _IsOn( SW_POWERBUILDER ) ) { WndMinimizeWindow( WndMain ); } else { if( IsWindow( HwndFore ) ) { SetForegroundWindow( HwndFore ); } else { HwndFore = NULL; } } } return( FALSE ); }
static void RunRequest( int req ) { if( _IsOn( SW_TASK_RUNNING ) ) return; WaitForSingleObject( Requestdonesem, INFINITE ); // wait for last request to finish Req = req; _SwitchOn( SW_TASK_RUNNING ); ReleaseSemaphore( Requestsem, 1, NULL ); // tell worker to go }
static void DumpLocals( void ) { address addr; int row; int depth; int inherit; var_node *v; if( !_IsOn( SW_TASK_RUNNING ) ) { VarErrState(); VarInfoRefresh( VAR_LOCALS, &Locals, &addr, NULL ); VarOkToCache( &Locals, TRUE ); } for( row = 0;; ++row ) { v = VarGetDisplayPiece( &Locals, row, VAR_PIECE_GADGET, &depth, &inherit ); if( v == NULL ) break; v = VarGetDisplayPiece( &Locals, row, VAR_PIECE_NAME, &depth, &inherit ); v = VarGetDisplayPiece( &Locals, row, VAR_PIECE_VALUE, &depth, &inherit ); switch( v->gadget ) { case VARGADGET_NONE: printf( " " ); break; case VARGADGET_OPEN: printf( "+ " ); break; case VARGADGET_CLOSED: printf( "- " ); break; case VARGADGET_POINTS: printf( "->" ); break; case VARGADGET_UNPOINTS: printf( "<-" ); break; } VarBuildName( &Locals, v, TRUE ); printf( " %-20s %s\n", TxtBuff, v->value ); } if( !_IsOn( SW_TASK_RUNNING ) ) { VarOkToCache( &Locals, FALSE ); VarOldErrState(); } }
void ConfigFlip( void ) { char *p; ReqEOC(); p = StrCopy( GetCmdName( CMD_FLIP ), TxtBuff ); *p++ = ' '; GetCmdEntry( &OnOffNameTab, _IsOn( SW_FLIP ) ? 1 : 2, p ); DUIDlgTxt( TxtBuff ); }
void InitScreen( void ) { DebuggerHwnd = GetForegroundWindow(); GetConsoleTitle( OldTitle, sizeof( OldTitle ) ); SetConsoleTitle( LIT_DUI( The_WATCOM_Debugger ) ); if( uistart() ) { if( _IsOn( SW_USE_MOUSE ) ) { GUIInitMouse( INIT_MOUSE ); } } }
void RunRequest( int req ) { ULONG ulCount; if( _IsOn( SW_TASK_RUNNING ) ) return; DosWaitEventSem( Requestdonesem, SEM_INDEFINITE_WAIT ); // wait for last request to finish DosResetEventSem( Requestdonesem, &ulCount ); Req = req; _SwitchOn( SW_TASK_RUNNING ); DosPostEventSem( Requestsem ); // tell worker to go }
int SameAddrSpace( address a, address b ) { if( _IsOn( SW_IGNORE_SEGMENTS ) ) return( TRUE ); if( a.sect_id == 0 ) a.sect_id = b.sect_id; if( b.sect_id == 0 ) b.sect_id = a.sect_id; if( a.sect_id != b.sect_id ) return( FALSE ); AddrFix( &a ); AddrFix( &b ); DeAlias( &a.mach ); DeAlias( &b.mach ); return( a.mach.segment == b.mach.segment ); }
// The following routine is cut & pasted verbatim from dbgwvar.c // (which we really don't want to drag in here) var_node *VarGetDisplayPiece( var_info *i, int row, int piece, int *pdepth, int *pinherit ) { var_node *row_v; var_node *v; if( piece >= VAR_PIECE_LAST ) return( NULL ); if( VarFirstNode( i ) == NULL ) return( NULL ); if( row >= VarRowTotal( i ) ) return( NULL ); row_v = VarFindRowNode( i, row ); if( !row_v->value_valid ) { VarSetValue( row_v, LIT_ENG( Quest_Marks ) ); row_v->value_valid = FALSE; } if( !row_v->gadget_valid ) { VarSetGadget( row_v, VARGADGET_NONE ); row_v->gadget_valid = FALSE; } v = row_v; if( piece == VAR_PIECE_NAME || ( piece == VAR_PIECE_GADGET && row_v->gadget_valid ) || ( piece == VAR_PIECE_VALUE && row_v->value_valid ) ) { VarError = FALSE; } else if( !_IsOn( SW_TASK_RUNNING ) ) { if( row == i->exprsp_cacherow && i->exprsp_cache != NULL ) { VarError = FALSE; v = i->exprsp_cache; } else if( row == i->exprsp_cacherow && i->exprsp_cache_is_error ) { VarError = TRUE; v = NULL; } else { VarErrState(); v = VarFindRow( i, row ); VarOldErrState(); i->exprsp_cacherow = row; i->exprsp_cache = v; i->exprsp_cache_is_error = VarError; } if( v == NULL ) { if( !VarError ) return( NULL ); v = row_v; } VarNodeInvalid( v ); VarErrState(); ExprValue( ExprSP ); VarSetGadget( v, VarGetGadget( v ) ); VarSetOnTop( v, VarGetOnTop( v ) ); VarSetValue( v, VarGetValue( i, v ) ); VarOldErrState(); VarDoneRow( i ); } VarGetDepths( i, v, pdepth, pinherit ); return( v ); }
void ProcACmd( void ) { int cmd; ChkBreak(); CmdStart = ScanPos(); switch( CurrToken ) { case T_CMD_SEPARATOR: Scan(); break; case T_DIV: Scan(); ProcDo(); break; case T_LT: Scan(); ProcInvoke(); break; case T_GT: Scan(); ProcLog(); break; case T_QUESTION: Scan(); ProcPrint(); break; case T_MUL: Scan(); ProcRemark(); break; case T_EXCLAMATION: Scan(); ProcSystem(); break; case T_TILDE: Scan(); ProcThread(); break; default: cmd = ScanCmd( CmdNameTab ); if( cmd < 0 ) { if( _IsOn( SW_IMPLICIT ) ) { ProcInvoke(); } else { ProcNil(); } } else { (*CmdJmpTab[ cmd ])(); } break; } ScanSavePtr = 0; /* clean up previous ScanSave locations */ }
bool DebugScreen( void ) { HWND hwnd; HWND fore; if( ScreenState == DEBUG_SCREEN ) return( FALSE ); if( _IsOn( SW_POWERBUILDER ) ) return( FALSE ); if( WndMain ) { ScreenState = DEBUG_SCREEN; hwnd = GUIGetSysHandle( WndGui( WndMain ) ); fore = GetForegroundWindow(); if( fore != hwnd ) { HwndFore = fore; } if( GUIIsMinimized( WndGui( WndMain ) ) ) GUIRestoreWindow( WndGui( WndMain ) ); if( IsWindow( hwnd ) ) SetForegroundWindow( hwnd ); if( _IsOn( SW_POWERBUILDER ) ) { WndRestoreWindow( WndMain ); } } return( FALSE ); }
bool SetCapabilitiesExactBreakpointSupport( bool status, bool set_switch ) { /* Don't change config if it is just the trap file that does not support the option! */ if( SupportsExactBreakpoints ) { if( set_switch ) { _SwitchSet( SW_BREAK_ON_WRITE, status ); } if( _IsOn( SW_BREAK_ON_WRITE ) ) { return( CapabilitiesSetExactBreakpointSupport( status ) ); } } return( FALSE ); }
void InitScreen( void ) { if( FlipMech == FLIP_SWAP ) { InitSwapper( WantFast ); } if( FlipMech == FLIP_SWAP ) { ToCharacter(); } uistart(); UIData->height = ScrnLines; if( _IsOn( SW_USE_MOUSE ) ) { GUIInitMouse( 1 ); } }
static void DumpSource( void ) { char buff[256]; DIPHDL( cue, ch ); if( _IsOn( SW_TASK_RUNNING ) ) { printf( "I don't know where the task is. It's running\n" ); } if( DeAliasAddrCue( NO_MOD, GetCodeDot(), ch ) == SR_NONE || !DUIGetSourceLine( ch, buff, sizeof( buff ) ) ) { UnAsm( GetCodeDot(), buff, sizeof( buff ) ); } printf( "%s\n", buff ); }
void DlgCmd( void ) { char buff[256]; printf( "DBG>" ); fflush( stdout ); // not really necessary gets( buff ); if( buff[0] != NULLCHAR && buff[1] == NULLCHAR ) { switch( tolower( buff[0] ) ) { case 'u': WndAsmInspect( GetCodeDot() ); break; case 's': DumpSource(); break; case 'l': DumpLocals(); break; case 'i': RunRequest( REQ_TRACE_INTO ); break; case 'o': RunRequest( REQ_TRACE_OVER ); break; case 'g': RunRequest( REQ_GO ); break; case 'x': if( _IsOn( SW_REMOTE_LINK ) ) { printf( "Can't break remote task!\n" ); } else { HMODULE hmod; PFN proc = NULL; DosQueryModuleHandle( TrapParms, &hmod ); DosQueryProcAddr( hmod, 5, 0, &proc ); // if( proc != NULL ) // proc(); } // break the task break; default: printf( "Error - unrecognized command\n" ); } } else { DoCmd( DupStr( buff ) ); DoInput(); } }
void DlgNewProg( void ) { dlg_new_prog dlg; for( ;; ) { DoDlgNewProg( &dlg ); if( dlg.cancel ) break; LoadNewProg( dlg.prog, dlg.args ); if( _IsOn( SW_HAVE_TASK ) ) { break; } } DoInput(); }
void DlgCmd( void ) { char buff[256]; printf( "DBG>" ); fflush( stdout ); gets( buff ); if( buff[0] != NULLCHAR && buff[1] == NULLCHAR ) { switch( tolower( buff[0] ) ) { case 'u': WndAsmInspect( GetCodeDot() ); break; case 's': DumpSource(); break; case 'l': DumpLocals(); break; case 'i': RunRequest( REQ_TRACE_INTO ); break; case 'o': RunRequest( REQ_TRACE_OVER ); break; case 'g': RunRequest( REQ_GO ); break; case 'x': if( _IsOn( SW_REMOTE_LINK ) ) { printf( "Can't break remote task!\n" ); } else { HANDLE hmod; FARPROC proc; hmod = GetModuleHandle( TrapParms ); proc = GetProcAddress( hmod, (LPSTR)5 ); if( proc != NULL ) proc(); CloseHandle( hmod ); } // break the task break; default: printf( "Error - unrecognized command\n" ); } } else { DoCmd( DupStr( buff ) ); DoInput(); } }
/* * UsrScrnMode -- setup the user screen mode */ bool UsrScrnMode( void ) { #if 0 if( UIData->height != ScrnLines ) { UIData->height = ScrnLines; if( _IsOn( SW_USE_MOUSE ) ) { /* This is a sideways dive into the UI to get the boundries of the mouse cursor properly defined. */ initmouse( 1 ); } } #endif return( FALSE ); }
void FiniScreen( void ) { if( _IsOn( SW_USE_MOUSE ) ) GUIFiniMouse(); uistop(); switch( ConMode ) { case C_QCON: console_active( ConCtrl, InitConsole ); console_size( ConCtrl, DbgConsole, PrevLines, PrevColumns, NULL, NULL ); console_close( ConCtrl ); break; case C_XWIN: signal( SIGHUP, SIG_IGN ); kill( XQshPid, SIGTERM ); break; } }
static bool ScanKeyword( char *table ) { int namelen; int keylen; namelen = ScanPtr - TokenStart; for( ; *table != NULLCHAR ; table += (keylen + 3) ) { keylen = strlen( table ); if( keylen == namelen && ( _IsOn( SW_CASE_SENSITIVE ) ? !memcmp( table, TokenStart, namelen ) : !memicmp( table, TokenStart, namelen ) ) ) { table += (namelen + 1); CurrToken = *table; return( TRUE ); } } return( FALSE ); }
static bool ScanExprDelim( char *table ) { char *ptr; for( ; *table != NULLCHAR ; table += 3 ) { for( ptr = ScanPtr ; ( _IsOn( SW_CASE_SENSITIVE ) ? *table == *ptr : toupper(*table) == toupper(*ptr) ) && *table != NULLCHAR ; ptr++, table++ ); if( *table == NULLCHAR ) { table++; CurrToken = *table; ScanPtr = ptr; return( TRUE ); } for( ; *table != NULLCHAR ; table++ ); } return( FALSE ); }
static void SetDlgStatus( gui_window *gui ) { unsigned old; old = NewCurrRadix( 10 ); GUISetChecked( gui, CTL_OPT_AUTO, _IsOn( SW_AUTO_SAVE_CONFIG ) ); GUISetChecked( gui, CTL_OPT_BELL, _IsOn( SW_BELL ) ); GUISetChecked( gui, CTL_OPT_IMPLICIT, _IsOn( SW_IMPLICIT ) ); GUISetChecked( gui, CTL_OPT_RECURSE, _IsOn( SW_RECURSE_CHECK ) ); GUISetChecked( gui, CTL_OPT_FLIP, _IsOn( SW_FLIP ) ); GUISetChecked( gui, CTL_OPT_CASE, _IsOn( SW_CASE_IGNORE ) ); DlgSetLong( gui, CTL_OPT_RADIX, old ); DlgSetLong( gui, CTL_OPT_DCLICK, WndGetDClick() ); NewCurrRadix( old ); GUIEnableControl( gui, CTL_OPT_BR_ON_WRITE, SupportsExactBreakpoints ); GUISetChecked( gui, CTL_OPT_NOHEX, _IsOn( SW_DONT_EXPAND_HEX ) ); if( SupportsExactBreakpoints ) GUISetChecked( gui, CTL_OPT_BR_ON_WRITE, _IsOn ( SW_BREAK_ON_WRITE ) ); else GUISetChecked( gui, CTL_OPT_BR_ON_WRITE, FALSE ); }