gdbint.pp 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727
  1. {
  2. $Id$
  3. Copyright (c) 1998 by Peter Vreman
  4. Lowlevel GDB interface which communicates directly with libgdb
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. unit GdbInt;
  12. interface
  13. {$smartlink off}
  14. {.define GDB_HAS_SYSROOT} {versions of gdb >5.3 may need this}
  15. {main.c exports a string that is empty (not null) for}
  16. {targets that do not support sysroot}
  17. {for now GDB_HAS_SYSROOT is not set here, it has to be done}
  18. {manually (set it if you have the unresolved symbol gdb_sysroot) }
  19. { this is not needed (PM) $output_format as}
  20. {.$define Verbose}
  21. {.$define DebugCommand}
  22. {$define NotImplemented}
  23. { GDB has a simulator for powerpc CPU
  24. it is integrated into GDB by default }
  25. {$ifdef powerpc}
  26. {$define GDB_HAS_SIM}
  27. {$endif powerpc}
  28. {$ifdef BSD} {v4.x nearly useless for BSD. 5.x is fine}
  29. {$DEFINE GDB_V502}
  30. {$endif}
  31. { Default version for GDB 5 is 5.01 for now PM }
  32. {$ifdef GDB_V5}
  33. {$ifndef GDB_V500}
  34. {$define GDB_V501}
  35. {$endif ndef GDB_V500}
  36. {$endif def GDB_V5}
  37. {$ifdef GDB_V503}
  38. {$define GDB_V502}
  39. {$define GDB_SYMTAB_HAS_MACROS}
  40. {$endif GDB_V503}
  41. {$ifdef GDB_V502}
  42. {$define GDB_V501}
  43. {$endif GDB_V502}
  44. {$ifdef GDB_V501}
  45. {$define GDB_USES_PTID}
  46. {$define GDB_V5}
  47. {$endif GDB_V501}
  48. {$ifdef GDB_V500}
  49. {$define GDB_V5}
  50. {$endif GDB_V500}
  51. { V4.18 is default for now }
  52. { set when starting v5 support PM }
  53. {$ifndef GDB_V5}
  54. {$ifndef GDB_V416}
  55. {$define GDB_V418}
  56. {$endif GDB_V416}
  57. {$endif GDB_V5}
  58. {$ifdef go32v2}
  59. {$undef NotImplemented}
  60. { ifdef GDB_V418 changed to ifndef GDB_V416}
  61. {$ifdef USE_GDB_OBJS}
  62. {$include gdbobjs.inc}
  63. {$else USE_GDB_OBJS}
  64. {$LINKLIB gdb}
  65. {$ifdef GDB_HAS_SIM}
  66. {$LINKLIB sim}
  67. {$endif GDB_HAS_SIM}
  68. {$ifdef GDB_V5}
  69. {$LINKLIB bfd}
  70. {$LINKLIB readline}
  71. {$LINKLIB opcodes}
  72. {$LINKLIB history}
  73. {$LINKLIB iberty}
  74. {$LINKLIB intl}
  75. {$endif GDB_V5}
  76. {$endif ndef USE_GDB_OBJS}
  77. {$LINKLIB dbg}
  78. {$LINKLIB c}
  79. {$endif go32v2}
  80. {$ifndef bsd}
  81. {$ifdef linux}
  82. {$undef NotImplemented}
  83. {$ifndef GDB_V5}
  84. {$LINKLIB ncurses}
  85. {$endif not GDB_V5}
  86. {$LINKLIB gdb}
  87. {$ifdef GDB_HAS_SIM}
  88. {$LINKLIB sim}
  89. {$endif GDB_HAS_SIM}
  90. {$ifdef GDB_V5}
  91. {$LINKLIB bfd}
  92. {$LINKLIB readline}
  93. {$LINKLIB opcodes}
  94. {$LINKLIB history}
  95. {$LINKLIB iberty}
  96. {$LINKLIB ncurses}
  97. {$LINKLIB m}
  98. {$LINKLIB iberty}
  99. {$LINKLIB dl}
  100. {$endif GDB_V5}
  101. {$LINKLIB c}
  102. {$LINKLIB gcc}
  103. {$endif linux}
  104. {$endif bsd}
  105. {$ifdef freebsd}
  106. {$undef NotImplemented}
  107. {$ifndef GDB_V5}
  108. {$LINKLIB ncurses}
  109. {$endif not GDB_V5}
  110. {$LINKLIB gdb}
  111. {$ifdef GDB_HAS_SIM}
  112. {$LINKLIB sim}
  113. {$endif GDB_HAS_SIM}
  114. {$ifdef GDB_V5}
  115. {$LINKLIB bfd}
  116. {$LINKLIB readline}
  117. {$LINKLIB opcodes}
  118. {$LINKLIB history}
  119. {$LINKLIB iberty}
  120. {$LINKLIB ncurses}
  121. {$LINKLIB m}
  122. {$LINKLIB iberty}
  123. {$LINKLIB intl} { does not seem to exist on netbsd LINKLIB dl,
  124. but I use GDB CVS snapshots for the *BSDs}
  125. {$endif GDB_V5}
  126. {$LINKLIB c}
  127. {$LINKLIB gcc}
  128. {$endif freebsd}
  129. {$ifdef netbsd}
  130. {$undef NotImplemented}
  131. {$ifndef GDB_V5}
  132. {$LINKLIB ncurses}
  133. {$endif not GDB_V5}
  134. {$LINKLIB gdb}
  135. {$ifdef GDB_HAS_SIM}
  136. {$LINKLIB sim}
  137. {$endif GDB_HAS_SIM}
  138. {$ifdef GDB_V5}
  139. {$LINKLIB bfd}
  140. {$LINKLIB readline}
  141. {$LINKLIB opcodes}
  142. {$LINKLIB history}
  143. {$LINKLIB iberty}
  144. {$LINKLIB ncurses}
  145. {$LINKLIB m}
  146. {$LINKLIB iberty}
  147. {$LINKLIB intl}
  148. { does not seem to exist on netbsd LINKLIB dl}
  149. {$endif GDB_V5}
  150. {$LINKLIB c}
  151. {$LINKLIB gcc}
  152. {$endif netbsd}
  153. {$ifdef openbsd}
  154. {$undef NotImplemented}
  155. {$ifndef GDB_V5}
  156. {$LINKLIB curses}
  157. {$endif not GDB_V5}
  158. {$LINKLIB gdb}
  159. {$ifdef GDB_HAS_SIM}
  160. {$LINKLIB sim}
  161. {$endif GDB_HAS_SIM}
  162. {$ifdef GDB_V5}
  163. {$LINKLIB bfd}
  164. {$LINKLIB readline}
  165. {$LINKLIB opcodes}
  166. {$LINKLIB history}
  167. {$LINKLIB iberty}
  168. {$LINKLIB ncurses}
  169. {$LINKLIB m}
  170. {$LINKLIB iberty}
  171. {$LINKLIB intl}
  172. { does not seem to exist on netbsd LINKLIB dl}
  173. {$endif GDB_V5}
  174. {$LINKLIB c}
  175. {$LINKLIB gcc}
  176. {$endif netbsd}
  177. {$ifdef win32}
  178. {$undef NotImplemented}
  179. {$ifndef GDB_V5}
  180. {$LINKLIB cygwin}
  181. {$LINKLIB gdb}
  182. {$ifdef GDB_HAS_SIM}
  183. {$LINKLIB sim}
  184. {$endif GDB_HAS_SIM}
  185. {$ifdef USE_TERMCAP}
  186. {$LINKLIB termcap}
  187. {$else not USE_TERMCAP}
  188. {$LINKLIB ncurses}
  189. {$endif not USE_TERMCAP}
  190. {$LINKLIB gcc}
  191. {$LINKLIB c}
  192. {$LINKLIB cygwin}
  193. { all those are maybe not necessary
  194. but at least user32 is required
  195. because of clipboard handling PM }
  196. {$LINKLIB kernel32}
  197. {$LINKLIB user32}
  198. {$else GDB_V5}
  199. {$LINKLIB gdb}
  200. {$ifdef GDB_HAS_SIM}
  201. {$LINKLIB sim}
  202. {$endif GDB_HAS_SIM}
  203. {$LINKLIB bfd}
  204. {$LINKLIB readline}
  205. {$LINKLIB opcodes}
  206. {$LINKLIB intl}
  207. {$LINKLIB iberty}
  208. {$LINKLIB termcap}
  209. {$LINKLIB gcc}
  210. {$LINKLIB cygwin} { alias of libm.a and libc.a }
  211. {$LINKLIB iberty}
  212. {$LINKLIB imagehlp}
  213. {$LINKLIB kernel32}
  214. {$LINKLIB user32}
  215. {$endif GDB_V5}
  216. {$endif win32}
  217. {$ifdef go32v2}
  218. {$define supportexceptions}
  219. {$endif go32v2}
  220. {$ifdef unix}
  221. {$define supportexceptions}
  222. {$endif unix}
  223. {$ifdef CROSSGDB}
  224. { do we neeed something special if cross GDB? }
  225. {$endif CROSSGDB}
  226. {$ifdef NotImplemented}
  227. {$fatal This OS is not yet supported !!!}
  228. {$endif NotImplemented}
  229. {$packrecords C}
  230. type
  231. psyminfo=^tsyminfo;
  232. tsyminfo=record
  233. address : longint;
  234. fname : pchar;
  235. line : longint;
  236. funcname : pchar;
  237. offset : longint;
  238. end;
  239. tframeentry = object
  240. file_name : pchar;
  241. function_name : pchar;
  242. args : pchar;
  243. line_number : longint;
  244. address : longint;
  245. level : longint;
  246. constructor init;
  247. destructor done;
  248. procedure reset;
  249. procedure clear;
  250. end;
  251. pframeentry=^tframeentry;
  252. ppframeentry=^pframeentry;
  253. {$ifndef GDB_V416}
  254. { needed for handles }
  255. {not anymore I textrec.inc}
  256. type
  257. CORE_ADDR = cardinal; { might be target dependent PM }
  258. streamtype = (afile,astring);
  259. C_FILE = longint; { at least under DJGPP }
  260. P_C_FILE = ^C_FILE;
  261. {$ifdef GDB_V418}
  262. { GDB_FILE type }
  263. type
  264. PGDB_FILE = ^TGDB_FILE;
  265. TGDB_FILE = record
  266. ts_streamtype : streamtype;
  267. ts_filestream : P_C_FILE;
  268. ts_strbuf : pchar;
  269. ts_buflen : longint;
  270. end;
  271. {$endif GDB_V418}
  272. {$ifdef GDB_V5}
  273. type
  274. pui_file = ^ui_file;
  275. ui_file_flush_ftype = procedure(stream : pui_file);cdecl;
  276. ui_file_write_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl;
  277. ui_file_fputs_ftype = procedure(buf : pchar; stream : pui_file);cdecl;
  278. ui_file_delete_ftype = procedure(stream : pui_file);cdecl;
  279. ui_file_isatty_ftype = function(stream : pui_file) : longbool;cdecl;
  280. ui_file_rewind_ftype = procedure(stream : pui_file);cdecl;
  281. ui_file_put_method_ftype = procedure(var _object; buffer : pchar;length_buffer : longint);cdecl;
  282. ui_file_put_ftype = procedure(stream : pui_file;method : ui_file_put_method_ftype;var context);cdecl;
  283. plongint = ^longint;
  284. ui_file = record
  285. magic : plongint;
  286. to_flush : ui_file_flush_ftype;
  287. to_write : ui_file_write_ftype;
  288. to_fputs : ui_file_fputs_ftype;
  289. to_delete : ui_file_delete_ftype;
  290. to_isatty : ui_file_isatty_ftype;
  291. to_rewind : ui_file_rewind_ftype;
  292. to_put : ui_file_put_ftype;
  293. to_data : pointer;
  294. end;
  295. { used to delete stdio_ui_file gdb_stdout and gdb_stderr }
  296. procedure ui_file_delete(stream : pui_file);cdecl;external;
  297. { used to recreate gdb_stdout and gdb_stderr as memory streams }
  298. function mem_fileopen : pui_file;cdecl;external;
  299. { used to change the write procvar to ours }
  300. procedure set_ui_file_write(stream : pui_file;write : ui_file_write_ftype);cdecl;external;
  301. {$endif GDB_V5}
  302. {$ifdef GDB_USES_PTID}
  303. type
  304. (* struct ptid
  305. {
  306. /* Process id */
  307. int pid;
  308. /* Lightweight process id */
  309. long lwp;
  310. /* Thread id */
  311. long tid;
  312. }; *)
  313. pinferior_ptid = ^tinferior_ptid;
  314. tinferior_ptid = record
  315. pid : longint{C int};
  316. lwp : longint{ C long};
  317. tid : longint{ C long};
  318. end;
  319. {$endif}
  320. {$ifdef win32}
  321. type
  322. { from sys/reent.h
  323. real structure is bigger but only std.. are wanted here PM }
  324. REENT = record
  325. err : longint;
  326. stdin,stdout,stderr : P_C_FILE;
  327. end;
  328. PREENT = ^REENT;
  329. var _impure_ptr : PREENT;cvar;external;
  330. {$endif win32}
  331. {$endif not GDB_V416}
  332. type
  333. tgdbbuffer=object
  334. buf : pchar;
  335. size,
  336. idx : longint;
  337. {$ifdef GDB_V418}
  338. link : pgdb_file;
  339. {$endif not GDB_V418}
  340. {$ifdef GDB_V5}
  341. gdb_file : pui_file;
  342. {$endif not GDB_V5}
  343. constructor Init;
  344. destructor Done;
  345. procedure Reset;
  346. procedure Resize(nsize : longint);
  347. procedure Append(p:pchar);
  348. procedure lappend(p:pchar;len : longint);
  349. end;
  350. pgdbinterface=^tgdbinterface;
  351. tgdbinterface=object
  352. gdberrorbuf,
  353. gdboutputbuf : tgdbbuffer;
  354. got_error,
  355. reset_command,
  356. call_reset,
  357. signaled,
  358. Debuggee_started : boolean;
  359. { frames and frame info while recording a frame }
  360. frames : ppframeentry;
  361. frame_size,
  362. frame_count : longint;
  363. record_frames,
  364. frame_begin_seen : boolean;
  365. frame_level,
  366. command_level,
  367. stop_breakpoint_number,
  368. current_address,
  369. current_line_number,
  370. signal_start,
  371. signal_end,
  372. signal_name_start,
  373. signal_name_end,
  374. error_start,
  375. error_end,
  376. function_start,
  377. function_end,
  378. args_start,
  379. args_end,
  380. file_start,
  381. file_end,
  382. line_start,
  383. line_end : longint;
  384. signal_name,
  385. signal_string : pchar;
  386. current_pc : CORE_ADDR;
  387. { breakpoint }
  388. last_breakpoint_number,
  389. last_breakpoint_address,
  390. last_breakpoint_line : longint;
  391. last_breakpoint_file : pchar;
  392. invalid_breakpoint_line : boolean;
  393. { init }
  394. constructor init;
  395. destructor done;
  396. { Lowlevel }
  397. function error:boolean;
  398. function error_num:longint;
  399. procedure gdb_command(const s:string);
  400. procedure gdb__init;
  401. procedure gdb_done;
  402. procedure resize_frames;
  403. function add_frameentry:pframeentry;
  404. function get_frameentry(level : longint):pframeentry;
  405. function get_current_frame : longint;
  406. function set_current_frame(level : longint) : boolean;
  407. procedure clear_frames;
  408. { Highlevel }
  409. user_screen_shown,
  410. switch_to_user : boolean;
  411. procedure GetAddrSyminfo(addr:longint;var si:tsyminfo);
  412. procedure SelectSourceline(fn:pchar;line:longint);
  413. procedure StartSession;
  414. procedure BreakSession;
  415. procedure EndSession(code:longint);
  416. procedure DebuggerScreen;
  417. procedure UserScreen;
  418. { Hooks }
  419. procedure DoSelectSourceline(const fn:string;line:longint);virtual;
  420. procedure DoStartSession;virtual;
  421. procedure DoBreakSession;virtual;
  422. procedure DoEndSession(code:longint);virtual;
  423. procedure DoUserSignal;virtual;
  424. procedure DoDebuggerScreen;virtual;
  425. procedure DoUserScreen;virtual;
  426. function AllowQuit : boolean;virtual;
  427. end;
  428. function GDBVersion : string;
  429. var
  430. curr_gdb : pgdbinterface;
  431. const
  432. use_gdb_file : boolean = false;
  433. var
  434. gdb_file : text;
  435. {$ifdef GDB_USES_PTID}
  436. inferior_ptid : tinferior_ptid;cvar;external;
  437. {$else}
  438. inferior_pid : longint;cvar;external;
  439. {$endif}
  440. {$ifdef go32v2}
  441. { needed to be sure %fs contains the DOS memory selector
  442. used in Mem[] code PM }
  443. procedure reload_fs;
  444. {$endif go32v2}
  445. {$ifdef GDB_USES_PTID}
  446. function inferior_pid : longint;
  447. {$endif}
  448. implementation
  449. uses
  450. {$ifdef win32}
  451. initc,
  452. {$endif win32}
  453. {$ifdef unix}
  454. {$ifdef ver1_0}
  455. linux,
  456. {$else}
  457. unix,
  458. {$endif}
  459. {$endif}
  460. {$ifdef go32v2}
  461. go32,
  462. dpmiexcp,
  463. initc,
  464. {$endif}
  465. strings;
  466. {*****************************************************************************
  467. Types used by libgdb.a
  468. *****************************************************************************}
  469. {$ifdef go32v2}
  470. type
  471. jmp_buf = dpmi_jmp_buf;
  472. pjmp_buf = pdpmi_jmp_buf;
  473. function setjmp(var rec : jmp_buf) : longint;cdecl;external;
  474. procedure longjmp(var rec : jmp_buf;return_value : longint);cdecl;external;
  475. procedure reload_fs;assembler;
  476. asm
  477. movw dosmemselector,%ax
  478. movw %ax,%fs
  479. end['EAX'];
  480. {$endif}
  481. {$ifdef win32}
  482. type
  483. jmp_buf = record
  484. case byte of
  485. 0 :
  486. { greatest value found in cygwin machine/setjmp.h for i386 }
  487. (unknown_field : array [1..13] of longint;);
  488. 1 :
  489. (eax,ebx,ecx,edx : longint;
  490. esi,edi,ebp,esp,eip : longint;);
  491. end;
  492. pjmp_buf = ^jmp_buf;
  493. function setjmp(var rec : jmp_buf) : longint;cdecl;external;
  494. procedure longjmp(var rec : jmp_buf;return_value : longint);cdecl;external;
  495. {$ifndef supportexceptions}
  496. type
  497. { I don't think FPC would accept that
  498. the funcvar return type is the funcvar type itself ! PM }
  499. SignalHandler = Procedure(Sig : LongInt);cdecl;
  500. function signal(sig : longint;new_signal : SignalHandler) : SignalHandler;cdecl;external;
  501. {define supportexceptions not yet working }
  502. {$endif now exceptions are supported for win32}
  503. {$endif win32}
  504. type
  505. pCORE_ADDR = ^CORE_ADDR;
  506. pblock = ^block;
  507. tlanguage = (language_unknown,language_auto,language_c,
  508. language_cplus,language_java,language_chill,
  509. language_fortran,language_m2,language_asm,
  510. language_scm,language_pascal,language_objc);
  511. bptype = (bp_breakpoint,bp_hardware_breakpoint,
  512. bp_until,bp_finish,bp_watchpoint,bp_hardware_watchpoint,
  513. bp_read_watchpoint,bp_access_watchpoint,
  514. bp_longjmp,bp_longjmp_resume,bp_step_resume,
  515. bp_through_sigtramp,bp_watchpoint_scope,
  516. bp_call_dummy,bp_shlib_event);
  517. tenable = (disabled,enabled,shlib_disabled);
  518. bpdisp = (del,del_at_next_stop,disable,donttouch);
  519. {$PACKRECORDS 4}
  520. pbreakpoint = ^breakpoint;
  521. breakpoint = record
  522. next : pbreakpoint;
  523. typ : bptype;
  524. enable : tenable;
  525. disposition : bpdisp;
  526. number : longint;
  527. address : CORE_ADDR;
  528. line_number : longint;
  529. source_file : pchar;
  530. silent : byte;
  531. ignore_count : longint;
  532. shadow_contents : array[0..15] of char;
  533. inserted : char;
  534. duplicate : char;
  535. commands : pointer; {^command_line}
  536. frame : CORE_ADDR;
  537. cond : pointer; {^expression}
  538. addr_string : ^char;
  539. language : tlanguage;
  540. input_radix : longint;
  541. cond_string : ^char;
  542. exp_string : ^char;
  543. exp : pointer; {^expression}
  544. exp_valid_block : pblock; {^block;}
  545. val : pointer; {value_ptr;}
  546. val_chain : pointer; {value_ptr;}
  547. related_breakpoint : pbreakpoint;
  548. watchpoint_frame : CORE_ADDR;
  549. thread : longint;
  550. hit_count : longint;
  551. section : pointer; {^asection}
  552. end;
  553. tfreecode=(free_nothing,free_contents,free_linetable);
  554. psymtab = ^symtab;
  555. symtab = record
  556. next : psymtab;
  557. blockvector : pointer; {^blockvector;}
  558. linetable : pointer; {^linetable;}
  559. block_line_section : longint;
  560. primary : longint;
  561. {$ifdef GDB_SYMTAB_HAS_MACROS}
  562. { new field added in the middle :( }
  563. macro_table : pointer;
  564. {$endif GDB_SYMTAB_HAS_MACROS}
  565. filename : pchar;
  566. dirname : pchar;
  567. free_code : tfreecode;
  568. free_ptr : pchar;
  569. nlines : longint;
  570. line_charpos : ^longint;
  571. language : tlanguage;
  572. Debugformat : pchar;
  573. version : pchar;
  574. fullname : pchar;
  575. objfile : pointer; {^objfile;}
  576. end;
  577. psymtab_and_line = ^symtab_and_line;
  578. symtab_and_line = record
  579. symtab : psymtab;
  580. {$ifndef GDB_V416}
  581. { v4.16 does not have the section field !! }
  582. section : pointer; {^asection;}
  583. {$endif GDB_V416}
  584. line : longint;
  585. pc : CORE_ADDR;
  586. _end : CORE_ADDR;
  587. end;
  588. symtabs_and_lines = record
  589. sals : ^symtab_and_line;
  590. nelts : longint;
  591. end;
  592. psymbol = ^symbol;
  593. pminimal_symbol = ^minimal_symbol;
  594. general_symbol_info = record
  595. (* Name of the symbol. This is a required field. Storage for the name is
  596. allocated on the psymbol_obstack or symbol_obstack for the associated
  597. objfile. *)
  598. _name : pchar;
  599. (* Value of the symbol. Which member of this union to use, and what
  600. it means, depends on what kind of symbol this is and its
  601. SYMBOL_CLASS. See comments there for more details. All of these
  602. are in host byte order (though what they point to might be in
  603. target byte order, e.g. LOC_CONST_BYTES). *)
  604. value : record
  605. case integer of
  606. (* The fact that this is a long not a LONGEST mainly limits the
  607. range of a LOC_CONST. Since LOC_CONST_BYTES exists, I'm not
  608. sure that is a big deal. *)
  609. 0 : (ivalue : longint;);
  610. 1 : (block : pblock;);
  611. 2 : (bytes : pchar;);
  612. 3 : (address : CORE_ADDR;);
  613. (* for opaque typedef struct chain *)
  614. 4 : (chain : psymbol;);
  615. end;
  616. (* Since one and only one language can apply, wrap the language specific
  617. information inside a union. *)
  618. (* union
  619. {
  620. struct cplus_specific /* For C++ */
  621. /* and Java */
  622. {
  623. char *demangled_name;
  624. } cplus_specific;
  625. struct chill_specific /* For Chill */
  626. {
  627. char *demangled_name;
  628. } chill_specific;
  629. } language_specific; *)
  630. demangled_name : pchar;
  631. (* Record the source code language that applies to this symbol.
  632. This is used to select one of the fields from the language specific
  633. union above. *)
  634. language : tlanguage;
  635. (* Which section is this symbol in? This is an index into
  636. section_offsets for this objfile. Negative means that the symbol
  637. does not get relocated relative to a section.
  638. Disclaimer: currently this is just used for xcoff, so don't
  639. expect all symbol-reading code to set it correctly (the ELF code
  640. also tries to set it correctly). *)
  641. section : word;
  642. (* The bfd section associated with this symbol. *)
  643. bfd_section : pointer {^asection};
  644. end; { of general_symbol_info record declaration }
  645. tminimal_symbol_type =
  646. (
  647. mst_unknown := 0, (* Unknown type, the default *)
  648. mst_text, (* Generally executable instructions *)
  649. mst_data, (* Generally initialized data *)
  650. mst_bss, (* Generally uninitialized data *)
  651. mst_abs, (* Generally absolute (nonrelocatable) *)
  652. (* GDB uses mst_solib_trampoline for the start address of a shared
  653. library trampoline entry. Breakpoints for shared library functions
  654. are put there if the shared library is not yet loaded.
  655. After the shared library is loaded, lookup_minimal_symbol will
  656. prefer the minimal symbol from the shared library (usually
  657. a mst_text symbol) over the mst_solib_trampoline symbol, and the
  658. breakpoints will be moved to their true address in the shared
  659. library via breakpoint_re_set. *)
  660. mst_solib_trampoline, (* Shared library trampoline code *)
  661. (* For the mst_file* types, the names are only guaranteed to be unique
  662. within a given .o file. *)
  663. mst_file_text, (* Static version of mst_text *)
  664. mst_file_data, (* Static version of mst_data *)
  665. mst_file_bss (* Static version of mst_bss *)
  666. );
  667. namespace_enum = (
  668. (* UNDEF_NAMESPACE is used when a namespace has not been discovered or
  669. none of the following apply. This usually indicates an error either
  670. in the symbol information or in gdb's handling of symbols. *)
  671. UNDEF_NAMESPACE,
  672. (* VAR_NAMESPACE is the usual namespace. In C, this contains variables,
  673. function names, typedef names and enum type values. *)
  674. VAR_NAMESPACE,
  675. (* STRUCT_NAMESPACE is used in C to hold struct, union and enum type names.
  676. Thus, if `struct foo' is used in a C program, it produces a symbol named
  677. `foo' in the STRUCT_NAMESPACE. *)
  678. STRUCT_NAMESPACE,
  679. (* LABEL_NAMESPACE may be used for names of labels (for gotos);
  680. currently it is not used and labels are not recorded at all. *)
  681. LABEL_NAMESPACE,
  682. (* Searching namespaces. These overlap with VAR_NAMESPACE, providing
  683. some granularity with the search_symbols function. *)
  684. (* Everything in VAR_NAMESPACE minus FUNCTIONS_-, TYPES_-, and
  685. METHODS_NAMESPACE *)
  686. VARIABLES_NAMESPACE,
  687. (* All functions -- for some reason not methods, though. *)
  688. FUNCTIONS_NAMESPACE,
  689. (* All defined types *)
  690. TYPES_NAMESPACE,
  691. (* All class methods -- why is this separated out? *)
  692. METHODS_NAMESPACE
  693. );
  694. address_class = (
  695. (* Not used; catches errors *)
  696. LOC_UNDEF,
  697. (* Value is constant int SYMBOL_VALUE, host byteorder *)
  698. LOC_CONST,
  699. (* Value is at fixed address SYMBOL_VALUE_ADDRESS *)
  700. LOC_STATIC,
  701. (* Value is in register. SYMBOL_VALUE is the register number. *)
  702. LOC_REGISTER,
  703. (* It's an argument; the value is at SYMBOL_VALUE offset in arglist. *)
  704. LOC_ARG,
  705. (* Value address is at SYMBOL_VALUE offset in arglist. *)
  706. LOC_REF_ARG,
  707. (* Value is in register number SYMBOL_VALUE. Just like LOC_REGISTER
  708. except this is an argument. Probably the cleaner way to handle
  709. this would be to separate address_class (which would include
  710. separate ARG and LOCAL to deal with FRAME_ARGS_ADDRESS versus
  711. FRAME_LOCALS_ADDRESS), and an is_argument flag.
  712. For some symbol formats (stabs, for some compilers at least),
  713. the compiler generates two symbols, an argument and a register.
  714. In some cases we combine them to a single LOC_REGPARM in symbol
  715. reading, but currently not for all cases (e.g. it's passed on the
  716. stack and then loaded into a register). *)
  717. LOC_REGPARM,
  718. (* Value is in specified register. Just like LOC_REGPARM except the
  719. register holds the address of the argument instead of the argument
  720. itself. This is currently used for the passing of structs and unions
  721. on sparc and hppa. It is also used for call by reference where the
  722. address is in a register, at least by mipsread.c. *)
  723. LOC_REGPARM_ADDR,
  724. (* Value is a local variable at SYMBOL_VALUE offset in stack frame. *)
  725. LOC_LOCAL,
  726. (* Value not used; definition in SYMBOL_TYPE. Symbols in the namespace
  727. STRUCT_NAMESPACE all have this class. *)
  728. LOC_TYPEDEF,
  729. (* Value is address SYMBOL_VALUE_ADDRESS in the code *)
  730. LOC_LABEL,
  731. (* In a symbol table, value is SYMBOL_BLOCK_VALUE of a `struct block'.
  732. In a partial symbol table, SYMBOL_VALUE_ADDRESS is the start address
  733. of the block. Function names have this class. *)
  734. LOC_BLOCK,
  735. (* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_BYTES, in
  736. target byte order. *)
  737. LOC_CONST_BYTES,
  738. (* Value is arg at SYMBOL_VALUE offset in stack frame. Differs from
  739. LOC_LOCAL in that symbol is an argument; differs from LOC_ARG in
  740. that we find it in the frame (FRAME_LOCALS_ADDRESS), not in the
  741. arglist (FRAME_ARGS_ADDRESS). Added for i960, which passes args
  742. in regs then copies to frame. *)
  743. LOC_LOCAL_ARG,
  744. (* Value is at SYMBOL_VALUE offset from the current value of
  745. register number SYMBOL_BASEREG. This exists mainly for the same
  746. things that LOC_LOCAL and LOC_ARG do; but we need to do this
  747. instead because on 88k DWARF gives us the offset from the
  748. frame/stack pointer, rather than the offset from the "canonical
  749. frame address" used by COFF, stabs, etc., and we don't know how
  750. to convert between these until we start examining prologues.
  751. Note that LOC_BASEREG is much less general than a DWARF expression.
  752. We don't need the generality (at least not yet), and storing a general
  753. DWARF expression would presumably take up more space than the existing
  754. scheme. *)
  755. LOC_BASEREG,
  756. (* Same as LOC_BASEREG but it is an argument. *)
  757. LOC_BASEREG_ARG,
  758. (* Value is at fixed address, but the address of the variable has
  759. to be determined from the minimal symbol table whenever the
  760. variable is referenced.
  761. This happens if debugging information for a global symbol is
  762. emitted and the corresponding minimal symbol is defined
  763. in another object file or runtime common storage.
  764. The linker might even remove the minimal symbol if the global
  765. symbol is never referenced, in which case the symbol remains
  766. unresolved. *)
  767. LOC_UNRESOLVED,
  768. (* Value is at a thread-specific location calculated by a
  769. target-specific method. *)
  770. LOC_THREAD_LOCAL_STATIC,
  771. (* The variable does not actually exist in the program.
  772. The value is ignored. *)
  773. LOC_OPTIMIZED_OUT,
  774. (* The variable is static, but actually lives at * (address).
  775. * I.e. do an extra indirection to get to it.
  776. * This is used on HP-UX to get at globals that are allocated
  777. * in shared libraries, where references from images other
  778. * than the one where the global was allocated are done
  779. * with a level of indirection.
  780. *)
  781. LOC_INDIRECT
  782. );
  783. minimal_symbol = record
  784. (* The general symbol info required for all types of symbols.
  785. The SYMBOL_VALUE_ADDRESS contains the address that this symbol
  786. corresponds to. *)
  787. ginfo : general_symbol_info;
  788. (* The info field is available for caching machine-specific information
  789. so it doesn't have to rederive the info constantly (over a serial line).
  790. It is initialized to zero and stays that way until target-dependent code
  791. sets it. Storage for any data pointed to by this field should be allo-
  792. cated on the symbol_obstack for the associated objfile.
  793. The type would be "void *" except for reasons of compatibility with older
  794. compilers. This field is optional.
  795. Currently, the AMD 29000 tdep.c uses it to remember things it has decoded
  796. from the instructions in the function header, and the MIPS-16 code uses
  797. it to identify 16-bit procedures. *)
  798. info : pchar;
  799. {$ifdef SOFUN_ADDRESS_MAYBE_MISSING}
  800. (* Which source file is this symbol in? Only relevant for mst_file_*. *)
  801. filename : pchar;
  802. {$endif}
  803. (* Classification types for this symbol. These should be taken as "advisory
  804. only", since if gdb can't easily figure out a classification it simply
  805. selects mst_unknown. It may also have to guess when it can't figure out
  806. which is a better match between two types (mst_data versus mst_bss) for
  807. example. Since the minimal symbol info is sometimes derived from the
  808. BFD library's view of a file, we need to live with what information bfd
  809. supplies. *)
  810. minimal_symbol_type : tminimal_symbol_type;
  811. end{ of minimal_symbol};
  812. block = record
  813. (* Addresses in the executable code that are in this block. *)
  814. startaddr,
  815. endaddr : CORE_ADDR ;
  816. (* The symbol that names this block, if the block is the body of a
  817. function; otherwise, zero. *)
  818. _function : psymbol;
  819. (* The `struct block' for the containing block, or 0 if none.
  820. The superblock of a top-level local block (i.e. a function in the
  821. case of C) is the STATIC_BLOCK. The superblock of the
  822. STATIC_BLOCK is the GLOBAL_BLOCK. *)
  823. superblock : pblock;
  824. (* Version of GCC used to compile the function corresponding
  825. to this block, or 0 if not compiled with GCC. When possible,
  826. GCC should be compatible with the native compiler, or if that
  827. is not feasible, the differences should be fixed during symbol
  828. reading. As of 16 Apr 93, this flag is never used to distinguish
  829. between gcc2 and the native compiler.
  830. If there is no function corresponding to this block, this meaning
  831. of this flag is undefined. *)
  832. gcc_compile_flag : byte;
  833. (* Number of local symbols. *)
  834. nsyms : longint;
  835. (* The symbols. If some of them are arguments, then they must be
  836. in the order in which we would like to print them. *)
  837. sym : array [0..0] of psymbol;
  838. end { of block definition };
  839. symbol = record
  840. (* The general symbol info required for all types of symbols. *)
  841. ginfo : general_symbol_info;
  842. (* Data type of value *)
  843. _type : pointer{ptype};
  844. (* Name space code. *)
  845. namespace : namespace_enum;
  846. (* Address class *)
  847. aclass : address_class;
  848. (* Line number of definition. FIXME: Should we really make the assumption
  849. that nobody will try to debug files longer than 64K lines? What about
  850. machine generated programs? *)
  851. line : word;
  852. (* Some symbols require an additional value to be recorded on a per-
  853. symbol basis. Stash those values here. *)
  854. (*union
  855. {
  856. /* Used by LOC_BASEREG and LOC_BASEREG_ARG. */
  857. short basereg;
  858. } *)
  859. aux_value_base_reg : word;
  860. (* Link to a list of aliases for this symbol.
  861. Only a "primary/main symbol may have aliases. *)
  862. aliases : pointer{palias_list};
  863. (* List of ranges where this symbol is active. This is only
  864. used by alias symbols at the current time. *)
  865. ranges : pointer{prange_list};
  866. end;
  867. target_signal = (TARGET_SIGNAL_FIRST := 0,
  868. TARGET_SIGNAL_HUP := 1,TARGET_SIGNAL_INT := 2,
  869. TARGET_SIGNAL_QUIT := 3,TARGET_SIGNAL_ILL := 4,
  870. TARGET_SIGNAL_TRAP := 5,TARGET_SIGNAL_ABRT := 6,
  871. TARGET_SIGNAL_EMT := 7,TARGET_SIGNAL_FPE := 8,
  872. TARGET_SIGNAL_KILL := 9,TARGET_SIGNAL_BUS := 10,
  873. TARGET_SIGNAL_SEGV := 11,TARGET_SIGNAL_SYS := 12,
  874. TARGET_SIGNAL_PIPE := 13,TARGET_SIGNAL_ALRM := 14,
  875. TARGET_SIGNAL_TERM := 15,TARGET_SIGNAL_URG := 16,
  876. TARGET_SIGNAL_STOP := 17,TARGET_SIGNAL_TSTP := 18,
  877. TARGET_SIGNAL_CONT := 19,TARGET_SIGNAL_CHLD := 20,
  878. TARGET_SIGNAL_TTIN := 21,TARGET_SIGNAL_TTOU := 22,
  879. TARGET_SIGNAL_IO := 23,TARGET_SIGNAL_XCPU := 24,
  880. TARGET_SIGNAL_XFSZ := 25,TARGET_SIGNAL_VTALRM := 26,
  881. TARGET_SIGNAL_PROF := 27,TARGET_SIGNAL_WINCH := 28,
  882. TARGET_SIGNAL_LOST := 29,TARGET_SIGNAL_USR1 := 30,
  883. TARGET_SIGNAL_USR2 := 31,TARGET_SIGNAL_PWR := 32,
  884. TARGET_SIGNAL_POLL := 33,TARGET_SIGNAL_WIND := 34,
  885. TARGET_SIGNAL_PHONE := 35,TARGET_SIGNAL_WAITING := 36,
  886. TARGET_SIGNAL_LWP := 37,TARGET_SIGNAL_DANGER := 38,
  887. TARGET_SIGNAL_GRANT := 39,TARGET_SIGNAL_RETRACT := 40,
  888. TARGET_SIGNAL_MSG := 41,TARGET_SIGNAL_SOUND := 42,
  889. TARGET_SIGNAL_SAK := 43,TARGET_SIGNAL_PRIO := 44,
  890. TARGET_SIGNAL_REALTIME_33 := 45,TARGET_SIGNAL_REALTIME_34 := 46,
  891. TARGET_SIGNAL_REALTIME_35 := 47,TARGET_SIGNAL_REALTIME_36 := 48,
  892. TARGET_SIGNAL_REALTIME_37 := 49,TARGET_SIGNAL_REALTIME_38 := 50,
  893. TARGET_SIGNAL_REALTIME_39 := 51,TARGET_SIGNAL_REALTIME_40 := 52,
  894. TARGET_SIGNAL_REALTIME_41 := 53,TARGET_SIGNAL_REALTIME_42 := 54,
  895. TARGET_SIGNAL_REALTIME_43 := 55,TARGET_SIGNAL_REALTIME_44 := 56,
  896. TARGET_SIGNAL_REALTIME_45 := 57,TARGET_SIGNAL_REALTIME_46 := 58,
  897. TARGET_SIGNAL_REALTIME_47 := 59,TARGET_SIGNAL_REALTIME_48 := 60,
  898. TARGET_SIGNAL_REALTIME_49 := 61,TARGET_SIGNAL_REALTIME_50 := 62,
  899. TARGET_SIGNAL_REALTIME_51 := 63,TARGET_SIGNAL_REALTIME_52 := 64,
  900. TARGET_SIGNAL_REALTIME_53 := 65,TARGET_SIGNAL_REALTIME_54 := 66,
  901. TARGET_SIGNAL_REALTIME_55 := 67,TARGET_SIGNAL_REALTIME_56 := 68,
  902. TARGET_SIGNAL_REALTIME_57 := 69,TARGET_SIGNAL_REALTIME_58 := 70,
  903. TARGET_SIGNAL_REALTIME_59 := 71,TARGET_SIGNAL_REALTIME_60 := 72,
  904. TARGET_SIGNAL_REALTIME_61 := 73,TARGET_SIGNAL_REALTIME_62 := 74,
  905. TARGET_SIGNAL_REALTIME_63 := 75,TARGET_SIGNAL_UNKNOWN,
  906. TARGET_SIGNAL_DEFAULT,TARGET_SIGNAL_LAST
  907. );
  908. strata = (dummy_stratum,file_stratum,core_stratum,download_stratum,process_stratum);
  909. ptarget_ops = ^target_ops;
  910. target_ops = record
  911. to_shortname : pchar;
  912. to_longname : pchar;
  913. to_doc : pchar;
  914. to_open : procedure (_para1:pchar; _para2:longint);
  915. to_close : procedure (_para1:longint);
  916. to_attach : procedure (_para1:pchar; _para2:longint);
  917. to_detach : procedure (_para1:pchar; _para2:longint);
  918. to_resume : procedure (_para1:longint; _para2:longint; _para3:target_signal);
  919. to_wait : pointer; {function (_para1:longint; _para2:ptarget_waitstatus):longint;}
  920. to_fetch_registers : procedure (_para1:longint);
  921. to_store_registers : procedure (_para1:longint);
  922. to_prepare_to_store : procedure ;
  923. to_xfer_memory : function (memaddr:CORE_ADDR; myaddr:pchar; len:longint; write:longint; target:ptarget_ops):longint;
  924. to_files_info : procedure (_para1:ptarget_ops);
  925. to_insert_breakpoint : function (_para1:CORE_ADDR; _para2:pchar):longint;
  926. to_remove_breakpoint : function (_para1:CORE_ADDR; _para2:pchar):longint;
  927. to_terminal_init : procedure ;
  928. to_terminal_inferior : procedure ;
  929. to_terminal_ours_for_output : procedure ;
  930. to_terminal_ours : procedure ;
  931. to_terminal_info : procedure (_para1:pchar; _para2:longint);
  932. to_kill : procedure ;
  933. to_load : procedure (_para1:pchar; _para2:longint);
  934. to_lookup_symbol : function (_para1:pchar; _para2:pCORE_ADDR):longint;
  935. to_create_inferior : procedure (_para1:pchar; _para2:pchar; _para3:ppchar);
  936. to_mourn_inferior : procedure ;
  937. to_can_run : function :longint;
  938. to_notice_signals : procedure (pid:longint);
  939. to_thread_alive : function (pid:longint):longint;
  940. to_stop : procedure ;
  941. to_stratum : strata;
  942. DONT_USE : pointer;
  943. to_has_all_memory : longint;
  944. to_has_memory : longint;
  945. to_has_stack : longint;
  946. to_has_registers : longint;
  947. to_has_execution : longint;
  948. to_sections : pointer; {^section_table}
  949. to_sections_end : pointer; {^section_table}
  950. to_magic : longint;
  951. end;
  952. {$PACKRECORDS NORMAL}
  953. {*****************************************************************************
  954. Define external calls to libgdb.a
  955. *****************************************************************************}
  956. var
  957. { external variables }
  958. error_return : jmp_buf;cvar;{$ifndef GDB_V5}external;{$endif}
  959. quit_return : jmp_buf;cvar;{$ifndef GDB_V5}external;{$endif}
  960. create_breakpoint_hook : pointer;cvar;external;
  961. current_target : target_ops;cvar;external;
  962. stop_pc : CORE_ADDR;cvar;external;
  963. { Only used from GDB 5.01 but doesn't hurst otherwise }
  964. interpreter_p : pchar;cvar;
  965. { we need also to declare some vars }
  966. watchdog : longint;cvar;public;
  967. gdb_error : longint;cvar;public;
  968. display_time : longbool;cvar;public;
  969. display_space : longbool;cvar;public;
  970. {$ifndef GDB_V416}
  971. { the following are also needed from version 4.18 }
  972. { Whether this is the command line version or not }
  973. tui_version : longint;cvar;public;
  974. { Whether xdb commands will be handled }
  975. xdb_commands : longint;cvar;public;
  976. { Whether dbx commands will be handled }
  977. dbx_commands : longint;cvar;public;
  978. {$ifndef GDB_V5}
  979. var
  980. gdb_stdout : PGDB_FILE;cvar;public;
  981. gdb_stderr : PGDB_FILE;cvar;public;
  982. {$else GDB_V5}
  983. var
  984. gdb_stdout : pui_file;cvar;public;
  985. gdb_stderr : pui_file;cvar;public;
  986. gdb_stdlog : pui_file;cvar;public;
  987. gdb_stdtarg : pui_file;cvar;public;
  988. event_loop_p : longint;cvar;public;
  989. {$endif GDB_V5}
  990. { used for gdb_stdout and gdb_stderr }
  991. function xmalloc(size : longint) : pointer;cdecl;external;
  992. {$endif not GDB_V416}
  993. function find_pc_line(i:CORE_ADDR;l:longint):symtab_and_line;cdecl;external;
  994. function find_pc_function(i:CORE_ADDR):psymbol;cdecl;external;
  995. function lookup_minimal_symbol_by_pc(i : CORE_ADDR):pminimal_symbol;cdecl;external;
  996. procedure gdb_init;cdecl;external;
  997. procedure execute_command(p:pchar;i:longint);cdecl;external;
  998. procedure target_kill;cdecl;external;
  999. procedure target_close(i:longint);cdecl;external;
  1000. {*****************************************************************************
  1001. Helpers
  1002. *****************************************************************************}
  1003. procedure Debug(const s:string);
  1004. begin
  1005. if use_gdb_file then
  1006. Writeln(gdb_file,s)
  1007. else
  1008. Writeln(s);
  1009. end;
  1010. {*****************************************************************************
  1011. TFrameEntry
  1012. *****************************************************************************}
  1013. constructor tframeentry.init;
  1014. begin
  1015. Reset;
  1016. end;
  1017. destructor tframeentry.done;
  1018. begin
  1019. Clear;
  1020. end;
  1021. procedure tframeentry.reset;
  1022. begin
  1023. file_name:=nil;
  1024. function_name:=nil;
  1025. args:=nil;
  1026. line_number:=0;
  1027. address:=0;
  1028. end;
  1029. procedure tframeentry.clear;
  1030. begin
  1031. if assigned(file_name) then
  1032. strdispose(file_name);
  1033. if assigned(function_name) then
  1034. strdispose(function_name);
  1035. if assigned(args) then
  1036. strdispose(args);
  1037. reset;
  1038. end;
  1039. {*****************************************************************************
  1040. tgdbbuffer
  1041. *****************************************************************************}
  1042. const
  1043. blocksize=2048;
  1044. constructor tgdbbuffer.init;
  1045. begin
  1046. Buf:=nil;
  1047. {$ifdef GDB_V418}
  1048. link:=nil;
  1049. {$endif GDB_V418}
  1050. {$ifdef GDB_V5}
  1051. gdb_file:=nil;
  1052. {$endif GDB_V5}
  1053. Size:=0;
  1054. Resize(blocksize);
  1055. Reset;
  1056. end;
  1057. destructor tgdbbuffer.done;
  1058. begin
  1059. if assigned(buf) then
  1060. freemem(buf,size);
  1061. {$ifdef GDB_V418}
  1062. if assigned(link) then
  1063. begin
  1064. link^.ts_streamtype:=afile;
  1065. link^.ts_strbuf:=nil;
  1066. link^.ts_buflen:=0;
  1067. end;
  1068. {$endif GDB_V418}
  1069. end;
  1070. procedure tgdbbuffer.reset;
  1071. begin
  1072. idx:=0;
  1073. Buf[0]:=#0;
  1074. end;
  1075. procedure tgdbbuffer.append(p:pchar);
  1076. var
  1077. len : longint;
  1078. begin
  1079. if not assigned(p) then
  1080. exit;
  1081. len:=Strlen(p);
  1082. if len+idx>size then
  1083. Resize(len+idx);
  1084. Move(p^,buf[idx],len);
  1085. inc(idx,len);
  1086. buf[idx]:=#0;
  1087. end;
  1088. procedure tgdbbuffer.lappend(p:pchar;len : longint);
  1089. begin
  1090. if not assigned(p) then
  1091. exit;
  1092. if len+idx>size then
  1093. Resize(len+idx);
  1094. Move(p^,buf[idx],len);
  1095. inc(idx,len);
  1096. buf[idx]:=#0;
  1097. end;
  1098. procedure tgdbbuffer.resize(nsize : longint);
  1099. var
  1100. np : pchar;
  1101. begin
  1102. nsize:=((nsize+blocksize-1) div blocksize)*blocksize;
  1103. getmem(np,nsize);
  1104. if assigned(buf) then
  1105. begin
  1106. move(buf^,np^,size);
  1107. freemem(buf,size);
  1108. end;
  1109. buf:=np;
  1110. size:=nsize;
  1111. {$ifdef GDB_V418}
  1112. if assigned(link) then
  1113. begin
  1114. link^.ts_strbuf:=buf;
  1115. link^.ts_buflen:=size;
  1116. end;
  1117. {$endif GDB_V418}
  1118. end;
  1119. {*****************************************************************************
  1120. Hook calls from libgdb.a
  1121. *****************************************************************************}
  1122. {$ifdef go32v2}
  1123. procedure gdbpas_prev_exception_handler;cdecl;public;
  1124. begin
  1125. end;
  1126. {$endif go32v2}
  1127. procedure init_proc;cdecl;public;
  1128. begin
  1129. end;
  1130. procedure annotate_signalled;cdecl;public;
  1131. begin
  1132. {$ifdef Verbose}
  1133. Debug('|signalled|');
  1134. {$endif}
  1135. end;
  1136. procedure annotate_signal_name;cdecl;public;
  1137. begin
  1138. {$ifdef Verbose}
  1139. Debug('|signal_name|');
  1140. {$endif}
  1141. with curr_gdb^ do
  1142. signal_name_start:=gdboutputbuf.idx;
  1143. end;
  1144. procedure annotate_signal_name_end;cdecl;public;
  1145. begin
  1146. {$ifdef Verbose}
  1147. Debug('|signal_name_end|');
  1148. {$endif}
  1149. with curr_gdb^ do
  1150. signal_name_end:=gdboutputbuf.idx;
  1151. end;
  1152. procedure annotate_signal_string;cdecl;public;
  1153. begin
  1154. {$ifdef Verbose}
  1155. Debug('|signal_string|');
  1156. {$endif}
  1157. with curr_gdb^ do
  1158. signal_start:=gdboutputbuf.idx;
  1159. end;
  1160. procedure annotate_signal_string_end;cdecl;public;
  1161. var
  1162. c : char;
  1163. begin
  1164. {$ifdef Verbose}
  1165. Debug('|signal_string_end|');
  1166. {$endif}
  1167. with curr_gdb^ do
  1168. begin
  1169. signal_end:=gdboutputbuf.idx;
  1170. c:=gdboutputbuf.buf[signal_end];
  1171. gdboutputbuf.buf[signal_end]:=#0;
  1172. if assigned(signal_string) then
  1173. strdispose(signal_string);
  1174. signal_string:=strnew(gdboutputbuf.buf+signal_start);
  1175. gdboutputbuf.buf[signal_end]:=c;
  1176. c:=gdboutputbuf.buf[signal_name_end];
  1177. gdboutputbuf.buf[signal_name_end]:=#0;
  1178. if assigned(signal_name) then
  1179. strdispose(signal_name);
  1180. signal_name:=strnew(gdboutputbuf.buf+signal_name_start);
  1181. gdboutputbuf.buf[signal_name_end]:=c;
  1182. if (user_screen_shown) then
  1183. begin
  1184. DebuggerScreen;
  1185. DoUserSignal;
  1186. UserScreen;
  1187. end
  1188. else
  1189. DoUserSignal;
  1190. call_reset:=true;
  1191. signaled:=false;
  1192. end;
  1193. end;
  1194. procedure annotate_signal;cdecl;public;
  1195. begin
  1196. {$ifdef Verbose}
  1197. Debug('|signal|');
  1198. {$endif}
  1199. with curr_gdb^ do
  1200. signaled:=true;
  1201. end;
  1202. procedure annotate_exited(exitstatus:longint);cdecl;public;
  1203. begin
  1204. {$ifdef Verbose}
  1205. Debug('|exited|');
  1206. {$endif}
  1207. {#ifdef __DJGPP__
  1208. /* this is very important. The exit code of a djgpp program
  1209. disables interrupts and after this there is no other interrupt
  1210. called, which enables interrupts with the iret. */
  1211. __dpmi_get_and_enable_virtual_interrupt_state();
  1212. #endif }
  1213. {$ifdef go32v2}
  1214. {$asmmode att}
  1215. asm
  1216. movw $0x901,%ax
  1217. int $0x31
  1218. end;
  1219. {$asmmode default}
  1220. reload_fs;
  1221. {$endif def go32v2}
  1222. curr_gdb^.DebuggerScreen;
  1223. { DeleteBreakPoints; }
  1224. curr_gdb^.EndSession(exitstatus);
  1225. end;
  1226. procedure annotate_error;cdecl;public;
  1227. begin
  1228. {$ifdef Verbose}
  1229. Debug('|error|');
  1230. {$endif}
  1231. end;
  1232. procedure annotate_error_begin;cdecl;public;
  1233. begin
  1234. {$ifdef Verbose}
  1235. Debug('|error begin|');
  1236. {$endif}
  1237. with curr_gdb^ do
  1238. begin
  1239. error_start:=gdboutputbuf.idx+strlen(gdboutputbuf.buf);
  1240. got_error:=true;
  1241. end;
  1242. {$ifdef Verbose}
  1243. Debug('|end of error begin|');
  1244. {$endif}
  1245. end;
  1246. procedure annotate_starting;cdecl;public;
  1247. begin
  1248. {$ifdef Verbose}
  1249. Debug('|starting|');
  1250. {$endif}
  1251. {$ifdef go32v2}
  1252. reload_fs;
  1253. {$endif go32v2}
  1254. curr_gdb^.UserScreen;
  1255. end;
  1256. procedure annotate_stopped;cdecl;public;
  1257. var
  1258. sym : symtab_and_line;
  1259. fname : pchar;
  1260. begin
  1261. {$ifdef Verbose}
  1262. Debug('|stopped|');
  1263. {$endif}
  1264. with curr_gdb^ do
  1265. begin
  1266. {$ifdef go32v2}
  1267. reload_fs;
  1268. {$endif go32v2}
  1269. DebuggerScreen;
  1270. current_pc:=stop_pc;
  1271. Debuggee_started:=inferior_pid<>0;
  1272. if not Debuggee_started then exit;
  1273. if reset_command then exit;
  1274. sym:=find_pc_line(stop_pc,0);
  1275. if assigned(sym.symtab) then
  1276. fname:=sym.symtab^.filename
  1277. else
  1278. fname:=nil;
  1279. SelectSourceLine(fname,sym.line);
  1280. end;
  1281. end;
  1282. {$ifdef GDB_USES_PTID}
  1283. function inferior_pid : longint;
  1284. begin
  1285. inferior_pid:=inferior_ptid.pid;
  1286. end;
  1287. {$endif}
  1288. procedure proc_remove_foreign(pid:longint);cdecl;public;
  1289. begin
  1290. end;
  1291. procedure breakpoints_changed;cdecl;public;
  1292. begin
  1293. {$ifdef Verbose}
  1294. Debug('|breakpoints_changed|');
  1295. {$endif}
  1296. end;
  1297. { only from version 5.0 }
  1298. procedure annotate_ignore_count_change;cdecl;public;
  1299. begin
  1300. {$ifdef Verbose}
  1301. Debug('|annotate_ignore_count_change()|');
  1302. {$endif}
  1303. end;
  1304. procedure annotate_breakpoint(num:longint);cdecl;public;
  1305. begin
  1306. {$ifdef Verbose}
  1307. Debug('|breakpoint(%d)|');
  1308. {$endif}
  1309. With Curr_gdb^ do
  1310. stop_breakpoint_number:=num;
  1311. end;
  1312. procedure annotate_watchpoint(num:longint);cdecl;public;
  1313. begin
  1314. {$ifdef Verbose}
  1315. Debug('|watchpoint(%d)|');
  1316. {$endif}
  1317. With Curr_gdb^ do
  1318. stop_breakpoint_number:=num;
  1319. end;
  1320. procedure annotate_catchpoint(num:longint);cdecl;public;
  1321. begin
  1322. {$ifdef Verbose}
  1323. Debug('|catchpoint(%d)|');
  1324. {$endif}
  1325. With Curr_gdb^ do
  1326. stop_breakpoint_number:=num;
  1327. end;
  1328. procedure annotate_breakpoints_headers;cdecl;public;
  1329. begin
  1330. {$ifdef Verbose}
  1331. Debug('|breakpoints_headers|');
  1332. {$endif}
  1333. end;
  1334. procedure annotate_breakpoints_table;cdecl;public;
  1335. begin
  1336. {$ifdef Verbose}
  1337. Debug('|breakpoints_table|');
  1338. {$endif}
  1339. end;
  1340. procedure annotate_record;cdecl;public;
  1341. begin
  1342. {$ifdef Verbose}
  1343. Debug('|record|');
  1344. {$endif}
  1345. end;
  1346. procedure annotate_breakpoints_table_end;cdecl;public;
  1347. begin
  1348. {$ifdef Verbose}
  1349. Debug('|breakpoints_table_end|');
  1350. {$endif}
  1351. end;
  1352. procedure annotate_frames_invalid;cdecl;public;
  1353. begin
  1354. {$ifdef Verbose}
  1355. Debug('|frames_invalid|');
  1356. {$endif}
  1357. end;
  1358. procedure annotate_frame_begin(level:longint;pc:CORE_ADDR);cdecl;public;
  1359. begin
  1360. {$ifdef Verbose}
  1361. Debug('|frame_begin(%d,%ld)|');
  1362. {$endif}
  1363. with curr_gdb^ do
  1364. begin
  1365. frame_begin_seen:=true;
  1366. frame_level:=level;
  1367. current_address:=pc;
  1368. current_line_number:=-1;
  1369. function_start:=-1;
  1370. function_end:=-1;
  1371. args_start:=-1;
  1372. args_end:=-1;
  1373. file_start:=-1;
  1374. file_end:=-1;
  1375. line_start:=-1;
  1376. line_end:=-1;
  1377. end;
  1378. end;
  1379. procedure annotate_frame_address;cdecl;public;
  1380. begin
  1381. {$ifdef Verbose}
  1382. Debug('|frame_address|');
  1383. {$endif}
  1384. end;
  1385. procedure annotate_frame_address_end;cdecl;public;
  1386. begin
  1387. {$ifdef Verbose}
  1388. Debug('|frame_address_end|');
  1389. {$endif}
  1390. end;
  1391. procedure annotate_frame_function_name;cdecl;public;
  1392. begin
  1393. {$ifdef Verbose}
  1394. Debug('|frame_function_name|');
  1395. {$endif}
  1396. with curr_gdb^ do
  1397. function_start:=gdboutputbuf.idx;
  1398. end;
  1399. procedure annotate_frame_args;cdecl;public;
  1400. begin
  1401. {$ifdef Verbose}
  1402. Debug('|frame_args|');
  1403. {$endif}
  1404. with curr_gdb^ do
  1405. begin
  1406. function_end:=gdboutputbuf.idx;
  1407. args_start:=gdboutputbuf.idx;
  1408. end;
  1409. end;
  1410. procedure annotate_frame_source_begin;cdecl;public;
  1411. begin
  1412. {$ifdef Verbose}
  1413. Debug('|frame_source_begin|');
  1414. {$endif}
  1415. with curr_gdb^ do
  1416. args_end:=gdboutputbuf.idx;
  1417. end;
  1418. procedure annotate_frame_source_file;cdecl;public;
  1419. begin
  1420. {$ifdef Verbose}
  1421. Debug('|frame_source_file|');
  1422. {$endif}
  1423. with curr_gdb^ do
  1424. file_start:=gdboutputbuf.idx;
  1425. end;
  1426. procedure annotate_frame_source_file_end;cdecl;public;
  1427. begin
  1428. {$ifdef Verbose}
  1429. Debug('|frame_source_file_end|');
  1430. {$endif}
  1431. with curr_gdb^ do
  1432. file_end:=gdboutputbuf.idx;
  1433. end;
  1434. procedure annotate_frame_source_line;cdecl;public;
  1435. begin
  1436. {$ifdef Verbose}
  1437. Debug('|frame_source_line|');
  1438. {$endif}
  1439. with curr_gdb^ do
  1440. line_start:=gdboutputbuf.idx;
  1441. end;
  1442. procedure annotate_frame_source_end;cdecl;public;
  1443. begin
  1444. {$ifdef Verbose}
  1445. Debug('|frame_source_end|');
  1446. {$endif}
  1447. with curr_gdb^ do
  1448. line_end:=gdboutputbuf.idx;
  1449. end;
  1450. procedure annotate_frame_where;cdecl;public;
  1451. begin
  1452. {$ifdef Verbose}
  1453. Debug('|frame_where|');
  1454. {$endif}
  1455. end;
  1456. procedure annotate_frame_end;cdecl;public;
  1457. var
  1458. fe : pframeentry;
  1459. c : char;
  1460. err : integer;
  1461. begin
  1462. {$ifdef Verbose}
  1463. Debug('|frame_end|');
  1464. {$endif}
  1465. with curr_gdb^ do
  1466. begin
  1467. if (not record_frames) or (not frame_begin_seen) then
  1468. exit;
  1469. { This can happen, when the function has no Debugging information }
  1470. if (args_start >= 0) and (args_end < 0) then
  1471. args_end:=gdboutputbuf.idx;
  1472. frame_begin_seen:=false;
  1473. fe:=get_frameentry(frame_level);
  1474. fe^.address:=current_address;
  1475. fe^.level:=frame_level;
  1476. if (function_start>=0) then
  1477. begin
  1478. c:=gdboutputbuf.buf[function_end];
  1479. gdboutputbuf.buf[function_end]:=#0;
  1480. fe^.function_name:=strnew(gdboutputbuf.buf+function_start);
  1481. gdboutputbuf.buf[function_end]:=c;
  1482. end;
  1483. if (file_start>=0) then
  1484. begin
  1485. c:=gdboutputbuf.buf[file_end];
  1486. gdboutputbuf.buf[file_end]:=#0;
  1487. fe^.file_name:=strnew(gdboutputbuf.buf+file_start);
  1488. gdboutputbuf.buf[file_end]:=c;
  1489. end;
  1490. if (args_start>=0) then
  1491. begin
  1492. if (gdboutputbuf.buf[args_end-1]=#10) then
  1493. dec(args_end);
  1494. c:=gdboutputbuf.buf[args_end];
  1495. gdboutputbuf.buf[args_end]:=#0;
  1496. fe^.args:=strnew(gdboutputbuf.buf+args_start);
  1497. gdboutputbuf.buf[args_end]:=c;
  1498. end;
  1499. if (line_start>=0) then
  1500. begin
  1501. c:=gdboutputbuf.buf[line_end];
  1502. gdboutputbuf.buf[line_end]:=#0;
  1503. { sscanf(gdb_output_buffer+line_start,'%d',&fe^.line_number); }
  1504. val(strpas(pchar(@gdboutputbuf.buf[line_start])),fe^.line_number,err);
  1505. gdboutputbuf.buf[line_end]:=c;
  1506. end;
  1507. end;
  1508. end;
  1509. procedure annotate_quit;cdecl;public;
  1510. begin
  1511. {$ifdef Verbose}
  1512. Debug('|quit|');
  1513. {$endif}
  1514. end;
  1515. procedure annotate_arg_begin;cdecl;public;
  1516. begin
  1517. {$ifdef Verbose}
  1518. Debug('|arg_begin|');
  1519. {$endif}
  1520. end;
  1521. procedure annotate_arg_name_end;cdecl;public;
  1522. begin
  1523. {$ifdef Verbose}
  1524. Debug('|arg_name_end|');
  1525. {$endif}
  1526. end;
  1527. procedure annotate_arg_value(typ:pointer);cdecl;public;
  1528. begin
  1529. {$ifdef Verbose}
  1530. Debug('|arg_value|');
  1531. {$endif}
  1532. end;
  1533. procedure annotate_arg_end;cdecl;public;
  1534. begin
  1535. {$ifdef Verbose}
  1536. Debug('|arg_end|');
  1537. {$endif}
  1538. end;
  1539. procedure annotate_source(filename:pchar;line,character,mid:longint;pc:CORE_ADDR);cdecl;public;
  1540. begin
  1541. {$ifdef Verbose}
  1542. Debug('|source|');
  1543. {$endif}
  1544. end;
  1545. procedure annotate_function_call;cdecl;public;
  1546. begin
  1547. {$ifdef Verbose}
  1548. Debug('|function_call|');
  1549. {$endif}
  1550. end;
  1551. procedure annotate_signal_handler_caller;cdecl;public;
  1552. begin
  1553. {$ifdef Verbose}
  1554. Debug('|signal_handler_caller|');
  1555. {$endif}
  1556. end;
  1557. procedure annotate_array_section_begin(index:longint;elttype:pointer);cdecl;public;
  1558. begin
  1559. {$ifdef Verbose}
  1560. Debug('|array_section_begin()|');
  1561. {$endif}
  1562. end;
  1563. procedure annotate_elt_rep(repcount:longint);cdecl;public;
  1564. begin
  1565. {$ifdef Verbose}
  1566. Debug('|elt_rep()|');
  1567. {$endif}
  1568. end;
  1569. procedure annotate_elt_rep_end;cdecl;public;
  1570. begin
  1571. {$ifdef Verbose}
  1572. Debug('|elt_rep_end|');
  1573. {$endif}
  1574. end;
  1575. procedure annotate_elt;cdecl;public;
  1576. begin
  1577. {$ifdef Verbose}
  1578. Debug('|elt|');
  1579. {$endif}
  1580. end;
  1581. procedure annotate_array_section_end;cdecl;public;
  1582. begin
  1583. {$ifdef Verbose}
  1584. Debug('|array_section_end|');
  1585. {$endif}
  1586. end;
  1587. procedure annotate_display_begin;cdecl;public;
  1588. begin
  1589. {$ifdef Verbose}
  1590. Debug('|display_begin|');
  1591. {$endif}
  1592. end;
  1593. procedure annotate_display_number_end;cdecl;public;
  1594. begin
  1595. {$ifdef Verbose}
  1596. Debug('|display_number_end|');
  1597. {$endif}
  1598. end;
  1599. procedure annotate_display_format;cdecl;public;
  1600. begin
  1601. {$ifdef Verbose}
  1602. Debug('|display_format|');
  1603. {$endif}
  1604. end;
  1605. procedure annotate_display_expression;cdecl;public;
  1606. begin
  1607. {$ifdef Verbose}
  1608. Debug('|display_expression|');
  1609. {$endif}
  1610. end;
  1611. procedure annotate_display_expression_end;cdecl;public;
  1612. begin
  1613. {$ifdef Verbose}
  1614. Debug('|display_expression_end|');
  1615. {$endif}
  1616. end;
  1617. procedure annotate_display_value;cdecl;public;
  1618. begin
  1619. {$ifdef Verbose}
  1620. Debug('|display_value|');
  1621. {$endif}
  1622. end;
  1623. procedure annotate_display_end;cdecl;public;
  1624. begin
  1625. {$ifdef Verbose}
  1626. Debug('|display_end|');
  1627. {$endif}
  1628. end;
  1629. procedure annotate_field (num:longint);cdecl;public;
  1630. begin
  1631. {$ifdef Verbose}
  1632. Debug('a_field(%d)');
  1633. {$endif}
  1634. end;
  1635. procedure annotate_field_begin(typ:pointer);cdecl;public;
  1636. begin
  1637. {$ifdef Verbose}
  1638. Debug('a_field_begin\n');
  1639. {$endif}
  1640. end;
  1641. procedure annotate_field_name_end;cdecl;public;
  1642. begin
  1643. {$ifdef Verbose}
  1644. Debug('a_field_name_end\n');
  1645. {$endif}
  1646. end;
  1647. procedure annotate_field_value;cdecl;public;
  1648. begin
  1649. {$ifdef Verbose}
  1650. Debug('a_field_value\n');
  1651. {$endif}
  1652. end;
  1653. procedure annotate_field_end;cdecl;public;
  1654. begin
  1655. {$ifdef Verbose}
  1656. Debug('a_field_end\n');
  1657. {$endif}
  1658. end;
  1659. procedure annotate_value_history_begin (histindex:longint;typ:pointer);cdecl;public;
  1660. begin
  1661. {$ifdef Verbose}
  1662. Debug('a_value_history_begin(%d)\n');
  1663. {$endif}
  1664. end;
  1665. procedure annotate_value_begin (typ:pointer);cdecl;public;
  1666. begin
  1667. {$ifdef Verbose}
  1668. Debug('a_value_begin\n');
  1669. {$endif}
  1670. end;
  1671. procedure annotate_value_history_value;cdecl;public;
  1672. begin
  1673. {$ifdef Verbose}
  1674. Debug('a_value_history_value\n');
  1675. {$endif}
  1676. end;
  1677. procedure annotate_value_history_end;cdecl;public;
  1678. begin
  1679. {$ifdef Verbose}
  1680. Debug('a_value_history_end\n');
  1681. {$endif}
  1682. end;
  1683. procedure annotate_value_end;cdecl;public;
  1684. begin
  1685. {$ifdef Verbose}
  1686. Debug('a_value_end\n');
  1687. {$endif}
  1688. end;
  1689. procedure _initialize_annotate;cdecl;public;
  1690. begin
  1691. end;
  1692. {$ifndef GDB_V5}
  1693. procedure fputs_unfiltered(linebuffer:pchar;stream:pointer);cdecl;public;
  1694. begin
  1695. with curr_gdb^ do
  1696. {$ifdef gdb_v418}
  1697. if stream = gdb_stderr then
  1698. gdberrorbuf.append(linebuffer)
  1699. else
  1700. {$endif gdb_v418}
  1701. gdboutputbuf.append(linebuffer);
  1702. end;
  1703. {$else GDB_V5}
  1704. procedure gdbint_ui_file_write(stream : pui_file; p : pchar; len : longint);cdecl;
  1705. begin
  1706. if assigned(curr_gdb) then
  1707. with curr_gdb^ do
  1708. if stream = gdb_stderr then
  1709. gdberrorbuf.lappend(p,len)
  1710. else if stream = gdb_stdout then
  1711. gdboutputbuf.lappend(p,len)
  1712. else
  1713. begin
  1714. gdberrorbuf.append('Unknown gdb ui_file');
  1715. gdberrorbuf.lappend(p,len);
  1716. end;
  1717. end;
  1718. {$endif GDB_V5}
  1719. procedure CreateBreakPointHook(var b:breakpoint);cdecl;
  1720. var
  1721. sym : symtab_and_line;
  1722. { this procedure is only here to avoid the problems
  1723. with different version of gcc having different stack
  1724. handling:
  1725. on older versions find_pc_line uses just "ret"
  1726. while on newer gcc version "ret $4" is used
  1727. if this call is within the CreateBreakPointHook function
  1728. it changes %esp and thus the registers are
  1729. not restored correctly PM }
  1730. procedure get_pc_line;
  1731. begin
  1732. sym:=find_pc_line(b.address,0);
  1733. end;
  1734. begin
  1735. get_pc_line;
  1736. with curr_gdb^ do
  1737. begin
  1738. last_breakpoint_number:=b.number;
  1739. { function breakpoints have zero as file and as line !!
  1740. but they are valid !! }
  1741. invalid_breakpoint_line:=(b.line_number<>sym.line) and (b.line_number<>0);
  1742. last_breakpoint_address:=b.address;
  1743. last_breakpoint_line:=sym.line;
  1744. if assigned(sym.symtab) then
  1745. last_breakpoint_file:=sym.symtab^.filename
  1746. else
  1747. last_breakpoint_file:=nil;
  1748. end;
  1749. end;
  1750. {*****************************************************************************
  1751. tgdbinterface
  1752. *****************************************************************************}
  1753. constructor tgdbinterface.init;
  1754. begin
  1755. gdboutputbuf.init;
  1756. gdberrorbuf.init;
  1757. record_frames:=true;
  1758. {$ifdef GDB_V418}
  1759. (* GDB_FILE *
  1760. gdb_file_init_astring (n)
  1761. int n;
  1762. should we use xmalloc ?
  1763. gdb could resize the buffer => crash,
  1764. but normally it should not if unfiltered !! PM *)
  1765. gdb_stdout^.ts_streamtype := astring;
  1766. gdb_stdout^.ts_strbuf := gdboutputbuf.buf;
  1767. gdb_stdout^.ts_buflen := gdboutputbuf.size;
  1768. gdboutputbuf.link:=gdb_stdout;
  1769. gdb_stderr^.ts_streamtype := astring;
  1770. gdb_stderr^.ts_strbuf := gdberrorbuf.buf;
  1771. gdb_stderr^.ts_buflen := gdberrorbuf.size;
  1772. gdberrorbuf.link:=gdb_stderr;
  1773. {$endif GDB_V418}
  1774. {$ifdef GDB_V5}
  1775. {$endif GDB_V5}
  1776. { This must be placed before gdb__init is called
  1777. as gdb_init might issue output PM }
  1778. curr_gdb:=@self;
  1779. gdb__init;
  1780. command_level:=0;
  1781. { set output mode for GDB }
  1782. { only these values disable filtering
  1783. DONT CHANGE THEM !!! PM }
  1784. gdb_command('set width 0xffffffff');
  1785. gdb_command('set height 0xffffffff');
  1786. { other standard commands used for fpc debugging }
  1787. gdb_command('set print demangle off');
  1788. gdb_command('set gnutarget auto');
  1789. gdb_command('set language auto');
  1790. gdb_command('set print vtbl on');
  1791. gdb_command('set print object on');
  1792. gdb_command('set print null-stop');
  1793. end;
  1794. destructor tgdbinterface.done;
  1795. begin
  1796. clear_frames;
  1797. gdb_done;
  1798. gdboutputbuf.done;
  1799. gdberrorbuf.done;
  1800. end;
  1801. procedure tgdbinterface.gdb__init;
  1802. begin
  1803. gdboutputbuf.reset;
  1804. gdberrorbuf.reset;
  1805. create_breakpoint_hook:=@CreateBreakPointHook;
  1806. signal_string:=nil;
  1807. signal_name:=nil;
  1808. end;
  1809. procedure tgdbinterface.gdb_done;
  1810. begin
  1811. if debuggee_started then
  1812. begin
  1813. current_target.to_kill;
  1814. current_target.to_close(1);
  1815. end;
  1816. create_breakpoint_hook:=nil;
  1817. end;
  1818. function tgdbinterface.error:boolean;
  1819. begin
  1820. error:=got_error;
  1821. end;
  1822. function tgdbinterface.error_num:longint;
  1823. begin
  1824. error_num:=gdb_error;
  1825. end;
  1826. var
  1827. top_level_val : longint;
  1828. {$ifdef GDB_V5}
  1829. function catch_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external;
  1830. function gdbint_execute_command(command : pchar; from_tty,mask : longint) : longint;cdecl;
  1831. begin
  1832. gdbint_execute_command:=1;
  1833. execute_command(command,from_tty);
  1834. gdbint_execute_command:=0;
  1835. end;
  1836. {$endif GDB_V5}
  1837. {$ifdef cpui386}
  1838. type
  1839. tfpustate = word;
  1840. const
  1841. MaskAllExceptions = $ff;
  1842. {$else}
  1843. type
  1844. tfpustate = longint;
  1845. const
  1846. MaskAllExceptions = 0;
  1847. {$endif}
  1848. procedure SaveFPUState(var control :TFPUState);
  1849. begin
  1850. {$ifdef cpui386}
  1851. asm
  1852. movl control, %edi
  1853. fstcw (%edi)
  1854. end;
  1855. {$else}
  1856. control:=0;
  1857. {$endif}
  1858. end;
  1859. procedure SetFPUState(control : TFPUState);
  1860. begin
  1861. {$ifdef cpui386}
  1862. asm
  1863. fnclex
  1864. fldcw control
  1865. end;
  1866. {$else}
  1867. {$endif}
  1868. end;
  1869. function MaskAllFPUExceptions(control : TFPUState) : TFPUState;
  1870. begin
  1871. {$ifdef cpui386}
  1872. MaskAllFPUExceptions := control or MaskAllExceptions;
  1873. {$endif}
  1874. end;
  1875. procedure tgdbinterface.gdb_command(const s:string);
  1876. var
  1877. command : array[0..256] of char;
  1878. {$ifdef GDB_V5}
  1879. mask : longint;
  1880. {$endif GDB_V5}
  1881. s2 : string;
  1882. old_quit_return,
  1883. old_error_return : jmp_buf;
  1884. control : TFPUState;
  1885. begin
  1886. inc(command_level);
  1887. SaveFPUState(control);
  1888. SetFPUState(MaskAllFPUExceptions(control));
  1889. move(s[1],command,length(s));
  1890. command[length(s)]:=#0;
  1891. old_quit_return:=quit_return;
  1892. old_error_return:=error_return;
  1893. gdb_error:=0;
  1894. got_error:=false;
  1895. stop_breakpoint_number:=0;
  1896. { Trap quit commands }
  1897. s2:=s;
  1898. while (length(s2)>0) and ((s2[1]=' ') or (s2[1]=#9)) do
  1899. s2:=copy(s2,2,255);
  1900. if (length(s2)>0) and
  1901. (UpCase(s2[1])='Q') and
  1902. ((length(s2)=1) or
  1903. (s2[2]=' ') or
  1904. ((UpCase(s2[2])='U') and
  1905. ((length(s2)=2) or
  1906. (s2[3]=' ') or
  1907. ((UpCase(s2[3])='I') and
  1908. ((length(s2)=3) or
  1909. (s2[4]=' ') or
  1910. ((UpCase(s2[4])='T') and
  1911. ((length(s2)=4) or
  1912. (s2[5]=' ')
  1913. ))))))) then
  1914. begin
  1915. if not AllowQuit then
  1916. exit;
  1917. end;
  1918. {$ifdef DebugCommand}
  1919. Debug('start of handle_gdb_command ('+s+')');
  1920. {$endif}
  1921. top_level_val:=setjmp(error_return);
  1922. if top_level_val=0 then
  1923. begin
  1924. quit_return:=error_return;
  1925. {$ifdef GDB_V5}
  1926. mask:=longint($ffffffff);
  1927. catch_errors(@gdbint_execute_command,@command,0,mask);
  1928. {$else not GDB_V5}
  1929. execute_command(@command,0);
  1930. {$endif not GDB_V5}
  1931. {$ifdef go32v2}
  1932. reload_fs;
  1933. {$endif go32v2}
  1934. end
  1935. else
  1936. {$ifdef Verbose}
  1937. Debug('error longjmp in handle_gdb_command ('+s+')');
  1938. {$endif}
  1939. ;
  1940. {$ifdef DebugCommand}
  1941. Debug('end of handle_gdb_command ('+s+')');
  1942. {$endif}
  1943. quit_return:=old_quit_return;
  1944. error_return:=old_error_return;
  1945. dec(command_level);
  1946. SetFPUState(control);
  1947. end;
  1948. procedure tgdbinterface.resize_frames;
  1949. var
  1950. i : longint;
  1951. new_frames : ppframeentry;
  1952. begin
  1953. if (frame_count>=frame_size) then
  1954. begin
  1955. getmem(new_frames,sizeof(pointer)*(frame_count+1));
  1956. for i:=0 to frame_size-1 do
  1957. new_frames[i]:=frames[i];
  1958. if assigned(frames) then
  1959. freemem(frames,sizeof(pointer)*frame_size);
  1960. frames:=new_frames;
  1961. frame_size:=frame_count+1;
  1962. for i:=frame_count to frame_size-1 do
  1963. frames[i]:=new(pframeentry,init);
  1964. end;
  1965. end;
  1966. function tgdbinterface.add_frameentry:pframeentry;
  1967. begin
  1968. resize_frames;
  1969. add_frameentry:=frames[frame_count];
  1970. inc(frame_count);
  1971. end;
  1972. function tgdbinterface.get_frameentry(level : longint) : pframeentry;
  1973. begin
  1974. { only climb values one by one PM }
  1975. if level>=frame_count then
  1976. resize_frames;
  1977. get_frameentry:=frames[level];
  1978. frames[level]^.clear;
  1979. if level>=frame_count then
  1980. inc(frame_count);
  1981. end;
  1982. procedure tgdbinterface.clear_frames;
  1983. var
  1984. i : longint;
  1985. begin
  1986. for i:=0 to frame_size-1 do
  1987. dispose(frames[i],done);
  1988. freemem(frames,sizeof(pointer)*Frame_size);
  1989. frame_count:=0;
  1990. frame_size:=0;
  1991. end;
  1992. function tgdbinterface.get_current_frame : longint;
  1993. begin
  1994. record_frames:=false;
  1995. gdb_command('f');
  1996. get_current_frame:=frame_level;
  1997. record_frames:=true;
  1998. end;
  1999. function tgdbinterface.set_current_frame(level : longint) : boolean;
  2000. var
  2001. s : string;
  2002. begin
  2003. record_frames:=false;
  2004. str(level,s);
  2005. gdb_command('f '+s);
  2006. if level=frame_level then
  2007. set_current_frame:=true
  2008. else
  2009. set_current_frame:=false;
  2010. record_frames:=true;
  2011. end;
  2012. {*****************************************************************************
  2013. Highlevel tgdbinterface
  2014. *****************************************************************************}
  2015. procedure tgdbinterface.GetAddrSyminfo(addr:longint;var si:tsyminfo);
  2016. var
  2017. sym : symtab_and_line;
  2018. symbol : psymbol;
  2019. begin
  2020. sym:=find_pc_line(addr,1);
  2021. fillchar(si,sizeof(tsyminfo),0);
  2022. si.address:=addr;
  2023. si.offset:=addr-sym.pc;
  2024. if assigned(sym.symtab) then
  2025. si.fname:=sym.symtab^.filename
  2026. else
  2027. si.fname:=nil;
  2028. si.line:=sym.line;
  2029. symbol:=find_pc_function(addr);
  2030. if assigned(symbol) then
  2031. si.funcname:=symbol^.ginfo._name
  2032. else
  2033. si.funcname:=nil;
  2034. end;
  2035. procedure tgdbinterface.SelectSourceLine(fn:pchar;line:longint);
  2036. begin
  2037. if assigned(fn) then
  2038. DoSelectSourceLine(StrPas(fn),line)
  2039. else
  2040. DoSelectSourceLine('',line);
  2041. end;
  2042. procedure tgdbinterface.StartSession;
  2043. begin
  2044. DoStartSession;
  2045. end;
  2046. procedure tgdbinterface.BreakSession;
  2047. begin
  2048. DoBreakSession;
  2049. end;
  2050. procedure tgdbinterface.EndSession(code:longint);
  2051. begin
  2052. Debuggee_started:=false;
  2053. {$ifdef Go32v2}
  2054. {$ifdef GDB_USES_PTID}
  2055. inferior_ptid.pid:=0;
  2056. {$else}
  2057. inferior_pid:=0;
  2058. {$endif}
  2059. {$endif}
  2060. DoEndSession(code);
  2061. if assigned(signal_name) then
  2062. strdispose(signal_name);
  2063. signal_name:=nil;
  2064. if assigned(signal_string) then
  2065. strdispose(signal_string);
  2066. signal_string:=nil;
  2067. end;
  2068. procedure tgdbinterface.DebuggerScreen;
  2069. begin
  2070. {$ifdef Verbose}
  2071. Debug('|DebuggerScreen|');
  2072. {$endif}
  2073. if user_screen_shown then
  2074. DoDebuggerScreen;
  2075. user_screen_shown:=false;
  2076. end;
  2077. procedure tgdbinterface.UserScreen;
  2078. begin
  2079. {$ifdef Verbose}
  2080. Debug('|UserScreen|');
  2081. {$endif}
  2082. if switch_to_user then
  2083. begin
  2084. if (not user_screen_shown) then
  2085. DoUserScreen;
  2086. user_screen_shown:=true;
  2087. end;
  2088. end;
  2089. {---------------------------------------
  2090. Default Hooks
  2091. ---------------------------------------}
  2092. procedure tgdbinterface.DoSelectSourceLine(const fn:string;line:longint);
  2093. {$ifdef Verbose}
  2094. var
  2095. s : string;
  2096. {$endif}
  2097. begin
  2098. {$ifdef Verbose}
  2099. Str(line,S);
  2100. Debug('|SelectSource '+fn+':'+s+'|');
  2101. {$endif}
  2102. end;
  2103. procedure tgdbinterface.DoStartSession;
  2104. begin
  2105. end;
  2106. procedure tgdbinterface.DoBreakSession;
  2107. begin
  2108. end;
  2109. procedure tgdbinterface.DoEndSession(code:longint);
  2110. begin
  2111. end;
  2112. procedure tgdbinterface.DoUserSignal;
  2113. begin
  2114. end;
  2115. procedure tgdbinterface.DoDebuggerScreen;
  2116. begin
  2117. end;
  2118. procedure tgdbinterface.DoUserScreen;
  2119. begin
  2120. end;
  2121. function tgdbinterface.AllowQuit : boolean;
  2122. begin
  2123. AllowQuit:=true;
  2124. end;
  2125. {$ifdef GDB_V5}
  2126. var
  2127. version : array[0..0] of char;cvar;external;
  2128. procedure error_init;cdecl;external;
  2129. {$else}
  2130. var
  2131. version : pchar;cvar;
  2132. {$endif}
  2133. function GDBVersion : string;
  2134. begin
  2135. GDBVersion:='GDB '+StrPas(version);
  2136. end;
  2137. const next_exit : pointer = nil;
  2138. procedure DoneLibGDB;
  2139. begin
  2140. exitproc:=next_exit;
  2141. {$ifdef GDB_V418}
  2142. if assigned(gdb_stdout) then
  2143. dispose(gdb_stdout);
  2144. gdb_stdout:=nil;
  2145. if assigned(gdb_stderr) then
  2146. dispose(gdb_stderr);
  2147. gdb_stderr:=nil;
  2148. {$endif GDB_V418}
  2149. end;
  2150. {$ifdef go32v2}
  2151. var
  2152. c_environ : ppchar;external name '_environ';
  2153. c_argc : longint;external name '___crt0_argc';
  2154. c_argv : ppchar;external name '___crt0_argv';
  2155. {$endif def go32v2}
  2156. {$ifdef GDB_V418}
  2157. {$ifndef go32v2}
  2158. {$ifndef win32}
  2159. var
  2160. stdout : p_c_file;cvar;external;
  2161. stderr : p_c_file;cvar;external;
  2162. {$endif win32}
  2163. {$else go32v2}
  2164. { the type is not really important
  2165. for external cvars PM
  2166. but the main problem is that stdout and stderr
  2167. and defined as macros under DJGPP !! }
  2168. var
  2169. __dj_stdout : c_file;cvar;external;
  2170. __dj_stderr : c_file;cvar;external;
  2171. {$endif go32v2}
  2172. {$endif not GDB_V418}
  2173. procedure InitLibGDB;
  2174. {$ifdef supportexceptions}
  2175. var
  2176. OldSigInt : SignalHandler;
  2177. {$endif supportexceptions}
  2178. begin
  2179. {$ifdef go32v2}
  2180. c_environ:=system.envp;
  2181. c_argc:=system.argc;
  2182. c_argv:=system.argv;
  2183. {$endif def go32v2}
  2184. {$ifdef supportexceptions}
  2185. {$ifdef go32v2}
  2186. OldSigInt:=Signal(SIGINT,SignalHandler(@SIG_DFL));
  2187. {$else}
  2188. OldSigInt:=Signal(SIGINT,SignalHandler(SIG_DFL));
  2189. {$endif}
  2190. {$endif supportexceptions}
  2191. {$ifdef GDB_V418}
  2192. new(gdb_stdout);
  2193. gdb_stdout^.ts_streamtype := afile;
  2194. {$ifndef go32v2}
  2195. {$ifdef win32}
  2196. gdb_stdout^.ts_filestream := _impure_ptr^.stdout;
  2197. {$else not win32 }
  2198. gdb_stdout^.ts_filestream := stdout;{p_c_file(textrec(output).handle); was wrong PM }
  2199. {$endif not win32 }
  2200. {$else go32v2}
  2201. gdb_stdout^.ts_filestream := @__dj_stdout;
  2202. {$endif go32v2}
  2203. gdb_stdout^.ts_strbuf := nil;
  2204. gdb_stdout^.ts_buflen := 0;
  2205. new(gdb_stderr);
  2206. gdb_stderr^.ts_streamtype := afile;
  2207. {$ifndef go32v2}
  2208. {$ifdef win32}
  2209. gdb_stderr^.ts_filestream := _impure_ptr^.stderr;
  2210. {$else not win32 }
  2211. gdb_stderr^.ts_filestream := stderr;
  2212. {$endif not win32 }
  2213. {$else go32v2}
  2214. gdb_stderr^.ts_filestream := @__dj_stderr;
  2215. {$endif go32v2}
  2216. gdb_stderr^.ts_strbuf := nil;
  2217. gdb_stderr^.ts_buflen := 0;
  2218. {$endif GDB_V418}
  2219. {$ifdef GDB_V5}
  2220. if assigned(gdb_stderr) then
  2221. ui_file_delete(gdb_stderr);
  2222. if assigned(gdb_stdout) then
  2223. ui_file_delete(gdb_stdout);
  2224. gdb_stderr:=mem_fileopen;
  2225. gdb_stdout:=mem_fileopen;
  2226. gdb_stdlog:=gdb_stderr;
  2227. gdb_stdtarg:=gdb_stderr;
  2228. set_ui_file_write(gdb_stdout,@gdbint_ui_file_write);
  2229. set_ui_file_write(gdb_stderr,@gdbint_ui_file_write);
  2230. error_init;
  2231. {$endif GDB_V5}
  2232. next_exit:=exitproc;
  2233. exitproc:=@DoneLibGDB;
  2234. gdb_init;
  2235. {$ifdef supportexceptions}
  2236. Signal(SIGINT,OldSigInt);
  2237. {$endif supportexceptions}
  2238. if setjmp(error_return)=0 then
  2239. begin
  2240. quit_return:=error_return;
  2241. exit;
  2242. end
  2243. else
  2244. begin
  2245. {$ifdef Verbose}
  2246. Debug('|LongJump to Init|');
  2247. {$endif}
  2248. {$ifdef go32v2}
  2249. RunError(99);
  2250. {$endif def go32v2}
  2251. end;
  2252. WatchDog:=0;
  2253. end;
  2254. {$ifdef GDB_HAS_SYSROOT}
  2255. var gdb_sysroot : pchar; export name 'gdb_sysroot';
  2256. gdb_sysrootc : char;
  2257. {$endif}
  2258. begin
  2259. {$ifdef GDB_HAS_SYSROOT}
  2260. gdb_sysrootc := #0;
  2261. gdb_sysroot := @gdb_sysrootc;
  2262. {$endif}
  2263. InitLibGDB;
  2264. end.
  2265. {
  2266. $Log$
  2267. Revision 1.14 2003-03-25 22:50:29 armin
  2268. * added GDB_HAS_SYSROOT, needed for gdb-Versions >= 20030324
  2269. Revision 1.13 2003/02/09 23:08:38 marco
  2270. * ncurses to curses for openbsd rename
  2271. Revision 1.12 2002/12/02 13:59:56 pierre
  2272. + add sim library for powerpc cpu
  2273. Revision 1.11 2002/11/21 00:42:27 pierre
  2274. * prepare for gdb 5.3
  2275. Revision 1.10 2002/09/27 17:49:09 pierre
  2276. * fix not i386 typo bug
  2277. Revision 1.9 2002/09/17 20:20:05 pierre
  2278. * mask all fpu exceptions in GDB commands as GDB relies on that
  2279. Revision 1.8 2002/09/07 15:42:52 peter
  2280. * old logs removed and tabs fixed
  2281. Revision 1.7 2002/07/30 16:40:41 marco
  2282. * Gdbint openbsd support
  2283. Revision 1.6 2002/05/31 11:54:32 marco
  2284. * Renamefest for 1.0, many 1.1.x spots patched also.
  2285. Revision 1.5 2002/05/13 13:45:35 peter
  2286. * updated to compile tests with kylix
  2287. Revision 1.4 2002/03/26 16:24:49 pierre
  2288. * set signal names to nil at start
  2289. Revision 1.3 2002/02/06 14:42:45 pierre
  2290. + code to handle signals
  2291. Revision 1.2 2002/02/05 11:03:59 marco
  2292. * library fix, and define GDB_V502 for BSD
  2293. Revision 1.1 2002/01/29 17:54:49 peter
  2294. * splitted to base and extra
  2295. Revision 1.13 2002/01/25 22:39:29 pierre
  2296. * fix problem with 5.0 lib version
  2297. Revision 1.12 2002/01/24 12:31:51 pierre
  2298. * fix go32v2 compilation for gdb 5.1
  2299. Revision 1.11 2002/01/24 09:14:39 pierre
  2300. * adapt to GDB 5.1
  2301. Revision 1.10 2002/01/07 10:31:57 pierre
  2302. * avoid problem if gdb start generates output
  2303. }