fpdebug.pas 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Debugger call routines for the IDE
  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. unit FPDebug;
  13. interface
  14. uses
  15. Objects,Dialogs,Drivers,Views,
  16. GDBCon,GDBInt,Menus,
  17. WViews,
  18. FPViews;
  19. type
  20. PDebugController=^TDebugController;
  21. TDebugController=object(TGDBController)
  22. InvalidSourceLine : boolean;
  23. LastFileName : string;
  24. LastSource : PView; {PsourceWindow !! }
  25. HiddenStepsCount : longint;
  26. constructor Init(const exefn:string);
  27. destructor Done;
  28. procedure DoSelectSourceline(const fn:string;line:longint);virtual;
  29. { procedure DoStartSession;virtual;
  30. procedure DoBreakSession;virtual;}
  31. procedure DoEndSession(code:longint);virtual;
  32. procedure AnnotateError;
  33. procedure InsertBreakpoints;
  34. procedure RemoveBreakpoints;
  35. procedure ReadWatches;
  36. procedure ResetBreakpointsValues;
  37. procedure DoDebuggerScreen;virtual;
  38. procedure DoUserScreen;virtual;
  39. procedure Reset;virtual;
  40. procedure Run;virtual;
  41. procedure Continue;virtual;
  42. procedure UntilReturn;virtual;
  43. procedure CommandBegin(const s:string);virtual;
  44. procedure CommandEnd(const s:string);virtual;
  45. function AllowQuit : boolean;virtual;
  46. end;
  47. BreakpointType = (bt_function,bt_file_line,bt_watch,bt_awatch,bt_rwatch,bt_invalid);
  48. BreakpointState = (bs_enabled,bs_disabled,bs_deleted);
  49. PBreakpointCollection=^TBreakpointCollection;
  50. PBreakpoint=^TBreakpoint;
  51. TBreakpoint=object(TObject)
  52. typ : BreakpointType;
  53. state : BreakpointState;
  54. owner : PBreakpointCollection;
  55. Name : PString; { either function name or expr to watch }
  56. FileName : PString;
  57. OldValue,CurrentValue : Pstring;
  58. Line : Longint; { only used for bt_file_line type }
  59. Conditions : PString; { conditions relative to that breakpoint }
  60. IgnoreCount : Longint; { how many counts should be ignored }
  61. Commands : pchar; { commands that should be executed on breakpoint }
  62. GDBIndex : longint;
  63. GDBState : BreakpointState;
  64. constructor Init_function(Const AFunc : String);
  65. constructor Init_Empty;
  66. constructor Init_file_line(AFile : String; ALine : longint);
  67. constructor Init_type(atyp : BreakpointType;Const AnExpr : String);
  68. constructor Load(var S: TStream);
  69. procedure Store(var S: TStream);
  70. procedure Insert;
  71. procedure Remove;
  72. procedure Enable;
  73. procedure Disable;
  74. procedure ResetValues;
  75. destructor Done;virtual;
  76. end;
  77. TBreakpointCollection=object(TCollection)
  78. function At(Index: Integer): PBreakpoint;
  79. function GetGDB(index : longint) : PBreakpoint;
  80. function GetType(typ : BreakpointType;Const s : String) : PBreakpoint;
  81. function ToggleFileLine(Const FileName: String;LineNr : Longint) : boolean;
  82. procedure Update;
  83. procedure ShowBreakpoints(W : PSourceWindow);
  84. end;
  85. PBreakpointItem = ^TBreakpointItem;
  86. TBreakpointItem = object(TObject)
  87. Breakpoint : PBreakpoint;
  88. constructor Init(ABreakpoint : PBreakpoint);
  89. function GetText(MaxLen: Sw_integer): string; virtual;
  90. procedure Selected; virtual;
  91. function GetModuleName: string; virtual;
  92. end;
  93. PBreakpointsListBox = ^TBreakpointsListBox;
  94. TBreakpointsListBox = object(THSListBox)
  95. Transparent : boolean;
  96. NoSelection : boolean;
  97. MaxWidth : Sw_integer;
  98. (* ModuleNames : PStoreCollection; *)
  99. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  100. procedure AddBreakpoint(P: PBreakpointItem); virtual;
  101. function GetText(Item,MaxLen: Sw_Integer): String; virtual;
  102. function GetLocalMenu: PMenu;virtual;
  103. procedure Clear; virtual;
  104. procedure TrackSource; virtual;
  105. procedure EditNew; virtual;
  106. procedure EditCurrent; virtual;
  107. procedure DeleteCurrent; virtual;
  108. procedure ToggleCurrent;
  109. procedure Draw; virtual;
  110. procedure HandleEvent(var Event: TEvent); virtual;
  111. constructor Load(var S: TStream);
  112. procedure Store(var S: TStream);
  113. destructor Done; virtual;
  114. end;
  115. PBreakpointsWindow = ^TBreakpointsWindow;
  116. TBreakpointsWindow = object(TDlgWindow)
  117. BreakLB : PBreakpointsListBox;
  118. constructor Init;
  119. procedure AddBreakpoint(ABreakpoint : PBreakpoint);
  120. procedure ClearBreakpoints;
  121. procedure ReloadBreakpoints;
  122. procedure Close; virtual;
  123. procedure SizeLimits(var Min, Max: TPoint);virtual;
  124. procedure HandleEvent(var Event: TEvent); virtual;
  125. procedure Update; virtual;
  126. constructor Load(var S: TStream);
  127. procedure Store(var S: TStream);
  128. destructor Done; virtual;
  129. end;
  130. PBreakpointItemDialog = ^TBreakpointItemDialog;
  131. TBreakpointItemDialog = object(TCenterDialog)
  132. constructor Init(ABreakpoint: PBreakpoint);
  133. function Execute: Word; virtual;
  134. private
  135. Breakpoint : PBreakpoint;
  136. TypeRB : PRadioButtons;
  137. NameIL : PInputLine;
  138. ConditionsIL: PInputLine;
  139. LineIL : PInputLine;
  140. IgnoreIL : PInputLine;
  141. end;
  142. PWatch = ^TWatch;
  143. TWatch = Object(TObject)
  144. constructor Init(s : string);
  145. constructor Load(var S: TStream);
  146. procedure Store(var S: TStream);
  147. procedure rename(s : string);
  148. procedure Get_new_value;
  149. destructor done;virtual;
  150. private
  151. expr : pstring;
  152. last_value,current_value : pchar;
  153. end;
  154. PWatchesCollection = ^TWatchesCollection;
  155. TWatchesCollection = Object(TCollection)
  156. constructor Init;
  157. procedure Insert(Item: Pointer); virtual;
  158. function At(Index: Integer): PWatch;
  159. procedure Update;
  160. private
  161. MaxW : integer;
  162. end;
  163. PWatchesListBox = ^TWatchesListBox;
  164. TWatchesListBox = object(THSListBox)
  165. Transparent : boolean;
  166. MaxWidth : Sw_integer;
  167. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  168. (* procedure AddWatch(P: PWatch); virtual; *)
  169. procedure Update(AMaxWidth : integer);
  170. function GetIndentedText(Item,Indent,MaxLen: Sw_Integer): String; virtual;
  171. function GetLocalMenu: PMenu;virtual;
  172. (* procedure Clear; virtual;
  173. procedure TrackSource; virtual;*)
  174. procedure EditNew; virtual;
  175. procedure EditCurrent; virtual;
  176. procedure DeleteCurrent; virtual;
  177. (*procedure ToggleCurrent; *)
  178. procedure Draw; virtual;
  179. procedure HandleEvent(var Event: TEvent); virtual;
  180. constructor Load(var S: TStream);
  181. procedure Store(var S: TStream);
  182. destructor Done; virtual;
  183. end;
  184. PWatchItemDialog = ^TWatchItemDialog;
  185. TWatchItemDialog = object(TCenterDialog)
  186. constructor Init(AWatch: PWatch);
  187. function Execute: Word; virtual;
  188. private
  189. Watch : PWatch;
  190. NameIL : PInputLine;
  191. TextST : PAdvancedStaticText;
  192. end;
  193. PWatchesWindow = ^TWatchesWindow;
  194. TWatchesWindow = Object(TDlgWindow)
  195. WLB : PWatchesListBox;
  196. Constructor Init;
  197. constructor Load(var S: TStream);
  198. procedure Store(var S: TStream);
  199. procedure Update; virtual;
  200. destructor Done; virtual;
  201. end;
  202. PFramesListBox = ^TFramesListBox;
  203. TFramesListBox = object(TMessageListBox)
  204. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  205. procedure Update;
  206. function GetLocalMenu: PMenu;virtual;
  207. procedure GotoSource; virtual;
  208. procedure HandleEvent(var Event: TEvent); virtual;
  209. destructor Done; virtual;
  210. end;
  211. PStackWindow = ^TStackWindow;
  212. TStackWindow = Object(TDlgWindow)
  213. FLB : PFramesListBox;
  214. Constructor Init;
  215. constructor Load(var S: TStream);
  216. procedure Store(var S: TStream);
  217. procedure Update; virtual;
  218. destructor Done; virtual;
  219. end;
  220. const
  221. StackWindow : PStackWindow = nil;
  222. procedure InitStackWindow;
  223. procedure DoneStackWindow;
  224. const
  225. BreakpointTypeStr : Array[BreakpointType] of String[9]
  226. = ( 'function','file-line','watch','awatch','rwatch','invalid' );
  227. BreakpointStateStr : Array[BreakpointState] of String[8]
  228. = ( 'enabled','disabled','invalid' );
  229. var
  230. Debugger : PDebugController;
  231. BreakpointsCollection : PBreakpointCollection;
  232. WatchesCollection : PwatchesCollection;
  233. procedure InitDebugger;
  234. procedure DoneDebugger;
  235. procedure InitGDBWindow;
  236. procedure DoneGDBWindow;
  237. procedure InitBreakpoints;
  238. procedure DoneBreakpoints;
  239. procedure InitWatches;
  240. procedure DoneWatches;
  241. procedure RegisterFPDebugViews;
  242. implementation
  243. uses
  244. Dos,Mouse,Video,
  245. App,Commands,Strings,
  246. FPVars,FPUtils,FPConst,
  247. FPIntf,FPCompile,FPIde,
  248. Validate,WEditor,WUtils;
  249. const
  250. RBreakpointsWindow: TStreamRec = (
  251. ObjType: 1701;
  252. VmtLink: Ofs(TypeOf(TBreakpointsWindow)^);
  253. Load: @TBreakpointsWindow.Load;
  254. Store: @TBreakpointsWindow.Store
  255. );
  256. RBreakpointsListBox : TStreamRec = (
  257. ObjType: 1702;
  258. VmtLink: Ofs(TypeOf(TBreakpointsListBox)^);
  259. Load: @TBreakpointsListBox.Load;
  260. Store: @TBreakpointsListBox.Store
  261. );
  262. RWatchesWindow: TStreamRec = (
  263. ObjType: 1703;
  264. VmtLink: Ofs(TypeOf(TWatchesWindow)^);
  265. Load: @TWatchesWindow.Load;
  266. Store: @TWatchesWindow.Store
  267. );
  268. RWatchesListBox: TStreamRec = (
  269. ObjType: 1704;
  270. VmtLink: Ofs(TypeOf(TWatchesListBox)^);
  271. Load: @TWatchesListBox.Load;
  272. Store: @TWatchesListBox.Store
  273. );
  274. RStackWindow: TStreamRec = (
  275. ObjType: 1705;
  276. VmtLink: Ofs(TypeOf(TStackWindow)^);
  277. Load: @TStackWindow.Load;
  278. Store: @TStackWindow.Store
  279. );
  280. RFramesListBox: TStreamRec = (
  281. ObjType: 1706;
  282. VmtLink: Ofs(TypeOf(TFramesListBox)^);
  283. Load: @TFramesListBox.Load;
  284. Store: @TFramesListBox.Store
  285. );
  286. RBreakpoint: TStreamRec = (
  287. ObjType: 1707;
  288. VmtLink: Ofs(TypeOf(TBreakpoint)^);
  289. Load: @TBreakpoint.Load;
  290. Store: @TBreakpoint.Store
  291. );
  292. RWatch: TStreamRec = (
  293. ObjType: 1708;
  294. VmtLink: Ofs(TypeOf(TWatch)^);
  295. Load: @TWatch.Load;
  296. Store: @TWatch.Store
  297. );
  298. RBreakpointCollection: TStreamRec = (
  299. ObjType: 1709;
  300. VmtLink: Ofs(TypeOf(TBreakpointCollection)^);
  301. Load: @TBreakpointCollection.Load;
  302. Store: @TBreakpointCollection.Store
  303. );
  304. RWatchesCollection: TStreamRec = (
  305. ObjType: 1710;
  306. VmtLink: Ofs(TypeOf(TWatchesCollection)^);
  307. Load: @TWatchesCollection.Load;
  308. Store: @TWatchesCollection.Store
  309. );
  310. {****************************************************************************
  311. TDebugController
  312. ****************************************************************************}
  313. constructor TDebugController.Init(const exefn:string);
  314. var f: string;
  315. begin
  316. inherited Init;
  317. f := exefn;
  318. LoadFile(f);
  319. SetArgs(GetRunParameters);
  320. Debugger:=@self;
  321. {$ifndef GABOR}
  322. switch_to_user:=true;
  323. {$endif}
  324. InsertBreakpoints;
  325. ReadWatches;
  326. end;
  327. procedure TDebugController.InsertBreakpoints;
  328. procedure DoInsert(PB : PBreakpoint);
  329. begin
  330. PB^.Insert;
  331. end;
  332. begin
  333. BreakpointsCollection^.ForEach(@DoInsert);
  334. end;
  335. procedure TDebugController.ReadWatches;
  336. procedure DoRead(PB : PWatch);
  337. begin
  338. PB^.Get_new_value;
  339. end;
  340. begin
  341. WatchesCollection^.ForEach(@DoRead);
  342. If Assigned(WatchesWindow) then
  343. WatchesWindow^.Update;
  344. end;
  345. procedure TDebugController.RemoveBreakpoints;
  346. procedure DoDelete(PB : PBreakpoint);
  347. begin
  348. PB^.Remove;
  349. end;
  350. begin
  351. BreakpointsCollection^.ForEach(@DoDelete);
  352. end;
  353. procedure TDebugController.ResetBreakpointsValues;
  354. procedure DoResetVal(PB : PBreakpoint);
  355. begin
  356. PB^.ResetValues;
  357. end;
  358. begin
  359. BreakpointsCollection^.ForEach(@DoResetVal);
  360. end;
  361. destructor TDebugController.Done;
  362. begin
  363. { kill the program if running }
  364. Reset;
  365. RemoveBreakpoints;
  366. inherited Done;
  367. end;
  368. procedure TDebugController.Run;
  369. begin
  370. ResetBreakpointsValues;
  371. inherited Run;
  372. MyApp.SetCmdState([cmResetDebugger,cmUntilReturn],true);
  373. If assigned(StackWindow) then
  374. StackWindow^.Update;
  375. end;
  376. procedure TDebugController.Continue;
  377. begin
  378. {$ifdef NODEBUG}
  379. NoDebugger;
  380. {$else}
  381. if not debuggee_started then
  382. Run
  383. else
  384. inherited Continue;
  385. If assigned(StackWindow) then
  386. StackWindow^.Update;
  387. {$endif NODEBUG}
  388. end;
  389. procedure TDebugController.UntilReturn;
  390. begin
  391. Command('finish');
  392. If assigned(StackWindow) then
  393. StackWindow^.Update;
  394. { We could try to get the return value !
  395. Not done yet }
  396. end;
  397. procedure TDebugController.CommandBegin(const s:string);
  398. begin
  399. if assigned(GDBWindow) and (in_command>1) then
  400. begin
  401. { We should do something special for errors !! }
  402. If StrLen(GetError)>0 then
  403. GDBWindow^.WriteErrorText(GetError);
  404. GDBWindow^.WriteOutputText(GetOutput);
  405. end;
  406. if assigned(GDBWindow) then
  407. GDBWindow^.WriteString(S);
  408. end;
  409. procedure TDebugController.CommandEnd(const s:string);
  410. begin
  411. if assigned(GDBWindow) and (in_command=0) then
  412. begin
  413. { We should do something special for errors !! }
  414. If StrLen(GetError)>0 then
  415. GDBWindow^.WriteErrorText(GetError);
  416. GDBWindow^.WriteOutputText(GetOutput);
  417. GDBWindow^.Editor^.TextEnd;
  418. end;
  419. end;
  420. function TDebugController.AllowQuit : boolean;
  421. begin
  422. if ConfirmBox('Really quit editor ?',nil,true)=cmOK then
  423. begin
  424. Message(@MyApp,evCommand,cmQuit,nil);
  425. end
  426. else
  427. AllowQuit:=false;
  428. end;
  429. procedure TDebugController.Reset;
  430. var
  431. W : PSourceWindow;
  432. procedure ResetDebugerRow(P: PView); {$ifndef FPC}far;{$endif}
  433. begin
  434. if assigned(P) and
  435. (TypeOf(P^)=TypeOf(TSourceWindow)) then
  436. Message(P,evCommand,cmResetDebuggerRow,nil);
  437. end;
  438. begin
  439. inherited Reset;
  440. MyApp.SetCmdState([cmResetDebugger,cmUntilReturn],false);
  441. W:=PSourceWindow(LastSource);
  442. if assigned(W) then
  443. W^.Editor^.SetDebuggerRow(-1);
  444. Desktop^.ForEach(@ResetDebugerRow);
  445. end;
  446. procedure TDebugController.AnnotateError;
  447. var errornb : longint;
  448. begin
  449. if error then
  450. begin
  451. errornb:=error_num;
  452. ReadWatches;
  453. If assigned(StackWindow) then
  454. StackWindow^.Update;
  455. ErrorBox(#3'Error within GDB'#13#3'Error code = %d',@errornb);
  456. end;
  457. end;
  458. procedure TDebugController.DoSelectSourceLine(const fn:string;line:longint);
  459. var
  460. W: PSourceWindow;
  461. Found : boolean;
  462. PB : PBreakpoint;
  463. S : String;
  464. BreakIndex : longint;
  465. begin
  466. BreakIndex:=stop_breakpoint_number;
  467. Desktop^.Lock;
  468. { 0 based line count in Editor }
  469. if Line>0 then
  470. dec(Line);
  471. if (fn=LastFileName) then
  472. begin
  473. W:=PSourceWindow(LastSource);
  474. if assigned(W) then
  475. begin
  476. W^.Editor^.SetCurPtr(0,Line);
  477. W^.Editor^.TrackCursor(true);
  478. W^.Editor^.SetDebuggerRow(Line);
  479. ReadWatches;
  480. If assigned(StackWindow) then
  481. StackWindow^.Update;
  482. if Not assigned(GDBWindow) or not GDBWindow^.GetState(sfActive) then
  483. W^.Select;
  484. InvalidSourceLine:=false;
  485. end
  486. else
  487. InvalidSourceLine:=true;
  488. end
  489. else
  490. begin
  491. W:=TryToOpenFile(nil,fn,0,Line,false);
  492. if assigned(W) then
  493. begin
  494. W^.Editor^.SetDebuggerRow(Line);
  495. W^.Editor^.TrackCursor(true);
  496. If assigned(StackWindow) then
  497. StackWindow^.Update;
  498. ReadWatches;
  499. if Not assigned(GDBWindow) or not GDBWindow^.GetState(sfActive) then
  500. W^.Select;
  501. LastSource:=W;
  502. InvalidSourceLine:=false;
  503. end
  504. { only search a file once }
  505. else
  506. begin
  507. Desktop^.UnLock;
  508. Found:=MyApp.OpenSearch(fn);
  509. Desktop^.Lock;
  510. if not Found then
  511. begin
  512. InvalidSourceLine:=true;
  513. LastSource:=Nil;
  514. end
  515. else
  516. begin
  517. { should now be open }
  518. W:=TryToOpenFile(nil,fn,0,Line,true);
  519. W^.Editor^.SetDebuggerRow(Line);
  520. W^.Editor^.TrackCursor(true);
  521. ReadWatches;
  522. If assigned(StackWindow) then
  523. StackWindow^.Update;
  524. if Not assigned(GDBWindow) or not GDBWindow^.GetState(sfActive) then
  525. W^.Select;
  526. LastSource:=W;
  527. InvalidSourceLine:=false;
  528. end;
  529. end;
  530. end;
  531. LastFileName:=fn;
  532. Desktop^.UnLock;
  533. if BreakIndex>0 then
  534. begin
  535. PB:=BreakpointsCollection^.GetGDB(BreakIndex);
  536. { For watch we should get old and new value !! }
  537. if (Not assigned(GDBWindow) or not GDBWindow^.GetState(sfActive)) and
  538. (PB^.typ<>bt_file_line) and (PB^.typ<>bt_function) then
  539. begin
  540. Command('p '+GetStr(PB^.Name));
  541. S:=StrPas(GetOutput);
  542. got_error:=false;
  543. If Pos('=',S)>0 then
  544. S:=Copy(S,Pos('=',S)+1,255);
  545. If S[Length(S)]=#10 then
  546. Delete(S,Length(S),1);
  547. if Assigned(PB^.OldValue) then
  548. DisposeStr(PB^.OldValue);
  549. PB^.OldValue:=PB^.CurrentValue;
  550. PB^.CurrentValue:=NewStr(S);
  551. If PB^.typ=bt_function then
  552. WarningBox(#3'GDB stopped due to'#13+
  553. #3+BreakpointTypeStr[PB^.typ]+' '+GetStr(PB^.Name),nil)
  554. else if (GetStr(PB^.OldValue)<>S) then
  555. WarningBox(#3'GDB stopped due to'#13+
  556. #3+BreakpointTypeStr[PB^.typ]+' '+GetStr(PB^.Name)+#13+
  557. #3+'Old value = '+GetStr(PB^.OldValue)+#13+
  558. #3+'New value = '+GetStr(PB^.CurrentValue),nil)
  559. else
  560. WarningBox(#3'GDB stopped due to'#13+
  561. #3+BreakpointTypeStr[PB^.typ]+' '+GetStr(PB^.Name)+#13+
  562. #3+' value = '+GetStr(PB^.CurrentValue),nil);
  563. end;
  564. end;
  565. end;
  566. procedure TDebugController.DoEndSession(code:longint);
  567. var P :Array[1..2] of longint;
  568. W : PSourceWindow;
  569. begin
  570. MyApp.SetCmdState([cmResetDebugger],false);
  571. W:=PSourceWindow(LastSource);
  572. if assigned(W) then
  573. W^.Editor^.SetDebuggerRow(-1);
  574. If HiddenStepsCount=0 then
  575. InformationBox(#3'Program exited with '#13#3'exitcode = %d',@code)
  576. else
  577. begin
  578. P[1]:=code;
  579. P[2]:=HiddenStepsCount;
  580. WarningBox(#3'Program exited with '#13+
  581. #3'exitcode = %d'#13+
  582. #3'hidden steps = %d',@P);
  583. end;
  584. end;
  585. procedure TDebugController.DoDebuggerScreen;
  586. begin
  587. MyApp.ShowIDEScreen;
  588. end;
  589. procedure TDebugController.DoUserScreen;
  590. begin
  591. MyApp.ShowUserScreen;
  592. end;
  593. {****************************************************************************
  594. TBreakpoint
  595. ****************************************************************************}
  596. constructor TBreakpoint.Init_function(Const AFunc : String);
  597. begin
  598. typ:=bt_function;
  599. state:=bs_enabled;
  600. GDBState:=bs_deleted;
  601. Name:=NewStr(AFunc);
  602. FileName:=nil;
  603. Line:=0;
  604. IgnoreCount:=0;
  605. Commands:=nil;
  606. Conditions:=nil;
  607. OldValue:=nil;
  608. CurrentValue:=nil;
  609. end;
  610. constructor TBreakpoint.Init_Empty;
  611. begin
  612. typ:=bt_function;
  613. state:=bs_enabled;
  614. GDBState:=bs_deleted;
  615. Name:=Nil;
  616. FileName:=nil;
  617. Line:=0;
  618. IgnoreCount:=0;
  619. Commands:=nil;
  620. Conditions:=nil;
  621. OldValue:=nil;
  622. CurrentValue:=nil;
  623. end;
  624. constructor TBreakpoint.Init_type(atyp : BreakpointType;Const AnExpr : String);
  625. begin
  626. typ:=atyp;
  627. state:=bs_enabled;
  628. GDBState:=bs_deleted;
  629. Name:=NewStr(AnExpr);
  630. IgnoreCount:=0;
  631. Commands:=nil;
  632. Conditions:=nil;
  633. OldValue:=nil;
  634. CurrentValue:=nil;
  635. end;
  636. constructor TBreakpoint.Init_file_line(AFile : String; ALine : longint);
  637. begin
  638. typ:=bt_file_line;
  639. state:=bs_enabled;
  640. GDBState:=bs_deleted;
  641. { d:test.pas:12 does not work !! }
  642. { I do not know how to solve this if
  643. if (Length(AFile)>1) and (AFile[2]=':') then
  644. AFile:=Copy(AFile,3,255);
  645. Only use base name for now !! PM }
  646. FileName:=NewStr(AFile);
  647. Name:=nil;
  648. Line:=ALine;
  649. IgnoreCount:=0;
  650. Commands:=nil;
  651. Conditions:=nil;
  652. OldValue:=nil;
  653. CurrentValue:=nil;
  654. end;
  655. constructor TBreakpoint.Load(var S: TStream);
  656. begin
  657. S.Read(typ,SizeOf(BreakpointType));
  658. S.Read(state,SizeOf(BreakpointState));
  659. GDBState:=bs_deleted;
  660. case typ of
  661. bt_file_line :
  662. begin
  663. FileName:=S.ReadStr;
  664. S.Read(Line,SizeOf(Line));
  665. Name:=nil;
  666. end;
  667. else
  668. begin
  669. Name:=S.ReadStr;
  670. Line:=0;
  671. FileName:=nil;
  672. end;
  673. end;
  674. S.Read(IgnoreCount,SizeOf(IgnoreCount));
  675. Commands:=S.StrRead;
  676. Conditions:=S.ReadStr;
  677. OldValue:=nil;
  678. CurrentValue:=nil;
  679. end;
  680. procedure TBreakpoint.Store(var S: TStream);
  681. begin
  682. S.Write(typ,SizeOf(BreakpointType));
  683. S.Write(state,SizeOf(BreakpointState));
  684. case typ of
  685. bt_file_line :
  686. begin
  687. S.WriteStr(FileName);
  688. S.Write(Line,SizeOf(Line));
  689. end;
  690. else
  691. begin
  692. S.WriteStr(Name);
  693. end;
  694. end;
  695. S.Write(IgnoreCount,SizeOf(IgnoreCount));
  696. S.StrWrite(Commands);
  697. S.WriteStr(Conditions);
  698. end;
  699. procedure TBreakpoint.Insert;
  700. begin
  701. If not assigned(Debugger) then Exit;
  702. Remove;
  703. Debugger^.last_breakpoint_number:=0;
  704. if (GDBState=bs_deleted) and (state=bs_enabled) then
  705. begin
  706. if (typ=bt_file_line) and assigned(FileName) then
  707. Debugger^.Command('break '+NameAndExtOf(FileName^)+':'+IntToStr(Line))
  708. else if (typ=bt_function) and assigned(name) then
  709. Debugger^.Command('break '+name^)
  710. else if (typ=bt_watch) and assigned(name) then
  711. Debugger^.Command('watch '+name^)
  712. else if (typ=bt_awatch) and assigned(name) then
  713. Debugger^.Command('awatch '+name^)
  714. else if (typ=bt_rwatch) and assigned(name) then
  715. Debugger^.Command('rwatch '+name^);
  716. if Debugger^.last_breakpoint_number<>0 then
  717. begin
  718. GDBIndex:=Debugger^.last_breakpoint_number;
  719. GDBState:=bs_enabled;
  720. Debugger^.Command('cond '+IntToStr(GDBIndex)+' '+GetStr(Conditions));
  721. Debugger^.Command('ignore '+IntToStr(GDBIndex)+' '+IntToStr(IgnoreCount));
  722. If Assigned(Commands) then
  723. begin
  724. {Commands are not handled yet }
  725. end;
  726. end
  727. else
  728. { Here there was a problem !! }
  729. begin
  730. GDBIndex:=0;
  731. ErrorBox(#3'Could not set Breakpoint'#13+
  732. #3+BreakpointTypeStr[typ]+' '+Name^,nil);
  733. state:=bs_disabled;
  734. end;
  735. end
  736. else if (GDBState=bs_disabled) and (state=bs_enabled) then
  737. Enable
  738. else if (GDBState=bs_enabled) and (state=bs_disabled) then
  739. Disable;
  740. end;
  741. procedure TBreakpoint.Remove;
  742. begin
  743. If not assigned(Debugger) then Exit;
  744. if GDBIndex>0 then
  745. Debugger^.Command('delete '+IntToStr(GDBIndex));
  746. GDBIndex:=0;
  747. GDBState:=bs_deleted;
  748. end;
  749. procedure TBreakpoint.Enable;
  750. begin
  751. If not assigned(Debugger) then Exit;
  752. if GDBIndex>0 then
  753. Debugger^.Command('enable '+IntToStr(GDBIndex))
  754. else
  755. Insert;
  756. GDBState:=bs_enabled;
  757. end;
  758. procedure TBreakpoint.Disable;
  759. begin
  760. If not assigned(Debugger) then Exit;
  761. if GDBIndex>0 then
  762. Debugger^.Command('disable '+IntToStr(GDBIndex));
  763. GDBState:=bs_disabled;
  764. end;
  765. procedure TBreakpoint.ResetValues;
  766. begin
  767. if assigned(OldValue) then
  768. DisposeStr(OldValue);
  769. OldValue:=nil;
  770. if assigned(CurrentValue) then
  771. DisposeStr(CurrentValue);
  772. CurrentValue:=nil;
  773. end;
  774. destructor TBreakpoint.Done;
  775. begin
  776. Remove;
  777. ResetValues;
  778. if assigned(Name) then
  779. DisposeStr(Name);
  780. if assigned(FileName) then
  781. DisposeStr(FileName);
  782. if assigned(Conditions) then
  783. DisposeStr(Conditions);
  784. if assigned(Commands) then
  785. StrDispose(Commands);
  786. inherited Done;
  787. end;
  788. {****************************************************************************
  789. TBreakpointCollection
  790. ****************************************************************************}
  791. function TBreakpointCollection.At(Index: Integer): PBreakpoint;
  792. begin
  793. At:=inherited At(Index);
  794. end;
  795. procedure TBreakpointCollection.Update;
  796. begin
  797. if assigned(Debugger) then
  798. begin
  799. Debugger^.RemoveBreakpoints;
  800. Debugger^.InsertBreakpoints;
  801. end;
  802. if assigned(BreakpointsWindow) then
  803. BreakpointsWindow^.Update;
  804. end;
  805. function TBreakpointCollection.GetGDB(index : longint) : PBreakpoint;
  806. function IsNum(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
  807. begin
  808. IsNum:=P^.GDBIndex=index;
  809. end;
  810. begin
  811. if index=0 then
  812. GetGDB:=nil
  813. else
  814. GetGDB:=FirstThat(@IsNum);
  815. end;
  816. procedure TBreakpointCollection.ShowBreakpoints(W : PSourceWindow);
  817. procedure SetInSource(P : PBreakpoint);{$ifndef FPC}far;{$endif}
  818. begin
  819. If assigned(P^.FileName) and (P^.FileName^=W^.Editor^.FileName) then
  820. W^.Editor^.SetLineBreakState(P^.Line,P^.state=bs_enabled);
  821. end;
  822. begin
  823. ForEach(@SetInSource);
  824. end;
  825. function TBreakpointCollection.GetType(typ : BreakpointType;Const s : String) : PBreakpoint;
  826. function IsThis(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
  827. begin
  828. IsThis:=(P^.typ=typ) and (P^.Name^=S);
  829. end;
  830. begin
  831. GetType:=FirstThat(@IsThis);
  832. end;
  833. function TBreakpointCollection.ToggleFileLine(Const FileName: String;LineNr : Longint) : boolean;
  834. var PB : PBreakpoint;
  835. function IsThere(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
  836. begin
  837. IsThere:=(P^.typ=bt_file_line) and (P^.FileName^=FileName) and (P^.Line=LineNr);
  838. end;
  839. begin
  840. PB:=FirstThat(@IsThere);
  841. ToggleFileLine:=false;
  842. If Assigned(PB) then
  843. if PB^.state=bs_disabled then
  844. begin
  845. PB^.state:=bs_enabled;
  846. ToggleFileLine:=true;
  847. end
  848. else if PB^.state=bs_enabled then
  849. PB^.state:=bs_disabled;
  850. If not assigned(PB) then
  851. begin
  852. PB:= New(PBreakpoint,Init_file_line(FileName,LineNr));
  853. if assigned(PB) then
  854. Begin
  855. Insert(PB);
  856. ToggleFileLine:=true;
  857. End;
  858. end;
  859. Update;
  860. end;
  861. {****************************************************************************
  862. TBreakpointItem
  863. ****************************************************************************}
  864. constructor TBreakpointItem.Init(ABreakpoint : PBreakpoint);
  865. begin
  866. inherited Init;
  867. Breakpoint:=ABreakpoint;
  868. end;
  869. function TBreakpointItem.GetText(MaxLen: Sw_integer): string;
  870. var S: string;
  871. begin
  872. with Breakpoint^ do
  873. begin
  874. S:=BreakpointTypeStr[typ];
  875. While Length(S)<10 do
  876. S:=S+' ';
  877. S:=S+'|';
  878. S:=S+BreakpointStateStr[state]+' ';
  879. While Length(S)<20 do
  880. S:=S+' ';
  881. S:=S+'|';
  882. if (typ=bt_file_line) then
  883. S:=S+NameAndExtOf(GetStr(FileName))+':'+IntToStr(Line)
  884. else
  885. S:=S+GetStr(name);
  886. While Length(S)<40 do
  887. S:=S+' ';
  888. S:=S+'|';
  889. if IgnoreCount>0 then
  890. S:=S+IntToStr(IgnoreCount);
  891. While Length(S)<49 do
  892. S:=S+' ';
  893. S:=S+'|';
  894. if assigned(Conditions) then
  895. S:=S+' '+GetStr(Conditions);
  896. if length(S)>MaxLen then S:=copy(S,1,MaxLen-2)+'..';
  897. GetText:=S;
  898. end;
  899. end;
  900. procedure TBreakpointItem.Selected;
  901. begin
  902. end;
  903. function TBreakpointItem.GetModuleName: string;
  904. begin
  905. if breakpoint^.typ=bt_file_line then
  906. GetModuleName:=GetStr(breakpoint^.FileName)
  907. else
  908. GetModuleName:='';
  909. end;
  910. {****************************************************************************
  911. TBreakpointsListBox
  912. ****************************************************************************}
  913. constructor TBreakpointsListBox.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  914. begin
  915. inherited Init(Bounds,1,AHScrollBar, AVScrollBar);
  916. GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
  917. NoSelection:=true;
  918. end;
  919. function TBreakpointsListBox.GetLocalMenu: PMenu;
  920. var M: PMenu;
  921. begin
  922. if (Owner<>nil) and (Owner^.GetState(sfModal)) then M:=nil else
  923. M:=NewMenu(
  924. NewItem('~G~oto source','',kbNoKey,cmMsgGotoSource,hcMsgGotoSource,
  925. NewItem('~E~dit breakpoint','',kbNoKey,cmEditBreakpoint,hcEditBreakpoint,
  926. NewItem('~N~ew breakpoint','',kbNoKey,cmNewBreakpoint,hcNewBreakpoint,
  927. NewItem('~D~elete breakpoint','',kbNoKey,cmDeleteBreakpoint,hcDeleteBreakpoint,
  928. NewItem('~T~oggle state','',kbNoKey,cmToggleBreakpoint,hcToggleBreakpoint,
  929. nil))))));
  930. GetLocalMenu:=M;
  931. end;
  932. procedure TBreakpointsListBox.HandleEvent(var Event: TEvent);
  933. var DontClear: boolean;
  934. begin
  935. case Event.What of
  936. evKeyDown :
  937. begin
  938. DontClear:=false;
  939. case Event.KeyCode of
  940. kbEnter :
  941. Message(@Self,evCommand,cmMsgGotoSource,nil);
  942. else
  943. DontClear:=true;
  944. end;
  945. if not DontClear then
  946. ClearEvent(Event);
  947. end;
  948. evBroadcast :
  949. case Event.Command of
  950. cmListItemSelected :
  951. if Event.InfoPtr=@Self then
  952. Message(@Self,evCommand,cmEditBreakpoint,nil);
  953. end;
  954. evCommand :
  955. begin
  956. DontClear:=false;
  957. case Event.Command of
  958. cmMsgTrackSource :
  959. if Range>0 then
  960. TrackSource;
  961. cmEditBreakpoint :
  962. EditCurrent;
  963. cmToggleBreakpoint :
  964. ToggleCurrent;
  965. cmDeleteBreakpoint :
  966. DeleteCurrent;
  967. cmNewBreakpoint :
  968. EditNew;
  969. cmMsgClear :
  970. Clear;
  971. else
  972. DontClear:=true;
  973. end;
  974. if not DontClear then
  975. ClearEvent(Event);
  976. end;
  977. end;
  978. inherited HandleEvent(Event);
  979. end;
  980. procedure TBreakpointsListBox.AddBreakpoint(P: PBreakpointItem);
  981. var W : integer;
  982. begin
  983. if List=nil then New(List, Init(20,20));
  984. W:=length(P^.GetText(255));
  985. if W>MaxWidth then
  986. begin
  987. MaxWidth:=W;
  988. if HScrollBar<>nil then
  989. HScrollBar^.SetRange(0,MaxWidth);
  990. end;
  991. List^.Insert(P);
  992. SetRange(List^.Count);
  993. if Focused=List^.Count-1-1 then
  994. FocusItem(List^.Count-1);
  995. DrawView;
  996. end;
  997. (* function TBreakpointsListBox.AddModuleName(const Name: string): PString;
  998. var P: PString;
  999. begin
  1000. if ModuleNames<>nil then
  1001. P:=ModuleNames^.Add(Name)
  1002. else
  1003. P:=nil;
  1004. AddModuleName:=P;
  1005. end; *)
  1006. function TBreakpointsListBox.GetText(Item,MaxLen: Sw_Integer): String;
  1007. var P: PBreakpointItem;
  1008. S: string;
  1009. begin
  1010. P:=List^.At(Item);
  1011. S:=P^.GetText(MaxLen);
  1012. GetText:=copy(S,1,MaxLen);
  1013. end;
  1014. procedure TBreakpointsListBox.Clear;
  1015. begin
  1016. if assigned(List) then
  1017. Dispose(List, Done);
  1018. List:=nil;
  1019. MaxWidth:=0;
  1020. (* if assigned(ModuleNames) then
  1021. ModuleNames^.FreeAll; *)
  1022. SetRange(0); DrawView;
  1023. Message(Application,evBroadcast,cmClearLineHighlights,@Self);
  1024. end;
  1025. procedure TBreakpointsListBox.TrackSource;
  1026. var W: PSourceWindow;
  1027. P: PBreakpointItem;
  1028. R: TRect;
  1029. (* Row,Col: sw_integer; *)
  1030. begin
  1031. (*Message(Application,evBroadcast,cmClearLineHighlights,@Self);
  1032. if Range=0 then Exit;*)
  1033. P:=List^.At(Focused);
  1034. if P^.GetModuleName='' then Exit;
  1035. Desktop^.Lock;
  1036. GetNextEditorBounds(R);
  1037. R.B.Y:=Owner^.Origin.Y;
  1038. W:=EditorWindowFile(P^.GetModuleName);
  1039. if assigned(W) then
  1040. begin
  1041. W^.GetExtent(R);
  1042. R.B.Y:=Owner^.Origin.Y;
  1043. W^.ChangeBounds(R);
  1044. W^.Editor^.SetCurPtr(1,P^.Breakpoint^.Line);
  1045. end
  1046. else
  1047. W:=TryToOpenFile(@R,P^.GetModuleName,1,P^.Breakpoint^.Line,true);
  1048. if W<>nil then
  1049. begin
  1050. W^.Select;
  1051. W^.Editor^.TrackCursor(true);
  1052. W^.Editor^.SetHighlightRow(P^.Breakpoint^.Line);
  1053. end;
  1054. if Assigned(Owner) then
  1055. Owner^.Select;
  1056. Desktop^.UnLock;
  1057. end;
  1058. procedure TBreakpointsListBox.ToggleCurrent;
  1059. var W: PSourceWindow;
  1060. P: PBreakpointItem;
  1061. b : boolean;
  1062. (* Row,Col: sw_integer; *)
  1063. begin
  1064. if Range=0 then Exit;
  1065. P:=List^.At(Focused);
  1066. if P=nil then Exit;
  1067. if P^.Breakpoint^.state=bs_enabled then
  1068. P^.Breakpoint^.state:=bs_disabled
  1069. else if P^.Breakpoint^.state=bs_disabled then
  1070. P^.Breakpoint^.state:=bs_enabled;
  1071. BreakpointsCollection^.Update;
  1072. if P^.Breakpoint^.typ=bt_file_line then
  1073. begin
  1074. W:=TryToOpenFile(nil,GetStr(P^.Breakpoint^.FileName),1,P^.Breakpoint^.Line,false);
  1075. If assigned(W) then
  1076. begin
  1077. if P^.Breakpoint^.state=bs_enabled then
  1078. b:=true
  1079. else
  1080. b:=false;
  1081. W^.Editor^.SetLineBreakState(P^.Breakpoint^.Line,b);
  1082. end;
  1083. end;
  1084. end;
  1085. procedure TBreakpointsListBox.EditCurrent;
  1086. var
  1087. P: PBreakpointItem;
  1088. begin
  1089. if Range=0 then Exit;
  1090. P:=List^.At(Focused);
  1091. if P=nil then Exit;
  1092. Application^.ExecuteDialog(New(PBreakpointItemDialog,Init(P^.Breakpoint)),nil);
  1093. BreakpointsCollection^.Update;
  1094. end;
  1095. procedure TBreakpointsListBox.DeleteCurrent;
  1096. var
  1097. P: PBreakpointItem;
  1098. begin
  1099. if Range=0 then Exit;
  1100. P:=List^.At(Focused);
  1101. if P=nil then Exit;
  1102. BreakpointsCollection^.free(P^.Breakpoint);
  1103. List^.free(P);
  1104. BreakpointsCollection^.Update;
  1105. end;
  1106. procedure TBreakpointsListBox.EditNew;
  1107. var
  1108. P: PBreakpoint;
  1109. begin
  1110. P:=New(PBreakpoint,Init_Empty);
  1111. if Application^.ExecuteDialog(New(PBreakpointItemDialog,Init(P)),nil)<>cmCancel then
  1112. begin
  1113. BreakpointsCollection^.Insert(P);
  1114. BreakpointsCollection^.Update;
  1115. end
  1116. else
  1117. dispose(P,Done);
  1118. end;
  1119. procedure TBreakpointsListBox.Draw;
  1120. var
  1121. I, J, Item: Sw_Integer;
  1122. NormalColor, SelectedColor, FocusedColor, Color: Word;
  1123. ColWidth, CurCol, Indent: Integer;
  1124. B: TDrawBuffer;
  1125. Text: String;
  1126. SCOff: Byte;
  1127. TC: byte;
  1128. procedure MT(var C: word); begin if TC<>0 then C:=(C and $ff0f) or (TC and $f0); end;
  1129. begin
  1130. if (Owner<>nil) then TC:=ord(Owner^.GetColor(6)) else TC:=0;
  1131. if State and (sfSelected + sfActive) = (sfSelected + sfActive) then
  1132. begin
  1133. NormalColor := GetColor(1);
  1134. FocusedColor := GetColor(3);
  1135. SelectedColor := GetColor(4);
  1136. end else
  1137. begin
  1138. NormalColor := GetColor(2);
  1139. SelectedColor := GetColor(4);
  1140. end;
  1141. if Transparent then
  1142. begin MT(NormalColor); MT(SelectedColor); end;
  1143. if NoSelection then
  1144. SelectedColor:=NormalColor;
  1145. if HScrollBar <> nil then Indent := HScrollBar^.Value
  1146. else Indent := 0;
  1147. ColWidth := Size.X div NumCols + 1;
  1148. for I := 0 to Size.Y - 1 do
  1149. begin
  1150. for J := 0 to NumCols-1 do
  1151. begin
  1152. Item := J*Size.Y + I + TopItem;
  1153. CurCol := J*ColWidth;
  1154. if (State and (sfSelected + sfActive) = (sfSelected + sfActive)) and
  1155. (Focused = Item) and (Range > 0) then
  1156. begin
  1157. Color := FocusedColor;
  1158. SetCursor(CurCol+1,I);
  1159. SCOff := 0;
  1160. end
  1161. else if (Item < Range) and IsSelected(Item) then
  1162. begin
  1163. Color := SelectedColor;
  1164. SCOff := 2;
  1165. end
  1166. else
  1167. begin
  1168. Color := NormalColor;
  1169. SCOff := 4;
  1170. end;
  1171. MoveChar(B[CurCol], ' ', Color, ColWidth);
  1172. if Item < Range then
  1173. begin
  1174. Text := GetText(Item, ColWidth + Indent);
  1175. Text := Copy(Text,Indent,ColWidth);
  1176. MoveStr(B[CurCol+1], Text, Color);
  1177. if ShowMarkers then
  1178. begin
  1179. WordRec(B[CurCol]).Lo := Byte(SpecialChars[SCOff]);
  1180. WordRec(B[CurCol+ColWidth-2]).Lo := Byte(SpecialChars[SCOff+1]);
  1181. end;
  1182. end;
  1183. MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);
  1184. end;
  1185. WriteLine(0, I, Size.X, 1, B);
  1186. end;
  1187. end;
  1188. constructor TBreakpointsListBox.Load(var S: TStream);
  1189. begin
  1190. inherited Load(S);
  1191. end;
  1192. procedure TBreakpointsListBox.Store(var S: TStream);
  1193. var OL: PCollection;
  1194. OldR : integer;
  1195. begin
  1196. OL:=List;
  1197. OldR:=Range;
  1198. Range:=0;
  1199. New(List, Init(1,1));
  1200. inherited Store(S);
  1201. Dispose(List, Done);
  1202. Range:=OldR;
  1203. List:=OL;
  1204. { ^^^ nasty trick - has anyone a better idea how to avoid storing the
  1205. collection? Pasting here a modified version of TListBox.Store+
  1206. TAdvancedListBox.Store isn't a better solution, since by eventually
  1207. changing the obj-hierarchy you'll always have to modify this, too - BG }
  1208. end;
  1209. destructor TBreakpointsListBox.Done;
  1210. begin
  1211. inherited Done;
  1212. if List<>nil then Dispose(List, Done);
  1213. (* if ModuleNames<>nil then Dispose(ModuleNames, Done);*)
  1214. end;
  1215. {****************************************************************************
  1216. TBreakpointsWindow
  1217. ****************************************************************************}
  1218. constructor TBreakpointsWindow.Init;
  1219. var R,R2: TRect;
  1220. HSB,VSB: PScrollBar;
  1221. ST: PStaticText;
  1222. S: String;
  1223. X,X1 : Sw_integer;
  1224. const White = 15;
  1225. begin
  1226. Desktop^.GetExtent(R); R.A.Y:=R.B.Y-18;
  1227. inherited Init(R, 'Breakpoint list', wnNoNumber);
  1228. HelpCtx:=hcBreakpointListWindow;
  1229. GetExtent(R); R.Grow(-1,-1); R.B.Y:=R.A.Y+1;
  1230. S:=' Type | State | Position | Ignore | Conditions ';
  1231. New(ST, Init(R,S));
  1232. ST^.GrowMode:=gfGrowHiX;
  1233. Insert(ST);
  1234. GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,1); R.B.Y:=R.A.Y+1;
  1235. New(ST, Init(R, CharStr('Ä', MaxViewWidth)));
  1236. ST^.GrowMode:=gfGrowHiX;
  1237. Insert(ST);
  1238. GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,2);Dec(R.B.Y,5);
  1239. R2.Copy(R); Inc(R2.B.Y); R2.A.Y:=R2.B.Y-1;
  1240. New(HSB, Init(R2)); HSB^.GrowMode:=gfGrowLoY+gfGrowHiY+gfGrowHiX; Insert(HSB);
  1241. R2.Copy(R); Inc(R2.B.X); R2.A.X:=R2.B.X-1;
  1242. New(VSB, Init(R2)); VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY; Insert(VSB);
  1243. New(BreakLB, Init(R,HSB,VSB));
  1244. BreakLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1245. BreakLB^.Transparent:=true;
  1246. Insert(BreakLB);
  1247. GetExtent(R);R.Grow(-1,-1);
  1248. Dec(R.B.Y);
  1249. R.A.Y:=R.B.Y-2;
  1250. X:=(R.B.X-R.A.X) div 4;
  1251. X1:=R.A.X+(X div 2);
  1252. R.A.X:=X1-3;R.B.X:=X1+7;
  1253. Insert(New(PButton, Init(R, '~C~lose', cmClose, bfDefault)));
  1254. X1:=X1+X;
  1255. R.A.X:=X1-3;R.B.X:=X1+7;
  1256. Insert(New(PButton, Init(R, '~N~ew', cmNewBreakpoint, bfNormal)));
  1257. X1:=X1+X;
  1258. R.A.X:=X1-3;R.B.X:=X1+7;
  1259. Insert(New(PButton, Init(R, '~E~dit', cmEditBreakpoint, bfNormal)));
  1260. X1:=X1+X;
  1261. R.A.X:=X1-3;R.B.X:=X1+7;
  1262. Insert(New(PButton, Init(R, '~D~elete', cmDeleteBreakpoint, bfNormal)));
  1263. BreakLB^.Select;
  1264. Update;
  1265. BreakpointsWindow:=@self;
  1266. end;
  1267. constructor TBreakpointsWindow.Load(var S: TStream);
  1268. begin
  1269. inherited Load(S);
  1270. GetSubViewPtr(S,BreakLB);
  1271. end;
  1272. procedure TBreakpointsWindow.Store(var S: TStream);
  1273. begin
  1274. inherited Store(S);
  1275. PutSubViewPtr(S,BreakLB);
  1276. end;
  1277. procedure TBreakpointsWindow.AddBreakpoint(ABreakpoint : PBreakpoint);
  1278. begin
  1279. BreakLB^.AddBreakpoint(New(PBreakpointItem, Init(ABreakpoint)));
  1280. end;
  1281. procedure TBreakpointsWindow.ClearBreakpoints;
  1282. begin
  1283. BreakLB^.Clear;
  1284. ReDraw;
  1285. end;
  1286. procedure TBreakpointsWindow.ReloadBreakpoints;
  1287. procedure InsertInBreakLB(P : PBreakpoint);
  1288. begin
  1289. BreakLB^.AddBreakpoint(New(PBreakpointItem, Init(P)));
  1290. end;
  1291. begin
  1292. If not assigned(BreakpointsCollection) then
  1293. exit;
  1294. BreakpointsCollection^.ForEach(@InsertInBreakLB);
  1295. ReDraw;
  1296. end;
  1297. procedure TBreakpointsWindow.SizeLimits(var Min, Max: TPoint);
  1298. begin
  1299. inherited SizeLimits(Min,Max);
  1300. Min.X:=40; Min.Y:=18;
  1301. end;
  1302. procedure TBreakpointsWindow.Close;
  1303. begin
  1304. Hide;
  1305. end;
  1306. procedure TBreakpointsWindow.HandleEvent(var Event: TEvent);
  1307. var DontClear : boolean;
  1308. begin
  1309. case Event.What of
  1310. evKeyDown :
  1311. begin
  1312. if (Event.KeyCode=kbEnter) or (Event.KeyCode=kbEsc) then
  1313. begin
  1314. ClearEvent(Event);
  1315. Hide;
  1316. end;
  1317. end;
  1318. evCommand :
  1319. begin
  1320. DontClear:=False;
  1321. case Event.Command of
  1322. cmNewBreakpoint :
  1323. BreakLB^.EditNew;
  1324. cmEditBreakpoint :
  1325. BreakLB^.EditCurrent;
  1326. cmDeleteBreakpoint :
  1327. BreakLB^.DeleteCurrent;
  1328. cmClose :
  1329. Hide;
  1330. else
  1331. DontClear:=true;
  1332. end;
  1333. if not DontClear then
  1334. ClearEvent(Event);
  1335. end;
  1336. evBroadcast :
  1337. case Event.Command of
  1338. cmUpdate :
  1339. Update;
  1340. end;
  1341. end;
  1342. inherited HandleEvent(Event);
  1343. end;
  1344. procedure TBreakpointsWindow.Update;
  1345. begin
  1346. ClearBreakpoints;
  1347. ReloadBreakpoints;
  1348. end;
  1349. destructor TBreakpointsWindow.Done;
  1350. begin
  1351. inherited Done;
  1352. BreakpointsWindow:=nil;
  1353. end;
  1354. {****************************************************************************
  1355. TBreakpointItemDialog
  1356. ****************************************************************************}
  1357. constructor TBreakpointItemDialog.Init(ABreakpoint: PBreakpoint);
  1358. var R,R2,R3: TRect;
  1359. Items: PSItem;
  1360. I : BreakpointType;
  1361. KeyCount: sw_integer;
  1362. begin
  1363. KeyCount:=longint(high(BreakpointType));
  1364. R.Assign(0,0,60,Max(3+KeyCount,18));
  1365. inherited Init(R,'Modify/New Breakpoint');
  1366. Breakpoint:=ABreakpoint;
  1367. GetExtent(R); R.Grow(-3,-2); R3.Copy(R);
  1368. Inc(R.A.Y); R.B.Y:=R.A.Y+1; R.B.X:=R.A.X+36;
  1369. New(NameIL, Init(R, 128)); Insert(NameIL);
  1370. R2.Copy(R); R2.Move(-1,-1); Insert(New(PLabel, Init(R2, '~N~ame', NameIL)));
  1371. R.Move(0,3);
  1372. New(LineIL, Init(R, 128)); Insert(LineIL);
  1373. LineIL^.SetValidator(New(PRangeValidator, Init(0,MaxInt)));
  1374. R2.Copy(R); R2.Move(-1,-1); Insert(New(PLabel, Init(R2, '~L~ine', LineIL)));
  1375. R.Move(0,3);
  1376. New(ConditionsIL, Init(R, 128)); Insert(ConditionsIL);
  1377. R2.Copy(R); R2.Move(-1,-1); Insert(New(PLabel, Init(R2, 'Conditions', ConditionsIL)));
  1378. R.Move(0,3);
  1379. New(IgnoreIL, Init(R, 128)); Insert(IgnoreIL);
  1380. IgnoreIL^.SetValidator(New(PRangeValidator, Init(0,MaxInt)));
  1381. R2.Copy(R); R2.Move(-1,-1); Insert(New(PLabel, Init(R2, '~I~gnore count', IgnoreIL)));
  1382. R.Copy(R3); Inc(R.A.X,38); R.B.Y:=R.A.Y+KeyCount;
  1383. Items:=nil;
  1384. for I:=high(BreakpointType) downto low(BreakpointType) do
  1385. Items:=NewSItem(BreakpointTypeStr[I], Items);
  1386. New(TypeRB, Init(R, Items));
  1387. Insert(TypeRB);
  1388. InsertButtons(@Self);
  1389. NameIL^.Select;
  1390. end;
  1391. function TBreakpointItemDialog.Execute: Word;
  1392. var R: word;
  1393. S1: string;
  1394. err: word;
  1395. L: longint;
  1396. begin
  1397. R:=longint(Breakpoint^.typ);
  1398. TypeRB^.SetData(R);
  1399. If Breakpoint^.typ=bt_file_line then
  1400. S1:=GetStr(Breakpoint^.FileName)
  1401. else
  1402. S1:=GetStr(Breakpoint^.name);
  1403. NameIL^.SetData(S1);
  1404. If Breakpoint^.typ=bt_file_line then
  1405. S1:=IntToStr(Breakpoint^.Line)
  1406. else
  1407. S1:='0';
  1408. LineIL^.SetData(S1);
  1409. S1:=IntToStr(Breakpoint^.IgnoreCount);
  1410. IgnoreIL^.SetData(S1);
  1411. S1:=GetStr(Breakpoint^.Conditions);
  1412. ConditionsIL^.SetData(S1);
  1413. R:=inherited Execute;
  1414. if R=cmOK then
  1415. begin
  1416. TypeRB^.GetData(R);
  1417. L:=R;
  1418. Breakpoint^.typ:=BreakpointType(L);
  1419. NameIL^.GetData(S1);
  1420. If Breakpoint^.typ=bt_file_line then
  1421. begin
  1422. If assigned(Breakpoint^.FileName) then
  1423. DisposeStr(Breakpoint^.FileName);
  1424. Breakpoint^.FileName:=NewStr(S1);
  1425. end
  1426. else
  1427. begin
  1428. If assigned(Breakpoint^.Name) then
  1429. DisposeStr(Breakpoint^.Name);
  1430. Breakpoint^.name:=NewStr(S1);
  1431. end;
  1432. If Breakpoint^.typ=bt_file_line then
  1433. begin
  1434. LineIL^.GetData(S1);
  1435. Val(S1,L,err);
  1436. Breakpoint^.Line:=L;
  1437. end;
  1438. IgnoreIL^.GetData(S1);
  1439. Val(S1,L,err);
  1440. Breakpoint^.IgnoreCount:=L;
  1441. ConditionsIL^.GetData(S1);
  1442. If assigned(Breakpoint^.Conditions) then
  1443. DisposeStr(Breakpoint^.Conditions);
  1444. Breakpoint^.Conditions:=NewStr(S1);
  1445. end;
  1446. Execute:=R;
  1447. end;
  1448. {****************************************************************************
  1449. TWatch
  1450. ****************************************************************************}
  1451. constructor TWatch.Init(s : string);
  1452. begin
  1453. expr:=NewStr(s);
  1454. last_value:=nil;
  1455. current_value:=nil;
  1456. Get_new_value;
  1457. end;
  1458. constructor TWatch.Load(var S: TStream);
  1459. begin
  1460. expr:=S.ReadStr;
  1461. last_value:=nil;
  1462. current_value:=nil;
  1463. Get_new_value;
  1464. end;
  1465. procedure TWatch.Store(var S: TStream);
  1466. begin
  1467. S.WriteStr(expr);
  1468. end;
  1469. procedure TWatch.rename(s : string);
  1470. begin
  1471. if assigned(expr) then
  1472. begin
  1473. if GetStr(expr)=S then
  1474. exit;
  1475. DisposeStr(expr);
  1476. end;
  1477. expr:=NewStr(s);
  1478. if assigned(last_value) then
  1479. StrDispose(last_value);
  1480. last_value:=nil;
  1481. if assigned(current_value) then
  1482. StrDispose(current_value);
  1483. current_value:=nil;
  1484. Get_new_value;
  1485. end;
  1486. procedure TWatch.Get_new_value;
  1487. var p,q : pchar;
  1488. i : longint;
  1489. last_removed : boolean;
  1490. begin
  1491. If not assigned(Debugger) then
  1492. exit;
  1493. if assigned(last_value) then
  1494. strdispose(last_value);
  1495. last_value:=current_value;
  1496. Debugger^.Command('p '+GetStr(expr));
  1497. if Debugger^.Error then
  1498. p:=StrNew(Debugger^.GetError)
  1499. else
  1500. p:=StrNew(Debugger^.GetOutput);
  1501. { do not open a messagebox for such errors }
  1502. Debugger^.got_error:=false;
  1503. q:=nil;
  1504. if assigned(p) and (p[0]='$') then
  1505. q:=StrPos(p,'=');
  1506. if not assigned(q) then
  1507. q:=p;
  1508. if assigned(q) then
  1509. i:=strlen(q)
  1510. else
  1511. i:=0;
  1512. if (i>0) and (q[i-1]=#10) then
  1513. begin
  1514. q[i-1]:=#0;
  1515. last_removed:=true;
  1516. end
  1517. else
  1518. last_removed:=false;
  1519. if assigned(q) then
  1520. current_value:=strnew(q)
  1521. else
  1522. current_value:=strnew('');
  1523. if last_removed then
  1524. q[i-1]:=#10;
  1525. strdispose(p);
  1526. end;
  1527. destructor TWatch.Done;
  1528. begin
  1529. if assigned(expr) then
  1530. disposestr(expr);
  1531. if assigned(last_value) then
  1532. strdispose(last_value);
  1533. if assigned(current_value) then
  1534. strdispose(current_value);
  1535. inherited done;
  1536. end;
  1537. {****************************************************************************
  1538. TWatchesCollection
  1539. ****************************************************************************}
  1540. constructor TWatchesCollection.Init;
  1541. begin
  1542. inherited Init(10,10);
  1543. end;
  1544. procedure TWatchesCollection.Insert(Item: Pointer);
  1545. begin
  1546. PWatch(Item)^.Get_new_value;
  1547. Inherited Insert(Item);
  1548. Update;
  1549. end;
  1550. procedure TWatchesCollection.Update;
  1551. var
  1552. W,W1 : integer;
  1553. procedure GetMax(P : PWatch);
  1554. begin
  1555. if assigned(P^.Current_value) then
  1556. begin
  1557. W1:=StrLen(P^.Current_value)+2+Length(GetStr(P^.expr));
  1558. if W1>W then
  1559. W:=W1;
  1560. end;
  1561. end;
  1562. begin
  1563. W:=0;
  1564. ForEach(@GetMax);
  1565. MaxW:=W;
  1566. If assigned(WatchesWindow) then
  1567. WatchesWindow^.WLB^.Update(MaxW);
  1568. end;
  1569. function TWatchesCollection.At(Index: Integer): PWatch;
  1570. begin
  1571. At:=Inherited At(Index);
  1572. end;
  1573. {****************************************************************************
  1574. TWatchesListBox
  1575. ****************************************************************************}
  1576. constructor TWatchesListBox.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  1577. begin
  1578. inherited Init(Bounds,1,AHScrollBar,AVScrollBar);
  1579. If assigned(List) then
  1580. dispose(list,done);
  1581. List:=WatchesCollection;
  1582. end;
  1583. procedure TWatchesListBox.Update(AMaxWidth : integer);
  1584. var R : TRect;
  1585. begin
  1586. GetExtent(R);
  1587. MaxWidth:=AMaxWidth;
  1588. if HScrollBar<>nil then
  1589. HScrollBar^.SetRange(0,MaxWidth);
  1590. if R.B.X-R.A.X>MaxWidth then
  1591. HScrollBar^.Hide
  1592. else
  1593. HScrollBar^.Show;
  1594. SetRange(List^.Count);
  1595. if R.B.Y-R.A.Y>Range then
  1596. VScrollBar^.Hide
  1597. else
  1598. VScrollBar^.Show;
  1599. if Focused=List^.Count-1-1 then
  1600. FocusItem(List^.Count-1);
  1601. DrawView;
  1602. end;
  1603. function TWatchesListBox.GetIndentedText(Item,Indent,MaxLen: Sw_Integer): String;
  1604. var
  1605. PW : PWatch;
  1606. ValOffset : Sw_integer;
  1607. S : String;
  1608. begin
  1609. PW:=WatchesCollection^.At(Item);
  1610. ValOffset:=Length(GetStr(PW^.Expr))+2;
  1611. if Indent<ValOffset then
  1612. begin
  1613. if not assigned(PW^.current_value) then
  1614. S:=' '+GetStr(PW^.Expr)+' <Unknown value>'
  1615. else if not assigned(PW^.last_value) or
  1616. (strcomp(PW^.Last_value,PW^.Current_value)=0) then
  1617. S:=' '+GetStr(PW^.Expr)+' '+StrPas(PW^.Current_value)
  1618. else
  1619. S:='!'+GetStr(PW^.Expr)+'!'+StrPas(PW^.Current_value);
  1620. GetIndentedText:=Copy(S,Indent,MaxLen);
  1621. end
  1622. else
  1623. begin
  1624. if not assigned(PW^.Current_value) or
  1625. (StrLen(PW^.Current_value)<Indent-Valoffset) then
  1626. S:=''
  1627. else
  1628. S:=StrPas(@(PW^.Current_Value[Indent-Valoffset]));
  1629. GetIndentedText:=Copy(S,1,MaxLen);
  1630. end;
  1631. end;
  1632. procedure TWatchesListBox.EditCurrent;
  1633. var
  1634. P: PWatch;
  1635. begin
  1636. if Range=0 then Exit;
  1637. P:=WatchesCollection^.At(Focused);
  1638. if P=nil then Exit;
  1639. Application^.ExecuteDialog(New(PWatchItemDialog,Init(P)),nil);
  1640. WatchesCollection^.Update;
  1641. end;
  1642. procedure TWatchesListBox.DeleteCurrent;
  1643. var
  1644. P: PWatch;
  1645. begin
  1646. if Range=0 then Exit;
  1647. P:=WatchesCollection^.At(Focused);
  1648. if P=nil then Exit;
  1649. WatchesCollection^.free(P);
  1650. WatchesCollection^.Update;
  1651. end;
  1652. procedure TWatchesListBox.EditNew;
  1653. var
  1654. P: PWatch;
  1655. begin
  1656. P:=New(PWatch,Init(''));
  1657. if Application^.ExecuteDialog(New(PWatchItemDialog,Init(P)),nil)<>cmCancel then
  1658. begin
  1659. WatchesCollection^.Insert(P);
  1660. WatchesCollection^.Update;
  1661. end
  1662. else
  1663. dispose(P,Done);
  1664. end;
  1665. procedure TWatchesListBox.Draw;
  1666. var
  1667. I, J, Item: Sw_Integer;
  1668. NormalColor, SelectedColor, FocusedColor, Color: Word;
  1669. ColWidth, CurCol, Indent: Integer;
  1670. B: TDrawBuffer;
  1671. Text: String;
  1672. SCOff: Byte;
  1673. TC: byte;
  1674. procedure MT(var C: word); begin if TC<>0 then C:=(C and $ff0f) or (TC and $f0); end;
  1675. begin
  1676. if (Owner<>nil) then TC:=ord(Owner^.GetColor(6)) else TC:=0;
  1677. if State and (sfSelected + sfActive) = (sfSelected + sfActive) then
  1678. begin
  1679. NormalColor := GetColor(1);
  1680. FocusedColor := GetColor(3);
  1681. SelectedColor := GetColor(4);
  1682. end else
  1683. begin
  1684. NormalColor := GetColor(2);
  1685. SelectedColor := GetColor(4);
  1686. end;
  1687. if Transparent then
  1688. begin MT(NormalColor); MT(SelectedColor); end;
  1689. (* if NoSelection then
  1690. SelectedColor:=NormalColor;*)
  1691. if HScrollBar <> nil then Indent := HScrollBar^.Value
  1692. else Indent := 0;
  1693. ColWidth := Size.X div NumCols + 1;
  1694. for I := 0 to Size.Y - 1 do
  1695. begin
  1696. for J := 0 to NumCols-1 do
  1697. begin
  1698. Item := J*Size.Y + I + TopItem;
  1699. CurCol := J*ColWidth;
  1700. if (State and (sfSelected + sfActive) = (sfSelected + sfActive)) and
  1701. (Focused = Item) and (Range > 0) then
  1702. begin
  1703. Color := FocusedColor;
  1704. SetCursor(CurCol+1,I);
  1705. SCOff := 0;
  1706. end
  1707. else if (Item < Range) and IsSelected(Item) then
  1708. begin
  1709. Color := SelectedColor;
  1710. SCOff := 2;
  1711. end
  1712. else
  1713. begin
  1714. Color := NormalColor;
  1715. SCOff := 4;
  1716. end;
  1717. MoveChar(B[CurCol], ' ', Color, ColWidth);
  1718. if Item < Range then
  1719. begin
  1720. (* Text := GetText(Item, ColWidth + Indent);
  1721. Text := Copy(Text,Indent,ColWidth); *)
  1722. Text:=GetIndentedText(Item,Indent,ColWidth);
  1723. MoveStr(B[CurCol+1], Text, Color);
  1724. if ShowMarkers then
  1725. begin
  1726. WordRec(B[CurCol]).Lo := Byte(SpecialChars[SCOff]);
  1727. WordRec(B[CurCol+ColWidth-2]).Lo := Byte(SpecialChars[SCOff+1]);
  1728. end;
  1729. end;
  1730. MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);
  1731. end;
  1732. WriteLine(0, I, Size.X, 1, B);
  1733. end;
  1734. end;
  1735. function TWatchesListBox.GetLocalMenu: PMenu;
  1736. var M: PMenu;
  1737. begin
  1738. if (Owner<>nil) and (Owner^.GetState(sfModal)) then M:=nil else
  1739. M:=NewMenu(
  1740. NewItem('~E~dit watch','',kbNoKey,cmEdit,hcNoContext,
  1741. NewItem('~N~ew watch','',kbNoKey,cmNew,hcNoContext,
  1742. NewItem('~D~elete watch','',kbNoKey,cmDelete,hcNoContext,
  1743. nil))));
  1744. GetLocalMenu:=M;
  1745. end;
  1746. procedure TWatchesListBox.HandleEvent(var Event: TEvent);
  1747. var DontClear: boolean;
  1748. begin
  1749. case Event.What of
  1750. evKeyDown :
  1751. begin
  1752. DontClear:=false;
  1753. case Event.KeyCode of
  1754. kbEnter :
  1755. Message(@Self,evCommand,cmEdit,nil);
  1756. kbIns :
  1757. Message(@Self,evCommand,cmNew,nil);
  1758. kbDel :
  1759. Message(@Self,evCommand,cmDelete,nil);
  1760. else
  1761. DontClear:=true;
  1762. end;
  1763. if not DontClear then
  1764. ClearEvent(Event);
  1765. end;
  1766. evBroadcast :
  1767. case Event.Command of
  1768. cmListItemSelected :
  1769. if Event.InfoPtr=@Self then
  1770. Message(@Self,evCommand,cmEdit,nil);
  1771. end;
  1772. evCommand :
  1773. begin
  1774. DontClear:=false;
  1775. case Event.Command of
  1776. cmEdit :
  1777. EditCurrent;
  1778. cmDelete :
  1779. DeleteCurrent;
  1780. cmNew :
  1781. EditNew;
  1782. else
  1783. DontClear:=true;
  1784. end;
  1785. if not DontClear then
  1786. ClearEvent(Event);
  1787. end;
  1788. end;
  1789. inherited HandleEvent(Event);
  1790. end;
  1791. constructor TWatchesListBox.Load(var S: TStream);
  1792. begin
  1793. inherited Load(S);
  1794. If assigned(List) then
  1795. dispose(list,done);
  1796. List:=WatchesCollection;
  1797. { we must set Range PM }
  1798. SetRange(List^.count);
  1799. end;
  1800. procedure TWatchesListBox.Store(var S: TStream);
  1801. var OL: PCollection;
  1802. OldRange : Sw_integer;
  1803. begin
  1804. OL:=List;
  1805. OldRange:=Range;
  1806. Range:=0;
  1807. New(List, Init(1,1));
  1808. inherited Store(S);
  1809. Dispose(List, Done);
  1810. List:=OL;
  1811. { ^^^ nasty trick - has anyone a better idea how to avoid storing the
  1812. collection? Pasting here a modified version of TListBox.Store+
  1813. TAdvancedListBox.Store isn't a better solution, since by eventually
  1814. changing the obj-hierarchy you'll always have to modify this, too - BG }
  1815. SetRange(OldRange);
  1816. end;
  1817. destructor TWatchesListBox.Done;
  1818. begin
  1819. List:=nil;
  1820. inherited Done;
  1821. end;
  1822. {****************************************************************************
  1823. TWatchesWindow
  1824. ****************************************************************************}
  1825. Constructor TWatchesWindow.Init;
  1826. var
  1827. HSB,VSB: PScrollBar;
  1828. R,R2 : trect;
  1829. begin
  1830. Desktop^.GetExtent(R);
  1831. R.A.Y:=R.B.Y-5;
  1832. inherited Init(R, 'Watches', wnNoNumber);
  1833. GetExtent(R);
  1834. HelpCtx:=hcWatches;
  1835. R.Grow(-1,-1);
  1836. R2.Copy(R);
  1837. Inc(R2.B.Y);
  1838. R2.A.Y:=R2.B.Y-1;
  1839. New(HSB, Init(R2));
  1840. HSB^.GrowMode:=gfGrowLoY+gfGrowHiY+gfGrowHiX;
  1841. Insert(HSB);
  1842. R2.Copy(R);
  1843. Inc(R2.B.X);
  1844. R2.A.X:=R2.B.X-1;
  1845. New(VSB, Init(R2));
  1846. VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
  1847. Insert(VSB);
  1848. New(WLB,Init(R,HSB,VSB));
  1849. WLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
  1850. WLB^.Transparent:=true;
  1851. Insert(WLB);
  1852. If assigned(WatchesWindow) then
  1853. dispose(WatchesWindow,done);
  1854. WatchesWindow:=@Self;
  1855. Update;
  1856. end;
  1857. procedure TWatchesWindow.Update;
  1858. begin
  1859. WatchesCollection^.Update;
  1860. Draw;
  1861. end;
  1862. constructor TWatchesWindow.Load(var S: TStream);
  1863. begin
  1864. inherited Load(S);
  1865. GetSubViewPtr(S,WLB);
  1866. end;
  1867. procedure TWatchesWindow.Store(var S: TStream);
  1868. begin
  1869. inherited Store(S);
  1870. PutSubViewPtr(S,WLB);
  1871. end;
  1872. Destructor TWatchesWindow.Done;
  1873. begin
  1874. WatchesWindow:=nil;
  1875. Dispose(WLB,done);
  1876. inherited done;
  1877. end;
  1878. {****************************************************************************
  1879. TWatchItemDialog
  1880. ****************************************************************************}
  1881. constructor TWatchItemDialog.Init(AWatch: PWatch);
  1882. var R,R2: TRect;
  1883. begin
  1884. R.Assign(0,0,50,10);
  1885. inherited Init(R,'Edit Watch');
  1886. Watch:=AWatch;
  1887. GetExtent(R); R.Grow(-3,-2);
  1888. Inc(R.A.Y); R.B.Y:=R.A.Y+1; R.B.X:=R.A.X+36;
  1889. New(NameIL, Init(R, 255)); Insert(NameIL);
  1890. R2.Copy(R); R2.Move(-1,-1);
  1891. Insert(New(PLabel, Init(R2, '~E~xpression to watch', NameIL)));
  1892. GetExtent(R);
  1893. R.Grow(-1,-1);
  1894. R.A.Y:=R.A.Y+3;
  1895. R.B.X:=R.A.X+36;
  1896. TextST:=New(PAdvancedStaticText, Init(R, 'Watch values'));
  1897. Insert(TextST);
  1898. InsertButtons(@Self);
  1899. NameIL^.Select;
  1900. end;
  1901. function TWatchItemDialog.Execute: Word;
  1902. var R: word;
  1903. S1,S2: string;
  1904. begin
  1905. S1:=GetStr(Watch^.expr);
  1906. NameIL^.SetData(S1);
  1907. if assigned(Watch^.Current_value) then
  1908. S1:=StrPas(Watch^.Current_value)
  1909. else
  1910. S1:='';
  1911. if assigned(Watch^.Last_value) then
  1912. S2:=StrPas(Watch^.Last_value)
  1913. else
  1914. S2:='';
  1915. if assigned(Watch^.Last_value) and
  1916. assigned(Watch^.Current_value) and
  1917. (strcomp(Watch^.Last_value,Watch^.Current_value)=0) then
  1918. S1:='Current value: '+#13+S1
  1919. else
  1920. S1:='Current value: '+#13+S1+#13+
  1921. 'Previous value: '+#13+S2;
  1922. TextST^.SetText(S1);
  1923. R:=inherited Execute;
  1924. if R=cmOK then
  1925. begin
  1926. NameIL^.GetData(S1);
  1927. Watch^.Rename(S1);
  1928. If assigned(Debugger) then
  1929. Debugger^.ReadWatches;
  1930. end;
  1931. Execute:=R;
  1932. end;
  1933. {****************************************************************************
  1934. TStackWindow
  1935. ****************************************************************************}
  1936. constructor TFramesListBox.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
  1937. begin
  1938. Inherited Init(Bounds,AHScrollBar,AVScrollBar);
  1939. end;
  1940. procedure TFramesListBox.Update;
  1941. var i : longint;
  1942. begin
  1943. { call backtrace command }
  1944. If not assigned(Debugger) then
  1945. exit;
  1946. {$ifndef NODEBUG}
  1947. Clear;
  1948. { forget all old frames }
  1949. Debugger^.clear_frames;
  1950. Debugger^.Command('backtrace');
  1951. { generate list }
  1952. { all is in tframeentry }
  1953. for i:=0 to Debugger^.frame_count-1 do
  1954. begin
  1955. with Debugger^.frames[i]^ do
  1956. begin
  1957. AddItem(new(PMessageItem,init(0,StrPas(function_name)+StrPas(args),
  1958. AddModuleName(StrPas(file_name)),line_number,1)));
  1959. end;
  1960. end;
  1961. if List^.Count > 0 then
  1962. FocusItem(0);
  1963. {$endif}
  1964. end;
  1965. function TFramesListBox.GetLocalMenu: PMenu;
  1966. begin
  1967. GetLocalMenu:=Inherited GetLocalMenu;
  1968. end;
  1969. procedure TFramesListBox.GotoSource;
  1970. begin
  1971. { select frame for watches }
  1972. If not assigned(Debugger) then
  1973. exit;
  1974. {$ifdef NODEBUG}
  1975. Debugger^.Command('f '+IntToStr(Focused));
  1976. { for local vars }
  1977. Debugger^.ReadWatches;
  1978. {$endif}
  1979. { goto source }
  1980. inherited GotoSource;
  1981. end;
  1982. procedure TFramesListBox.HandleEvent(var Event: TEvent);
  1983. begin
  1984. inherited HandleEvent(Event);
  1985. end;
  1986. destructor TFramesListBox.Done;
  1987. begin
  1988. Inherited Done;
  1989. end;
  1990. Constructor TStackWindow.Init;
  1991. var
  1992. HSB,VSB: PScrollBar;
  1993. R,R2 : trect;
  1994. begin
  1995. Desktop^.GetExtent(R);
  1996. R.A.Y:=R.B.Y-5;
  1997. inherited Init(R, 'Call Stack', wnNoNumber);
  1998. GetExtent(R);
  1999. HelpCtx:=hcStack;
  2000. R.Grow(-1,-1);
  2001. R2.Copy(R);
  2002. Inc(R2.B.Y);
  2003. R2.A.Y:=R2.B.Y-1;
  2004. New(HSB, Init(R2));
  2005. HSB^.GrowMode:=gfGrowLoY+gfGrowHiY+gfGrowHiX;
  2006. Insert(HSB);
  2007. R2.Copy(R);
  2008. Inc(R2.B.X);
  2009. R2.A.X:=R2.B.X-1;
  2010. New(VSB, Init(R2));
  2011. VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
  2012. Insert(VSB);
  2013. New(FLB,Init(R,HSB,VSB));
  2014. FLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
  2015. Insert(FLB);
  2016. If assigned(StackWindow) then
  2017. dispose(StackWindow,done);
  2018. StackWindow:=@Self;
  2019. Update;
  2020. end;
  2021. procedure TStackWindow.Update;
  2022. begin
  2023. FLB^.Update;
  2024. DrawView;
  2025. end;
  2026. constructor TStackWindow.Load(var S: TStream);
  2027. begin
  2028. inherited Load(S);
  2029. GetSubViewPtr(S,FLB);
  2030. end;
  2031. procedure TStackWindow.Store(var S: TStream);
  2032. begin
  2033. inherited Store(S);
  2034. PutSubViewPtr(S,FLB);
  2035. end;
  2036. Destructor TStackWindow.Done;
  2037. begin
  2038. StackWindow:=nil;
  2039. Dispose(FLB,done);
  2040. inherited done;
  2041. end;
  2042. {****************************************************************************
  2043. Init/Final
  2044. ****************************************************************************}
  2045. procedure InitDebugger;
  2046. begin
  2047. {$ifdef DEBUG}
  2048. Assign(gdb_file,GDBOutFileName);
  2049. Rewrite(gdb_file);
  2050. Use_gdb_file:=true;
  2051. {$endif}
  2052. if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) then
  2053. DoCompile(cRun);
  2054. if CompilationPhase<>cpDone then
  2055. Exit;
  2056. if (EXEFile='') then
  2057. begin
  2058. ErrorBox('Oooops, nothing to debug.',nil);
  2059. Exit;
  2060. end;
  2061. { init debugcontroller }
  2062. if assigned(Debugger) then
  2063. dispose(Debugger,Done);
  2064. new(Debugger,Init(ExeFile));
  2065. {$ifdef GDBWINDOW}
  2066. InitGDBWindow;
  2067. {$endif def GDBWINDOW}
  2068. end;
  2069. procedure DoneDebugger;
  2070. begin
  2071. if assigned(Debugger) then
  2072. dispose(Debugger,Done);
  2073. Debugger:=nil;
  2074. {$ifdef DEBUG}
  2075. If Use_gdb_file then
  2076. Close(GDB_file);
  2077. Use_gdb_file:=false;
  2078. {$endif}
  2079. {DoneGDBWindow;}
  2080. end;
  2081. procedure InitGDBWindow;
  2082. var
  2083. R : TRect;
  2084. begin
  2085. if GDBWindow=nil then
  2086. begin
  2087. DeskTop^.GetExtent(R);
  2088. new(GDBWindow,init(R));
  2089. DeskTop^.Insert(GDBWindow);
  2090. end;
  2091. end;
  2092. procedure DoneGDBWindow;
  2093. begin
  2094. if assigned(GDBWindow) then
  2095. begin
  2096. DeskTop^.Delete(GDBWindow);
  2097. GDBWindow:=nil;
  2098. end;
  2099. end;
  2100. procedure InitStackWindow;
  2101. begin
  2102. if StackWindow=nil then
  2103. begin
  2104. new(StackWindow,init);
  2105. DeskTop^.Insert(StackWindow);
  2106. end;
  2107. end;
  2108. procedure DoneStackWindow;
  2109. begin
  2110. if assigned(StackWindow) then
  2111. begin
  2112. DeskTop^.Delete(StackWindow);
  2113. StackWindow:=nil;
  2114. end;
  2115. end;
  2116. procedure InitBreakpoints;
  2117. begin
  2118. New(BreakpointsCollection,init(10,10));
  2119. end;
  2120. procedure DoneBreakpoints;
  2121. begin
  2122. Dispose(BreakpointsCollection,Done);
  2123. BreakpointsCollection:=nil;
  2124. end;
  2125. procedure InitWatches;
  2126. begin
  2127. New(WatchesCollection,init);
  2128. end;
  2129. procedure DoneWatches;
  2130. begin
  2131. Dispose(WatchesCollection,Done);
  2132. WatchesCollection:=nil;
  2133. end;
  2134. procedure RegisterFPDebugViews;
  2135. begin
  2136. RegisterType(RWatchesWindow);
  2137. RegisterType(RBreakpointsWindow);
  2138. RegisterType(RWatchesListBox);
  2139. RegisterType(RBreakpointsListBox);
  2140. RegisterType(RStackWindow);
  2141. RegisterType(RFramesListBox);
  2142. RegisterType(RBreakpoint);
  2143. RegisterType(RWatch);
  2144. RegisterType(RBreakpointCollection);
  2145. RegisterType(RWatchesCollection);
  2146. end;
  2147. end.
  2148. {
  2149. $Log$
  2150. Revision 1.32 1999-09-16 14:34:57 pierre
  2151. + TBreakpoint and TWatch registering
  2152. + WatchesCollection and BreakpointsCollection stored in desk file
  2153. * Syntax highlighting was broken
  2154. Revision 1.31 1999/09/13 16:24:43 peter
  2155. + clock
  2156. * backspace unident like tp7
  2157. Revision 1.30 1999/09/09 16:36:30 pierre
  2158. * Breakpoint storage problem corrected
  2159. Revision 1.29 1999/09/09 16:31:45 pierre
  2160. * some breakpoint related fixes and Help contexts
  2161. Revision 1.28 1999/09/09 14:20:05 pierre
  2162. + Stack Window
  2163. Revision 1.27 1999/08/24 22:04:33 pierre
  2164. + TCodeEditor.SetDebuggerRow
  2165. works like SetHighlightRow but is only disposed by a SetDebuggerRow(-1)
  2166. so the current stop point in debugging is not lost if
  2167. we move the cursor
  2168. Revision 1.26 1999/08/22 22:26:48 pierre
  2169. + Registration of Breakpoint/Watches windows
  2170. Revision 1.25 1999/08/16 18:25:15 peter
  2171. * Adjusting the selection when the editor didn't contain any line.
  2172. * Reserved word recognition redesigned, but this didn't affect the overall
  2173. syntax highlight speed remarkably (at least not on my Amd-K6/350).
  2174. The syntax scanner loop is a bit slow but the main problem is the
  2175. recognition of special symbols. Switching off symbol processing boosts
  2176. the performance up to ca. 200%...
  2177. * The editor didn't allow copying (for ex to clipboard) of a single character
  2178. * 'File|Save as' caused permanently run-time error 3. Not any more now...
  2179. * Compiler Messages window (actually the whole desktop) did not act on any
  2180. keypress when compilation failed and thus the window remained visible
  2181. + Message windows are now closed upon pressing Esc
  2182. + At 'Run' the IDE checks whether any sources are modified, and recompiles
  2183. only when neccessary
  2184. + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
  2185. + LineSelect (Ctrl+K+L) implemented
  2186. * The IDE had problems closing help windows before saving the desktop
  2187. Revision 1.24 1999/08/03 20:22:28 peter
  2188. + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
  2189. + Desktop saving should work now
  2190. - History saved
  2191. - Clipboard content saved
  2192. - Desktop saved
  2193. - Symbol info saved
  2194. * syntax-highlight bug fixed, which compared special keywords case sensitive
  2195. (for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
  2196. * with 'whole words only' set, the editor didn't found occourences of the
  2197. searched text, if the text appeared previously in the same line, but didn't
  2198. satisfied the 'whole-word' condition
  2199. * ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
  2200. (ie. the beginning of the selection)
  2201. * when started typing in a new line, but not at the start (X=0) of it,
  2202. the editor inserted the text one character more to left as it should...
  2203. * TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
  2204. * Shift shouldn't cause so much trouble in TCodeEditor now...
  2205. * Syntax highlight had problems recognizing a special symbol if it was
  2206. prefixed by another symbol character in the source text
  2207. * Auto-save also occours at Dos shell, Tool execution, etc. now...
  2208. Revision 1.23 1999/07/28 23:11:17 peter
  2209. * fixes from gabor
  2210. Revision 1.22 1999/07/12 13:14:15 pierre
  2211. * LineEnd bug corrected, now goes end of text even if selected
  2212. + Until Return for debugger
  2213. + Code for Quit inside GDB Window
  2214. Revision 1.21 1999/07/11 00:35:14 pierre
  2215. * fix problems for wrong watches
  2216. Revision 1.20 1999/07/10 01:24:14 pierre
  2217. + First implementation of watches window
  2218. Revision 1.19 1999/06/30 23:58:12 pierre
  2219. + BreakpointsList Window implemented
  2220. with Edit/New/Delete functions
  2221. + Individual breakpoint dialog with support for all types
  2222. ignorecount and conditions
  2223. (commands are not yet implemented, don't know if this wolud be useful)
  2224. awatch and rwatch have problems because GDB does not annotate them
  2225. I fixed v4.16 for this
  2226. Revision 1.18 1999/03/16 00:44:42 peter
  2227. * forgotten in last commit :(
  2228. Revision 1.17 1999/03/02 13:48:28 peter
  2229. * fixed far problem is fpdebug
  2230. * tile/cascading with message window
  2231. * grep fixes
  2232. Revision 1.16 1999/03/01 15:41:52 peter
  2233. + Added dummy entries for functions not yet implemented
  2234. * MenuBar didn't update itself automatically on command-set changes
  2235. * Fixed Debugging/Profiling options dialog
  2236. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  2237. set
  2238. * efBackSpaceUnindents works correctly
  2239. + 'Messages' window implemented
  2240. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  2241. + Added TP message-filter support (for ex. you can call GREP thru
  2242. GREP2MSG and view the result in the messages window - just like in TP)
  2243. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  2244. so topic search didn't work...
  2245. * In FPHELP.PAS there were still context-variables defined as word instead
  2246. of THelpCtx
  2247. * StdStatusKeys() was missing from the statusdef for help windows
  2248. + Topic-title for index-table can be specified when adding a HTML-files
  2249. Revision 1.15 1999/02/20 15:18:29 peter
  2250. + ctrl-c capture with confirm dialog
  2251. + ascii table in the tools menu
  2252. + heapviewer
  2253. * empty file fixed
  2254. * fixed callback routines in fpdebug to have far for tp7
  2255. Revision 1.14 1999/02/16 12:47:36 pierre
  2256. * GDBWindow does not popup on F7 or F8 anymore
  2257. Revision 1.13 1999/02/16 10:43:54 peter
  2258. * use -dGDB for the compiler
  2259. * only use gdb_file when -dDEBUG is used
  2260. * profiler switch is now a toggle instead of radiobutton
  2261. Revision 1.12 1999/02/11 19:07:20 pierre
  2262. * GDBWindow redesigned :
  2263. normal editor apart from
  2264. that any kbEnter will send the line (for begin to cursor)
  2265. to GDB command !
  2266. GDBWindow opened in Debugger Menu
  2267. still buggy :
  2268. -echo should not be present if at end of text
  2269. -GDBWindow becomes First after each step (I don't know why !)
  2270. Revision 1.11 1999/02/11 13:10:03 pierre
  2271. + GDBWindow only with -dGDBWindow for now : still buggy !!
  2272. Revision 1.10 1999/02/10 09:55:07 pierre
  2273. + added OldValue and CurrentValue field for watchpoints
  2274. + InitBreakpoints and DoneBreakpoints
  2275. + MessageBox if GDB stops bacause of a watchpoint !
  2276. Revision 1.9 1999/02/08 17:43:43 pierre
  2277. * RestDebugger or multiple running of debugged program now works
  2278. + added DoContToCursor(F4)
  2279. * Breakpoints are now inserted correctly (was mainlyy a problem
  2280. of directories)
  2281. Revision 1.8 1999/02/05 17:21:52 pierre
  2282. Invalid_line renamed InvalidSourceLine
  2283. Revision 1.7 1999/02/05 13:08:41 pierre
  2284. + new breakpoint types added
  2285. Revision 1.6 1999/02/05 12:11:53 pierre
  2286. + SourceDir that stores directories for sources that the
  2287. compiler should not know about
  2288. Automatically asked for addition when a new file that
  2289. needed filedialog to be found is in an unknown directory
  2290. Stored and retrieved from INIFile
  2291. + Breakpoints conditions added to INIFile
  2292. * Breakpoints insterted and removed at debin and end of debug session
  2293. Revision 1.5 1999/02/04 17:54:22 pierre
  2294. + several commands added
  2295. Revision 1.4 1999/02/04 13:32:02 pierre
  2296. * Several things added (I cannot commit them independently !)
  2297. + added TBreakpoint and TBreakpointCollection
  2298. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  2299. + Breakpoint list in INIFile
  2300. * Select items now also depend of SwitchMode
  2301. * Reading of option '-g' was not possible !
  2302. + added search for -Fu args pathes in TryToOpen
  2303. + added code for automatic opening of FileDialog
  2304. if source not found
  2305. Revision 1.3 1999/02/02 16:41:38 peter
  2306. + automatic .pas/.pp adding by opening of file
  2307. * better debuggerscreen changes
  2308. Revision 1.2 1999/01/22 18:14:09 pierre
  2309. * adaptd to changes in gdbint and gdbcon for to /
  2310. Revision 1.1 1999/01/22 10:24:03 peter
  2311. * first debugger things
  2312. }