ppudump.pp 62 KB

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