gdbint.pp 66 KB

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