gdbint.pp 65 KB

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