ppudump.pp 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190
  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. writeln(space,' Length: ',len);
  1000. writeln(space,' Value: "',pc,'"');
  1001. freemem(pc,len+1);
  1002. if tconsttyp(b)=constresourcestring then
  1003. writeln(space,' Index: ',getlongint);
  1004. end;
  1005. constreal :
  1006. writeln(space,' Value: ',getreal);
  1007. constset :
  1008. begin
  1009. write (space,' Set Type: ');
  1010. readtype;
  1011. for i:=1to 4 do
  1012. begin
  1013. write (space,' Value: ');
  1014. for j:=1to 8 do
  1015. begin
  1016. if j>1 then
  1017. write(',');
  1018. write(hexb(getbyte));
  1019. end;
  1020. writeln;
  1021. end;
  1022. end;
  1023. constwstring:
  1024. begin
  1025. end;
  1026. constguid:
  1027. begin
  1028. getdata(guid,sizeof(guid));
  1029. write (space,' IID String: {',hexstr(guid.d1,8),'-',hexstr(guid.d2,4),'-',hexstr(guid.d3,4),'-');
  1030. for i:=0 to 7 do
  1031. begin
  1032. write(hexstr(guid.d4[i],2));
  1033. if i=1 then write('-');
  1034. end;
  1035. writeln('}');
  1036. end
  1037. else
  1038. Writeln ('!! Invalid unit format : Invalid const type encountered: ',b);
  1039. end;
  1040. end;
  1041. ibvarsym :
  1042. begin
  1043. readcommonsym('Variable symbol ');
  1044. writeln(space,' Spez: ',Varspez2Str(getbyte));
  1045. writeln(space,' Address: ',getlongint);
  1046. write (space,' Var Type: ');
  1047. readtype;
  1048. i:=getlongint;
  1049. writeln(space,' Options: ',i);
  1050. if (vo_is_C_var in tvaroptions(i)) then
  1051. writeln(space,' Mangledname: ',getstring);
  1052. end;
  1053. ibenumsym :
  1054. begin
  1055. readcommonsym('Enumeration symbol ');
  1056. write (space,' Definition: ');
  1057. readderef;
  1058. writeln(space,' Value: ',getlongint);
  1059. end;
  1060. ibsyssym :
  1061. begin
  1062. readcommonsym('Internal system symbol ');
  1063. writeln(space,' Internal Nr: ',getlongint);
  1064. end;
  1065. ibrttisym :
  1066. begin
  1067. readcommonsym('RTTI symbol ');
  1068. writeln(space,' RTTI Type: ',getbyte);
  1069. end;
  1070. ibtypedconstsym :
  1071. begin
  1072. readcommonsym('Typed constant ');
  1073. write (space,' Constant Type: ');
  1074. readtype;
  1075. writeln(space,' ReallyConst: ',(getbyte<>0));
  1076. end;
  1077. ibabsolutesym :
  1078. begin
  1079. readcommonsym('Absolute variable symbol ');
  1080. writeln(space,' Type: ',getbyte);
  1081. writeln(space,' Address: ',getlongint);
  1082. write (space,' Var Type: ');
  1083. readtype;
  1084. writeln(space,' Options: ',getlongint);
  1085. Write (space,' Relocated to ');
  1086. b:=getbyte;
  1087. case absolutetyp(b) of
  1088. tovar :
  1089. readsymlist(space+' Sym: ');
  1090. toasm :
  1091. Writeln('Assembler name : ',getstring);
  1092. toaddr :
  1093. begin
  1094. Write('Address : ',getlongint);
  1095. if ttargetcpu(ppufile.header.cpu)=i386 then
  1096. WriteLn(' (Far: ',getbyte<>0,')');
  1097. end;
  1098. else
  1099. Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
  1100. end;
  1101. end;
  1102. ibpropertysym :
  1103. begin
  1104. readcommonsym('Property ');
  1105. i:=getlongint;
  1106. writeln(space,' PropOptions: ',i);
  1107. if (i and 32)>0 then
  1108. begin
  1109. write (space,'OverrideProp: ');
  1110. readderef;
  1111. end
  1112. else
  1113. begin
  1114. write (space,' Prop Type: ');
  1115. readtype;
  1116. writeln(space,' Index: ',getlongint);
  1117. writeln(space,' Default: ',getlongint);
  1118. write (space,' Index Type: ');
  1119. readtype;
  1120. write (space,' Readaccess: ');
  1121. readsymlist(space+' Sym: ');
  1122. write (space,' Writeaccess: ');
  1123. readsymlist(space+' Sym: ');
  1124. write (space,'Storedaccess: ');
  1125. readsymlist(space+' Sym: ');
  1126. end;
  1127. end;
  1128. iberror :
  1129. begin
  1130. Writeln('!! Error in PPU');
  1131. exit;
  1132. end;
  1133. ibendsyms :
  1134. break;
  1135. else
  1136. WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
  1137. end;
  1138. if not EndOfEntry then
  1139. Writeln('!! Entry has more information stored');
  1140. until false;
  1141. if (totalsyms<>-1) and (symcnt-1<>totalsyms) then
  1142. Writeln('!! Only read ',symcnt-1,' of ',totalsyms,' symbols');
  1143. end;
  1144. end;
  1145. {****************************************************************************
  1146. Read defintions Part
  1147. ****************************************************************************}
  1148. procedure readdefinitions(const s:string;start_read : boolean);
  1149. type
  1150. tsettype = (normset,smallset,varset);
  1151. tbasetype = (
  1152. uvoid,
  1153. u8bit,u16bit,u32bit,u64bit,
  1154. s8bit,s16bit,s32bit,s64bit,
  1155. bool8bit,bool16bit,bool32bit,
  1156. uchar,uwidechar
  1157. );
  1158. tobjectdeftype = (odt_none,
  1159. odt_class,
  1160. odt_object,
  1161. odt_interfacecom,
  1162. odt_interfacecorba,
  1163. odt_cppclass
  1164. );
  1165. tvarianttype = (
  1166. vt_normalvariant,vt_olevariant
  1167. );
  1168. var
  1169. b : byte;
  1170. totaldefs,l,j,
  1171. defcnt : longint;
  1172. calloption : tproccalloption;
  1173. procoptions : tprocoptions;
  1174. procinfooptions : tprocinfoflag;
  1175. begin
  1176. defcnt:=0;
  1177. with ppufile do
  1178. begin
  1179. if space<>'' then
  1180. Writeln(space,'------ ',s,' ------');
  1181. if not start_read then
  1182. if readentry=ibstartdefs then
  1183. begin
  1184. totaldefs:=getlongint;
  1185. Writeln(space,'Number of definitions: ',totaldefs);
  1186. end
  1187. else
  1188. begin
  1189. totaldefs:=-1;
  1190. Writeln('!! ibstartdef not found');
  1191. end;
  1192. repeat
  1193. b:=readentry;
  1194. if not (b in [iberror,ibenddefs]) then
  1195. inc(defcnt);
  1196. case b of
  1197. ibpointerdef :
  1198. begin
  1199. readcommondef('Pointer definition');
  1200. write (space,' Pointed Type : ');
  1201. readtype;
  1202. writeln(space,' Is Far : ',(getbyte<>0));
  1203. end;
  1204. iborddef :
  1205. begin
  1206. readcommondef('Ordinal definition');
  1207. write (space,' Base type : ');
  1208. b:=getbyte;
  1209. case tbasetype(b) of
  1210. uvoid : writeln('uvoid');
  1211. u8bit : writeln('u8bit');
  1212. u16bit : writeln('u16bit');
  1213. u32bit : writeln('s32bit');
  1214. u64bit : writeln('u64bit');
  1215. s8bit : writeln('s8bit');
  1216. s16bit : writeln('s16bit');
  1217. s32bit : writeln('s32bit');
  1218. s64bit : writeln('s64bit');
  1219. bool8bit : writeln('bool8bit');
  1220. bool16bit : writeln('bool16bit');
  1221. bool32bit : writeln('bool32bit');
  1222. uchar : writeln('uchar');
  1223. uwidechar : writeln('uwidechar');
  1224. else writeln('!! Warning: Invalid base type ',b);
  1225. end;
  1226. writeln(space,' Range : ',getint64,' to ',getint64);
  1227. end;
  1228. ibfloatdef :
  1229. begin
  1230. readcommondef('Float definition');
  1231. writeln(space,' Float type : ',getbyte);
  1232. end;
  1233. ibarraydef :
  1234. begin
  1235. readcommondef('Array definition');
  1236. write (space,' Element type : ');
  1237. readtype;
  1238. write (space,' Range Type : ');
  1239. readtype;
  1240. writeln(space,' Range : ',getlongint,' to ',getlongint);
  1241. writeln(space,' Is Constructor : ',(getbyte<>0));
  1242. writeln(space,' Is Dynamic : ',(getbyte<>0));
  1243. end;
  1244. ibprocdef :
  1245. begin
  1246. readcommondef('Procedure definition');
  1247. read_abstract_proc_def(calloption,procoptions);
  1248. if (getbyte<>0) then
  1249. writeln(space,' Mangled name : ',getstring);
  1250. writeln(space,' Overload Number : ',getword);
  1251. writeln(space,' Number : ',getword);
  1252. writeln(space,' Level : ',getbyte);
  1253. write (space,' Class : ');
  1254. readderef;
  1255. write (space,' Procsym : ');
  1256. readderef;
  1257. write (space,' File Pos : ');
  1258. readposinfo;
  1259. write (space,' SymOptions : ');
  1260. readsymoptions;
  1261. {$ifdef powerpc}
  1262. { library symbol for AmigaOS/MorphOS }
  1263. write (space,' Library symbol : ');
  1264. readderef;
  1265. {$endif powerpc}
  1266. if (calloption=pocall_inline) then
  1267. begin
  1268. write (space,' FuncretSym : ');
  1269. readderef;
  1270. ppufile.getsmallset(procinfooptions);
  1271. writeln(space,' ProcInfoOptions : ',dword(procinfooptions));
  1272. b := ppufile.getbyte;
  1273. writeln(space,' Inline node tree : ',b);
  1274. end;
  1275. if not EndOfEntry then
  1276. Writeln('!! Entry has more information stored');
  1277. space:=' '+space;
  1278. { parast }
  1279. readdefinitions('parast',false);
  1280. readsymbols('parast');
  1281. { localst }
  1282. if (po_haslocalst in procoptions) or
  1283. (calloption = pocall_inline) then
  1284. begin
  1285. readdefinitions('localst',false);
  1286. readsymbols('localst');
  1287. end;
  1288. if (calloption=pocall_inline) then
  1289. readnodetree;
  1290. delete(space,1,4);
  1291. end;
  1292. ibprocvardef :
  1293. begin
  1294. readcommondef('Procedural type (ProcVar) definition');
  1295. read_abstract_proc_def(calloption,procoptions);
  1296. if not EndOfEntry then
  1297. Writeln('!! Entry has more information stored');
  1298. space:=' '+space;
  1299. { parast }
  1300. readdefinitions('parast',false);
  1301. readsymbols('parast');
  1302. delete(space,1,4);
  1303. end;
  1304. ibshortstringdef :
  1305. begin
  1306. readcommondef('ShortString definition');
  1307. writeln(space,' Length : ',getbyte);
  1308. end;
  1309. ibwidestringdef :
  1310. begin
  1311. readcommondef('WideString definition');
  1312. writeln(space,' Length : ',getlongint);
  1313. end;
  1314. ibansistringdef :
  1315. begin
  1316. readcommondef('AnsiString definition');
  1317. writeln(space,' Length : ',getlongint);
  1318. end;
  1319. iblongstringdef :
  1320. begin
  1321. readcommondef('Longstring definition');
  1322. writeln(space,' Length : ',getlongint);
  1323. end;
  1324. ibrecorddef :
  1325. begin
  1326. readcommondef('Record definition');
  1327. writeln(space,' DataSize : ',getlongint);
  1328. writeln(space,' FieldAlign : ',getbyte);
  1329. writeln(space,' RecordAlign : ',getbyte);
  1330. if not EndOfEntry then
  1331. Writeln('!! Entry has more information stored');
  1332. {read the record definitions and symbols}
  1333. space:=' '+space;
  1334. readdefinitions('fields',false);
  1335. readsymbols('fields');
  1336. Delete(space,1,4);
  1337. end;
  1338. ibobjectdef :
  1339. begin
  1340. readcommondef('Object/Class definition');
  1341. b:=getbyte;
  1342. write (space,' Type : ');
  1343. case tobjectdeftype(b) of
  1344. odt_class : writeln('class');
  1345. odt_object : writeln('object');
  1346. odt_interfacecom : writeln('interfacecom');
  1347. odt_interfacecorba : writeln('interfacecorba');
  1348. odt_cppclass : writeln('cppclass');
  1349. else writeln('!! Warning: Invalid object type ',b);
  1350. end;
  1351. writeln(space,' Name of Class : ',getstring);
  1352. writeln(space,' DataSize : ',getlongint);
  1353. writeln(space,' FieldAlign : ',getbyte);
  1354. writeln(space,' RecordAlign : ',getbyte);
  1355. writeln(space,' Vmt offset : ',getlongint);
  1356. write(space, ' Ancestor Class : ');
  1357. readderef;
  1358. writeln(space,' Options : ',getlongint);
  1359. if tobjectdeftype(b) in [odt_interfacecom,odt_interfacecorba] then
  1360. begin
  1361. { IIDGUID }
  1362. for j:=1to 16 do
  1363. getbyte;
  1364. writeln(space,' IID String : ',getstring);
  1365. writeln(space,' Last VTable idx : ',getlongint);
  1366. end;
  1367. if tobjectdeftype(b) in [odt_class,odt_interfacecorba] then
  1368. begin
  1369. l:=getlongint;
  1370. writeln(space,' Impl Intf Count : ',l);
  1371. for j:=1 to l do
  1372. begin
  1373. write (space,' - Definition : ');
  1374. readderef;
  1375. writeln(space,' IOffset : ',getlongint);
  1376. end;
  1377. end;
  1378. if not EndOfEntry then
  1379. Writeln('!! Entry has more information stored');
  1380. {read the record definitions and symbols}
  1381. space:=' '+space;
  1382. readdefinitions('fields',false);
  1383. readsymbols('fields');
  1384. Delete(space,1,4);
  1385. end;
  1386. ibfiledef :
  1387. begin
  1388. ReadCommonDef('File definition');
  1389. write (space,' Type : ');
  1390. case getbyte of
  1391. 0 : writeln('Text');
  1392. 1 : begin
  1393. writeln('Typed');
  1394. write (space,' File of Type : ');
  1395. Readtype;
  1396. end;
  1397. 2 : writeln('Untyped');
  1398. end;
  1399. end;
  1400. ibformaldef :
  1401. readcommondef('Generic Definition (void-typ)');
  1402. ibenumdef :
  1403. begin
  1404. readcommondef('Enumeration type definition');
  1405. write(space,'Base enumeration type : ');
  1406. readderef;
  1407. writeln(space,' Smallest element : ',getlongint);
  1408. writeln(space,' Largest element : ',getlongint);
  1409. writeln(space,' Size : ',getlongint);
  1410. end;
  1411. ibclassrefdef :
  1412. begin
  1413. readcommondef('Class reference definition');
  1414. write (space,' Pointed Type : ');
  1415. readtype;
  1416. end;
  1417. ibsetdef :
  1418. begin
  1419. readcommondef('Set definition');
  1420. write (space,' Element type : ');
  1421. readtype;
  1422. b:=getbyte;
  1423. case tsettype(b) of
  1424. smallset : writeln(space,' Set with 32 Elements');
  1425. normset : writeln(space,' Set with 256 Elements');
  1426. varset : writeln(space,' Set with ',getlongint,' Elements');
  1427. else writeln('!! Warning: Invalid set type ',b);
  1428. end;
  1429. end;
  1430. ibvariantdef :
  1431. begin
  1432. readcommondef('Variant definition');
  1433. write (space,' Varianttype : ');
  1434. b:=getbyte;
  1435. case tvarianttype(b) of
  1436. vt_normalvariant :
  1437. writeln('Normal');
  1438. vt_olevariant :
  1439. writeln('OLE');
  1440. else
  1441. writeln('!! Warning: Invalid varianttype ',b);
  1442. end;
  1443. end;
  1444. iberror :
  1445. begin
  1446. Writeln('!! Error in PPU');
  1447. exit;
  1448. end;
  1449. ibenddefs :
  1450. break;
  1451. else
  1452. WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
  1453. end;
  1454. if not EndOfEntry then
  1455. Writeln('!! Entry has more information stored');
  1456. until false;
  1457. if (totaldefs<>-1) and (defcnt<>totaldefs) then
  1458. Writeln('!! Only read ',defcnt,' of ',totaldefs,' definitions');
  1459. end;
  1460. end;
  1461. {****************************************************************************
  1462. Read General Part
  1463. ****************************************************************************}
  1464. procedure readinterface;
  1465. var
  1466. b : byte;
  1467. sourcenumber : longint;
  1468. begin
  1469. with ppufile do
  1470. begin
  1471. repeat
  1472. b:=readentry;
  1473. case b of
  1474. ibmodulename :
  1475. Writeln('Module Name: ',getstring);
  1476. ibsourcefiles :
  1477. begin
  1478. sourcenumber:=1;
  1479. while not EndOfEntry do
  1480. begin
  1481. Writeln('Source file ',sourcenumber,' : ',getstring,' ',filetimestring(getlongint));
  1482. inc(sourcenumber);
  1483. end;
  1484. end;
  1485. ibusedmacros :
  1486. begin
  1487. while not EndOfEntry do
  1488. begin
  1489. Write('Conditional ',getstring);
  1490. b:=getbyte;
  1491. if boolean(b)=true then
  1492. write(' defined at startup')
  1493. else
  1494. write(' not defined at startup');
  1495. b:=getbyte;
  1496. if boolean(b)=true then
  1497. writeln(' was used')
  1498. else
  1499. writeln;
  1500. end;
  1501. end;
  1502. ibloadunit :
  1503. ReadLoadUnit;
  1504. iblinkunitofiles :
  1505. ReadLinkContainer('Link unit object file: ');
  1506. iblinkunitstaticlibs :
  1507. ReadLinkContainer('Link unit static lib: ');
  1508. iblinkunitsharedlibs :
  1509. ReadLinkContainer('Link unit shared lib: ');
  1510. iblinkotherofiles :
  1511. ReadLinkContainer('Link other object file: ');
  1512. iblinkotherstaticlibs :
  1513. ReadLinkContainer('Link other static lib: ');
  1514. iblinkothersharedlibs :
  1515. ReadLinkContainer('Link other shared lib: ');
  1516. ibderefdata :
  1517. ReadDerefData;
  1518. iberror :
  1519. begin
  1520. Writeln('Error in PPU');
  1521. exit;
  1522. end;
  1523. ibendinterface :
  1524. break;
  1525. else
  1526. WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
  1527. end;
  1528. until false;
  1529. end;
  1530. end;
  1531. {****************************************************************************
  1532. Read Implementation Part
  1533. ****************************************************************************}
  1534. procedure readimplementation;
  1535. var
  1536. b : byte;
  1537. begin
  1538. with ppufile do
  1539. begin
  1540. repeat
  1541. b:=readentry;
  1542. case b of
  1543. ibasmsymbols :
  1544. ReadAsmSymbols;
  1545. ibloadunit :
  1546. ReadLoadUnit;
  1547. iberror :
  1548. begin
  1549. Writeln('Error in PPU');
  1550. exit;
  1551. end;
  1552. ibendimplementation :
  1553. break;
  1554. else
  1555. WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
  1556. end;
  1557. until false;
  1558. end;
  1559. end;
  1560. {****************************************************************************
  1561. Read Browser Part
  1562. ****************************************************************************}
  1563. procedure readbrowser;
  1564. var
  1565. b : byte;
  1566. const indent : string = '';
  1567. begin
  1568. Writeln(indent,'Start of symtable browser');
  1569. indent:=indent+'**';
  1570. with ppufile do
  1571. begin
  1572. repeat
  1573. b:=readentry;
  1574. case b of
  1575. ibbeginsymtablebrowser :
  1576. begin
  1577. { here we must read object and record symtables !! }
  1578. indent:=indent+' ';
  1579. Writeln(indent,'Record/Object symtable');
  1580. readbrowser;
  1581. Indent:=Copy(Indent,1,Length(Indent)-2);
  1582. end;
  1583. ibsymref :
  1584. begin
  1585. readderef;
  1586. readref;
  1587. end;
  1588. ibdefref :
  1589. begin
  1590. readderef;
  1591. readref;
  1592. if ((ppufile.header.flags and uf_local_browser)<>0) and
  1593. (UnitIndex=0) then
  1594. begin
  1595. { parast and localst }
  1596. indent:=indent+' ';
  1597. b:=ppufile.readentry;
  1598. if b=ibbeginsymtablebrowser then
  1599. readbrowser;
  1600. b:=ppufile.readentry;
  1601. if b=ibbeginsymtablebrowser then
  1602. readbrowser;
  1603. Indent:=Copy(Indent,1,Length(Indent)-2);
  1604. end;
  1605. end;
  1606. iberror :
  1607. begin
  1608. Writeln('Error in PPU');
  1609. exit;
  1610. end;
  1611. ibendsymtablebrowser :
  1612. break;
  1613. else
  1614. begin
  1615. WriteLn('!! Skipping unsupported PPU Entry in Browser: ',b);
  1616. Halt;
  1617. end;
  1618. end;
  1619. until false;
  1620. end;
  1621. Indent:=Copy(Indent,1,Length(Indent)-2);
  1622. Writeln(Indent,'End of symtable browser');
  1623. end;
  1624. procedure dofile (filename : string);
  1625. var
  1626. b : byte;
  1627. begin
  1628. { reset }
  1629. space:='';
  1630. { fix filename }
  1631. if pos('.',filename)=0 then
  1632. filename:=filename+'.ppu';
  1633. ppufile:=tppufile.create(filename);
  1634. if not ppufile.openfile then
  1635. begin
  1636. writeln ('IO-Error when opening : ',filename,', Skipping');
  1637. exit;
  1638. end;
  1639. { PPU File is open, check for PPU Id }
  1640. if not ppufile.CheckPPUID then
  1641. begin
  1642. writeln(Filename,' : Not a valid PPU file, Skipping');
  1643. exit;
  1644. end;
  1645. { Check PPU Version }
  1646. Writeln('Analyzing ',filename,' (v',ppufile.GetPPUVersion,')');
  1647. if ppufile.GetPPUVersion<16 then
  1648. begin
  1649. writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
  1650. exit;
  1651. end;
  1652. { Write PPU Header Information }
  1653. if (verbose and v_header)<>0 then
  1654. begin
  1655. Writeln;
  1656. Writeln('Header');
  1657. Writeln('-------');
  1658. with ppufile.header do
  1659. begin
  1660. Writeln('Compiler version : ',ppufile.header.compiler shr 14,'.',
  1661. (ppufile.header.compiler shr 7) and $7f,'.',
  1662. ppufile.header.compiler and $7f);
  1663. WriteLn('Target processor : ',Cpu2Str(cpu));
  1664. WriteLn('Target operating system : ',Target2Str(target));
  1665. Writeln('Unit flags : ',PPUFlags2Str(flags));
  1666. Writeln('FileSize (w/o header) : ',size);
  1667. Writeln('Checksum : ',hexstr(checksum,8));
  1668. Writeln('Interface Checksum : ',hexstr(interface_checksum,8));
  1669. end;
  1670. end;
  1671. {read the general stuff}
  1672. if (verbose and v_interface)<>0 then
  1673. begin
  1674. Writeln;
  1675. Writeln('Interface section');
  1676. Writeln('------------------');
  1677. readinterface;
  1678. end
  1679. else
  1680. ppufile.skipuntilentry(ibendinterface);
  1681. {read the definitions}
  1682. if (verbose and v_defs)<>0 then
  1683. begin
  1684. Writeln;
  1685. Writeln('Interface definitions');
  1686. Writeln('----------------------');
  1687. readdefinitions('interface',false);
  1688. end
  1689. else
  1690. ppufile.skipuntilentry(ibenddefs);
  1691. {read the symbols}
  1692. if (verbose and v_syms)<>0 then
  1693. begin
  1694. Writeln;
  1695. Writeln('Interface Symbols');
  1696. Writeln('------------------');
  1697. readsymbols('interface');
  1698. end
  1699. else
  1700. ppufile.skipuntilentry(ibendsyms);
  1701. {read the implementation stuff}
  1702. if (verbose and v_implementation)<>0 then
  1703. begin
  1704. Writeln;
  1705. Writeln('Implementation section');
  1706. Writeln('-----------------------');
  1707. readimplementation;
  1708. end
  1709. else
  1710. ppufile.skipuntilentry(ibendimplementation);
  1711. {read the static browser units stuff}
  1712. if (ppufile.header.flags and uf_local_symtable)<>0 then
  1713. begin
  1714. if (verbose and v_defs)<>0 then
  1715. begin
  1716. Writeln;
  1717. Writeln('Static definitions');
  1718. Writeln('----------------------');
  1719. readdefinitions('implementation',false);
  1720. end
  1721. else
  1722. ppufile.skipuntilentry(ibenddefs);
  1723. {read the symbols}
  1724. if (verbose and v_syms)<>0 then
  1725. begin
  1726. Writeln;
  1727. Writeln('Static Symbols');
  1728. Writeln('------------------');
  1729. readsymbols('implementation');
  1730. end
  1731. else
  1732. ppufile.skipuntilentry(ibendsyms);
  1733. end;
  1734. {read the browser units stuff}
  1735. if (ppufile.header.flags and uf_has_browser)<>0 then
  1736. begin
  1737. if (verbose and v_browser)<>0 then
  1738. begin
  1739. Writeln;
  1740. Writeln('Browser section');
  1741. Writeln('---------------');
  1742. UnitIndex:=0;
  1743. repeat
  1744. b:=ppufile.readentry;
  1745. if b = ibendbrowser then break;
  1746. if b=ibbeginsymtablebrowser then
  1747. begin
  1748. Writeln('Unit ',UnitIndex);
  1749. readbrowser;
  1750. Inc(UnitIndex);
  1751. end
  1752. else
  1753. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1754. until false;
  1755. end;
  1756. end;
  1757. {read the static browser units stuff}
  1758. if (ppufile.header.flags and uf_local_browser)<>0 then
  1759. begin
  1760. if (verbose and v_browser)<>0 then
  1761. begin
  1762. Writeln;
  1763. Writeln('Static browser section');
  1764. Writeln('---------------');
  1765. UnitIndex:=0;
  1766. b:=ppufile.readentry;
  1767. if b=ibbeginsymtablebrowser then
  1768. readbrowser
  1769. else
  1770. Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
  1771. end;
  1772. end;
  1773. {shutdown ppufile}
  1774. ppufile.closefile;
  1775. ppufile.free;
  1776. Writeln;
  1777. end;
  1778. procedure help;
  1779. begin
  1780. writeln('usage: ppudump [options] <filename1> <filename2>...');
  1781. writeln;
  1782. writeln('[options] can be:');
  1783. writeln(' -V<verbose> Set verbosity to <verbose>');
  1784. writeln(' H - Show header info');
  1785. writeln(' I - Show interface');
  1786. writeln(' M - Show implementation');
  1787. writeln(' S - Show interface symbols');
  1788. writeln(' D - Show interface definitions');
  1789. writeln(' B - Show browser info');
  1790. writeln(' A - Show all');
  1791. writeln(' -h, -? This helpscreen');
  1792. halt;
  1793. end;
  1794. var
  1795. startpara,
  1796. nrfile,i : longint;
  1797. para : string;
  1798. begin
  1799. writeln(Title+' '+Version);
  1800. writeln(Copyright);
  1801. writeln;
  1802. if paramcount<1 then
  1803. begin
  1804. writeln('usage: dumpppu [options] <filename1> <filename2>...');
  1805. halt(1);
  1806. end;
  1807. { turn verbose on by default }
  1808. verbose:=v_all;
  1809. { read options }
  1810. startpara:=1;
  1811. while copy(paramstr(startpara),1,1)='-' do
  1812. begin
  1813. para:=paramstr(startpara);
  1814. case upcase(para[2]) of
  1815. 'V' : begin
  1816. verbose:=0;
  1817. for i:=3to length(para) do
  1818. case upcase(para[i]) of
  1819. 'H' : verbose:=verbose or v_header;
  1820. 'I' : verbose:=verbose or v_interface;
  1821. 'M' : verbose:=verbose or v_implementation;
  1822. 'D' : verbose:=verbose or v_defs;
  1823. 'S' : verbose:=verbose or v_syms;
  1824. 'B' : verbose:=verbose or v_browser;
  1825. 'A' : verbose:=verbose or v_all;
  1826. end;
  1827. end;
  1828. 'H' : help;
  1829. '?' : help;
  1830. end;
  1831. inc(startpara);
  1832. end;
  1833. { process files }
  1834. for nrfile:=startpara to paramcount do
  1835. dofile (paramstr(nrfile));
  1836. if has_errors then
  1837. Halt(1);
  1838. end.
  1839. {
  1840. $Log$
  1841. Revision 1.56 2004-09-27 18:04:11 olle
  1842. + added -h option to show help
  1843. Revision 1.55 2004/09/04 21:11:49 armin
  1844. * missing targets added
  1845. Revision 1.54 2004/08/27 21:59:27 peter
  1846. browser disabled
  1847. uf_local_symtable ppu flag when a localsymtable is stored
  1848. Revision 1.53 2004/07/12 09:14:04 jonas
  1849. * inline procedures at the node tree level, but only under some very
  1850. limited circumstances for now (only procedures, and only if they have
  1851. no or only vs_out/vs_var parameters).
  1852. * fixed ppudump for inline procedures
  1853. * fixed ppudump for ppc
  1854. Revision 1.52 2004/07/09 22:17:32 peter
  1855. * revert has_localst patch
  1856. * replace aktstaticsymtable/aktglobalsymtable with current_module
  1857. Revision 1.51 2004/07/06 19:52:04 peter
  1858. * fix storing of localst in ppu
  1859. Revision 1.50 2003/12/16 21:29:25 florian
  1860. + inlined procedures inherit procinfo flags
  1861. Revision 1.49 2003/12/08 21:04:08 peter
  1862. * line break in uses unit
  1863. Revision 1.48 2003/11/10 22:02:52 peter
  1864. * cross unit inlining fixed
  1865. Revision 1.47 2003/10/22 20:40:00 peter
  1866. * write derefdata in a separate ppu entry
  1867. Revision 1.46 2003/07/02 22:18:04 peter
  1868. * paraloc splitted in callerparaloc,calleeparaloc
  1869. * sparc calling convention updates
  1870. Revision 1.45 2003/06/25 18:31:23 peter
  1871. * sym,def resolving partly rewritten to support also parent objects
  1872. not directly available through the uses clause
  1873. Revision 1.44 2003/06/09 12:59:00 peter
  1874. * updated for new deref info
  1875. Revision 1.43 2003/06/05 20:06:11 peter
  1876. * new procoptions
  1877. Revision 1.42 2003/05/09 17:47:03 peter
  1878. * self moved to hidden parameter
  1879. * removed hdisposen,hnewn,selfn
  1880. Revision 1.41 2003/04/27 07:29:52 peter
  1881. * aktprocdef cleanup, aktprocdef is now always nil when parsing
  1882. a new procdef declaration
  1883. * aktprocsym removed
  1884. * lexlevel removed, use symtable.symtablelevel instead
  1885. * implicit init/final code uses the normal genentry/genexit
  1886. * funcret state checking updated for new funcret handling
  1887. Revision 1.39 2003/04/25 20:59:35 peter
  1888. * removed funcretn,funcretsym, function result is now in varsym
  1889. and aliases for result and function name are added using absolutesym
  1890. * vs_hidden parameter for funcret passed in parameter
  1891. * vs_hidden fixes
  1892. * writenode changed to printnode and released from extdebug
  1893. * -vp option added to generate a tree.log with the nodetree
  1894. * nicer printnode for statements, callnode
  1895. Revision 1.38 2003/04/10 17:57:53 peter
  1896. * vs_hidden released
  1897. Revision 1.37 2003/03/24 19:57:54 hajny
  1898. + emx target added
  1899. Revision 1.36 2003/03/17 15:54:22 peter
  1900. * store symoptions also for procdef
  1901. * check symoptions (private,public) when calculating possible
  1902. overload candidates
  1903. Revision 1.35 2003/01/03 22:16:29 peter
  1904. * updated for absolutesym and varsym
  1905. Revision 1.34 2002/11/17 16:32:04 carl
  1906. * memory optimization (3-4%) : cleanup of tai fields,
  1907. cleanup of tdef and tsym fields.
  1908. * make it work for m68k
  1909. Revision 1.33 2002/10/20 14:49:31 peter
  1910. * store original source time in ppu so it can be compared instead of
  1911. comparing with the ppu time
  1912. Revision 1.32 2002/10/06 12:25:53 florian
  1913. + dump of tdefoptions.df_unique
  1914. Revision 1.31 2002/09/27 21:22:04 carl
  1915. * update system information
  1916. Revision 1.30 2002/09/26 12:03:54 florian
  1917. + support of constguid and constwchar const symbols added
  1918. Revision 1.29 2002/08/20 16:54:40 peter
  1919. * write address of varsym always
  1920. Revision 1.28 2002/08/19 19:36:44 peter
  1921. * More fixes for cross unit inlining, all tnodes are now implemented
  1922. * Moved pocall_internconst to po_internconst because it is not a
  1923. calling type at all and it conflicted when inlining of these small
  1924. functions was requested
  1925. Revision 1.27 2002/08/15 15:15:56 carl
  1926. * jmpbuf size allocation for exceptions is now cpu specific (as it should)
  1927. * more generic nodes for maths
  1928. * several fixes for better m68k support
  1929. Revision 1.26 2002/08/11 13:24:20 peter
  1930. * saving of asmsymbols in ppu supported
  1931. * asmsymbollist global is removed and moved into a new class
  1932. tasmlibrarydata that will hold the info of a .a file which
  1933. corresponds with a single module. Added librarydata to tmodule
  1934. to keep the library info stored for the module. In the future the
  1935. objectfiles will also be stored to the tasmlibrarydata class
  1936. * all getlabel/newasmsymbol and friends are moved to the new class
  1937. Revision 1.25 2002/05/18 13:34:27 peter
  1938. * readded missing revisions
  1939. Revision 1.24 2002/05/16 19:46:54 carl
  1940. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1941. + try to fix temp allocation (still in ifdef)
  1942. + generic constructor calls
  1943. + start of tassembler / tmodulebase class cleanup
  1944. Revision 1.22 2002/05/12 16:53:18 peter
  1945. * moved entry and exitcode to ncgutil and cgobj
  1946. * foreach gets extra argument for passing local data to the
  1947. iterator function
  1948. * -CR checks also class typecasts at runtime by changing them
  1949. into as
  1950. * fixed compiler to cycle with the -CR option
  1951. * fixed stabs with elf writer, finally the global variables can
  1952. be watched
  1953. * removed a lot of routines from cga unit and replaced them by
  1954. calls to cgobj
  1955. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1956. u32bit then the other is typecasted also to u32bit without giving
  1957. a rangecheck warning/error.
  1958. * fixed pascal calling method with reversing also the high tree in
  1959. the parast, detected by tcalcst3 test
  1960. Revision 1.21 2002/04/23 13:12:58 peter
  1961. * updated for posinfo change
  1962. * updated for mangledname change
  1963. * include i386 registers, removed reference to cpubase unit that would
  1964. make ppudump dependent on the source processor
  1965. Revision 1.20 2002/04/15 19:15:09 carl
  1966. + write std_reg2str instead of gas registers
  1967. Revision 1.19 2002/04/14 17:02:19 carl
  1968. + att_reg2str -> gas_reg2str
  1969. Revision 1.18 2002/04/07 10:23:36 carl
  1970. + added vm / sparc targets
  1971. Revision 1.17 2002/04/04 19:06:14 peter
  1972. * removed unused units
  1973. * use tlocation.size in cg.a_*loc*() routines
  1974. Revision 1.16 2002/04/04 18:50:27 carl
  1975. + added wdosx support (patch from Pavel)
  1976. Revision 1.15 2002/03/31 20:26:42 jonas
  1977. + a_loadfpu_* and a_loadmm_* methods in tcg
  1978. * register allocation is now handled by a class and is mostly processor
  1979. independent (+rgobj.pas and i386/rgcpu.pas)
  1980. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  1981. * some small improvements and fixes to the optimizer
  1982. * some register allocation fixes
  1983. * some fpuvaroffset fixes in the unary minus node
  1984. * push/popusedregisters is now called rg.save/restoreusedregisters and
  1985. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  1986. also better optimizable)
  1987. * fixed and optimized register saving/restoring for new/dispose nodes
  1988. * LOC_FPU locations now also require their "register" field to be set to
  1989. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  1990. - list field removed of the tnode class because it's not used currently
  1991. and can cause hard-to-find bugs
  1992. Revision 1.14 2002/03/28 20:48:52 carl
  1993. - remove go32v1 support
  1994. Revision 1.13 2002/03/28 16:44:59 armin
  1995. + new flag if unit has local threadvars
  1996. Revision 1.12 2002/03/01 14:08:47 peter
  1997. * parasym added
  1998. Revision 1.11 2002/01/06 12:08:16 peter
  1999. * removed uauto from orddef, use new range_to_basetype generating
  2000. the correct ordinal type for a range
  2001. }