void TypeSet( void ) /******************/ { type_display *parent; type_display *field; ScanLeftBrace(); while( !ScanRightBrace() ) { if( ScanCmd( &TypeSettings ) != TY_STRUCT ) oops(); parent = VarDisplayAddStruct( ScanName() ); ScanLeftBrace(); while( !ScanRightBrace() ) { if( ScanAttribute( parent, ScanCmd( &TypeSettings ) ) == TY_FIELD ) { field = VarDisplayAddField( parent, ScanName() ); ScanLeftBrace(); while( !ScanRightBrace() ) { if( ScanAttribute( field, ScanCmd( &TypeSettings ) ) == TY_FIELD ) { oops(); } } } } } ReqEOC(); }
void ProcPaint( void ) { wnd_class wndcls; gui_colour fore; gui_colour back; gui_colour_set *set; bool dialog; int attr; dialog = FALSE; wndcls = WND_NO_CLASS; if( ScanStatus() ) { attr = 0; } else if( ScanCmd( "DIalog\0" ) == 0 ) { dialog = TRUE; attr = ScanAttr( DlgAttrMap, ArraySize( DlgAttrMap ) ); } else { wndcls = ReqWndName(); attr = ScanAttr( AttrMap, ArraySize( AttrMap ) ); } fore = ScanColour(); ScanCmd( "On\0" ); back = ScanColour(); ReqEOC(); if( attr < 0 ) return; if( wndcls == WND_NO_CLASS ) { if( dialog ) { GUIGetDialogColours( WndDlgColours ); set_dlg_attr( (gui_dlg_attr)attr, fore, back ); GUISetDialogColours( WndDlgColours ); } else { WndStatusColour.fore = fore; WndStatusColour.back = back; if( WndHaveStatusWindow() ) { WndCloseStatusWindow(); WndCreateStatusWindow( &WndStatusColour ); } } } else { set = WndClassColour[wndcls]; if( set == NULL ) { set = WndAlloc( sizeof( WndColours ) ); memcpy( set, WndColours, sizeof( WndColours ) ); WndClassColour[wndcls] = set; } set_wndcls_attr( (wnd_attr)attr, set, fore, back, ( wndcls == WND_ALL ) ); _SwitchOn( SW_PENDING_REPAINT ); } }
void ProcFlip( void ) { const char *old; uint_16 wait; wait = 0; if( !ScanEOC() ) { old = ScanPos(); switch( ScanCmd( "ON\0OFf\0" ) ) { case 0: ReqEOC(); _SwitchOn( SW_FLIP ); return; case 1: ReqEOC(); _SwitchOff( SW_FLIP ); return; default: ReScan( old ); wait = (uint_16)ReqExpr(); ReqEOC(); break; } } Flip( wait ); }
OVL_EXTERN brkp *ImageBreak( memory_expr def_seg ) { const char *start; size_t len; bool clear = false; int cmd; def_seg=def_seg; while( CurrToken == T_DIV ) { Scan(); cmd = ScanCmd( PointNameTab ); if( cmd < 0 ) break; switch( cmd ) { case B_CLEAR: clear = true; break; default: Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_BREAK ) ); break; } } if( !ScanItem( true, &start, &len ) ) { BadPoint( def_seg ); } BreakOnImageLoad( start, len, clear ); Scan(); ReqEOC(); return( NULL ); }
void SourceSet( void ) { char_ring **owner; char *start; unsigned len; if( CurrToken == T_DIV ) { Scan(); if( ScanCmd( AddTab ) == 0 ) { Error( ERR_LOC, LIT( ERR_BAD_SUBCOMMAND ), GetCmdName( CMD_SET ) ); } owner = RingEnd( &SrcSpec ); } else { owner = &SrcSpec; FiniSource(); } while( ScanItem( TRUE, &start, &len ) ) { while( len > 0 && *start == ' ' ) { ++start; --len; } InsertRing( owner, start, len ); } DbgUpdate( UP_NEW_SRC ); }
OVL_EXTERN brkp *ImageBreak( memory_expr def_seg ) { char *start; size_t len; bool clear = FALSE; def_seg=def_seg; while( CurrToken == T_DIV ) { Scan(); switch( ScanCmd( PointNameTab ) ) { case 0: goto done; case B_CLEAR: clear = TRUE; break; default: Error( ERR_LOC, LIT( ERR_BAD_OPTION ), GetCmdName( CMD_BREAK ) ); break; } } done:; if( !ScanItem( TRUE, &start, &len ) ) { BadPoint( def_seg ); } BreakOnImageLoad( start, len, clear ); Scan(); ReqEOC(); return( NULL ); }
void ProcFlip( void ) { char *old; unsigned wait; unsigned cmd; wait = 0; if( !ScanEOC() ) { old = ScanPos(); cmd = ScanCmd( OnOffNameTab ); switch( cmd ) { case 1: ReqEOC(); _SwitchOn( SW_FLIP ); return; case 2: ReqEOC(); _SwitchOff( SW_FLIP ); return; default: ReScan( old ); wait = ReqExpr(); ReqEOC(); break; } } Flip( wait ); }
wnd_class ReqWndName( void ) { int cmd; cmd = ScanCmd( WndNameTab ); if( cmd < 0 ) Error( ERR_LOC, LIT_DUI( ERR_BAD_WIND_NAME ) ); return( (wnd_class)cmd ); }
void ProcIf( void ) { const char *start; size_t len; const char *true_start; size_t true_len; unsigned_64 res; cmd_list *cmd; bool have_true; true_len = 0; have_true = false; for( ;; ) { if( have_true ) { ChkExpr(); U64Clear( res ); } else { res = ReqU64Expr(); } if( !ScanQuote( &start, &len ) ) { Error( ERR_LOC, LIT_ENG( ERR_WANT_COMMAND_LIST ) ); } if( U64Test( &res ) != 0 ) { true_start = start; true_len = len; have_true = true; } if( ScanCmd( ElseifTab ) < 0 ) { break; } } ScanCmd( ElseTab ); /* optional else */ if( ScanQuote( &start, &len ) && !have_true ) { true_start = start; true_len = len; } ReqEOC(); if( true_len != 0 ) { cmd = AllocCmdList( true_start, true_len ); PushCmdList( cmd ); CopyInpFlags(); FreeCmdList( cmd ); } }
bool SwitchOnOff( void ) { int cmd; cmd = ScanCmd( "ON\0OFf\0" ); if( cmd < 0 ) Error( ERR_LOC, LIT_ENG( ERR_WANT_ON_OFF ) ); ReqEOC(); return( cmd == 0 ); }
void ProcWindow( void ) { a_window *wnd = WndFindActive(); unsigned cmd; cmd = ScanCmd( WindowNameTab ); ReqEOC(); if( wnd != NULL ) { WndJmpTab[ cmd ]( wnd ); } }
void ProcSet( void ) { int cmd; cmd = ScanCmd( SetNameTab ); if( cmd < 0 ) { BadSet(); } else { (*SetJmpTab[cmd])(); } }
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 */ }
static void DoProcBreak( void ) { int cmd; if( CurrToken == T_DIV ) { Scan(); cmd = ScanCmd( PointNameTab ); BPJmpTab[ cmd ].rtn( BPJmpTab[ cmd ].type ); } else if( ScanEOC() ) { ShowBPs(); } else { SetBreak( EXPR_CODE ); } }
void ProcLog( void ) { if( ScanEOC() ) { LogEnd(); } else if( CurrToken == T_GT ) { Scan(); LogAppend(); } else if( CurrToken == T_DIV ) { Scan(); (*LogJmpTab[ ScanCmd( LogNameTab ) ])(); } else { LogStart(); } }
static char GetOption( void ) { char optn; if( CurrToken == T_DIV ) { Scan(); optn = ScanCmd( DispOptions ); if( optn == 0 ) { Error( ERR_LOC, LIT( ERR_BAD_OPTION ), GetCmdName( CMD_DISPLAY ) ); } } else { optn = OPEN; } return( optn ); }
static disp_optn GetOption( void ) { int cmd; disp_optn optn = OPEN; if( CurrToken == T_DIV ) { Scan(); cmd = ScanCmd( DispOptions ); if( cmd < 0 ) { Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_DISPLAY ) ); } else { optn = (disp_optn)cmd; } } return( optn ); }
static int ScanAttr( attr_map *map, int size ) { attr_bits bits; int i; bits = 0; while( (i = ScanCmd( AttrNameTab )) >= 0 ) { bits |= AttrBits[i]; } for( i = 0; i < size; ++i ) { if( map[i].bits == bits ) { return( map[i].attr ); } } Error( ERR_LOC, LIT_DUI( ERR_BAD_WINDOW_ATTR ) ); return( -1 ); }
void ProcSystem() { char *start; size_t len; int loc; loc = 0; if( CurrToken == T_DIV ) { Scan(); loc = ScanCmd( SystemOps ); if( loc == 0 ) { Error( ERR_LOC, LIT( ERR_BAD_OPTION ), GetCmdName( CMD_SYSTEM ) ); } if( loc == 2 ) loc = -1; } ScanItem( FALSE, &start, &len ); ReqEOC(); DoSystem( start, len, loc ); }
static gui_colour ScanColour( void ) { colour_bits bits; int i; bits = 0; while( (i = ScanCmd( ColourNameTab )) >= 0 ) { bits |= ColourBits[i]; if( bits != CLR_NONE && bits != CLR_BRIGHT ) { break; } } for( i = 0; i < ArraySize( ColourMap ); ++i ) { if( ColourMap[i].bits == bits ) { return( ColourMap[i].colour ); } } Error( ERR_LOC, LIT_DUI( ERR_BAD_COLOUR_ATTR ) ); return( -1 ); }
void ProcLog( void ) { int cmd; if( ScanEOC() ) { LogEnd(); } else if( CurrToken == T_GT ) { Scan(); LogAppend(); } else if( CurrToken == T_DIV ) { Scan(); cmd = ScanCmd( LogNameTab ); if( cmd < 0 ) { BadLog(); } else { (*LogJmpTab[cmd])(); } } else { LogStart(); } }
void ProcDisplay( void ) { wnd_class_wv wndclass; mad_radix old_radix; if( ScanEOC() ) { while( HookPendingPush() ); PushRefresh(); return; } old_radix = NewCurrRadix( 10 ); switch( ScanCmd( MiscTab ) ) { case MISC_TOOL: ProcTool(); break; case MISC_STATUS: ProcStatus(); break; default: wndclass = ReqWndName(); ProcSize( wndclass ); } NewCurrRadix( old_radix ); }
void ProcGo( void ) { address start; address stop; bool have_start; bool have_stop; bool have_keep; bool doflip; bool flip_on; bool until; unsigned conditions; int count; have_keep = FALSE; doflip = TRUE; until = FALSE; while( CurrToken == T_DIV ) { Scan(); switch( ScanCmd( GoOptionTab ) ) { case KEEP: have_keep = TRUE; break; case NOFLIP: doflip = FALSE; break; case UNTIL: until = TRUE; break; default: Error( ERR_LOC, LIT( ERR_BAD_OPTION ), GetCmdName( CMD_GO ) ); } } if( !have_keep ) TraceKill(); NullStatus( &DbgTmpBrk ); start = GetRegIP(); have_stop = FALSE; have_start = FALSE; if( !ScanEOC() ) { stop = start; ReqMemAddr( EXPR_GIVEN, &stop ); if( CurrToken == T_COMMA ) { start = stop; have_start = TRUE; Scan(); if( !ScanEOC() ) { ReqMemAddr( EXPR_GIVEN, &stop ); have_stop = TRUE; } } else { have_stop = TRUE; } } ReqEOC(); count = 0; do { if( have_stop ) { if( have_keep ) { if( UserTmpBrk.status.b.has_address ) { NullStatus( &UserTmpBrk ); UserTmpBrk.status.b.has_address = TRUE; } else { NullStatus( &UserTmpBrk ); } Error( ERR_NONE, LIT( ERR_INCONSISTENT_GO ) ); } SetTempBreak( stop ); } else if( have_keep ) { if( UserTmpBrk.status.b.has_address ) { UserTmpBrk.status.b.active = TRUE; } } else { NullStatus( &UserTmpBrk ); } if( have_start ) { RecordSetRegIP( start ); } flip_on = _IsOn( SW_FLIP ); if( !doflip ) { _SwitchOff( SW_FLIP ); } conditions = Go( doflip ); if( flip_on ) _SwitchOn( SW_FLIP ); if( UserTmpBrk.status.b.has_address ) { NullStatus( &UserTmpBrk ); UserTmpBrk.status.b.has_address = TRUE; } else { NullStatus( &UserTmpBrk ); } } while( until && (conditions & COND_BREAK) && AddrComp( stop, GetRegIP() ) != 0 && ++count < 100 ); }
static brkp *SetPoint( memory_expr def_seg, mad_type_handle th ) { brkp *bp; const char *start; size_t len; address loc; cmd_list *cmds; char *condition; long countdown; bool resume; bool active; int index; mad_type_info mti; unsigned old; bool unmapped; bool mapaddress; bool symaddress; char *image_name; char *mod_name; char *sym_name; long cue_diff; long addr_diff; int cmd; resume = false; index = 0; active = true; unmapped = false; mapaddress = false; symaddress = false; while( CurrToken == T_DIV ) { Scan(); cmd = ScanCmd( PointNameTab ); if( cmd < 0 ) break; switch( cmd ) { case B_RESUME: resume = true; break; case B_UNRESUME: resume = false; break; case B_ACTIVATE: active = true; break; case B_DEACTIVATE: active = false; break; case B_UNMAPPED: unmapped = true; break; case B_MAPADDRESS: mapaddress = true; ScanItem( true, &start, &len ); image_name = DupStrLen( start, len ); loc.mach.segment = ReqLongExpr(); loc.mach.offset = ReqLongExpr(); ReqComma(); break; case B_SYMADDRESS: symaddress = true; ScanItem( true, &start, &len ); image_name = DupStrLen( start, len ); ScanItem( true, &start, &len ); mod_name = DupStrLen( start, len ); ScanItem( true, &start, &len ); sym_name = DupStrLen( start, len ); cue_diff = ReqLongExpr(); addr_diff = ReqLongExpr(); loc = NilAddr; ReqComma(); break; case B_INDEX: old = NewCurrRadix( 10 ); index = ReqExpr(); NewCurrRadix( old ); ReqComma(); break; /* fall thru */ default: Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_BREAK ) ); break; } } if( !unmapped ) { ReqMemAddr( def_seg, &loc ); } for( bp = BrkList; bp != NULL; bp = bp->next ) { if( AddrComp( bp->loc.addr, loc ) == 0 ) { Error( ERR_NONE, LIT_ENG( ERR_POINT_EXISTS ) ); } } cmds = NULL; condition = NULL; countdown = 0; if( ScanQuote( &start, &len ) ) { if( len != 0 ) cmds = AllocCmdList( start, len ); if( ScanQuote( &start, &len ) ) { if( len != 0 ) condition = DupStrLen( start, len ); if( !ScanEOC() ) { countdown = ReqExpr(); } } } ReqEOC(); if( !IS_BP_EXECUTE( th ) ) { MADTypeInfo( th, &mti ); switch( mti.b.bits / BITS_PER_BYTE ) { case 1: case 2: case 4: break; case 8: if( Is8ByteBreakpointsSupported() ) break; default: Error( ERR_NONE, LIT_ENG( ERR_NOT_WATCH_SIZE ) ); break; } } bp = AddPoint( loc, th, unmapped ); if( bp == NULL ) return( NULL ); bp->status.b.unmapped = unmapped; if( mapaddress ) { bp->loc.image_name = image_name; } if( symaddress ) { bp->image_name = image_name; bp->mod_name = mod_name; bp->sym_name = sym_name; bp->cue_diff = cue_diff; bp->addr_diff = addr_diff; } bp->cmds = cmds; if( cmds != NULL ) bp->status.b.use_cmds = true; bp->condition = condition; if( condition != NULL ) bp->status.b.use_condition = true; SetBPCountDown( bp, countdown ); bp->status.b.resume = resume; bp->status.b.active = active; if( index != 0 ) bp->index = index; RecordBreakEvent( bp, B_SET ); return( bp ); }
bool ScanStatus( void ) { return( ScanCmd( MiscTab ) == MISC_STATUS ); }