diff --git a/.gitattributes b/.gitattributes index ff9797fe01..2c57e78ed7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1247,6 +1247,7 @@ ide/fpcygwin.pas svneol=native#text/plain ide/fpdebug.pas svneol=native#text/plain ide/fpdesk.pas svneol=native#text/plain ide/fpdpansi.pas svneol=native#text/plain +ide/fpevalw.pas svneol=native#text/x-pascal ide/fphelp.pas svneol=native#text/plain ide/fpide.pas svneol=native#text/plain ide/fpini.pas svneol=native#text/plain diff --git a/ide/Makefile b/ide/Makefile index 011004050c..834c16bc86 100644 --- a/ide/Makefile +++ b/ide/Makefile @@ -2527,6 +2527,7 @@ buildfp: $(MAKE) fpc_all $(MAKE) postgdbinfo gdb: + $(MAKE) -C ../packages/base/gdbint $(MAKE) buildfp nogdb: $(MAKE) buildfp NOGDB=1 diff --git a/ide/Makefile.fpc b/ide/Makefile.fpc index 1a8e240066..7581056423 100644 --- a/ide/Makefile.fpc +++ b/ide/Makefile.fpc @@ -141,6 +141,7 @@ buildfp: $(MAKE) postgdbinfo gdb: + $(MAKE) -C ../packages/base/gdbint $(MAKE) buildfp nogdb: diff --git a/ide/fpdebug.pas b/ide/fpdebug.pas index 50b03d60bd..bd2b9d9e56 100644 --- a/ide/fpdebug.pas +++ b/ide/fpdebug.pas @@ -209,9 +209,9 @@ type procedure Force_new_value; destructor done;virtual; expr : pstring; + last_value,current_value : pchar; private GDBRunCount : longint; - last_value,current_value : pchar; end; PWatchesCollection = ^TWatchesCollection; diff --git a/ide/fpevalw.pas b/ide/fpevalw.pas new file mode 100644 index 0000000000..d6892c83b4 --- /dev/null +++ b/ide/fpevalw.pas @@ -0,0 +1,89 @@ +unit fpevalw; + +{****************************************************************************} + interface +{****************************************************************************} + +uses fpdebug,dialogs,views,objects,fpconst,drivers; + +type Pevaluate_dialog=^Tevaluate_dialog; + Tevaluate_dialog=object(Tdialog) + watch:Pwatch; + expr_input,expr_output:Pinputline; + constructor init(var bounds:Trect); + procedure evaluate; + procedure handleevent(var event:Tevent);virtual; + destructor done; + end; + +{****************************************************************************} + implementation +{****************************************************************************} + +constructor Tevaluate_dialog.init(var bounds:Trect); + +var r:Trect; + l:Plabel; + b:Pbutton; + +begin + inherited init(bounds,'Evaluate expression'); + options:=options or ofcentered; + {watch is auto initialized to nil.} + + r.assign(2,3,size.x-20,4); + new(expr_input,init(r,255)); + insert(expr_input); + + r.assign(2,2,size.x-20,3); + new(l,init(r,'E~x~pression:',expr_input)); + insert(l); + + r.assign(2,6,size.x-20,7); + new(expr_output,init(r,255)); + insert(expr_output); + + r.assign(2,5,size.x-20,6); + new(l,init(r,'~R~esult:',expr_output)); + insert(l); + + r.assign(size.x-14,3,size.x-3,5); + new(b,init(r,'~E~valuate',cmEvaluate,bfDefault)); + insert(b); + + r.assign(size.x-14,6,size.x-3,8); + new(b,init(r,'Help',cmHelp,bfNormal)); + insert(b); + + expr_input^.select; +end; + +procedure Tevaluate_dialog.evaluate; + +begin + if watch<>nil then + dispose(watch,done); + new(watch,init(expr_input^.data^)); + expr_output^.data^:=strpas(watch^.current_value); + expr_output^.drawview; +end; + +procedure Tevaluate_dialog.handleevent(var event:Tevent); + +begin + inherited handleevent(event); + if event.what=evCommand then + case event.command of + cmEvaluate: + evaluate; + end; +end; + +destructor Tevaluate_dialog.done; + +begin + if watch<>nil then + dispose(watch,done); +end; + +end. diff --git a/ide/fpide.pas b/ide/fpide.pas index 0f85478a96..53c0642876 100644 --- a/ide/fpide.pas +++ b/ide/fpide.pas @@ -21,7 +21,7 @@ uses Objects,Drivers,Views,App,Gadgets,MsgBox,Tabs, WEditor,WCEdit, Comphook,Browcol, - WHTMLScn, + WHTMLScn,fpevalw, FPViews,FPSymbol,fpstring; type @@ -92,6 +92,7 @@ type procedure DoShowBreakpointList; procedure DoShowWatches; procedure DoAddWatch; + procedure do_evaluate; procedure DoShowRegisters; procedure DoShowFPU; procedure DoShowVector; @@ -404,6 +405,7 @@ begin NewItem(menu_debug_watches,'', kbNoKey, cmWatches, hcWatchesWindow, NewItem(menu_debug_breakpoint,menu_key_debug_breakpoint, kbCtrlF8, cmToggleBreakpoint, hcToggleBreakpoint, NewItem(menu_debug_breakpointlist,'', kbNoKey, cmBreakpointList, hcBreakpointList, + NewItem('~E~valuate...','Ctrl+F4', kbCtrlF4, cmEvaluate, hcEvaluate, NewItem(menu_debug_callstack,menu_key_debug_callstack, kbCtrlF3, cmStack, hcStackWindow, NewLine( NewItem(menu_debug_disassemble,'', kbNoKey, cmDisassemble, hcStackWindow, @@ -416,7 +418,7 @@ begin {$ifdef SUPPORT_REMOTE} ) {$endif SUPPORT_REMOTE} - )))))))))))))))), + ))))))))))))))))), NewSubMenu(menu_tools, hcToolsMenu, NewMenu( NewItem(menu_tools_messages,menu_key_tools_messages, kbF11, cmToolsMessages, hcToolsMessages, NewItem(menu_tools_msgnext,menu_key_tools_msgnext, kbAltF8, cmToolsMsgNext, hcToolsMsgNext, @@ -765,6 +767,7 @@ begin cmRegisters : DoShowRegisters; cmFPURegisters : DoShowFPU; cmVectorRegisters : DoShowVector; + cmEvaluate : do_evaluate; { -- Options menu -- } cmSwitchesMode : SetSwitchesMode; cmCompiler : DoCompilerSwitch; diff --git a/ide/fpmdebug.inc b/ide/fpmdebug.inc index d9e501b096..05438397fe 100644 --- a/ide/fpmdebug.inc +++ b/ide/fpmdebug.inc @@ -254,5 +254,19 @@ begin else dispose(P,Done); end; + +procedure TIDEapp.do_evaluate; + +var d:Pevaluate_dialog; + r:Trect; + +begin + desktop^.getextent(r); + r.b.x:=r.b.x*3 div 4; + r.b.y:=12; + new(d,init(r)); + desktop^.execview(d); + dispose(d,done); +end; {$endif NODEBUG}