ppudump.pp 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by the FPC Development Team
  4. Dumps the contents of a FPC unit file (PPU File)
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************}
  17. {$ifdef TP}
  18. {$N+,E+}
  19. {$endif}
  20. program pppdump;
  21. uses
  22. dos,
  23. ppu;
  24. const
  25. Version = 'Version 1.10';
  26. Title = 'PPU-Analyser';
  27. Copyright = 'Copyright (c) 1998-2002 by the Free Pascal Development Team';
  28. { verbosity }
  29. v_none = $0;
  30. v_header = $1;
  31. v_defs = $2;
  32. v_syms = $4;
  33. v_interface = $8;
  34. v_implementation = $10;
  35. v_browser = $20;
  36. v_all = $ff;
  37. type
  38. { Copied from systems.pas }
  39. ttargetcpu=
  40. (
  41. no_cpu, { 0 }
  42. i386, { 1 }
  43. m68k, { 2 }
  44. alpha, { 3 }
  45. powerpc, { 4 }
  46. sparc, { 5 }
  47. vm { 6 }
  48. );
  49. var
  50. ppufile : tppufile;
  51. space : string;
  52. read_member : boolean;
  53. unitindex : longint;
  54. verbose : longint;
  55. {****************************************************************************
  56. Helper Routines
  57. ****************************************************************************}
  58. const has_errors : boolean = false;
  59. Procedure Error(const S : string);
  60. Begin
  61. Writeln(S);
  62. has_errors:=true;
  63. End;
  64. Function Target2Str(w:longint):string;
  65. type
  66. { taken from systems.pas }
  67. ttarget =
  68. (
  69. target_none, { 0 }
  70. target_i386_GO32V1, { 1 }
  71. target_i386_GO32V2, { 2 }
  72. target_i386_linux, { 3 }
  73. target_i386_OS2, { 4 }
  74. target_i386_Win32, { 5 }
  75. target_i386_freebsd, { 6 }
  76. target_m68k_Amiga, { 7 }
  77. target_m68k_Atari, { 8 }
  78. target_m68k_Mac, { 9 }
  79. target_m68k_linux, { 10 }
  80. target_m68k_PalmOS, { 11 }
  81. target_alpha_linux, { 12 }
  82. target_powerpc_linux, { 13 }
  83. target_powerpc_macos, { 14 }
  84. target_i386_sunos, { 15 }
  85. target_i386_beos, { 16 }
  86. target_i386_netbsd, { 17 }
  87. target_m68k_netbsd, { 18 }
  88. target_i386_Netware, { 19 }
  89. target_i386_qnx, { 20 }
  90. target_i386_wdosx, { 21 }
  91. target_sparc_sunos, { 22 }
  92. target_sparc_linux, { 23 }
  93. target_i386_openbsd, { 24 }
  94. target_m68k_openbsd, { 25 }
  95. system_x86_64_linux, { 26 }
  96. system_powerpc_macosx, { 27 }
  97. target_i386_emx { 28 }
  98. );
  99. const
  100. Targets : array[ttarget] of string[16]=(
  101. { 0 } 'none',
  102. { 1 } 'GO32V1',
  103. { 2 } 'GO32V2',
  104. { 3 } 'Linux-i386',
  105. { 4 } 'OS/2',
  106. { 5 } 'Win32',
  107. { 6 } 'FreeBSD-i386',
  108. { 7 } 'Amiga',
  109. { 8 } 'Atari',
  110. { 9 } 'MacOS-m68k',
  111. { 10 } 'Linux-m68k',
  112. { 11 } 'PalmOS-m68k',
  113. { 12 } 'Linux-alpha',
  114. { 13 } 'Linux-ppc',
  115. { 14 } 'MacOS-ppc',
  116. { 15 } 'Solaris-i386',
  117. { 16 } 'BeOS-i386',
  118. { 17 } 'NetBSD-i386',
  119. { 18 } 'NetBSD-m68k',
  120. { 19 } 'Netware',
  121. { 20 } 'Qnx-i386',
  122. { 21 } 'WDOSX-i386',
  123. { 22 } 'Solaris-sparc',
  124. { 23 } 'Linux-sparc',
  125. { 24 } 'OpenBSD-i386',
  126. { 25 } 'OpenBSD-m68k',
  127. { 26 } 'Linux-x86-64',
  128. { 27 } 'MacOSX-ppc',
  129. { 28 } 'OS/2 via EMX'
  130. );
  131. begin
  132. if w<=ord(high(ttarget)) then
  133. Target2Str:=Targets[ttarget(w)]
  134. else
  135. Target2Str:='<Unknown>';
  136. end;
  137. Function Cpu2Str(w:longint):string;
  138. const
  139. CpuTxt : array[ttargetcpu] of string[7]=
  140. ('none','i386','m68k','alpha','powerpc','sparc','vis');
  141. begin
  142. if w<=ord(high(ttargetcpu)) then
  143. Cpu2Str:=CpuTxt[ttargetcpu(w)]
  144. else
  145. Cpu2Str:='<Unknown>';
  146. end;
  147. Function Varspez2Str(w:longint):string;
  148. const
  149. varspezstr : array[0..4] of string[6]=('Value','Const','Var','Out','Hidden');
  150. begin
  151. if w<=ord(high(varspezstr)) then
  152. Varspez2Str:=varspezstr[w]
  153. else
  154. Varspez2Str:='<Unknown>';
  155. end;
  156. function PPUFlags2Str(flags:longint):string;
  157. type
  158. tflagopt=record
  159. mask : longint;
  160. str : string[30];
  161. end;
  162. const
  163. flagopts=16;
  164. flagopt : array[1..flagopts] of tflagopt=(
  165. (mask: $1 ;str:'init'),
  166. (mask: $2 ;str:'final'),
  167. (mask: $4 ;str:'big_endian'),
  168. (mask: $8 ;str:'dbx'),
  169. (mask: $10 ;str:'browser'),
  170. (mask: $20 ;str:'in_library'),
  171. (mask: $40 ;str:'smart_linked'),
  172. (mask: $80 ;str:'static_linked'),
  173. (mask: $100 ;str:'shared_linked'),
  174. (mask: $200 ;str:'local_browser'),
  175. (mask: $400 ;str:'no_link'),
  176. (mask: $800 ;str:'has_resources'),
  177. (mask: $1000 ;str:'little_endian'),
  178. (mask: $2000 ;str:'release'),
  179. (mask: $4000 ;str:'local_threadvars'),
  180. (mask: $8000 ;str:'fpu emulation on')
  181. );
  182. var
  183. i : longint;
  184. first : boolean;
  185. s : string;
  186. begin
  187. s:='';
  188. if flags<>0 then
  189. begin
  190. first:=true;
  191. for i:=1to flagopts do
  192. if (flags and flagopt[i].mask)<>0 then
  193. begin
  194. if first then
  195. first:=false
  196. else
  197. s:=s+', ';
  198. s:=s+flagopt[i].str;
  199. end;
  200. end
  201. else
  202. s:='none';
  203. PPUFlags2Str:=s;
  204. end;
  205. const
  206. HexTbl : array[0..15] of char='0123456789ABCDEF';
  207. function HexB(b:byte):string;
  208. begin
  209. HexB[0]:=#2;
  210. HexB[1]:=HexTbl[b shr 4];
  211. HexB[2]:=HexTbl[b and $f];
  212. end;
  213. function hexstr(val : cardinal;cnt : byte) : string;
  214. const
  215. HexTbl : array[0..15] of char='0123456789ABCDEF';
  216. var
  217. i : longint;
  218. begin
  219. hexstr[0]:=char(cnt);
  220. for i:=cnt downto 1 do
  221. begin
  222. hexstr[i]:=hextbl[val and $f];
  223. val:=val shr 4;
  224. end;
  225. end;
  226. Function L0(l:longint):string;
  227. {
  228. return the string of value l, if l<10 then insert a zero, so
  229. the string is always at least 2 chars '01','02',etc
  230. }
  231. var
  232. s : string;
  233. begin
  234. Str(l,s);
  235. if l<10 then
  236. s:='0'+s;
  237. L0:=s;
  238. end;
  239. function filetimestring( t : longint) : string;
  240. {
  241. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  242. }
  243. var
  244. DT : DateTime;
  245. begin
  246. if t=-1 then
  247. begin
  248. FileTimeString:='Not Found';
  249. exit;
  250. end;
  251. unpacktime(t,DT);
  252. filetimestring:=L0(dt.Year)+'/'+L0(dt.Month)+'/'+L0(dt.Day)+' '+L0(dt.Hour)+':'+L0(dt.min)+':'+L0(dt.sec);
  253. end;
  254. {****************************************************************************
  255. Read Routines
  256. ****************************************************************************}
  257. function getint64:int64;
  258. var
  259. l1,l2 : longint;
  260. begin
  261. l1:=ppufile.getlongint;
  262. l2:=ppufile.getlongint;
  263. getint64:=(int64(l2) shl 32) or qword(l1);
  264. end;
  265. Procedure ReadLinkContainer(const prefix:string);
  266. {
  267. Read a serie of strings and write to the screen starting every line
  268. with prefix
  269. }
  270. function maskstr(m:longint):string;
  271. const
  272. { link options }
  273. link_none = $0;
  274. link_allways = $1;
  275. link_static = $2;
  276. link_smart = $4;
  277. link_shared = $8;
  278. var
  279. s : string;
  280. begin
  281. s:='';
  282. if (m and link_allways)<>0 then
  283. s:=s+'always ';
  284. if (m and link_static)<>0 then
  285. s:=s+'static ';
  286. if (m and link_smart)<>0 then
  287. s:=s+'smart ';
  288. if (m and link_shared)<>0 then
  289. s:=s+'shared ';
  290. maskstr:=s;
  291. end;
  292. var
  293. s : string;
  294. m : longint;
  295. begin
  296. while not ppufile.endofentry do
  297. begin
  298. s:=ppufile.getstring;
  299. m:=ppufile.getlongint;
  300. WriteLn(prefix,s,' (',maskstr(m),')');
  301. end;
  302. end;
  303. Procedure ReadContainer(const prefix:string);
  304. {
  305. Read a serie of strings and write to the screen starting every line
  306. with prefix
  307. }
  308. begin
  309. while not ppufile.endofentry do
  310. WriteLn(prefix,ppufile.getstring);
  311. end;
  312. Procedure ReadRef;
  313. begin
  314. if (verbose and v_browser)=0 then
  315. exit;
  316. while (not ppufile.endofentry) and (not ppufile.error) do
  317. Writeln(space,' - Refered : ',ppufile.getword,', (',ppufile.getlongint,',',ppufile.getword,')');
  318. end;
  319. Procedure ReadAsmSymbols;
  320. type
  321. { Copied from aasmbase.pas }
  322. TAsmsymbind=(AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL);
  323. TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION);
  324. var
  325. s,
  326. bindstr,
  327. typestr : string;
  328. i : longint;
  329. begin
  330. writeln(space,'Number of AsmSymbols: ',ppufile.getlongint);
  331. i:=0;
  332. while (not ppufile.endofentry) and (not ppufile.error) do
  333. begin
  334. s:=ppufile.getstring;
  335. case tasmsymbind(ppufile.getbyte) of
  336. AB_EXTERNAL :
  337. bindstr:='External';
  338. AB_COMMON :
  339. bindstr:='Common';
  340. AB_LOCAL :
  341. bindstr:='Local';
  342. AB_GLOBAL :
  343. bindstr:='Global';
  344. else
  345. bindstr:='<Error !!>'
  346. end;
  347. case tasmsymtype(ppufile.getbyte) of
  348. AT_FUNCTION :
  349. typestr:='Function';
  350. AT_DATA :
  351. typestr:='Data';
  352. AT_SECTION :
  353. typestr:='Section';
  354. else
  355. typestr:='<Error !!>'
  356. end;
  357. Writeln(space,' ',i,' : ',s,' [',bindstr,',',typestr,']');
  358. inc(i);
  359. end;
  360. end;
  361. Procedure ReadPosInfo;
  362. var
  363. info : byte;
  364. fileindex,line,column : longint;
  365. begin
  366. with ppufile do
  367. begin
  368. {
  369. info byte layout in bits:
  370. 0-1 - amount of bytes for fileindex
  371. 2-3 - amount of bytes for line
  372. 4-5 - amount of bytes for column
  373. }
  374. info:=getbyte;
  375. case (info and $03) of
  376. 0 : fileindex:=getbyte;
  377. 1 : fileindex:=getword;
  378. 2 : fileindex:=(getbyte shl 16) or getword;
  379. 3 : fileindex:=getlongint;
  380. end;
  381. case ((info shr 2) and $03) of
  382. 0 : line:=getbyte;
  383. 1 : line:=getword;
  384. 2 : line:=(getbyte shl 16) or getword;
  385. 3 : line:=getlongint;
  386. end;
  387. case ((info shr 4) and $03) of
  388. 0 : column:=getbyte;
  389. 1 : column:=getword;
  390. 2 : column:=(getbyte shl 16) or getword;
  391. 3 : column:=getlongint;
  392. end;
  393. Writeln(fileindex,' (',line,',',column,')');
  394. end;
  395. end;
  396. function readderef(const s:string;skipnil:boolean):boolean;
  397. type
  398. tdereftype = (derefnil,derefaktrecordindex,derefaktstaticindex,
  399. derefunit,derefrecord,derefindex,
  400. dereflocal,derefpara,derefaktlocalindex);
  401. var
  402. b : tdereftype;
  403. begin
  404. readderef:=true;
  405. repeat
  406. b:=tdereftype(ppufile.getbyte);
  407. case b of
  408. derefnil :
  409. begin
  410. if not skipnil then
  411. writeln('nil');
  412. readderef:=false;
  413. break;
  414. end;
  415. derefaktrecordindex :
  416. begin
  417. writeln('AktRecord ',s,' ',ppufile.getword);
  418. break;
  419. end;
  420. derefaktstaticindex :
  421. begin
  422. writeln('AktStatic ',s,' ',ppufile.getword);
  423. break;
  424. end;
  425. derefaktlocalindex :
  426. begin
  427. writeln('AktLocal ',s,' ',ppufile.getword);
  428. break;
  429. end;
  430. derefunit :
  431. begin
  432. writeln('Unit ',ppufile.getword);
  433. break;
  434. end;
  435. derefrecord :
  436. begin
  437. write('RecordDef ',ppufile.getword,', ');
  438. end;
  439. derefpara :
  440. begin
  441. write('Parameter of procdef ',ppufile.getword,', ');
  442. end;
  443. dereflocal :
  444. begin
  445. write('Local of procdef ',ppufile.getword,', ');
  446. end;
  447. derefindex :
  448. begin
  449. write(s,' ',ppufile.getword,', ');
  450. end;
  451. else
  452. begin
  453. writeln('!! unsupported dereftyp: ',ord(b));
  454. break;
  455. end;
  456. end;
  457. until false;
  458. end;
  459. function readdefref:boolean;
  460. begin
  461. readdefref:=readderef('Definition',false);
  462. end;
  463. function readsymref:boolean;
  464. begin
  465. readsymref:=readderef('Symbol',false);
  466. end;
  467. procedure readtype;
  468. var
  469. b1,b2 : boolean;
  470. begin
  471. b1:=readderef('Definition',true);
  472. b2:=readderef('Symbol',true);
  473. if not(b1 or b2) then
  474. Writeln('nil')
  475. else
  476. if (b1 and b2) then
  477. Writeln('!! Type has both definition and symbol stored');
  478. end;
  479. procedure readsymlist(const s:string);
  480. type
  481. tsltype = (sl_none,
  482. sl_load,
  483. sl_call,
  484. sl_subscript,
  485. sl_vec
  486. );
  487. const
  488. slstr : array[tsltype] of string[9] = ('',
  489. 'load',
  490. 'call',
  491. 'subscript',
  492. 'vec'
  493. );
  494. var
  495. sl : tsltype;
  496. begin
  497. readdefref;
  498. repeat
  499. sl:=tsltype(ppufile.getbyte);
  500. if sl=sl_none then
  501. break;
  502. write(s,'(',slstr[sl],') ');
  503. case sl of
  504. sl_call,
  505. sl_load,
  506. sl_subscript :
  507. readsymref;
  508. sl_vec :
  509. writeln(ppufile.getlongint);
  510. end;
  511. until false;
  512. end;
  513. procedure readsymoptions;
  514. type
  515. tsymoption=(sp_none,
  516. sp_public,
  517. sp_private,
  518. sp_published,
  519. sp_protected,
  520. sp_forwarddef,
  521. sp_static,
  522. sp_primary_typesym { this is for typesym, to know who is the primary symbol of a def }
  523. );
  524. tsymoptions=set of tsymoption;
  525. tsymopt=record
  526. mask : tsymoption;
  527. str : string[30];
  528. end;
  529. const
  530. symopts=7;
  531. symopt : array[1..symopts] of tsymopt=(
  532. (mask:sp_public; str:'Public'),
  533. (mask:sp_private; str:'Private'),
  534. (mask:sp_published; str:'Published'),
  535. (mask:sp_protected; str:'Protected'),
  536. (mask:sp_forwarddef; str:'ForwardDef'),
  537. (mask:sp_static; str:'Static'),
  538. (mask:sp_primary_typesym;str:'PrimaryTypeSym')
  539. );
  540. var
  541. symoptions : tsymoptions;
  542. i : longint;
  543. first : boolean;
  544. begin
  545. ppufile.getsmallset(symoptions);
  546. if symoptions<>[] then
  547. begin
  548. first:=true;
  549. for i:=1to symopts do
  550. if (symopt[i].mask in symoptions) then
  551. begin
  552. if first then
  553. first:=false
  554. else
  555. write(', ');
  556. write(symopt[i].str);
  557. end;
  558. end;
  559. writeln;
  560. end;
  561. { Read abstract procdef and return if inline procdef }
  562. type
  563. tproccalloption=(pocall_none,
  564. pocall_cdecl, { procedure uses C styled calling }
  565. pocall_cppdecl, { C++ calling conventions }
  566. pocall_compilerproc, { Procedure is used for internal compiler calls }
  567. pocall_far16, { Far16 for OS/2 }
  568. pocall_fpccall, { FPC default calling }
  569. pocall_inline, { Procedure is an assembler macro }
  570. pocall_internproc, { Procedure has compiler magic}
  571. pocall_palmossyscall, { procedure is a PalmOS system call }
  572. pocall_pascal, { pascal standard left to right }
  573. pocall_register, { procedure uses register (fastcall) calling }
  574. pocall_safecall, { safe call calling conventions }
  575. pocall_stdcall, { procedure uses stdcall call }
  576. pocall_system { system call }
  577. );
  578. tproccalloptions=set of tproccalloption;
  579. tproctypeoption=(potype_none,
  580. potype_proginit, { Program initialization }
  581. potype_unitinit, { unit initialization }
  582. potype_unitfinalize, { unit finalization }
  583. potype_constructor, { Procedure is a constructor }
  584. potype_destructor, { Procedure is a destructor }
  585. potype_operator { Procedure defines an operator }
  586. );
  587. tproctypeoptions=set of tproctypeoption;
  588. tprocoption=(po_none,
  589. po_classmethod, { class method }
  590. po_virtualmethod, { Procedure is a virtual method }
  591. po_abstractmethod, { Procedure is an abstract method }
  592. po_staticmethod, { static method }
  593. po_overridingmethod, { method with override directive }
  594. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  595. po_interrupt, { Procedure is an interrupt handler }
  596. po_iocheck, { IO checking should be done after a call to the procedure }
  597. po_assembler, { Procedure is written in assembler }
  598. po_msgstr, { method for string message handling }
  599. po_msgint, { method for int message handling }
  600. po_exports, { Procedure has export directive (needed for OS/2) }
  601. po_external, { Procedure is external (in other object or lib)}
  602. po_savestdregs, { save std regs cdecl and stdcall need that ! }
  603. po_saveregisters, { save all registers }
  604. po_overload, { procedure is declared with overload directive }
  605. po_varargs, { printf like arguments }
  606. po_leftright, { push arguments from left to right }
  607. po_clearstack, { caller clears the stack }
  608. po_internconst, { procedure has constant evaluator intern }
  609. po_addressonly, { flag that only the address of a method is returned and not a full methodpointer }
  610. po_public { procedure is exported }
  611. );
  612. tprocoptions=set of tprocoption;
  613. function read_abstract_proc_def:tproccalloption;
  614. type
  615. tproccallopt=record
  616. mask : tproccalloption;
  617. str : string[30];
  618. end;
  619. tproctypeopt=record
  620. mask : tproctypeoption;
  621. str : string[30];
  622. end;
  623. tprocopt=record
  624. mask : tprocoption;
  625. str : string[30];
  626. end;
  627. const
  628. proccalloptionStr : array[tproccalloption] of string[14]=('',
  629. 'CDecl',
  630. 'CPPDecl',
  631. 'CompilerProc',
  632. 'Far16',
  633. 'FPCCall',
  634. 'Inline',
  635. 'InternProc',
  636. 'PalmOSSysCall',
  637. 'Pascal',
  638. 'Register',
  639. 'SafeCall',
  640. 'StdCall',
  641. 'System'
  642. );
  643. proctypeopts=6;
  644. proctypeopt : array[1..proctypeopts] of tproctypeopt=(
  645. (mask:potype_proginit; str:'ProgInit'),
  646. (mask:potype_unitinit; str:'UnitInit'),
  647. (mask:potype_unitfinalize;str:'UnitFinalize'),
  648. (mask:potype_constructor; str:'Constructor'),
  649. (mask:potype_destructor; str:'Destructor'),
  650. (mask:potype_operator; str:'Operator')
  651. );
  652. procopts=22;
  653. procopt : array[1..procopts] of tprocopt=(
  654. (mask:po_classmethod; str:'ClassMethod'),
  655. (mask:po_virtualmethod; str:'VirtualMethod'),
  656. (mask:po_abstractmethod; str:'AbstractMethod'),
  657. (mask:po_staticmethod; str:'StaticMethod'),
  658. (mask:po_overridingmethod;str:'OverridingMethod'),
  659. (mask:po_methodpointer; str:'MethodPointer'),
  660. (mask:po_interrupt; str:'Interrupt'),
  661. (mask:po_iocheck; str:'IOCheck'),
  662. (mask:po_assembler; str:'Assembler'),
  663. (mask:po_msgstr; str:'MsgStr'),
  664. (mask:po_msgint; str:'MsgInt'),
  665. (mask:po_exports; str:'Exports'),
  666. (mask:po_external; str:'External'),
  667. (mask:po_savestdregs; str:'SaveStdRegs'),
  668. (mask:po_saveregisters; str:'SaveRegisters'),
  669. (mask:po_overload; str:'Overload'),
  670. (mask:po_varargs; str:'VarArgs'),
  671. (mask:po_leftright; str:'LeftRight'),
  672. (mask:po_clearstack; str:'ClearStack'),
  673. (mask:po_internconst; str:'InternConst'),
  674. (mask:po_addressonly; str:'AddressOnly'),
  675. (mask:po_public; str:'Public')
  676. );
  677. var
  678. proctypeoption : tproctypeoption;
  679. proccalloption : tproccalloption;
  680. procoptions : tprocoptions;
  681. i,params : longint;
  682. first : boolean;
  683. paraloclen : byte;
  684. paraloc : array[0..127] of byte;
  685. begin
  686. write(space,' Return type : ');
  687. readtype;
  688. writeln(space,' Fpu used : ',ppufile.getbyte);
  689. proctypeoption:=tproctypeoption(ppufile.getbyte);
  690. if proctypeoption<>potype_none then
  691. begin
  692. write(space,' TypeOption : ');
  693. first:=true;
  694. for i:=1 to proctypeopts do
  695. if (proctypeopt[i].mask=proctypeoption) then
  696. begin
  697. if first then
  698. first:=false
  699. else
  700. write(', ');
  701. write(proctypeopt[i].str);
  702. end;
  703. writeln;
  704. end;
  705. proccalloption:=tproccalloption(ppufile.getbyte);
  706. read_abstract_proc_def:=proccalloption;
  707. writeln(space,' CallOption : ',proccalloptionStr[proccalloption]);
  708. ppufile.getsmallset(procoptions);
  709. if procoptions<>[] then
  710. begin
  711. write(space,' Options : ');
  712. first:=true;
  713. for i:=1to procopts do
  714. if (procopt[i].mask in procoptions) then
  715. begin
  716. if first then
  717. first:=false
  718. else
  719. write(', ');
  720. write(procopt[i].str);
  721. end;
  722. writeln;
  723. end;
  724. params:=ppufile.getbyte;
  725. writeln(space,' Nr of parameters : ',params);
  726. for i:=1 to params do
  727. begin
  728. writeln(space,' - Parameter ',i);
  729. writeln(space,' Spez : ',Varspez2Str(ppufile.getbyte));
  730. write (space,' Type : ');
  731. readtype;
  732. write (space,' Default : ');
  733. readsymref;
  734. write (space,' Symbol : ');
  735. readsymref;
  736. writeln(space,' Is Hidden : ',(ppufile.getbyte<>0));
  737. write (space,' Location : ');
  738. writeln('<not yet implemented>');
  739. paraloclen:=ppufile.getbyte;
  740. ppufile.getdata(paraloc,paraloclen);
  741. end;
  742. end;
  743. procedure readcommonsym(const s:string);
  744. begin
  745. writeln(space,'** Symbol Nr. ',ppufile.getword,' **');
  746. writeln(space,s,ppufile.getstring);
  747. write(space,' File Pos: ');
  748. readposinfo;
  749. write(space,' SymOptions: ');
  750. readsymoptions;
  751. end;
  752. procedure readcommondef(const s:string);
  753. type
  754. tdefoption=(df_none,
  755. df_has_inittable, { init data has been generated }
  756. df_has_rttitable, { rtti data has been generated }
  757. df_unique
  758. );
  759. tdefoptions=set of tdefoption;
  760. var
  761. defopts : tdefoptions;
  762. begin
  763. writeln(space,'** Definition Nr. ',ppufile.getword,' **');
  764. writeln(space,s);
  765. write (space,' Type symbol : ');
  766. readsymref;
  767. ppufile.getsmallset(defopts);
  768. if df_unique in defopts then
  769. writeln (space,' Unique type symbol');
  770. if df_has_rttitable in defopts then
  771. begin
  772. write (space,' RTTI symbol : ');
  773. readsymref;
  774. end;
  775. if df_has_inittable in defopts then
  776. begin
  777. write (space,' Init symbol : ');
  778. readsymref;
  779. end;
  780. end;
  781. {****************************************************************************
  782. Read Symbols Part
  783. ****************************************************************************}
  784. procedure readsymbols;
  785. type
  786. { options for variables }
  787. tvaroption=(vo_none,
  788. vo_regable,
  789. vo_is_C_var,
  790. vo_is_external,
  791. vo_is_dll_var,
  792. vo_is_thread_var,
  793. vo_fpuregable,
  794. vo_is_local_copy,
  795. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  796. vo_is_exported,
  797. vo_is_high_value
  798. );
  799. tvaroptions=set of tvaroption;
  800. pguid = ^tguid;
  801. tguid = packed record
  802. D1: LongWord;
  803. D2: Word;
  804. D3: Word;
  805. D4: array[0..7] of Byte;
  806. end;
  807. absolutetyp = (tovar,toasm,toaddr);
  808. tconsttyp = (constnone,
  809. constord,conststring,constreal,constbool,
  810. constint,constchar,constset,constpointer,constnil,
  811. constresourcestring,constwstring,constwchar,constguid
  812. );
  813. var
  814. b : byte;
  815. pc : pchar;
  816. totalsyms,
  817. symcnt,
  818. i,j,len : longint;
  819. guid : tguid;
  820. begin
  821. symcnt:=1;
  822. with ppufile do
  823. begin
  824. if space<>'' then
  825. Writeln(space,'-----------------------------');
  826. if readentry=ibstartsyms then
  827. begin
  828. totalsyms:=getlongint;
  829. Writeln(space,'Number of symbols : ',totalsyms);
  830. Writeln(space,'Symtable datasize : ',getlongint);
  831. Writeln(space,'Symtable alignment: ',getlongint);
  832. end
  833. else
  834. begin
  835. totalsyms:=-1;
  836. Writeln('!! ibstartsym not found');
  837. end;
  838. repeat
  839. b:=readentry;
  840. if not (b in [iberror,ibendsyms]) then
  841. inc(symcnt);
  842. case b of
  843. ibunitsym :
  844. readcommonsym('Unit symbol ');
  845. iblabelsym :
  846. readcommonsym('Label symbol ');
  847. ibtypesym :
  848. begin
  849. readcommonsym('Type symbol ');
  850. write(space,' Result Type: ');
  851. readtype;
  852. end;
  853. ibprocsym :
  854. begin
  855. readcommonsym('Procedure symbol ');
  856. repeat
  857. write(space,' Definition: ');
  858. until not readdefref;
  859. end;
  860. ibconstsym :
  861. begin
  862. readcommonsym('Constant symbol ');
  863. b:=getbyte;
  864. case tconsttyp(b) of
  865. constord :
  866. begin
  867. write (space,'OrdinalType: ');
  868. readtype;
  869. writeln (space,' Value: ',getlongint)
  870. end;
  871. constpointer :
  872. begin
  873. write (space,' Pointer Type: ');
  874. readtype;
  875. writeln (space,' Value: ',getlongint)
  876. end;
  877. conststring,
  878. constresourcestring :
  879. begin
  880. len:=getlongint;
  881. getmem(pc,len+1);
  882. getdata(pc^,len);
  883. writeln(space,' Length: ',len);
  884. writeln(space,' Value: "',pc,'"');
  885. freemem(pc,len+1);
  886. if tconsttyp(b)=constresourcestring then
  887. writeln(space,' Index: ',getlongint);
  888. end;
  889. constreal :
  890. writeln(space,' Value: ',getreal);
  891. constbool :
  892. if getlongint<>0 then
  893. writeln (space,' Value : True')
  894. else
  895. writeln (space,' Value: False');
  896. constint :
  897. writeln(space,' Value: ',getint64);
  898. constchar :
  899. writeln(space,' Value: "'+chr(getlongint)+'"');
  900. constset :
  901. begin
  902. write (space,' Set Type: ');
  903. readtype;
  904. for i:=1to 4 do
  905. begin
  906. write (space,' Value: ');
  907. for j:=1to 8 do
  908. begin
  909. if j>1 then
  910. write(',');
  911. write(hexb(getbyte));
  912. end;
  913. writeln;
  914. end;
  915. end;
  916. constwstring:
  917. begin
  918. end;
  919. constwchar:
  920. writeln(space,' Value: #',getlongint);
  921. constguid:
  922. begin
  923. getdata(guid,sizeof(guid));
  924. write (space,' IID String: {',hexstr(guid.d1,8),'-',hexstr(guid.d2,4),'-',hexstr(guid.d3,4),'-');
  925. for i:=0 to 7 do
  926. begin
  927. write(hexstr(guid.d4[i],2));
  928. if i=1 then write('-');
  929. end;
  930. writeln('}');
  931. end
  932. else
  933. Writeln ('!! Invalid unit format : Invalid const type encountered: ',b);
  934. end;
  935. end;
  936. ibvarsym :
  937. begin
  938. readcommonsym('Variable symbol ');
  939. writeln(space,' Spez: ',Varspez2Str(getbyte));
  940. writeln(space,' Address: ',getlongint);
  941. write (space,' Var Type: ');
  942. readtype;
  943. i:=getlongint;
  944. writeln(space,' Options: ',i);
  945. if (vo_is_C_var in tvaroptions(i)) then
  946. writeln(space,' Mangledname: ',getstring);
  947. end;
  948. ibenumsym :
  949. begin
  950. readcommonsym('Enumeration symbol ');
  951. write (space,' Definition: ');
  952. readdefref;
  953. writeln(space,' Value: ',getlongint);
  954. end;
  955. ibsyssym :
  956. begin
  957. readcommonsym('Internal system symbol ');
  958. writeln(space,' Internal Nr: ',getlongint);
  959. end;
  960. ibrttisym :
  961. begin
  962. readcommonsym('RTTI symbol ');
  963. writeln(space,' RTTI Type: ',getbyte);
  964. end;
  965. ibtypedconstsym :
  966. begin
  967. readcommonsym('Typed constant ');
  968. write (space,' Constant Type: ');
  969. readtype;
  970. writeln(space,' ReallyConst: ',(getbyte<>0));
  971. end;
  972. ibabsolutesym :
  973. begin
  974. readcommonsym('Absolute variable symbol ');
  975. writeln(space,' Type: ',getbyte);
  976. writeln(space,' Address: ',getlongint);
  977. write (space,' Var Type: ');
  978. readtype;
  979. writeln(space,' Options: ',getlongint);
  980. Write (space,' Relocated to ');
  981. b:=getbyte;
  982. case absolutetyp(b) of
  983. tovar :
  984. Writeln('Name : ',getstring);
  985. toasm :
  986. Writeln('Assembler name : ',getstring);
  987. toaddr :
  988. begin
  989. Write('Address : ',getlongint);
  990. WriteLn(' (Far: ',getbyte<>0,')');
  991. end;
  992. else
  993. Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
  994. end;
  995. end;
  996. ibpropertysym :
  997. begin
  998. readcommonsym('Property ');
  999. i:=getlongint;
  1000. writeln(space,' PropOptions: ',i);
  1001. if (i and 32)>0 then
  1002. begin
  1003. write (space,'OverrideProp: ');
  1004. readsymref;
  1005. end
  1006. else
  1007. begin
  1008. write (space,' Prop Type: ');
  1009. readtype;
  1010. writeln(space,' Index: ',getlongint);
  1011. writeln(space,' Default: ',getlongint);
  1012. write (space,' Index Type: ');
  1013. readtype;
  1014. write (space,' Readaccess: ');
  1015. readsymlist(space+' Sym: ');
  1016. write (space,' Writeaccess: ');
  1017. readsymlist(space+' Sym: ');
  1018. write (space,'Storedaccess: ');
  1019. readsymlist(space+' Sym: ');
  1020. end;
  1021. end;
  1022. iberror :
  1023. begin
  1024. Writeln('!! Error in PPU');
  1025. exit;
  1026. end;
  1027. ibendsyms :
  1028. break;
  1029. else
  1030. WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
  1031. end;
  1032. if not EndOfEntry then
  1033. Writeln('!! Entry has more information stored');
  1034. until false;
  1035. if (totalsyms<>-1) and (symcnt-1<>totalsyms) then
  1036. Writeln('!! Only read ',symcnt-1,' of ',totalsyms,' symbols');
  1037. end;
  1038. end;
  1039. {****************************************************************************
  1040. Read defintions Part
  1041. ****************************************************************************}
  1042. procedure getusedregisters_i386;
  1043. type
  1044. tregister = (R_NO,
  1045. R_EAX,R_ECX,R_EDX,R_EBX,R_ESP,R_EBP,R_ESI,R_EDI,
  1046. R_AX,R_CX,R_DX,R_BX,R_SP,R_BP,R_SI,R_DI,
  1047. R_AL,R_CL,R_DL,R_BL,R_AH,R_CH,R_BH,R_DH,
  1048. R_CS,R_DS,R_ES,R_SS,R_FS,R_GS,
  1049. R_ST,R_ST0,R_ST1,R_ST2,R_ST3,R_ST4,R_ST5,R_ST6,R_ST7,
  1050. R_DR0,R_DR1,R_DR2,R_DR3,R_DR6,R_DR7,
  1051. R_CR0,R_CR2,R_CR3,R_CR4,
  1052. R_TR3,R_TR4,R_TR5,R_TR6,R_TR7,
  1053. R_MM0,R_MM1,R_MM2,R_MM3,R_MM4,R_MM5,R_MM6,R_MM7,
  1054. R_XMM0,R_XMM1,R_XMM2,R_XMM3,R_XMM4,R_XMM5,R_XMM6,R_XMM7
  1055. );
  1056. tregisterset = set of tregister;
  1057. reg2strtable = array[tregister] of string[6];
  1058. const
  1059. std_reg2str : reg2strtable = ('',
  1060. 'eax','ecx','edx','ebx','esp','ebp','esi','edi',
  1061. 'ax','cx','dx','bx','sp','bp','si','di',
  1062. 'al','cl','dl','bl','ah','ch','bh','dh',
  1063. 'cs','ds','es','ss','fs','gs',
  1064. 'st','st(0)','st(1)','st(2)','st(3)','st(4)','st(5)','st(6)','st(7)',
  1065. 'dr0','dr1','dr2','dr3','dr6','dr7',
  1066. 'cr0','cr2','cr3','cr4',
  1067. 'tr3','tr4','tr5','tr6','tr7',
  1068. 'mm0','mm1','mm2','mm3','mm4','mm5','mm6','mm7',
  1069. 'xmm0','xmm1','xmm2','xmm3','xmm4','xmm5','xmm6','xmm7'
  1070. );
  1071. firstsaveintreg = R_EAX;
  1072. lastsaveintreg = R_EBX;
  1073. firstsavefpureg = R_NO;
  1074. lastsavefpureg = R_NO;
  1075. firstsavemmreg = R_MM0;
  1076. lastsavemmreg = R_MM7;
  1077. var
  1078. regs: tregisterset;
  1079. r: tregister;
  1080. first: boolean;
  1081. begin
  1082. first := true;
  1083. ppufile.getnormalset(regs);
  1084. for r := firstsaveintreg to lastsaveintreg do
  1085. if r in regs then
  1086. begin
  1087. if not first then
  1088. write(', ')
  1089. else
  1090. first := false;
  1091. write(std_reg2str[r])
  1092. end;
  1093. if (firstsavefpureg <> R_NO) then
  1094. for r := firstsavefpureg to lastsavefpureg do
  1095. if r in regs then
  1096. begin
  1097. if not first then
  1098. write(', ')
  1099. else
  1100. first := false;
  1101. write(std_reg2str[r])
  1102. end;
  1103. if (firstsavemmreg <> R_NO) then
  1104. for r := firstsavemmreg to lastsavemmreg do
  1105. if r in regs then
  1106. begin
  1107. if not first then
  1108. write(', ')
  1109. else
  1110. first := false;
  1111. write(std_reg2str[r])
  1112. end;
  1113. writeln;
  1114. end;
  1115. procedure readdefinitions(start_read : boolean);
  1116. type
  1117. tsettype = (normset,smallset,varset);
  1118. tbasetype = (
  1119. uvoid,
  1120. u8bit,u16bit,u32bit,u64bit,
  1121. s8bit,s16bit,s32bit,s64bit,
  1122. bool8bit,bool16bit,bool32bit,
  1123. uchar,uwidechar
  1124. );
  1125. tobjectdeftype = (odt_none,
  1126. odt_class,
  1127. odt_object,
  1128. odt_interfacecom,
  1129. odt_interfacecorba,
  1130. odt_cppclass
  1131. );
  1132. var
  1133. b : byte;
  1134. oldread_member : boolean;
  1135. totaldefs,l,j,
  1136. defcnt : longint;
  1137. calloption : tproccalloption;
  1138. regs : set of char;
  1139. begin
  1140. defcnt:=0;
  1141. with ppufile do
  1142. begin
  1143. if space<>'' then
  1144. Writeln(space,'-----------------------------');
  1145. if not start_read then
  1146. if readentry=ibstartdefs then
  1147. begin
  1148. totaldefs:=getlongint;
  1149. Writeln(space,'Number of definitions: ',totaldefs);
  1150. end
  1151. else
  1152. begin
  1153. totaldefs:=-1;
  1154. Writeln('!! ibstartdef not found');
  1155. end;
  1156. repeat
  1157. b:=readentry;
  1158. if not (b in [iberror,ibenddefs]) then
  1159. inc(defcnt);
  1160. case b of
  1161. ibpointerdef :
  1162. begin
  1163. readcommondef('Pointer definition');
  1164. write (space,' Pointed Type : ');
  1165. readtype;
  1166. writeln(space,' Is Far : ',(getbyte<>0));
  1167. end;
  1168. iborddef :
  1169. begin
  1170. readcommondef('Ordinal definition');
  1171. write (space,' Base type : ');
  1172. b:=getbyte;
  1173. case tbasetype(b) of
  1174. uvoid : writeln('uvoid');
  1175. u8bit : writeln('u8bit');
  1176. u16bit : writeln('u16bit');
  1177. u32bit : writeln('s32bit');
  1178. u64bit : writeln('u64bit');
  1179. s8bit : writeln('s8bit');
  1180. s16bit : writeln('s16bit');
  1181. s32bit : writeln('s32bit');
  1182. s64bit : writeln('s64bit');
  1183. bool8bit : writeln('bool8bit');
  1184. bool16bit : writeln('bool16bit');
  1185. bool32bit : writeln('bool32bit');
  1186. uchar : writeln('uchar');
  1187. uwidechar : writeln('uwidechar');
  1188. else writeln('!! Warning: Invalid base type ',b);
  1189. end;
  1190. writeln(space,' Range : ',getint64,' to ',getint64);
  1191. end;
  1192. ibfloatdef :
  1193. begin
  1194. readcommondef('Float definition');
  1195. writeln(space,' Float type : ',getbyte);
  1196. end;
  1197. ibarraydef :
  1198. begin
  1199. readcommondef('Array definition');
  1200. write (space,' Element type : ');
  1201. readtype;
  1202. write (space,' Range Type : ');
  1203. readtype;
  1204. writeln(space,' Range : ',getlongint,' to ',getlongint);
  1205. writeln(space,' Is Constructor : ',(getbyte<>0));
  1206. writeln(space,' Is Dynamic : ',(getbyte<>0));
  1207. end;
  1208. ibprocdef :
  1209. begin
  1210. readcommondef('Procedure definition');
  1211. calloption:=read_abstract_proc_def;
  1212. write (space,' Used IntRegs : ');
  1213. getnormalset(regs);
  1214. writeln('<not yet implemented>');
  1215. write (space,' Used OtherRegs : ');
  1216. getnormalset(regs);
  1217. writeln('<not yet implemented>');
  1218. {$ifdef OLDRA}
  1219. case ttargetcpu(header.cpu) of
  1220. i386 :
  1221. getusedregisters_i386
  1222. else
  1223. begin
  1224. getnormalset(regs);
  1225. writeln('<not yet implemented>');
  1226. end;
  1227. end;
  1228. {$endif OLDRA}
  1229. if (getbyte<>0) then
  1230. writeln(space,' Mangled name : ',getstring);
  1231. writeln(space,' Overload Number : ',getword);
  1232. writeln(space,' Number : ',getword);
  1233. write (space,' Class : ');
  1234. readdefref;
  1235. write (space,' Procsym : ');
  1236. readsymref;
  1237. write (space,' File Pos : ');
  1238. readposinfo;
  1239. write (space,' SymOptions : ');
  1240. readsymoptions;
  1241. if (calloption=pocall_inline) then
  1242. begin
  1243. write (space,' FuncretSym : ');
  1244. readdefref;
  1245. end;
  1246. space:=' '+space;
  1247. { parast }
  1248. readdefinitions(false);
  1249. readsymbols;
  1250. { localst }
  1251. if (calloption=pocall_inline) or
  1252. ((ppufile.header.flags and uf_local_browser) <> 0) then
  1253. begin
  1254. readdefinitions(false);
  1255. readsymbols;
  1256. end;
  1257. delete(space,1,4);
  1258. end;
  1259. ibprocvardef :
  1260. begin
  1261. readcommondef('Procedural type (ProcVar) definition');
  1262. read_abstract_proc_def;
  1263. space:=' '+space;
  1264. { parast }
  1265. readdefinitions(false);
  1266. readsymbols;
  1267. delete(space,1,4);
  1268. end;
  1269. ibshortstringdef :
  1270. begin
  1271. readcommondef('ShortString definition');
  1272. writeln(space,' Length : ',getbyte);
  1273. end;
  1274. ibwidestringdef :
  1275. begin
  1276. readcommondef('WideString definition');
  1277. writeln(space,' Length : ',getlongint);
  1278. end;
  1279. ibansistringdef :
  1280. begin
  1281. readcommondef('AnsiString definition');
  1282. writeln(space,' Length : ',getlongint);
  1283. end;
  1284. iblongstringdef :
  1285. begin
  1286. readcommondef('Longstring definition');
  1287. writeln(space,' Length : ',getlongint);
  1288. end;
  1289. ibrecorddef :
  1290. begin
  1291. readcommondef('Record definition');
  1292. writeln(space,' Size : ',getlongint);
  1293. {read the record definitions and symbols}
  1294. space:=' '+space;
  1295. oldread_member:=read_member;
  1296. read_member:=true;
  1297. readdefinitions(false);
  1298. readsymbols;
  1299. read_member:=oldread_member;
  1300. Delete(space,1,4);
  1301. end;
  1302. ibobjectdef :
  1303. begin
  1304. readcommondef('Object/Class definition');
  1305. b:=getbyte;
  1306. write (space,' Type : ');
  1307. case tobjectdeftype(b) of
  1308. odt_class : writeln('class');
  1309. odt_object : writeln('object');
  1310. odt_interfacecom : writeln('interfacecom');
  1311. odt_interfacecorba : writeln('interfacecorba');
  1312. odt_cppclass : writeln('cppclass');
  1313. else writeln('!! Warning: Invalid object type ',b);
  1314. end;
  1315. writeln(space,' Size : ',getlongint);
  1316. writeln(space,' Vmt offset : ',getlongint);
  1317. writeln(space,' Name of Class : ',getstring);
  1318. write(space, ' Ancestor Class : ');
  1319. readdefref;
  1320. writeln(space,' Options : ',getlongint);
  1321. if tobjectdeftype(b) in [odt_interfacecom,odt_interfacecorba] then
  1322. begin
  1323. { IIDGUID }
  1324. for j:=1to 16 do
  1325. getbyte;
  1326. writeln(space,' IID String : ',getstring);
  1327. writeln(space,' Last VTable idx : ',getlongint);
  1328. end;
  1329. if tobjectdeftype(b) in [odt_class,odt_interfacecorba] then
  1330. begin
  1331. l:=getlongint;
  1332. writeln(space,' Impl Intf Count : ',l);
  1333. for j:=1 to l do
  1334. begin
  1335. write (space,' - Definition : ');
  1336. readdefref;
  1337. writeln(space,' IOffset : ',getlongint);
  1338. end;
  1339. end;
  1340. {read the record definitions and symbols}
  1341. space:=' '+space;
  1342. oldread_member:=read_member;
  1343. read_member:=true;
  1344. readdefinitions(false);
  1345. readsymbols;
  1346. read_member:=oldread_member;
  1347. Delete(space,1,4);
  1348. end;
  1349. ibfiledef :
  1350. begin
  1351. ReadCommonDef('File definition');
  1352. write (space,' Type : ');
  1353. case getbyte of
  1354. 0 : writeln('Text');
  1355. 1 : begin
  1356. writeln('Typed');
  1357. write (space,' File of Type : ');
  1358. Readtype;
  1359. end;
  1360. 2 : writeln('Untyped');
  1361. end;
  1362. end;
  1363. ibformaldef :
  1364. readcommondef('Generic Definition (void-typ)');
  1365. ibenumdef :
  1366. begin
  1367. readcommondef('Enumeration type definition');
  1368. write(space,'Base enumeration type : ');
  1369. readdefref;
  1370. writeln(space,' Smallest element : ',getlongint);
  1371. writeln(space,' Largest element : ',getlongint);
  1372. writeln(space,' Size : ',getlongint);
  1373. end;
  1374. ibclassrefdef :
  1375. begin
  1376. readcommondef('Class reference definition');
  1377. write (space,' Pointed Type : ');
  1378. readtype;
  1379. end;
  1380. ibsetdef :
  1381. begin
  1382. readcommondef('Set definition');
  1383. write (space,' Element type : ');
  1384. readtype;
  1385. b:=getbyte;
  1386. case tsettype(b) of
  1387. smallset : writeln(space,' Set with 32 Elements');
  1388. normset : writeln(space,' Set with 256 Elements');
  1389. varset : writeln(space,' Set with ',getlongint,' Elements');
  1390. else writeln('!! Warning: Invalid set type ',b);
  1391. end;
  1392. end;
  1393. ibvariantdef :
  1394. begin
  1395. readcommondef('Variant definition');
  1396. end;
  1397. iberror :
  1398. begin
  1399. Writeln('!! Error in PPU');
  1400. exit;
  1401. end;
  1402. ibenddefs :
  1403. break;
  1404. else
  1405. WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
  1406. end;
  1407. if not EndOfEntry then
  1408. Writeln('!! Entry has more information stored');
  1409. until false;
  1410. if (totaldefs<>-1) and (defcnt<>totaldefs) then
  1411. Writeln('!! Only read ',defcnt,' of ',totaldefs,' definitions');
  1412. end;
  1413. end;
  1414. {****************************************************************************
  1415. Read General Part
  1416. ****************************************************************************}
  1417. procedure readinterface;
  1418. var
  1419. b : byte;
  1420. sourcenumber,
  1421. unitnumber : word;
  1422. ucrc,uintfcrc : longint;
  1423. begin
  1424. with ppufile do
  1425. begin
  1426. repeat
  1427. b:=readentry;
  1428. case b of
  1429. ibmodulename :
  1430. Writeln('Module Name: ',getstring);
  1431. ibsourcefiles :
  1432. begin
  1433. sourcenumber:=1;
  1434. while not EndOfEntry do
  1435. begin
  1436. Writeln('Source file ',sourcenumber,' : ',getstring,' ',filetimestring(getlongint));
  1437. inc(sourcenumber);
  1438. end;
  1439. end;
  1440. ibusedmacros :
  1441. begin
  1442. while not EndOfEntry do
  1443. begin
  1444. Write('Conditional ',getstring);
  1445. b:=getbyte;
  1446. if boolean(b)=true then
  1447. write(' defined at startup')
  1448. else
  1449. write(' not defined at startup');
  1450. b:=getbyte;
  1451. if boolean(b)=true then
  1452. writeln(' was used')
  1453. else
  1454. writeln;
  1455. end;
  1456. end;
  1457. ibloadunit :
  1458. begin
  1459. unitnumber:=1;
  1460. while not EndOfEntry do
  1461. begin
  1462. write('Uses unit: ',getstring,' (Number: ',unitnumber,')');
  1463. ucrc:=getlongint;
  1464. uintfcrc:=getlongint;
  1465. write(' (Crc: ',hexstr(ucrc,8),', IntfcCrc: ',hexstr(uintfcrc,8),')');
  1466. if getbyte<>0 then
  1467. writeln(' (interface)')
  1468. else
  1469. writeln(' (implementation)');
  1470. inc(unitnumber);
  1471. end;
  1472. end;
  1473. iblinkunitofiles :
  1474. ReadLinkContainer('Link unit object file: ');
  1475. iblinkunitstaticlibs :
  1476. ReadLinkContainer('Link unit static lib: ');
  1477. iblinkunitsharedlibs :
  1478. ReadLinkContainer('Link unit shared lib: ');
  1479. iblinkotherofiles :
  1480. ReadLinkContainer('Link other object file: ');
  1481. iblinkotherstaticlibs :
  1482. ReadLinkContainer('Link other static lib: ');
  1483. iblinkothersharedlibs :
  1484. ReadLinkContainer('Link other shared lib: ');
  1485. iberror :
  1486. begin
  1487. Writeln('Error in PPU');
  1488. exit;
  1489. end;
  1490. ibendinterface :
  1491. break;
  1492. else
  1493. WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
  1494. end;
  1495. until false;
  1496. end;
  1497. end;
  1498. {****************************************************************************
  1499. Read Implementation Part
  1500. ****************************************************************************}
  1501. procedure readimplementation;
  1502. var
  1503. b : byte;
  1504. begin
  1505. with ppufile do
  1506. begin
  1507. repeat
  1508. b:=readentry;
  1509. case b of
  1510. ibasmsymbols :
  1511. ReadAsmSymbols;
  1512. iberror :
  1513. begin
  1514. Writeln('Error in PPU');
  1515. exit;
  1516. end;
  1517. ibendimplementation :
  1518. break;
  1519. else
  1520. WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
  1521. end;
  1522. until false;
  1523. end;
  1524. end;
  1525. {****************************************************************************
  1526. Read Browser Part
  1527. ****************************************************************************}
  1528. procedure readbrowser;
  1529. var
  1530. b : byte;
  1531. const indent : string = '';
  1532. begin
  1533. Writeln(indent,'Start of symtable browser');
  1534. indent:=indent+'**';
  1535. with ppufile do
  1536. begin
  1537. repeat
  1538. b:=readentry;
  1539. case b of
  1540. ibbeginsymtablebrowser :
  1541. begin
  1542. { here we must read object and record symtables !! }
  1543. indent:=indent+' ';
  1544. Writeln(indent,'Record/Object symtable');
  1545. readbrowser;
  1546. Indent:=Copy(Indent,1,Length(Indent)-2);
  1547. end;
  1548. ibsymref :
  1549. begin
  1550. readsymref;
  1551. readref;
  1552. end;
  1553. ibdefref :
  1554. begin
  1555. readdefref;
  1556. readref;
  1557. if ((ppufile.header.flags and uf_local_browser)<>0) and
  1558. (UnitIndex=0) then
  1559. begin
  1560. { parast and localst }
  1561. indent:=indent+' ';
  1562. b:=ppufile.readentry;
  1563. if b=ibbeginsymtablebrowser then
  1564. readbrowser;
  1565. b:=ppufile.readentry;
  1566. if b=ibbeginsymtablebrowser then
  1567. readbrowser;
  1568. Indent:=Copy(Indent,1,Length(Indent)-2);
  1569. end;
  1570. end;
  1571. iberror :
  1572. begin
  1573. Writeln('Error in PPU');
  1574. exit;
  1575. end;
  1576. ibendsymtablebrowser :
  1577. break;
  1578. else
  1579. begin
  1580. WriteLn('!! Skipping unsupported PPU Entry in Browser: ',b);
  1581. Halt;
  1582. end;
  1583. end;
  1584. until false;
  1585. end;
  1586. Indent:=Copy(Indent,1,Length(Indent)-2);
  1587. Writeln(Indent,'End of symtable browser');
  1588. end;
  1589. procedure dofile (filename : string);
  1590. var
  1591. b : byte;
  1592. begin
  1593. { reset }
  1594. space:='';
  1595. { fix filename }
  1596. if pos('.',filename)=0 then
  1597. filename:=filename+'.ppu';
  1598. ppufile:=tppufile.create(filename);
  1599. if not ppufile.openfile then
  1600. begin
  1601. writeln ('IO-Error when opening : ',filename,', Skipping');
  1602. exit;
  1603. end;
  1604. { PPU File is open, check for PPU Id }
  1605. if not ppufile.CheckPPUID then
  1606. begin
  1607. writeln(Filename,' : Not a valid PPU file, Skipping');
  1608. exit;
  1609. end;
  1610. { Check PPU Version }
  1611. Writeln('Analyzing ',filename,' (v',ppufile.GetPPUVersion,')');
  1612. if ppufile.GetPPUVersion<16 then
  1613. begin
  1614. writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
  1615. exit;
  1616. end;
  1617. { Write PPU Header Information }
  1618. if (verbose and v_header)<>0 then
  1619. begin
  1620. Writeln;
  1621. Writeln('Header');
  1622. Writeln('-------');
  1623. with ppufile.header do
  1624. begin
  1625. Writeln('Compiler version : ',ppufile.header.compiler shr 14,'.',
  1626. (ppufile.header.compiler shr 7) and $7f,'.',
  1627. ppufile.header.compiler and $7f);
  1628. WriteLn('Target processor : ',Cpu2Str(cpu));
  1629. WriteLn('Target operating system : ',Target2Str(target));
  1630. Writeln('Unit flags : ',PPUFlags2Str(flags));
  1631. Writeln('FileSize (w/o header) : ',size);
  1632. Writeln('Checksum : ',hexstr(checksum,8));
  1633. Writeln('Interface Checksum : ',hexstr(interface_checksum,8));
  1634. end;
  1635. end;
  1636. {read the general stuff}
  1637. if (verbose and v_interface)<>0 then
  1638. begin
  1639. Writeln;
  1640. Writeln('Interface section');
  1641. Writeln('------------------');
  1642. readinterface;
  1643. end
  1644. else
  1645. ppufile.skipuntilentry(ibendinterface);
  1646. {read the definitions}
  1647. if (verbose and v_defs)<>0 then
  1648. begin
  1649. Writeln;
  1650. Writeln('Interface definitions');
  1651. Writeln('----------------------');
  1652. readdefinitions(false);
  1653. end
  1654. else
  1655. ppufile.skipuntilentry(ibenddefs);
  1656. {read the symbols}
  1657. if (verbose and v_syms)<>0 then
  1658. begin
  1659. Writeln;
  1660. Writeln('Interface Symbols');
  1661. Writeln('------------------');
  1662. readsymbols;
  1663. end
  1664. else
  1665. ppufile.skipuntilentry(ibendsyms);
  1666. {read the implementation stuff}
  1667. if (verbose and v_implementation)<>0 then
  1668. begin
  1669. Writeln;
  1670. Writeln('Implementation section');
  1671. Writeln('-----------------------');
  1672. readimplementation;
  1673. end
  1674. else
  1675. ppufile.skipuntilentry(ibendimplementation);
  1676. {read the static browser units stuff}
  1677. if (ppufile.header.flags and uf_local_browser)<>0 then
  1678. begin
  1679. if (verbose and v_defs)<>0 then
  1680. begin
  1681. Writeln;
  1682. Writeln('Static definitions');
  1683. Writeln('----------------------');
  1684. readdefinitions(false);
  1685. end
  1686. else
  1687. ppufile.skipuntilentry(ibenddefs);
  1688. {read the symbols}
  1689. if (verbose and v_syms)<>0 then
  1690. begin
  1691. Writeln;
  1692. Writeln('Static Symbols');
  1693. Writeln('------------------');
  1694. readsymbols;
  1695. end;
  1696. end;
  1697. {read the browser units stuff}
  1698. if (ppufile.header.flags and uf_has_browser)<>0 then
  1699. begin
  1700. if (verbose and v_browser)<>0 then
  1701. begin
  1702. Writeln;
  1703. Writeln('Browser section');
  1704. Writeln('---------------');
  1705. UnitIndex:=0;
  1706. repeat
  1707. b:=ppufile.readentry;
  1708. if b = ibendbrowser then break;
  1709. if b=ibbeginsymtablebrowser then
  1710. begin
  1711. Writeln('Unit ',UnitIndex);
  1712. readbrowser;
  1713. Inc(UnitIndex);
  1714. end
  1715. else
  1716. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1717. until false;
  1718. end;
  1719. end;
  1720. {read the static browser units stuff}
  1721. if (ppufile.header.flags and uf_local_browser)<>0 then
  1722. begin
  1723. if (verbose and v_browser)<>0 then
  1724. begin
  1725. Writeln;
  1726. Writeln('Static browser section');
  1727. Writeln('---------------');
  1728. UnitIndex:=0;
  1729. b:=ppufile.readentry;
  1730. if b=ibbeginsymtablebrowser then
  1731. readbrowser
  1732. else
  1733. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1734. end;
  1735. end;
  1736. {shutdown ppufile}
  1737. ppufile.closefile;
  1738. ppufile.free;
  1739. Writeln;
  1740. end;
  1741. procedure help;
  1742. begin
  1743. writeln('usage: ppudump [options] <filename1> <filename2>...');
  1744. writeln;
  1745. writeln('[options] can be:');
  1746. writeln(' -V<verbose> Set verbosity to <verbose>');
  1747. writeln(' H - Show header info');
  1748. writeln(' I - Show interface');
  1749. writeln(' M - Show implementation');
  1750. writeln(' S - Show interface symbols');
  1751. writeln(' D - Show interface definitions');
  1752. writeln(' B - Show browser info');
  1753. writeln(' A - Show all');
  1754. writeln(' -? This helpscreen');
  1755. halt;
  1756. end;
  1757. var
  1758. startpara,
  1759. nrfile,i : longint;
  1760. para : string;
  1761. begin
  1762. writeln(Title+' '+Version);
  1763. writeln(Copyright);
  1764. writeln;
  1765. if paramcount<1 then
  1766. begin
  1767. writeln('usage: dumpppu [options] <filename1> <filename2>...');
  1768. halt(1);
  1769. end;
  1770. { turn verbose on by default }
  1771. verbose:=v_all;
  1772. { read options }
  1773. startpara:=1;
  1774. while copy(paramstr(startpara),1,1)='-' do
  1775. begin
  1776. para:=paramstr(startpara);
  1777. case upcase(para[2]) of
  1778. 'V' : begin
  1779. verbose:=0;
  1780. for i:=3to length(para) do
  1781. case upcase(para[i]) of
  1782. 'H' : verbose:=verbose or v_header;
  1783. 'I' : verbose:=verbose or v_interface;
  1784. 'M' : verbose:=verbose or v_implementation;
  1785. 'D' : verbose:=verbose or v_defs;
  1786. 'S' : verbose:=verbose or v_syms;
  1787. 'B' : verbose:=verbose or v_browser;
  1788. 'A' : verbose:=verbose or v_all;
  1789. end;
  1790. end;
  1791. '?' : help;
  1792. end;
  1793. inc(startpara);
  1794. end;
  1795. { process files }
  1796. for nrfile:=startpara to paramcount do
  1797. dofile (paramstr(nrfile));
  1798. if has_errors then
  1799. Halt(1);
  1800. end.
  1801. {
  1802. $Log$
  1803. Revision 1.43 2003-06-05 20:06:11 peter
  1804. * new procoptions
  1805. Revision 1.42 2003/05/09 17:47:03 peter
  1806. * self moved to hidden parameter
  1807. * removed hdisposen,hnewn,selfn
  1808. Revision 1.41 2003/04/27 07:29:52 peter
  1809. * aktprocdef cleanup, aktprocdef is now always nil when parsing
  1810. a new procdef declaration
  1811. * aktprocsym removed
  1812. * lexlevel removed, use symtable.symtablelevel instead
  1813. * implicit init/final code uses the normal genentry/genexit
  1814. * funcret state checking updated for new funcret handling
  1815. Revision 1.39 2003/04/25 20:59:35 peter
  1816. * removed funcretn,funcretsym, function result is now in varsym
  1817. and aliases for result and function name are added using absolutesym
  1818. * vs_hidden parameter for funcret passed in parameter
  1819. * vs_hidden fixes
  1820. * writenode changed to printnode and released from extdebug
  1821. * -vp option added to generate a tree.log with the nodetree
  1822. * nicer printnode for statements, callnode
  1823. Revision 1.38 2003/04/10 17:57:53 peter
  1824. * vs_hidden released
  1825. Revision 1.37 2003/03/24 19:57:54 hajny
  1826. + emx target added
  1827. Revision 1.36 2003/03/17 15:54:22 peter
  1828. * store symoptions also for procdef
  1829. * check symoptions (private,public) when calculating possible
  1830. overload candidates
  1831. Revision 1.35 2003/01/03 22:16:29 peter
  1832. * updated for absolutesym and varsym
  1833. Revision 1.34 2002/11/17 16:32:04 carl
  1834. * memory optimization (3-4%) : cleanup of tai fields,
  1835. cleanup of tdef and tsym fields.
  1836. * make it work for m68k
  1837. Revision 1.33 2002/10/20 14:49:31 peter
  1838. * store original source time in ppu so it can be compared instead of
  1839. comparing with the ppu time
  1840. Revision 1.32 2002/10/06 12:25:53 florian
  1841. + dump of tdefoptions.df_unique
  1842. Revision 1.31 2002/09/27 21:22:04 carl
  1843. * update system information
  1844. Revision 1.30 2002/09/26 12:03:54 florian
  1845. + support of constguid and constwchar const symbols added
  1846. Revision 1.29 2002/08/20 16:54:40 peter
  1847. * write address of varsym always
  1848. Revision 1.28 2002/08/19 19:36:44 peter
  1849. * More fixes for cross unit inlining, all tnodes are now implemented
  1850. * Moved pocall_internconst to po_internconst because it is not a
  1851. calling type at all and it conflicted when inlining of these small
  1852. functions was requested
  1853. Revision 1.27 2002/08/15 15:15:56 carl
  1854. * jmpbuf size allocation for exceptions is now cpu specific (as it should)
  1855. * more generic nodes for maths
  1856. * several fixes for better m68k support
  1857. Revision 1.26 2002/08/11 13:24:20 peter
  1858. * saving of asmsymbols in ppu supported
  1859. * asmsymbollist global is removed and moved into a new class
  1860. tasmlibrarydata that will hold the info of a .a file which
  1861. corresponds with a single module. Added librarydata to tmodule
  1862. to keep the library info stored for the module. In the future the
  1863. objectfiles will also be stored to the tasmlibrarydata class
  1864. * all getlabel/newasmsymbol and friends are moved to the new class
  1865. Revision 1.25 2002/05/18 13:34:27 peter
  1866. * readded missing revisions
  1867. Revision 1.24 2002/05/16 19:46:54 carl
  1868. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1869. + try to fix temp allocation (still in ifdef)
  1870. + generic constructor calls
  1871. + start of tassembler / tmodulebase class cleanup
  1872. Revision 1.22 2002/05/12 16:53:18 peter
  1873. * moved entry and exitcode to ncgutil and cgobj
  1874. * foreach gets extra argument for passing local data to the
  1875. iterator function
  1876. * -CR checks also class typecasts at runtime by changing them
  1877. into as
  1878. * fixed compiler to cycle with the -CR option
  1879. * fixed stabs with elf writer, finally the global variables can
  1880. be watched
  1881. * removed a lot of routines from cga unit and replaced them by
  1882. calls to cgobj
  1883. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1884. u32bit then the other is typecasted also to u32bit without giving
  1885. a rangecheck warning/error.
  1886. * fixed pascal calling method with reversing also the high tree in
  1887. the parast, detected by tcalcst3 test
  1888. Revision 1.21 2002/04/23 13:12:58 peter
  1889. * updated for posinfo change
  1890. * updated for mangledname change
  1891. * include i386 registers, removed reference to cpubase unit that would
  1892. make ppudump dependent on the source processor
  1893. Revision 1.20 2002/04/15 19:15:09 carl
  1894. + write std_reg2str instead of gas registers
  1895. Revision 1.19 2002/04/14 17:02:19 carl
  1896. + att_reg2str -> gas_reg2str
  1897. Revision 1.18 2002/04/07 10:23:36 carl
  1898. + added vm / sparc targets
  1899. Revision 1.17 2002/04/04 19:06:14 peter
  1900. * removed unused units
  1901. * use tlocation.size in cg.a_*loc*() routines
  1902. Revision 1.16 2002/04/04 18:50:27 carl
  1903. + added wdosx support (patch from Pavel)
  1904. Revision 1.15 2002/03/31 20:26:42 jonas
  1905. + a_loadfpu_* and a_loadmm_* methods in tcg
  1906. * register allocation is now handled by a class and is mostly processor
  1907. independent (+rgobj.pas and i386/rgcpu.pas)
  1908. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  1909. * some small improvements and fixes to the optimizer
  1910. * some register allocation fixes
  1911. * some fpuvaroffset fixes in the unary minus node
  1912. * push/popusedregisters is now called rg.save/restoreusedregisters and
  1913. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  1914. also better optimizable)
  1915. * fixed and optimized register saving/restoring for new/dispose nodes
  1916. * LOC_FPU locations now also require their "register" field to be set to
  1917. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  1918. - list field removed of the tnode class because it's not used currently
  1919. and can cause hard-to-find bugs
  1920. Revision 1.14 2002/03/28 20:48:52 carl
  1921. - remove go32v1 support
  1922. Revision 1.13 2002/03/28 16:44:59 armin
  1923. + new flag if unit has local threadvars
  1924. Revision 1.12 2002/03/01 14:08:47 peter
  1925. * parasym added
  1926. Revision 1.11 2002/01/06 12:08:16 peter
  1927. * removed uauto from orddef, use new range_to_basetype generating
  1928. the correct ordinal type for a range
  1929. }