fpmdebug.inc 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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.3 2002-09-03 13:59:09 pierre
  166. * don't use LowerCaseStr for AddWatch as it confuses line completion
  167. Revision 1.2 2002/09/02 09:27:35 pierre
  168. * avoid 100 CPU usage when AltF5 is used
  169. Revision 1.1 2001/08/04 11:30:23 peter
  170. * ide works now with both compiler versions
  171. Revision 1.1.2.3 2001/06/13 16:15:36 pierre
  172. * avoid crash if GDB gives an error while run is executed
  173. Revision 1.1.2.2 2001/03/09 15:06:27 pierre
  174. + DoShowFPU procedure
  175. Revision 1.1.2.1 2001/01/07 22:36:56 peter
  176. * Ctrl-F7 will stay in the editor if the watch window was already
  177. open
  178. Revision 1.1 2000/07/13 09:48:35 michael
  179. + Initial import
  180. Revision 1.13 2000/05/17 10:17:49 pierre
  181. * Reinit the keyboard in ShowUserScreen
  182. Revision 1.12 2000/05/02 08:42:28 pierre
  183. * new set of Gabor changes: see fixes.txt
  184. Revision 1.11 2000/02/04 00:13:59 pierre
  185. * AddWatch calls DoShowWatches
  186. Revision 1.10 2000/01/08 18:26:20 florian
  187. + added a register window, doesn't work yet
  188. Revision 1.9 1999/09/22 16:18:19 pierre
  189. + TIDEApp.DoCloseUserScreenWindow
  190. Revision 1.8 1999/09/09 14:20:05 pierre
  191. + Stack Window
  192. Revision 1.7 1999/07/28 23:11:19 peter
  193. * fixes from gabor
  194. Revision 1.6 1999/07/10 01:24:19 pierre
  195. + First implementation of watches window
  196. Revision 1.5 1999/06/30 23:58:17 pierre
  197. + BreakpointsList Window implemented
  198. with Edit/New/Delete functions
  199. + Individual breakpoint dialog with support for all types
  200. ignorecount and conditions
  201. (commands are not yet implemented, don't know if this wolud be useful)
  202. awatch and rwatch have problems because GDB does not annotate them
  203. I fixed v4.16 for this
  204. Revision 1.4 1999/06/25 00:36:51 pierre
  205. + missing Debug menu added (not implemented yet)
  206. Revision 1.3 1999/02/02 16:41:40 peter
  207. + automatic .pas/.pp adding by opening of file
  208. * better debuggerscreen changes
  209. Revision 1.2 1999/01/21 11:54:16 peter
  210. + tools menu
  211. + speedsearch in symbolbrowser
  212. * working run command
  213. Revision 1.1 1998/12/28 15:47:47 peter
  214. + Added user screen support, display & window
  215. + Implemented Editor,Mouse Options dialog
  216. + Added location of .INI and .CFG file
  217. + Option (INI) file managment implemented (see bottom of Options Menu)
  218. + Switches updated
  219. + Run program
  220. }