ppudump.pp 61 KB

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