ppudump.pp 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095
  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_containsself, { self is passed explicit to the compiler }
  596. po_interrupt, { Procedure is an interrupt handler }
  597. po_iocheck, { IO checking should be done after a call to the procedure }
  598. po_assembler, { Procedure is written in assembler }
  599. po_msgstr, { method for string message handling }
  600. po_msgint, { method for int message handling }
  601. po_exports, { Procedure has export directive (needed for OS/2) }
  602. po_external, { Procedure is external (in other object or lib)}
  603. po_savestdregs, { save std regs cdecl and stdcall need that ! }
  604. po_saveregisters, { save all registers }
  605. po_overload, { procedure is declared with overload directive }
  606. po_varargs, { printf like arguments }
  607. po_leftright, { push arguments from left to right }
  608. po_clearstack, { caller clears the stack }
  609. po_internconst { procedure has constant evaluator intern }
  610. );
  611. tprocoptions=set of tprocoption;
  612. function read_abstract_proc_def:tproccalloption;
  613. type
  614. tproccallopt=record
  615. mask : tproccalloption;
  616. str : string[30];
  617. end;
  618. tproctypeopt=record
  619. mask : tproctypeoption;
  620. str : string[30];
  621. end;
  622. tprocopt=record
  623. mask : tprocoption;
  624. str : string[30];
  625. end;
  626. const
  627. proccalloptionStr : array[tproccalloption] of string[14]=('',
  628. 'CDecl',
  629. 'CPPDecl',
  630. 'CompilerProc',
  631. 'Far16',
  632. 'FPCCall',
  633. 'Inline',
  634. 'InternProc',
  635. 'PalmOSSysCall',
  636. 'Pascal',
  637. 'Register',
  638. 'SafeCall',
  639. 'StdCall',
  640. 'System'
  641. );
  642. proctypeopts=6;
  643. proctypeopt : array[1..proctypeopts] of tproctypeopt=(
  644. (mask:potype_proginit; str:'ProgInit'),
  645. (mask:potype_unitinit; str:'UnitInit'),
  646. (mask:potype_unitfinalize;str:'UnitFinalize'),
  647. (mask:potype_constructor; str:'Constructor'),
  648. (mask:potype_destructor; str:'Destructor'),
  649. (mask:potype_operator; str:'Operator')
  650. );
  651. procopts=21;
  652. procopt : array[1..procopts] of tprocopt=(
  653. (mask:po_classmethod; str:'ClassMethod'),
  654. (mask:po_virtualmethod; str:'VirtualMethod'),
  655. (mask:po_abstractmethod; str:'AbstractMethod'),
  656. (mask:po_staticmethod; str:'StaticMethod'),
  657. (mask:po_overridingmethod;str:'OverridingMethod'),
  658. (mask:po_methodpointer; str:'MethodPointer'),
  659. (mask:po_containsself; str:'ContainsSelf'),
  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. );
  675. var
  676. proctypeoption : tproctypeoption;
  677. proccalloption : tproccalloption;
  678. procoptions : tprocoptions;
  679. i,params : longint;
  680. first : boolean;
  681. paraloclen : byte;
  682. paraloc : array[0..127] of byte;
  683. begin
  684. write(space,' Return type : ');
  685. readtype;
  686. writeln(space,' Fpu used : ',ppufile.getbyte);
  687. proctypeoption:=tproctypeoption(ppufile.getbyte);
  688. if proctypeoption<>potype_none then
  689. begin
  690. write(space,' TypeOption : ');
  691. first:=true;
  692. for i:=1 to proctypeopts do
  693. if (proctypeopt[i].mask=proctypeoption) then
  694. begin
  695. if first then
  696. first:=false
  697. else
  698. write(', ');
  699. write(proctypeopt[i].str);
  700. end;
  701. writeln;
  702. end;
  703. proccalloption:=tproccalloption(ppufile.getbyte);
  704. read_abstract_proc_def:=proccalloption;
  705. writeln(space,' CallOption : ',proccalloptionStr[proccalloption]);
  706. ppufile.getsmallset(procoptions);
  707. if procoptions<>[] then
  708. begin
  709. write(space,' Options : ');
  710. first:=true;
  711. for i:=1to procopts do
  712. if (procopt[i].mask in procoptions) then
  713. begin
  714. if first then
  715. first:=false
  716. else
  717. write(', ');
  718. write(procopt[i].str);
  719. end;
  720. writeln;
  721. end;
  722. params:=ppufile.getbyte;
  723. writeln(space,' Nr of parameters : ',params);
  724. for i:=1 to params do
  725. begin
  726. writeln(space,' - Parameter ',i);
  727. writeln(space,' Spez : ',Varspez2Str(ppufile.getbyte));
  728. write (space,' Type : ');
  729. readtype;
  730. write (space,' Default : ');
  731. readsymref;
  732. write (space,' Symbol : ');
  733. readsymref;
  734. writeln(space,' Is Hidden : ',(ppufile.getbyte<>0));
  735. write (space,' Location : ');
  736. writeln('<not yet implemented>');
  737. paraloclen:=ppufile.getbyte;
  738. ppufile.getdata(paraloc,paraloclen);
  739. end;
  740. end;
  741. procedure readcommonsym(const s:string);
  742. begin
  743. writeln(space,'** Symbol Nr. ',ppufile.getword,' **');
  744. writeln(space,s,ppufile.getstring);
  745. write(space,' File Pos: ');
  746. readposinfo;
  747. write(space,' SymOptions: ');
  748. readsymoptions;
  749. end;
  750. procedure readcommondef(const s:string);
  751. type
  752. tdefoption=(df_none,
  753. df_has_inittable, { init data has been generated }
  754. df_has_rttitable, { rtti data has been generated }
  755. df_unique
  756. );
  757. tdefoptions=set of tdefoption;
  758. var
  759. defopts : tdefoptions;
  760. begin
  761. writeln(space,'** Definition Nr. ',ppufile.getword,' **');
  762. writeln(space,s);
  763. write (space,' Type symbol : ');
  764. readsymref;
  765. ppufile.getsmallset(defopts);
  766. if df_unique in defopts then
  767. writeln (space,' Unique type symbol');
  768. if df_has_rttitable in defopts then
  769. begin
  770. write (space,' RTTI symbol : ');
  771. readsymref;
  772. end;
  773. if df_has_inittable in defopts then
  774. begin
  775. write (space,' Init symbol : ');
  776. readsymref;
  777. end;
  778. end;
  779. {****************************************************************************
  780. Read Symbols Part
  781. ****************************************************************************}
  782. procedure readsymbols;
  783. type
  784. { options for variables }
  785. tvaroption=(vo_none,
  786. vo_regable,
  787. vo_is_C_var,
  788. vo_is_external,
  789. vo_is_dll_var,
  790. vo_is_thread_var,
  791. vo_fpuregable,
  792. vo_is_local_copy,
  793. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  794. vo_is_exported,
  795. vo_is_high_value
  796. );
  797. tvaroptions=set of tvaroption;
  798. pguid = ^tguid;
  799. tguid = packed record
  800. D1: LongWord;
  801. D2: Word;
  802. D3: Word;
  803. D4: array[0..7] of Byte;
  804. end;
  805. absolutetyp = (tovar,toasm,toaddr);
  806. tconsttyp = (constnone,
  807. constord,conststring,constreal,constbool,
  808. constint,constchar,constset,constpointer,constnil,
  809. constresourcestring,constwstring,constwchar,constguid
  810. );
  811. var
  812. b : byte;
  813. pc : pchar;
  814. totalsyms,
  815. symcnt,
  816. i,j,len : longint;
  817. guid : tguid;
  818. begin
  819. symcnt:=1;
  820. with ppufile do
  821. begin
  822. if space<>'' then
  823. Writeln(space,'-----------------------------');
  824. if readentry=ibstartsyms then
  825. begin
  826. totalsyms:=getlongint;
  827. Writeln(space,'Number of symbols : ',totalsyms);
  828. Writeln(space,'Symtable datasize : ',getlongint);
  829. Writeln(space,'Symtable alignment: ',getlongint);
  830. end
  831. else
  832. begin
  833. totalsyms:=-1;
  834. Writeln('!! ibstartsym not found');
  835. end;
  836. repeat
  837. b:=readentry;
  838. if not (b in [iberror,ibendsyms]) then
  839. inc(symcnt);
  840. case b of
  841. ibunitsym :
  842. readcommonsym('Unit symbol ');
  843. iblabelsym :
  844. readcommonsym('Label symbol ');
  845. ibtypesym :
  846. begin
  847. readcommonsym('Type symbol ');
  848. write(space,' Result Type: ');
  849. readtype;
  850. end;
  851. ibprocsym :
  852. begin
  853. readcommonsym('Procedure symbol ');
  854. repeat
  855. write(space,' Definition: ');
  856. until not readdefref;
  857. end;
  858. ibconstsym :
  859. begin
  860. readcommonsym('Constant symbol ');
  861. b:=getbyte;
  862. case tconsttyp(b) of
  863. constord :
  864. begin
  865. write (space,'OrdinalType: ');
  866. readtype;
  867. writeln (space,' Value: ',getlongint)
  868. end;
  869. constpointer :
  870. begin
  871. write (space,' Pointer Type: ');
  872. readtype;
  873. writeln (space,' Value: ',getlongint)
  874. end;
  875. conststring,
  876. constresourcestring :
  877. begin
  878. len:=getlongint;
  879. getmem(pc,len+1);
  880. getdata(pc^,len);
  881. writeln(space,' Length: ',len);
  882. writeln(space,' Value: "',pc,'"');
  883. freemem(pc,len+1);
  884. if tconsttyp(b)=constresourcestring then
  885. writeln(space,' Index: ',getlongint);
  886. end;
  887. constreal :
  888. writeln(space,' Value: ',getreal);
  889. constbool :
  890. if getlongint<>0 then
  891. writeln (space,' Value : True')
  892. else
  893. writeln (space,' Value: False');
  894. constint :
  895. writeln(space,' Value: ',getint64);
  896. constchar :
  897. writeln(space,' Value: "'+chr(getlongint)+'"');
  898. constset :
  899. begin
  900. write (space,' Set Type: ');
  901. readtype;
  902. for i:=1to 4 do
  903. begin
  904. write (space,' Value: ');
  905. for j:=1to 8 do
  906. begin
  907. if j>1 then
  908. write(',');
  909. write(hexb(getbyte));
  910. end;
  911. writeln;
  912. end;
  913. end;
  914. constwstring:
  915. begin
  916. end;
  917. constwchar:
  918. writeln(space,' Value: #',getlongint);
  919. constguid:
  920. begin
  921. getdata(guid,sizeof(guid));
  922. write (space,' IID String: {',hexstr(guid.d1,8),'-',hexstr(guid.d2,4),'-',hexstr(guid.d3,4),'-');
  923. for i:=0 to 7 do
  924. begin
  925. write(hexstr(guid.d4[i],2));
  926. if i=1 then write('-');
  927. end;
  928. writeln('}');
  929. end
  930. else
  931. Writeln ('!! Invalid unit format : Invalid const type encountered: ',b);
  932. end;
  933. end;
  934. ibvarsym :
  935. begin
  936. readcommonsym('Variable symbol ');
  937. writeln(space,' Spez: ',Varspez2Str(getbyte));
  938. writeln(space,' Address: ',getlongint);
  939. write (space,' Var Type: ');
  940. readtype;
  941. i:=getlongint;
  942. writeln(space,' Options: ',i);
  943. if (vo_is_C_var in tvaroptions(i)) then
  944. writeln(space,' Mangledname: ',getstring);
  945. end;
  946. ibenumsym :
  947. begin
  948. readcommonsym('Enumeration symbol ');
  949. write (space,' Definition: ');
  950. readdefref;
  951. writeln(space,' Value: ',getlongint);
  952. end;
  953. ibsyssym :
  954. begin
  955. readcommonsym('Internal system symbol ');
  956. writeln(space,' Internal Nr: ',getlongint);
  957. end;
  958. ibrttisym :
  959. begin
  960. readcommonsym('RTTI symbol ');
  961. writeln(space,' RTTI Type: ',getbyte);
  962. end;
  963. ibtypedconstsym :
  964. begin
  965. readcommonsym('Typed constant ');
  966. write (space,' Constant Type: ');
  967. readtype;
  968. writeln(space,' ReallyConst: ',(getbyte<>0));
  969. end;
  970. ibabsolutesym :
  971. begin
  972. readcommonsym('Absolute variable symbol ');
  973. writeln(space,' Type: ',getbyte);
  974. writeln(space,' Address: ',getlongint);
  975. write (space,' Var Type: ');
  976. readtype;
  977. writeln(space,' Options: ',getlongint);
  978. Write (space,' Relocated to ');
  979. b:=getbyte;
  980. case absolutetyp(b) of
  981. tovar :
  982. Writeln('Name : ',getstring);
  983. toasm :
  984. Writeln('Assembler name : ',getstring);
  985. toaddr :
  986. begin
  987. Write('Address : ',getlongint);
  988. WriteLn(' (Far: ',getbyte<>0,')');
  989. end;
  990. else
  991. Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
  992. end;
  993. end;
  994. ibpropertysym :
  995. begin
  996. readcommonsym('Property ');
  997. i:=getlongint;
  998. writeln(space,' PropOptions: ',i);
  999. if (i and 32)>0 then
  1000. begin
  1001. write (space,'OverrideProp: ');
  1002. readsymref;
  1003. end
  1004. else
  1005. begin
  1006. write (space,' Prop Type: ');
  1007. readtype;
  1008. writeln(space,' Index: ',getlongint);
  1009. writeln(space,' Default: ',getlongint);
  1010. write (space,' Index Type: ');
  1011. readtype;
  1012. write (space,' Readaccess: ');
  1013. readsymlist(space+' Sym: ');
  1014. write (space,' Writeaccess: ');
  1015. readsymlist(space+' Sym: ');
  1016. write (space,'Storedaccess: ');
  1017. readsymlist(space+' Sym: ');
  1018. end;
  1019. end;
  1020. iberror :
  1021. begin
  1022. Writeln('!! Error in PPU');
  1023. exit;
  1024. end;
  1025. ibendsyms :
  1026. break;
  1027. else
  1028. WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
  1029. end;
  1030. if not EndOfEntry then
  1031. Writeln('!! Entry has more information stored');
  1032. until false;
  1033. if (totalsyms<>-1) and (symcnt-1<>totalsyms) then
  1034. Writeln('!! Only read ',symcnt-1,' of ',totalsyms,' symbols');
  1035. end;
  1036. end;
  1037. {****************************************************************************
  1038. Read defintions Part
  1039. ****************************************************************************}
  1040. procedure getusedregisters_i386;
  1041. type
  1042. tregister = (R_NO,
  1043. R_EAX,R_ECX,R_EDX,R_EBX,R_ESP,R_EBP,R_ESI,R_EDI,
  1044. R_AX,R_CX,R_DX,R_BX,R_SP,R_BP,R_SI,R_DI,
  1045. R_AL,R_CL,R_DL,R_BL,R_AH,R_CH,R_BH,R_DH,
  1046. R_CS,R_DS,R_ES,R_SS,R_FS,R_GS,
  1047. R_ST,R_ST0,R_ST1,R_ST2,R_ST3,R_ST4,R_ST5,R_ST6,R_ST7,
  1048. R_DR0,R_DR1,R_DR2,R_DR3,R_DR6,R_DR7,
  1049. R_CR0,R_CR2,R_CR3,R_CR4,
  1050. R_TR3,R_TR4,R_TR5,R_TR6,R_TR7,
  1051. R_MM0,R_MM1,R_MM2,R_MM3,R_MM4,R_MM5,R_MM6,R_MM7,
  1052. R_XMM0,R_XMM1,R_XMM2,R_XMM3,R_XMM4,R_XMM5,R_XMM6,R_XMM7
  1053. );
  1054. tregisterset = set of tregister;
  1055. reg2strtable = array[tregister] of string[6];
  1056. const
  1057. std_reg2str : reg2strtable = ('',
  1058. 'eax','ecx','edx','ebx','esp','ebp','esi','edi',
  1059. 'ax','cx','dx','bx','sp','bp','si','di',
  1060. 'al','cl','dl','bl','ah','ch','bh','dh',
  1061. 'cs','ds','es','ss','fs','gs',
  1062. 'st','st(0)','st(1)','st(2)','st(3)','st(4)','st(5)','st(6)','st(7)',
  1063. 'dr0','dr1','dr2','dr3','dr6','dr7',
  1064. 'cr0','cr2','cr3','cr4',
  1065. 'tr3','tr4','tr5','tr6','tr7',
  1066. 'mm0','mm1','mm2','mm3','mm4','mm5','mm6','mm7',
  1067. 'xmm0','xmm1','xmm2','xmm3','xmm4','xmm5','xmm6','xmm7'
  1068. );
  1069. firstsaveintreg = R_EAX;
  1070. lastsaveintreg = R_EBX;
  1071. firstsavefpureg = R_NO;
  1072. lastsavefpureg = R_NO;
  1073. firstsavemmreg = R_MM0;
  1074. lastsavemmreg = R_MM7;
  1075. var
  1076. regs: tregisterset;
  1077. r: tregister;
  1078. first: boolean;
  1079. begin
  1080. first := true;
  1081. ppufile.getnormalset(regs);
  1082. for r := firstsaveintreg to lastsaveintreg do
  1083. if r in regs then
  1084. begin
  1085. if not first then
  1086. write(', ')
  1087. else
  1088. first := false;
  1089. write(std_reg2str[r])
  1090. end;
  1091. if (firstsavefpureg <> R_NO) then
  1092. for r := firstsavefpureg to lastsavefpureg do
  1093. if r in regs then
  1094. begin
  1095. if not first then
  1096. write(', ')
  1097. else
  1098. first := false;
  1099. write(std_reg2str[r])
  1100. end;
  1101. if (firstsavemmreg <> R_NO) then
  1102. for r := firstsavemmreg to lastsavemmreg do
  1103. if r in regs then
  1104. begin
  1105. if not first then
  1106. write(', ')
  1107. else
  1108. first := false;
  1109. write(std_reg2str[r])
  1110. end;
  1111. writeln;
  1112. end;
  1113. procedure readdefinitions(start_read : boolean);
  1114. type
  1115. tsettype = (normset,smallset,varset);
  1116. tbasetype = (
  1117. uvoid,
  1118. u8bit,u16bit,u32bit,u64bit,
  1119. s8bit,s16bit,s32bit,s64bit,
  1120. bool8bit,bool16bit,bool32bit,
  1121. uchar,uwidechar
  1122. );
  1123. tobjectdeftype = (odt_none,
  1124. odt_class,
  1125. odt_object,
  1126. odt_interfacecom,
  1127. odt_interfacecorba,
  1128. odt_cppclass
  1129. );
  1130. var
  1131. b : byte;
  1132. oldread_member : boolean;
  1133. totaldefs,l,j,
  1134. defcnt : longint;
  1135. calloption : tproccalloption;
  1136. regs : set of char;
  1137. begin
  1138. defcnt:=0;
  1139. with ppufile do
  1140. begin
  1141. if space<>'' then
  1142. Writeln(space,'-----------------------------');
  1143. if not start_read then
  1144. if readentry=ibstartdefs then
  1145. begin
  1146. totaldefs:=getlongint;
  1147. Writeln(space,'Number of definitions: ',totaldefs);
  1148. end
  1149. else
  1150. begin
  1151. totaldefs:=-1;
  1152. Writeln('!! ibstartdef not found');
  1153. end;
  1154. repeat
  1155. b:=readentry;
  1156. if not (b in [iberror,ibenddefs]) then
  1157. inc(defcnt);
  1158. case b of
  1159. ibpointerdef :
  1160. begin
  1161. readcommondef('Pointer definition');
  1162. write (space,' Pointed Type : ');
  1163. readtype;
  1164. writeln(space,' Is Far : ',(getbyte<>0));
  1165. end;
  1166. iborddef :
  1167. begin
  1168. readcommondef('Ordinal definition');
  1169. write (space,' Base type : ');
  1170. b:=getbyte;
  1171. case tbasetype(b) of
  1172. uvoid : writeln('uvoid');
  1173. u8bit : writeln('u8bit');
  1174. u16bit : writeln('u16bit');
  1175. u32bit : writeln('s32bit');
  1176. u64bit : writeln('u64bit');
  1177. s8bit : writeln('s8bit');
  1178. s16bit : writeln('s16bit');
  1179. s32bit : writeln('s32bit');
  1180. s64bit : writeln('s64bit');
  1181. bool8bit : writeln('bool8bit');
  1182. bool16bit : writeln('bool16bit');
  1183. bool32bit : writeln('bool32bit');
  1184. uchar : writeln('uchar');
  1185. uwidechar : writeln('uwidechar');
  1186. else writeln('!! Warning: Invalid base type ',b);
  1187. end;
  1188. writeln(space,' Range : ',getint64,' to ',getint64);
  1189. end;
  1190. ibfloatdef :
  1191. begin
  1192. readcommondef('Float definition');
  1193. writeln(space,' Float type : ',getbyte);
  1194. end;
  1195. ibarraydef :
  1196. begin
  1197. readcommondef('Array definition');
  1198. write (space,' Element type : ');
  1199. readtype;
  1200. write (space,' Range Type : ');
  1201. readtype;
  1202. writeln(space,' Range : ',getlongint,' to ',getlongint);
  1203. writeln(space,' Is Constructor : ',(getbyte<>0));
  1204. writeln(space,' Is Dynamic : ',(getbyte<>0));
  1205. end;
  1206. ibprocdef :
  1207. begin
  1208. readcommondef('Procedure definition');
  1209. calloption:=read_abstract_proc_def;
  1210. write (space,' Used IntRegs : ');
  1211. getnormalset(regs);
  1212. writeln('<not yet implemented>');
  1213. write (space,' Used OtherRegs : ');
  1214. getnormalset(regs);
  1215. writeln('<not yet implemented>');
  1216. {$ifdef OLDRA}
  1217. case ttargetcpu(header.cpu) of
  1218. i386 :
  1219. getusedregisters_i386
  1220. else
  1221. begin
  1222. getnormalset(regs);
  1223. writeln('<not yet implemented>');
  1224. end;
  1225. end;
  1226. {$endif OLDRA}
  1227. if (getbyte<>0) then
  1228. writeln(space,' Mangled name : ',getstring);
  1229. writeln(space,' Overload Number : ',getword);
  1230. writeln(space,' Number : ',getword);
  1231. write (space,' Class : ');
  1232. readdefref;
  1233. write (space,' Procsym : ');
  1234. readsymref;
  1235. write (space,' File Pos : ');
  1236. readposinfo;
  1237. write (space,' SymOptions : ');
  1238. readsymoptions;
  1239. if (calloption=pocall_inline) then
  1240. begin
  1241. write (space,' FuncretSym : ');
  1242. readdefref;
  1243. end;
  1244. space:=' '+space;
  1245. { parast }
  1246. readdefinitions(false);
  1247. readsymbols;
  1248. { localst }
  1249. if (calloption=pocall_inline) or
  1250. ((ppufile.header.flags and uf_local_browser) <> 0) then
  1251. begin
  1252. readdefinitions(false);
  1253. readsymbols;
  1254. end;
  1255. delete(space,1,4);
  1256. end;
  1257. ibprocvardef :
  1258. begin
  1259. readcommondef('Procedural type (ProcVar) definition');
  1260. read_abstract_proc_def;
  1261. space:=' '+space;
  1262. { parast }
  1263. readdefinitions(false);
  1264. readsymbols;
  1265. delete(space,1,4);
  1266. end;
  1267. ibshortstringdef :
  1268. begin
  1269. readcommondef('ShortString definition');
  1270. writeln(space,' Length : ',getbyte);
  1271. end;
  1272. ibwidestringdef :
  1273. begin
  1274. readcommondef('WideString definition');
  1275. writeln(space,' Length : ',getlongint);
  1276. end;
  1277. ibansistringdef :
  1278. begin
  1279. readcommondef('AnsiString definition');
  1280. writeln(space,' Length : ',getlongint);
  1281. end;
  1282. iblongstringdef :
  1283. begin
  1284. readcommondef('Longstring definition');
  1285. writeln(space,' Length : ',getlongint);
  1286. end;
  1287. ibrecorddef :
  1288. begin
  1289. readcommondef('Record definition');
  1290. writeln(space,' Size : ',getlongint);
  1291. {read the record definitions and symbols}
  1292. space:=' '+space;
  1293. oldread_member:=read_member;
  1294. read_member:=true;
  1295. readdefinitions(false);
  1296. readsymbols;
  1297. read_member:=oldread_member;
  1298. Delete(space,1,4);
  1299. end;
  1300. ibobjectdef :
  1301. begin
  1302. readcommondef('Object/Class definition');
  1303. b:=getbyte;
  1304. write (space,' Type : ');
  1305. case tobjectdeftype(b) of
  1306. odt_class : writeln('class');
  1307. odt_object : writeln('object');
  1308. odt_interfacecom : writeln('interfacecom');
  1309. odt_interfacecorba : writeln('interfacecorba');
  1310. odt_cppclass : writeln('cppclass');
  1311. else writeln('!! Warning: Invalid object type ',b);
  1312. end;
  1313. writeln(space,' Size : ',getlongint);
  1314. writeln(space,' Vmt offset : ',getlongint);
  1315. writeln(space,' Name of Class : ',getstring);
  1316. write(space, ' Ancestor Class : ');
  1317. readdefref;
  1318. writeln(space,' Options : ',getlongint);
  1319. if tobjectdeftype(b) in [odt_interfacecom,odt_interfacecorba] then
  1320. begin
  1321. { IIDGUID }
  1322. for j:=1to 16 do
  1323. getbyte;
  1324. writeln(space,' IID String : ',getstring);
  1325. writeln(space,' Last VTable idx : ',getlongint);
  1326. end;
  1327. if tobjectdeftype(b) in [odt_class,odt_interfacecorba] then
  1328. begin
  1329. l:=getlongint;
  1330. writeln(space,' Impl Intf Count : ',l);
  1331. for j:=1 to l do
  1332. begin
  1333. write (space,' - Definition : ');
  1334. readdefref;
  1335. writeln(space,' IOffset : ',getlongint);
  1336. end;
  1337. end;
  1338. {read the record definitions and symbols}
  1339. space:=' '+space;
  1340. oldread_member:=read_member;
  1341. read_member:=true;
  1342. readdefinitions(false);
  1343. readsymbols;
  1344. read_member:=oldread_member;
  1345. Delete(space,1,4);
  1346. end;
  1347. ibfiledef :
  1348. begin
  1349. ReadCommonDef('File definition');
  1350. write (space,' Type : ');
  1351. case getbyte of
  1352. 0 : writeln('Text');
  1353. 1 : begin
  1354. writeln('Typed');
  1355. write (space,' File of Type : ');
  1356. Readtype;
  1357. end;
  1358. 2 : writeln('Untyped');
  1359. end;
  1360. end;
  1361. ibformaldef :
  1362. readcommondef('Generic Definition (void-typ)');
  1363. ibenumdef :
  1364. begin
  1365. readcommondef('Enumeration type definition');
  1366. write(space,'Base enumeration type : ');
  1367. readdefref;
  1368. writeln(space,' Smallest element : ',getlongint);
  1369. writeln(space,' Largest element : ',getlongint);
  1370. writeln(space,' Size : ',getlongint);
  1371. end;
  1372. ibclassrefdef :
  1373. begin
  1374. readcommondef('Class reference definition');
  1375. write (space,' Pointed Type : ');
  1376. readtype;
  1377. end;
  1378. ibsetdef :
  1379. begin
  1380. readcommondef('Set definition');
  1381. write (space,' Element type : ');
  1382. readtype;
  1383. b:=getbyte;
  1384. case tsettype(b) of
  1385. smallset : writeln(space,' Set with 32 Elements');
  1386. normset : writeln(space,' Set with 256 Elements');
  1387. varset : writeln(space,' Set with ',getlongint,' Elements');
  1388. else writeln('!! Warning: Invalid set type ',b);
  1389. end;
  1390. end;
  1391. ibvariantdef :
  1392. begin
  1393. readcommondef('Variant definition');
  1394. end;
  1395. iberror :
  1396. begin
  1397. Writeln('!! Error in PPU');
  1398. exit;
  1399. end;
  1400. ibenddefs :
  1401. break;
  1402. else
  1403. WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
  1404. end;
  1405. if not EndOfEntry then
  1406. Writeln('!! Entry has more information stored');
  1407. until false;
  1408. if (totaldefs<>-1) and (defcnt<>totaldefs) then
  1409. Writeln('!! Only read ',defcnt,' of ',totaldefs,' definitions');
  1410. end;
  1411. end;
  1412. {****************************************************************************
  1413. Read General Part
  1414. ****************************************************************************}
  1415. procedure readinterface;
  1416. var
  1417. b : byte;
  1418. sourcenumber,
  1419. unitnumber : word;
  1420. ucrc,uintfcrc : longint;
  1421. begin
  1422. with ppufile do
  1423. begin
  1424. repeat
  1425. b:=readentry;
  1426. case b of
  1427. ibmodulename :
  1428. Writeln('Module Name: ',getstring);
  1429. ibsourcefiles :
  1430. begin
  1431. sourcenumber:=1;
  1432. while not EndOfEntry do
  1433. begin
  1434. Writeln('Source file ',sourcenumber,' : ',getstring,' ',filetimestring(getlongint));
  1435. inc(sourcenumber);
  1436. end;
  1437. end;
  1438. ibusedmacros :
  1439. begin
  1440. while not EndOfEntry do
  1441. begin
  1442. Write('Conditional ',getstring);
  1443. b:=getbyte;
  1444. if boolean(b)=true then
  1445. write(' defined at startup')
  1446. else
  1447. write(' not defined at startup');
  1448. b:=getbyte;
  1449. if boolean(b)=true then
  1450. writeln(' was used')
  1451. else
  1452. writeln;
  1453. end;
  1454. end;
  1455. ibloadunit :
  1456. begin
  1457. unitnumber:=1;
  1458. while not EndOfEntry do
  1459. begin
  1460. write('Uses unit: ',getstring,' (Number: ',unitnumber,')');
  1461. ucrc:=getlongint;
  1462. uintfcrc:=getlongint;
  1463. write(' (Crc: ',hexstr(ucrc,8),', IntfcCrc: ',hexstr(uintfcrc,8),')');
  1464. if getbyte<>0 then
  1465. writeln(' (interface)')
  1466. else
  1467. writeln(' (implementation)');
  1468. inc(unitnumber);
  1469. end;
  1470. end;
  1471. iblinkunitofiles :
  1472. ReadLinkContainer('Link unit object file: ');
  1473. iblinkunitstaticlibs :
  1474. ReadLinkContainer('Link unit static lib: ');
  1475. iblinkunitsharedlibs :
  1476. ReadLinkContainer('Link unit shared lib: ');
  1477. iblinkotherofiles :
  1478. ReadLinkContainer('Link other object file: ');
  1479. iblinkotherstaticlibs :
  1480. ReadLinkContainer('Link other static lib: ');
  1481. iblinkothersharedlibs :
  1482. ReadLinkContainer('Link other shared lib: ');
  1483. iberror :
  1484. begin
  1485. Writeln('Error in PPU');
  1486. exit;
  1487. end;
  1488. ibendinterface :
  1489. break;
  1490. else
  1491. WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
  1492. end;
  1493. until false;
  1494. end;
  1495. end;
  1496. {****************************************************************************
  1497. Read Implementation Part
  1498. ****************************************************************************}
  1499. procedure readimplementation;
  1500. var
  1501. b : byte;
  1502. begin
  1503. with ppufile do
  1504. begin
  1505. repeat
  1506. b:=readentry;
  1507. case b of
  1508. ibasmsymbols :
  1509. ReadAsmSymbols;
  1510. iberror :
  1511. begin
  1512. Writeln('Error in PPU');
  1513. exit;
  1514. end;
  1515. ibendimplementation :
  1516. break;
  1517. else
  1518. WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
  1519. end;
  1520. until false;
  1521. end;
  1522. end;
  1523. {****************************************************************************
  1524. Read Browser Part
  1525. ****************************************************************************}
  1526. procedure readbrowser;
  1527. var
  1528. b : byte;
  1529. const indent : string = '';
  1530. begin
  1531. Writeln(indent,'Start of symtable browser');
  1532. indent:=indent+'**';
  1533. with ppufile do
  1534. begin
  1535. repeat
  1536. b:=readentry;
  1537. case b of
  1538. ibbeginsymtablebrowser :
  1539. begin
  1540. { here we must read object and record symtables !! }
  1541. indent:=indent+' ';
  1542. Writeln(indent,'Record/Object symtable');
  1543. readbrowser;
  1544. Indent:=Copy(Indent,1,Length(Indent)-2);
  1545. end;
  1546. ibsymref :
  1547. begin
  1548. readsymref;
  1549. readref;
  1550. end;
  1551. ibdefref :
  1552. begin
  1553. readdefref;
  1554. readref;
  1555. if ((ppufile.header.flags and uf_local_browser)<>0) and
  1556. (UnitIndex=0) then
  1557. begin
  1558. { parast and localst }
  1559. indent:=indent+' ';
  1560. b:=ppufile.readentry;
  1561. if b=ibbeginsymtablebrowser then
  1562. readbrowser;
  1563. b:=ppufile.readentry;
  1564. if b=ibbeginsymtablebrowser then
  1565. readbrowser;
  1566. Indent:=Copy(Indent,1,Length(Indent)-2);
  1567. end;
  1568. end;
  1569. iberror :
  1570. begin
  1571. Writeln('Error in PPU');
  1572. exit;
  1573. end;
  1574. ibendsymtablebrowser :
  1575. break;
  1576. else
  1577. begin
  1578. WriteLn('!! Skipping unsupported PPU Entry in Browser: ',b);
  1579. Halt;
  1580. end;
  1581. end;
  1582. until false;
  1583. end;
  1584. Indent:=Copy(Indent,1,Length(Indent)-2);
  1585. Writeln(Indent,'End of symtable browser');
  1586. end;
  1587. procedure dofile (filename : string);
  1588. var
  1589. b : byte;
  1590. begin
  1591. { reset }
  1592. space:='';
  1593. { fix filename }
  1594. if pos('.',filename)=0 then
  1595. filename:=filename+'.ppu';
  1596. ppufile:=tppufile.create(filename);
  1597. if not ppufile.openfile then
  1598. begin
  1599. writeln ('IO-Error when opening : ',filename,', Skipping');
  1600. exit;
  1601. end;
  1602. { PPU File is open, check for PPU Id }
  1603. if not ppufile.CheckPPUID then
  1604. begin
  1605. writeln(Filename,' : Not a valid PPU file, Skipping');
  1606. exit;
  1607. end;
  1608. { Check PPU Version }
  1609. Writeln('Analyzing ',filename,' (v',ppufile.GetPPUVersion,')');
  1610. if ppufile.GetPPUVersion<16 then
  1611. begin
  1612. writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
  1613. exit;
  1614. end;
  1615. { Write PPU Header Information }
  1616. if (verbose and v_header)<>0 then
  1617. begin
  1618. Writeln;
  1619. Writeln('Header');
  1620. Writeln('-------');
  1621. with ppufile.header do
  1622. begin
  1623. Writeln('Compiler version : ',ppufile.header.compiler shr 14,'.',
  1624. (ppufile.header.compiler shr 7) and $7f,'.',
  1625. ppufile.header.compiler and $7f);
  1626. WriteLn('Target processor : ',Cpu2Str(cpu));
  1627. WriteLn('Target operating system : ',Target2Str(target));
  1628. Writeln('Unit flags : ',PPUFlags2Str(flags));
  1629. Writeln('FileSize (w/o header) : ',size);
  1630. Writeln('Checksum : ',hexstr(checksum,8));
  1631. Writeln('Interface Checksum : ',hexstr(interface_checksum,8));
  1632. end;
  1633. end;
  1634. {read the general stuff}
  1635. if (verbose and v_interface)<>0 then
  1636. begin
  1637. Writeln;
  1638. Writeln('Interface section');
  1639. Writeln('------------------');
  1640. readinterface;
  1641. end
  1642. else
  1643. ppufile.skipuntilentry(ibendinterface);
  1644. {read the definitions}
  1645. if (verbose and v_defs)<>0 then
  1646. begin
  1647. Writeln;
  1648. Writeln('Interface definitions');
  1649. Writeln('----------------------');
  1650. readdefinitions(false);
  1651. end
  1652. else
  1653. ppufile.skipuntilentry(ibenddefs);
  1654. {read the symbols}
  1655. if (verbose and v_syms)<>0 then
  1656. begin
  1657. Writeln;
  1658. Writeln('Interface Symbols');
  1659. Writeln('------------------');
  1660. readsymbols;
  1661. end
  1662. else
  1663. ppufile.skipuntilentry(ibendsyms);
  1664. {read the implementation stuff}
  1665. if (verbose and v_implementation)<>0 then
  1666. begin
  1667. Writeln;
  1668. Writeln('Implementation section');
  1669. Writeln('-----------------------');
  1670. readimplementation;
  1671. end
  1672. else
  1673. ppufile.skipuntilentry(ibendimplementation);
  1674. {read the static browser units stuff}
  1675. if (ppufile.header.flags and uf_local_browser)<>0 then
  1676. begin
  1677. if (verbose and v_defs)<>0 then
  1678. begin
  1679. Writeln;
  1680. Writeln('Static definitions');
  1681. Writeln('----------------------');
  1682. readdefinitions(false);
  1683. end
  1684. else
  1685. ppufile.skipuntilentry(ibenddefs);
  1686. {read the symbols}
  1687. if (verbose and v_syms)<>0 then
  1688. begin
  1689. Writeln;
  1690. Writeln('Static Symbols');
  1691. Writeln('------------------');
  1692. readsymbols;
  1693. end;
  1694. end;
  1695. {read the browser units stuff}
  1696. if (ppufile.header.flags and uf_has_browser)<>0 then
  1697. begin
  1698. if (verbose and v_browser)<>0 then
  1699. begin
  1700. Writeln;
  1701. Writeln('Browser section');
  1702. Writeln('---------------');
  1703. UnitIndex:=0;
  1704. repeat
  1705. b:=ppufile.readentry;
  1706. if b = ibendbrowser then break;
  1707. if b=ibbeginsymtablebrowser then
  1708. begin
  1709. Writeln('Unit ',UnitIndex);
  1710. readbrowser;
  1711. Inc(UnitIndex);
  1712. end
  1713. else
  1714. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1715. until false;
  1716. end;
  1717. end;
  1718. {read the static browser units stuff}
  1719. if (ppufile.header.flags and uf_local_browser)<>0 then
  1720. begin
  1721. if (verbose and v_browser)<>0 then
  1722. begin
  1723. Writeln;
  1724. Writeln('Static browser section');
  1725. Writeln('---------------');
  1726. UnitIndex:=0;
  1727. b:=ppufile.readentry;
  1728. if b=ibbeginsymtablebrowser then
  1729. readbrowser
  1730. else
  1731. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1732. end;
  1733. end;
  1734. {shutdown ppufile}
  1735. ppufile.closefile;
  1736. ppufile.free;
  1737. Writeln;
  1738. end;
  1739. procedure help;
  1740. begin
  1741. writeln('usage: ppudump [options] <filename1> <filename2>...');
  1742. writeln;
  1743. writeln('[options] can be:');
  1744. writeln(' -V<verbose> Set verbosity to <verbose>');
  1745. writeln(' H - Show header info');
  1746. writeln(' I - Show interface');
  1747. writeln(' M - Show implementation');
  1748. writeln(' S - Show interface symbols');
  1749. writeln(' D - Show interface definitions');
  1750. writeln(' B - Show browser info');
  1751. writeln(' A - Show all');
  1752. writeln(' -? This helpscreen');
  1753. halt;
  1754. end;
  1755. var
  1756. startpara,
  1757. nrfile,i : longint;
  1758. para : string;
  1759. begin
  1760. writeln(Title+' '+Version);
  1761. writeln(Copyright);
  1762. writeln;
  1763. if paramcount<1 then
  1764. begin
  1765. writeln('usage: dumpppu [options] <filename1> <filename2>...');
  1766. halt(1);
  1767. end;
  1768. { turn verbose on by default }
  1769. verbose:=v_all;
  1770. { read options }
  1771. startpara:=1;
  1772. while copy(paramstr(startpara),1,1)='-' do
  1773. begin
  1774. para:=paramstr(startpara);
  1775. case upcase(para[2]) of
  1776. 'V' : begin
  1777. verbose:=0;
  1778. for i:=3to length(para) do
  1779. case upcase(para[i]) of
  1780. 'H' : verbose:=verbose or v_header;
  1781. 'I' : verbose:=verbose or v_interface;
  1782. 'M' : verbose:=verbose or v_implementation;
  1783. 'D' : verbose:=verbose or v_defs;
  1784. 'S' : verbose:=verbose or v_syms;
  1785. 'B' : verbose:=verbose or v_browser;
  1786. 'A' : verbose:=verbose or v_all;
  1787. end;
  1788. end;
  1789. '?' : help;
  1790. end;
  1791. inc(startpara);
  1792. end;
  1793. { process files }
  1794. for nrfile:=startpara to paramcount do
  1795. dofile (paramstr(nrfile));
  1796. if has_errors then
  1797. Halt(1);
  1798. end.
  1799. {
  1800. $Log$
  1801. Revision 1.42 2003-05-09 17:47:03 peter
  1802. * self moved to hidden parameter
  1803. * removed hdisposen,hnewn,selfn
  1804. Revision 1.41 2003/04/27 07:29:52 peter
  1805. * aktprocdef cleanup, aktprocdef is now always nil when parsing
  1806. a new procdef declaration
  1807. * aktprocsym removed
  1808. * lexlevel removed, use symtable.symtablelevel instead
  1809. * implicit init/final code uses the normal genentry/genexit
  1810. * funcret state checking updated for new funcret handling
  1811. Revision 1.39 2003/04/25 20:59:35 peter
  1812. * removed funcretn,funcretsym, function result is now in varsym
  1813. and aliases for result and function name are added using absolutesym
  1814. * vs_hidden parameter for funcret passed in parameter
  1815. * vs_hidden fixes
  1816. * writenode changed to printnode and released from extdebug
  1817. * -vp option added to generate a tree.log with the nodetree
  1818. * nicer printnode for statements, callnode
  1819. Revision 1.38 2003/04/10 17:57:53 peter
  1820. * vs_hidden released
  1821. Revision 1.37 2003/03/24 19:57:54 hajny
  1822. + emx target added
  1823. Revision 1.36 2003/03/17 15:54:22 peter
  1824. * store symoptions also for procdef
  1825. * check symoptions (private,public) when calculating possible
  1826. overload candidates
  1827. Revision 1.35 2003/01/03 22:16:29 peter
  1828. * updated for absolutesym and varsym
  1829. Revision 1.34 2002/11/17 16:32:04 carl
  1830. * memory optimization (3-4%) : cleanup of tai fields,
  1831. cleanup of tdef and tsym fields.
  1832. * make it work for m68k
  1833. Revision 1.33 2002/10/20 14:49:31 peter
  1834. * store original source time in ppu so it can be compared instead of
  1835. comparing with the ppu time
  1836. Revision 1.32 2002/10/06 12:25:53 florian
  1837. + dump of tdefoptions.df_unique
  1838. Revision 1.31 2002/09/27 21:22:04 carl
  1839. * update system information
  1840. Revision 1.30 2002/09/26 12:03:54 florian
  1841. + support of constguid and constwchar const symbols added
  1842. Revision 1.29 2002/08/20 16:54:40 peter
  1843. * write address of varsym always
  1844. Revision 1.28 2002/08/19 19:36:44 peter
  1845. * More fixes for cross unit inlining, all tnodes are now implemented
  1846. * Moved pocall_internconst to po_internconst because it is not a
  1847. calling type at all and it conflicted when inlining of these small
  1848. functions was requested
  1849. Revision 1.27 2002/08/15 15:15:56 carl
  1850. * jmpbuf size allocation for exceptions is now cpu specific (as it should)
  1851. * more generic nodes for maths
  1852. * several fixes for better m68k support
  1853. Revision 1.26 2002/08/11 13:24:20 peter
  1854. * saving of asmsymbols in ppu supported
  1855. * asmsymbollist global is removed and moved into a new class
  1856. tasmlibrarydata that will hold the info of a .a file which
  1857. corresponds with a single module. Added librarydata to tmodule
  1858. to keep the library info stored for the module. In the future the
  1859. objectfiles will also be stored to the tasmlibrarydata class
  1860. * all getlabel/newasmsymbol and friends are moved to the new class
  1861. Revision 1.25 2002/05/18 13:34:27 peter
  1862. * readded missing revisions
  1863. Revision 1.24 2002/05/16 19:46:54 carl
  1864. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1865. + try to fix temp allocation (still in ifdef)
  1866. + generic constructor calls
  1867. + start of tassembler / tmodulebase class cleanup
  1868. Revision 1.22 2002/05/12 16:53:18 peter
  1869. * moved entry and exitcode to ncgutil and cgobj
  1870. * foreach gets extra argument for passing local data to the
  1871. iterator function
  1872. * -CR checks also class typecasts at runtime by changing them
  1873. into as
  1874. * fixed compiler to cycle with the -CR option
  1875. * fixed stabs with elf writer, finally the global variables can
  1876. be watched
  1877. * removed a lot of routines from cga unit and replaced them by
  1878. calls to cgobj
  1879. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1880. u32bit then the other is typecasted also to u32bit without giving
  1881. a rangecheck warning/error.
  1882. * fixed pascal calling method with reversing also the high tree in
  1883. the parast, detected by tcalcst3 test
  1884. Revision 1.21 2002/04/23 13:12:58 peter
  1885. * updated for posinfo change
  1886. * updated for mangledname change
  1887. * include i386 registers, removed reference to cpubase unit that would
  1888. make ppudump dependent on the source processor
  1889. Revision 1.20 2002/04/15 19:15:09 carl
  1890. + write std_reg2str instead of gas registers
  1891. Revision 1.19 2002/04/14 17:02:19 carl
  1892. + att_reg2str -> gas_reg2str
  1893. Revision 1.18 2002/04/07 10:23:36 carl
  1894. + added vm / sparc targets
  1895. Revision 1.17 2002/04/04 19:06:14 peter
  1896. * removed unused units
  1897. * use tlocation.size in cg.a_*loc*() routines
  1898. Revision 1.16 2002/04/04 18:50:27 carl
  1899. + added wdosx support (patch from Pavel)
  1900. Revision 1.15 2002/03/31 20:26:42 jonas
  1901. + a_loadfpu_* and a_loadmm_* methods in tcg
  1902. * register allocation is now handled by a class and is mostly processor
  1903. independent (+rgobj.pas and i386/rgcpu.pas)
  1904. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  1905. * some small improvements and fixes to the optimizer
  1906. * some register allocation fixes
  1907. * some fpuvaroffset fixes in the unary minus node
  1908. * push/popusedregisters is now called rg.save/restoreusedregisters and
  1909. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  1910. also better optimizable)
  1911. * fixed and optimized register saving/restoring for new/dispose nodes
  1912. * LOC_FPU locations now also require their "register" field to be set to
  1913. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  1914. - list field removed of the tnode class because it's not used currently
  1915. and can cause hard-to-find bugs
  1916. Revision 1.14 2002/03/28 20:48:52 carl
  1917. - remove go32v1 support
  1918. Revision 1.13 2002/03/28 16:44:59 armin
  1919. + new flag if unit has local threadvars
  1920. Revision 1.12 2002/03/01 14:08:47 peter
  1921. * parasym added
  1922. Revision 1.11 2002/01/06 12:08:16 peter
  1923. * removed uauto from orddef, use new range_to_basetype generating
  1924. the correct ordinal type for a range
  1925. }