fpmdebug.inc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Debug menu entries
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. procedure TIDEApp.DoUserScreenWindow;
  13. begin
  14. if UserScreenWindow=nil then
  15. begin
  16. New(UserScreenWindow, Init(UserScreen, SearchFreeWindowNo));
  17. Desktop^.Insert(UserScreenWindow);
  18. end;
  19. UserScreenWindow^.MakeFirst;
  20. end;
  21. procedure TIDEApp.DoCloseUserScreenWindow;
  22. begin
  23. if Assigned(UserScreenWindow) then
  24. Message(UserScreenWindow,evCommand,cmClose,nil);
  25. end;
  26. procedure TIDEApp.DoUserScreen;
  27. var Event : TEvent;
  28. Clear : Boolean;
  29. begin
  30. if UserScreen=nil then
  31. begin
  32. ErrorBox(msg_userscreennotavailable,nil);
  33. Exit;
  34. end;
  35. ShowUserScreen;
  36. InitKeyBoard;
  37. repeat
  38. repeat
  39. Drivers.GetKeyEvent(Event);
  40. if Event.What=evNothing then
  41. GiveUpTimeSlice;
  42. until Event.What=evKeyboard;
  43. Clear:=true;
  44. case Event.keycode of
  45. kbPgUp : UserScreen^.Scroll(-20);
  46. kbPgDn : UserScreen^.Scroll(20);
  47. kbUp : UserScreen^.Scroll(-1);
  48. kbDown : UserScreen^.Scroll(1);
  49. kbHome : UserScreen^.Scroll(-1024);
  50. kbEnd : UserScreen^.Scroll(+1024);
  51. else
  52. Clear:=false;
  53. end;
  54. if Clear then
  55. ClearEvent(Event);
  56. until Event.what=evKeyboard;
  57. while (Keyboard.PollKeyEvent<>0) do
  58. Keyboard.GetKeyEvent;
  59. DoneKeyboard;
  60. ShowIDEScreen;
  61. end;
  62. procedure TIDEApp.DoShowCallStack;
  63. begin
  64. {$ifdef NODEBUG}
  65. NoDebugger;
  66. {$else}
  67. If not assigned(StackWindow) then
  68. InitStackWindow
  69. else
  70. StackWindow^.MakeFirst;
  71. {$endif NODEBUG}
  72. end;
  73. procedure TIDEApp.DoShowRegisters;
  74. begin
  75. {$ifdef NODEBUG}
  76. NoDebugger;
  77. {$else}
  78. If not assigned(RegistersWindow) then
  79. InitRegistersWindow
  80. else
  81. RegistersWindow^.MakeFirst;
  82. {$endif NODEBUG}
  83. end;
  84. procedure TIDEApp.DoShowFPU;
  85. begin
  86. {$ifdef NODEBUG}
  87. NoDebugger;
  88. {$else}
  89. If not assigned(FPUWindow) then
  90. InitFPUWindow
  91. else
  92. FPUWindow^.MakeFirst;
  93. {$endif NODEBUG}
  94. end;
  95. procedure TIDEApp.DoShowBreakpointList;
  96. begin
  97. {$ifdef NODEBUG}
  98. NoDebugger;
  99. {$else}
  100. If assigned(BreakpointsWindow) then
  101. begin
  102. BreakpointsWindow^.Update;
  103. BreakpointsWindow^.Show;
  104. BreakpointsWindow^.MakeFirst;
  105. end
  106. else
  107. begin
  108. New(BreakpointsWindow,Init);
  109. Desktop^.Insert(BreakpointsWindow);
  110. end;
  111. {$endif NODEBUG}
  112. end;
  113. procedure TIDEApp.DoShowWatches;
  114. begin
  115. {$ifdef NODEBUG}
  116. NoDebugger;
  117. {$else}
  118. If assigned(WatchesWindow) then
  119. begin
  120. WatchesWindow^.Update;
  121. WatchesWindow^.MakeFirst;
  122. end
  123. else
  124. begin
  125. New(WatchesWindow,Init);
  126. Desktop^.Insert(WatchesWindow);
  127. end;
  128. {$endif NODEBUG}
  129. end;
  130. procedure TIDEApp.DoAddWatch;
  131. {$ifdef NODEBUG}
  132. begin
  133. NoDebugger;
  134. end;
  135. {$else}
  136. var
  137. P: PWatch;
  138. EditorWindow : PSourceWindow;
  139. EditorWasFirst : boolean;
  140. S : string;
  141. begin
  142. EditorWindow:=FirstEditorWindow;
  143. { Leave the editor first, but only if there was already an WatchesWindow }
  144. EditorWasFirst:=(PWindow(Desktop^.First)=PWindow(EditorWindow)) and
  145. assigned(WatchesWindow);
  146. If assigned(EditorWindow) then
  147. S:={LowerCaseStr(}EditorWindow^.Editor^.GetCurrentWord
  148. else
  149. S:='';
  150. P:=New(PWatch,Init(S));
  151. if ExecuteDialog(New(PWatchItemDialog,Init(P)),nil)<>cmCancel then
  152. begin
  153. WatchesCollection^.Insert(P);
  154. WatchesCollection^.Update;
  155. DoShowWatches;
  156. if EditorWasFirst then
  157. EditorWindow^.MakeFirst;
  158. end
  159. else
  160. dispose(P,Done);
  161. end;
  162. {$endif NODEBUG}
  163. {
  164. $Log$
  165. Revision 1.4 2002-09-07 15:40:43 peter
  166. * old logs removed and tabs fixed
  167. Revision 1.3 2002/09/03 13:59:09 pierre
  168. * don't use LowerCaseStr for AddWatch as it confuses line completion
  169. Revision 1.2 2002/09/02 09:27:35 pierre
  170. * avoid 100 CPU usage when AltF5 is used
  171. }