ppudump.pp 61 KB

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