fpmdebug.inc 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. until Event.What=evKeyboard;
  41. Clear:=true;
  42. case Event.keycode of
  43. kbPgUp : UserScreen^.Scroll(-20);
  44. kbPgDn : UserScreen^.Scroll(20);
  45. kbUp : UserScreen^.Scroll(-1);
  46. kbDown : UserScreen^.Scroll(1);
  47. kbHome : UserScreen^.Scroll(-1024);
  48. kbEnd : UserScreen^.Scroll(+1024);
  49. else
  50. Clear:=false;
  51. end;
  52. if Clear then
  53. ClearEvent(Event);
  54. until Event.what=evKeyboard;
  55. while (Keyboard.PollKeyEvent<>0) do
  56. Keyboard.GetKeyEvent;
  57. DoneKeyboard;
  58. ShowIDEScreen;
  59. end;
  60. procedure TIDEApp.DoShowCallStack;
  61. begin
  62. {$ifdef NODEBUG}
  63. NoDebugger;
  64. {$else}
  65. If not assigned(StackWindow) then
  66. InitStackWindow
  67. else
  68. StackWindow^.MakeFirst;
  69. {$endif NODEBUG}
  70. end;
  71. procedure TIDEApp.DoShowRegisters;
  72. begin
  73. {$ifdef NODEBUG}
  74. NoDebugger;
  75. {$else}
  76. If not assigned(RegistersWindow) then
  77. InitRegistersWindow
  78. else
  79. RegistersWindow^.MakeFirst;
  80. {$endif NODEBUG}
  81. end;
  82. procedure TIDEApp.DoShowFPU;
  83. begin
  84. {$ifdef NODEBUG}
  85. NoDebugger;
  86. {$else}
  87. If not assigned(FPUWindow) then
  88. InitFPUWindow
  89. else
  90. FPUWindow^.MakeFirst;
  91. {$endif NODEBUG}
  92. end;
  93. procedure TIDEApp.DoShowBreakpointList;
  94. begin
  95. {$ifdef NODEBUG}
  96. NoDebugger;
  97. {$else}
  98. If assigned(BreakpointsWindow) then
  99. begin
  100. BreakpointsWindow^.Update;
  101. BreakpointsWindow^.Show;
  102. BreakpointsWindow^.MakeFirst;
  103. end
  104. else
  105. begin
  106. New(BreakpointsWindow,Init);
  107. Desktop^.Insert(BreakpointsWindow);
  108. end;
  109. {$endif NODEBUG}
  110. end;
  111. procedure TIDEApp.DoShowWatches;
  112. begin
  113. {$ifdef NODEBUG}
  114. NoDebugger;
  115. {$else}
  116. If assigned(WatchesWindow) then
  117. begin
  118. WatchesWindow^.Update;
  119. WatchesWindow^.MakeFirst;
  120. end
  121. else
  122. begin
  123. New(WatchesWindow,Init);
  124. Desktop^.Insert(WatchesWindow);
  125. end;
  126. {$endif NODEBUG}
  127. end;
  128. procedure TIDEApp.DoAddWatch;
  129. {$ifdef NODEBUG}
  130. begin
  131. NoDebugger;
  132. end;
  133. {$else}
  134. var
  135. P: PWatch;
  136. EditorWindow : PSourceWindow;
  137. EditorWasFirst : boolean;
  138. S : string;
  139. begin
  140. EditorWindow:=FirstEditorWindow;
  141. { Leave the editor first, but only if there was already an WatchesWindow }
  142. EditorWasFirst:=(PWindow(Desktop^.First)=PWindow(EditorWindow)) and
  143. assigned(WatchesWindow);
  144. If assigned(EditorWindow) then
  145. S:=LowerCaseStr(EditorWindow^.Editor^.GetCurrentWord)
  146. else
  147. S:='';
  148. P:=New(PWatch,Init(S));
  149. if ExecuteDialog(New(PWatchItemDialog,Init(P)),nil)<>cmCancel then
  150. begin
  151. WatchesCollection^.Insert(P);
  152. WatchesCollection^.Update;
  153. DoShowWatches;
  154. if EditorWasFirst then
  155. EditorWindow^.MakeFirst;
  156. end
  157. else
  158. dispose(P,Done);
  159. end;
  160. {$endif NODEBUG}
  161. {
  162. $Log$
  163. Revision 1.1 2001-08-04 11:30:23 peter
  164. * ide works now with both compiler versions
  165. Revision 1.1.2.3 2001/06/13 16:15:36 pierre
  166. * avoid crash if GDB gives an error while run is executed
  167. Revision 1.1.2.2 2001/03/09 15:06:27 pierre
  168. + DoShowFPU procedure
  169. Revision 1.1.2.1 2001/01/07 22:36:56 peter
  170. * Ctrl-F7 will stay in the editor if the watch window was already
  171. open
  172. Revision 1.1 2000/07/13 09:48:35 michael
  173. + Initial import
  174. Revision 1.13 2000/05/17 10:17:49 pierre
  175. * Reinit the keyboard in ShowUserScreen
  176. Revision 1.12 2000/05/02 08:42:28 pierre
  177. * new set of Gabor changes: see fixes.txt
  178. Revision 1.11 2000/02/04 00:13:59 pierre
  179. * AddWatch calls DoShowWatches
  180. Revision 1.10 2000/01/08 18:26:20 florian
  181. + added a register window, doesn't work yet
  182. Revision 1.9 1999/09/22 16:18:19 pierre
  183. + TIDEApp.DoCloseUserScreenWindow
  184. Revision 1.8 1999/09/09 14:20:05 pierre
  185. + Stack Window
  186. Revision 1.7 1999/07/28 23:11:19 peter
  187. * fixes from gabor
  188. Revision 1.6 1999/07/10 01:24:19 pierre
  189. + First implementation of watches window
  190. Revision 1.5 1999/06/30 23:58:17 pierre
  191. + BreakpointsList Window implemented
  192. with Edit/New/Delete functions
  193. + Individual breakpoint dialog with support for all types
  194. ignorecount and conditions
  195. (commands are not yet implemented, don't know if this wolud be useful)
  196. awatch and rwatch have problems because GDB does not annotate them
  197. I fixed v4.16 for this
  198. Revision 1.4 1999/06/25 00:36:51 pierre
  199. + missing Debug menu added (not implemented yet)
  200. Revision 1.3 1999/02/02 16:41:40 peter
  201. + automatic .pas/.pp adding by opening of file
  202. * better debuggerscreen changes
  203. Revision 1.2 1999/01/21 11:54:16 peter
  204. + tools menu
  205. + speedsearch in symbolbrowser
  206. * working run command
  207. Revision 1.1 1998/12/28 15:47:47 peter
  208. + Added user screen support, display & window
  209. + Implemented Editor,Mouse Options dialog
  210. + Added location of .INI and .CFG file
  211. + Option (INI) file managment implemented (see bottom of Options Menu)
  212. + Switches updated
  213. + Run program
  214. }