ppudump.pp 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690
  1. {
  2. Copyright (c) 1998-2002 by the FPC Development Team
  3. Dumps the contents of a FPC unit file (PPU File)
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************}
  16. program ppudump;
  17. {$mode objfpc}
  18. {$H+}
  19. {$define IN_PPUDUMP}
  20. uses
  21. { do NOT add symconst or globtype to make merging easier }
  22. { do include symconst and globtype now before splitting 2.5 PM 2011-06-15 }
  23. SysUtils,
  24. constexp,
  25. symconst,
  26. ppu,
  27. systems,
  28. globals,
  29. globtype,
  30. widestr,
  31. tokens;
  32. const
  33. Version = 'Version 2.5.1';
  34. Title = 'PPU-Analyser';
  35. Copyright = 'Copyright (c) 1998-2010 by the Free Pascal Development Team';
  36. { verbosity }
  37. v_none = $0;
  38. v_header = $1;
  39. v_defs = $2;
  40. v_syms = $4;
  41. v_interface = $8;
  42. v_implementation = $10;
  43. // v_browser = $20;
  44. v_all = $ff;
  45. { not needed anymore $i systems.inc }
  46. { List of all supported cpus }
  47. const
  48. CpuTxt : array[tsystemcpu] of string[9]=
  49. (
  50. { 0 } 'none',
  51. { 1 } 'i386',
  52. { 2 } 'm68k',
  53. { 3 } 'alpha',
  54. { 4 } 'powerpc',
  55. { 5 } 'sparc',
  56. { 6 } 'vis',
  57. { 7 } 'ia64',
  58. { 8 } 'x86_64',
  59. { 9 } 'mips',
  60. { 10 } 'arm',
  61. { 11 } 'powerpc64',
  62. { 12 } 'avr',
  63. { 13 } 'mipsel'
  64. );
  65. { List of all supported system-cpu couples }
  66. const
  67. Targets : array[tsystem] of string[18]=(
  68. { 0 } 'none',
  69. { 1 } 'GO32V1 (obsolete)',
  70. { 2 } 'GO32V2',
  71. { 3 } 'Linux-i386',
  72. { 4 } 'OS/2',
  73. { 5 } 'Win32',
  74. { 6 } 'FreeBSD-i386',
  75. { 7 } 'Amiga',
  76. { 8 } 'Atari',
  77. { 9 } 'MacOS-m68k',
  78. { 10 } 'Linux-m68k',
  79. { 11 } 'PalmOS-m68k',
  80. { 12 } 'Linux-alpha',
  81. { 13 } 'Linux-ppc',
  82. { 14 } 'MacOS-ppc',
  83. { 15 } 'Solaris-i386',
  84. { 16 } 'BeOS-i386',
  85. { 17 } 'NetBSD-i386',
  86. { 18 } 'NetBSD-m68k',
  87. { 19 } 'Netware-i386-clib',
  88. { 20 } 'Qnx-i386',
  89. { 21 } 'WDOSX-i386',
  90. { 22 } 'Solaris-sparc',
  91. { 23 } 'Linux-sparc',
  92. { 24 } 'OpenBSD-i386',
  93. { 25 } 'OpenBSD-m68k',
  94. { 26 } 'Linux-x86-64',
  95. { 27 } 'MacOSX-ppc',
  96. { 28 } 'OS/2 via EMX',
  97. { 29 } 'NetBSD-powerpc',
  98. { 30 } 'OpenBSD-powerpc',
  99. { 31 } 'Linux-arm',
  100. { 32 } 'Watcom-i386',
  101. { 33 } 'MorphOS-powerpc',
  102. { 34 } 'FreeBSD-x86-64',
  103. { 35 } 'Netware-i386-libc',
  104. { 36 } 'Amiga-PowerPC',
  105. { 37 } 'Win64-x64',
  106. { 38 } 'WinCE-ARM',
  107. { 39 } 'Win64-iA64',
  108. { 40 } 'WinCE-i386',
  109. { 41 } 'Linux-x64',
  110. { 42 } 'GBA-arm',
  111. { 43 } 'Linux-powerpc64',
  112. { 44 } 'Darwin-i386',
  113. { 45 } 'PalmOS-arm',
  114. { 46 } 'MacOSX-powerpc64',
  115. { 47 } 'NDS-arm',
  116. { 48 } 'Embedded-i386',
  117. { 49 } 'Embedded-m68k',
  118. { 50 } 'Embedded-alpha',
  119. { 51 } 'Embedded-powerpc',
  120. { 52 } 'Embedded-sparc',
  121. { 53 } 'Embedded-vm',
  122. { 54 } 'Embedded-iA64',
  123. { 55 } 'Embedded-x64',
  124. { 56 } 'Embedded-mips',
  125. { 57 } 'Embedded-arm',
  126. { 58 } 'Embedded-powerpc64',
  127. { 59 } 'Symbian-i386',
  128. { 60 } 'Symbian-arm',
  129. { 61 } 'MacOSX-x64',
  130. { 62 } 'Embedded-avr',
  131. { 63 } 'Haiku-i386',
  132. { 64 } 'Darwin-ARM',
  133. { 65 } 'Solaris-x86-64',
  134. { 66 } 'Linux-MIPS',
  135. { 67 } 'Linux-MIPSel',
  136. { 68 } 'NativeNT-i386',
  137. { 69 } 'iPhoneSim-i386',
  138. { 70 } 'Wii-powerpc'
  139. );
  140. const
  141. { in widestr, we have the following definition
  142. type
  143. tcompilerwidechar = word;
  144. thus widecharsize seems to always be 2 bytes }
  145. widecharsize : longint = 2;
  146. cpu : tsystemcpu = cpu_no;
  147. { This type is defined in scanner.pas unit }
  148. type
  149. tspecialgenerictoken = (
  150. ST_LOADSETTINGS,
  151. ST_LINE,
  152. ST_COLUMN,
  153. ST_FILEINDEX,
  154. ST_LOADMESSAGES);
  155. var
  156. ppufile : tppufile;
  157. ppuversion : dword;
  158. space : string;
  159. verbose : longint;
  160. derefdata : pbyte;
  161. derefdatalen : longint;
  162. {****************************************************************************
  163. Helper Routines
  164. ****************************************************************************}
  165. const has_errors : boolean = false;
  166. has_more_infos : boolean = false;
  167. Procedure HasMoreInfos;
  168. begin
  169. Writeln('!! Entry has more information stored');
  170. has_more_infos:=true;
  171. end;
  172. Procedure WriteError(const S : string);
  173. Begin
  174. Writeln(S);
  175. has_errors:=true;
  176. End;
  177. function Unknown(const st : string; val :longint) : string;
  178. Begin
  179. Unknown:='<!! Unknown'+st+' value '+tostr(val)+'>';
  180. has_errors:=true;
  181. end;
  182. function ToStr(w:longint):String;
  183. begin
  184. Str(w,ToStr);
  185. end;
  186. Function Target2Str(w:longint):string;
  187. begin
  188. if w<=ord(high(tsystem)) then
  189. Target2Str:=Targets[tsystem(w)]
  190. else
  191. Target2Str:=Unknown('target',w);
  192. end;
  193. Function Cpu2Str(w:longint):string;
  194. begin
  195. if w<=ord(high(tsystemcpu)) then
  196. begin
  197. cpu:=tsystemcpu(w);
  198. Cpu2Str:=CpuTxt[cpu];
  199. end
  200. else
  201. Cpu2Str:=Unknown('cpu',w);
  202. end;
  203. Function Varspez2Str(w:longint):string;
  204. const
  205. { in symconst unit
  206. tvarspez = (vs_value,vs_const,vs_var,vs_out,vs_constref); }
  207. varspezstr : array[tvarspez] of string[6]=('Value','Const','Var','Out','Hidden');
  208. begin
  209. if w<=ord(high(varspezstr)) then
  210. Varspez2Str:=varspezstr[tvarspez(w)]
  211. else
  212. Varspez2Str:=Unknown('varspez',w);
  213. end;
  214. Function VarRegable2Str(w:longint):string;
  215. { tvarregable type is defined in symconst unit }
  216. const
  217. varregableStr : array[tvarregable] of string[6]=('None','IntReg','FPUReg','MMReg','Addr');
  218. begin
  219. if w<=ord(high(varregablestr)) then
  220. Varregable2Str:=varregablestr[tvarregable(w)]
  221. else
  222. Varregable2Str:=Unknown('regable',w);
  223. end;
  224. Function Visibility2Str(w:longint):string;
  225. const
  226. { tvisibility type is defined in symconst unit }
  227. visibilityName : array[tvisibility] of string[16] = (
  228. 'hidden','strict private','private','strict protected','protected',
  229. 'public','published'
  230. );
  231. begin
  232. if w<=ord(high(visibilityName)) then
  233. result:=visibilityName[tvisibility(w)]
  234. else
  235. result:=Unknown('visibility',w);
  236. end;
  237. function PPUFlags2Str(flags:longint):string;
  238. type
  239. tflagopt=record
  240. mask : longint;
  241. str : string[30];
  242. end;
  243. const
  244. flagopts=24;
  245. flagopt : array[1..flagopts] of tflagopt=(
  246. (mask: $1 ;str:'init'),
  247. (mask: $2 ;str:'final'),
  248. (mask: $4 ;str:'big_endian'),
  249. (mask: $8 ;str:'dbx'),
  250. // (mask: $10 ;str:'browser'),
  251. (mask: $20 ;str:'in_library'),
  252. (mask: $40 ;str:'smart_linked'),
  253. (mask: $80 ;str:'static_linked'),
  254. (mask: $100 ;str:'shared_linked'),
  255. // (mask: $200 ;str:'local_browser'),
  256. (mask: $400 ;str:'no_link'),
  257. (mask: $800 ;str:'has_resources'),
  258. (mask: $1000 ;str:'little_endian'),
  259. (mask: $2000 ;str:'release'),
  260. (mask: $4000 ;str:'local_threadvars'),
  261. (mask: $8000 ;str:'fpu_emulation_on'),
  262. (mask: $210000 ;str:'has_debug_info'),
  263. (mask: $10000 ;str:'stabs_debug_info'),
  264. (mask: $200000 ;str:'dwarf_debug_info'),
  265. (mask: $20000 ;str:'local_symtable'),
  266. (mask: $40000 ;str:'uses_variants'),
  267. (mask: $80000 ;str:'has_resourcefiles'),
  268. (mask: $100000 ;str:'has_exports'),
  269. (mask: $400000 ;str:'has_wideinits'),
  270. (mask: $800000 ;str:'has_classinits'),
  271. (mask: $1000000 ;str:'has_resstrinits')
  272. );
  273. var
  274. i,ntflags : longint;
  275. first : boolean;
  276. s : string;
  277. begin
  278. s:='';
  279. if flags<>0 then
  280. begin
  281. ntflags:=flags;
  282. first:=true;
  283. for i:=1to flagopts do
  284. if (flags and flagopt[i].mask)<>0 then
  285. begin
  286. if first then
  287. first:=false
  288. else
  289. s:=s+', ';
  290. s:=s+flagopt[i].str;
  291. ntflags:=ntflags and (not flagopt[i].mask);
  292. end;
  293. end
  294. else
  295. s:='none';
  296. if ntflags<>0 then
  297. begin
  298. s:=s+' unknown '+hexstr(ntflags,8);
  299. has_errors:=true;
  300. end;
  301. PPUFlags2Str:=s;
  302. end;
  303. Function L0(l:longint):string;
  304. {
  305. return the string of value l, if l<10 then insert a zero, so
  306. the string is always at least 2 chars '01','02',etc
  307. }
  308. var
  309. s : string;
  310. begin
  311. Str(l,s);
  312. if l<10 then
  313. s:='0'+s;
  314. L0:=s;
  315. end;
  316. function filetimestring( t : longint) : string;
  317. {
  318. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  319. }
  320. var
  321. DT : TDateTime;
  322. hsec : word;
  323. Year,Month,Day: Word;
  324. hour,min,sec : word;
  325. begin
  326. if t=-1 then
  327. begin
  328. Result := 'Not Found';
  329. has_errors:=true;
  330. exit;
  331. end;
  332. DT := FileDateToDateTime(t);
  333. DecodeTime(DT,hour,min,sec,hsec);
  334. DecodeDate(DT,year,month,day);
  335. Result := L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
  336. end;
  337. {****************************************************************************
  338. Read Routines
  339. ****************************************************************************}
  340. procedure readrecsymtableoptions;
  341. var
  342. usefieldalignment : shortint;
  343. begin
  344. if ppufile.readentry<>ibrecsymtableoptions then
  345. begin
  346. has_errors:=true;
  347. exit;
  348. end;
  349. writeln(space,' recordalignment: ',shortint(ppufile.getbyte));
  350. usefieldalignment:=shortint(ppufile.getbyte);
  351. writeln(space,' usefieldalignment: ',usefieldalignment);
  352. if (usefieldalignment=C_alignment) then
  353. writeln(space,' fieldalignment: ',shortint(ppufile.getbyte));
  354. end;
  355. procedure readsymtableoptions(const s: string);
  356. type
  357. tsymtblopt=record
  358. mask : tsymtableoption;
  359. str : string[30];
  360. end;
  361. const
  362. symtblopts=ord(high(tsymtableoption)) + 1;
  363. symtblopt : array[1..symtblopts] of tsymtblopt=(
  364. (mask:sto_has_helper; str:'Has helper')
  365. );
  366. var
  367. options : tsymtableoptions;
  368. first : boolean;
  369. i : integer;
  370. begin
  371. if ppufile.readentry<>ibsymtableoptions then
  372. begin
  373. has_errors:=true;
  374. exit;
  375. end;
  376. ppufile.getsmallset(options);
  377. if space<>'' then
  378. writeln(space,'------ ',s,' ------');
  379. write(space,'Symtable options: ');
  380. if options<>[] then
  381. begin
  382. first:=true;
  383. for i:=1 to symtblopts do
  384. if (symtblopt[i].mask in options) then
  385. begin
  386. if first then
  387. first:=false
  388. else
  389. write(', ');
  390. write(symtblopt[i].str);
  391. end;
  392. end
  393. else
  394. write('none');
  395. writeln;
  396. end;
  397. Procedure ReadLinkContainer(const prefix:string);
  398. {
  399. Read a serie of strings and write to the screen starting every line
  400. with prefix
  401. }
  402. function maskstr(m:longint):string;
  403. { link options are in globtype unit
  404. const
  405. link_none = $0;
  406. link_always = $1;
  407. link_static = $2;
  408. link_smart = $4;
  409. link_shared = $8; }
  410. var
  411. s : string;
  412. begin
  413. s:='';
  414. if (m and link_always)<>0 then
  415. s:=s+'always ';
  416. if (m and link_static)<>0 then
  417. s:=s+'static ';
  418. if (m and link_smart)<>0 then
  419. s:=s+'smart ';
  420. if (m and link_shared)<>0 then
  421. s:=s+'shared ';
  422. maskstr:=s;
  423. end;
  424. var
  425. s : string;
  426. m : longint;
  427. begin
  428. while not ppufile.endofentry do
  429. begin
  430. s:=ppufile.getstring;
  431. m:=ppufile.getlongint;
  432. WriteLn(prefix,s,' (',maskstr(m),')');
  433. end;
  434. end;
  435. Procedure ReadContainer(const prefix:string);
  436. {
  437. Read a serie of strings and write to the screen starting every line
  438. with prefix
  439. }
  440. begin
  441. while not ppufile.endofentry do
  442. WriteLn(prefix,ppufile.getstring);
  443. end;
  444. procedure ReadLoadUnit;
  445. var
  446. ucrc,uintfcrc, indcrc : cardinal;
  447. begin
  448. while not ppufile.EndOfEntry do
  449. begin
  450. write('Uses unit: ',ppufile.getstring);
  451. ucrc:=cardinal(ppufile.getlongint);
  452. uintfcrc:=cardinal(ppufile.getlongint);
  453. indcrc:=cardinal(ppufile.getlongint);
  454. writeln(' (Crc: ',hexstr(ucrc,8),', IntfcCrc: ',hexstr(uintfcrc,8),', IndCrc: ',hexstr(indcrc,8),')');
  455. end;
  456. end;
  457. Procedure ReadDerefmap;
  458. var
  459. i,mapsize : longint;
  460. begin
  461. mapsize:=ppufile.getlongint;
  462. writeln('DerefMapsize: ',mapsize);
  463. for i:=0 to mapsize-1 do
  464. writeln('DerefMap[',i,'] = ',ppufile.getstring);
  465. end;
  466. Procedure ReadImportSymbols;
  467. var
  468. extlibname : string;
  469. j,
  470. extsymcnt : longint;
  471. extsymname : string;
  472. extsymmangledname : string;
  473. extsymordnr : longint;
  474. extsymisvar : boolean;
  475. begin
  476. while not ppufile.endofentry do
  477. begin
  478. extlibname:=ppufile.getstring;
  479. extsymcnt:=ppufile.getlongint;
  480. writeln('External Library: ',extlibname,' (',extsymcnt,' imports)');
  481. for j:=0 to extsymcnt-1 do
  482. begin
  483. extsymname:=ppufile.getstring;
  484. if ppuversion>130 then
  485. extsymmangledname:=ppufile.getstring
  486. else
  487. extsymmangledname:=extsymname;
  488. extsymordnr:=ppufile.getlongint;
  489. extsymisvar:=ppufile.getbyte<>0;
  490. writeln(' ',extsymname,' as ',extsymmangledname,
  491. '(OrdNr: ',extsymordnr,' IsVar: ',extsymisvar,')');
  492. end;
  493. end;
  494. end;
  495. Procedure ReadDerefdata;
  496. begin
  497. derefdatalen:=ppufile.entrysize;
  498. if derefdatalen=0 then
  499. begin
  500. WriteError('!! Error: derefdatalen=0');
  501. exit;
  502. end;
  503. Writeln('Derefdata length: ',derefdatalen);
  504. derefdata:=allocmem(derefdatalen);
  505. ppufile.getdata(derefdata^,derefdatalen);
  506. end;
  507. Procedure FreeDerefdata;
  508. begin
  509. if assigned(derefdata) then
  510. begin
  511. FreeMem(derefdata);
  512. derefdata:=nil;
  513. derefdatalen:=0;
  514. end;
  515. end;
  516. Procedure ReadWpoFileInfo;
  517. begin
  518. Writeln('Compiled with input whole-program optimisation from ',ppufile.getstring,' ',filetimestring(ppufile.getlongint));
  519. end;
  520. Procedure ReadAsmSymbols;
  521. type
  522. { Copied from aasmbase.pas }
  523. TAsmsymbind=(
  524. AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL,AB_WEAK_EXTERNAL,
  525. { global in the current program/library, but not visible outside it }
  526. AB_PRIVATE_EXTERN,AB_LAZY,AB_IMPORT);
  527. TAsmsymtype=(
  528. AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL,
  529. {
  530. the address of this code label is taken somewhere in the code
  531. so it must be taken care of it when creating pic
  532. }
  533. AT_ADDR
  534. );
  535. var
  536. s,
  537. bindstr,
  538. typestr : string;
  539. i : longint;
  540. begin
  541. writeln(space,'Number of AsmSymbols: ',ppufile.getlongint);
  542. i:=0;
  543. while (not ppufile.endofentry) and (not ppufile.error) do
  544. begin
  545. s:=ppufile.getstring;
  546. case tasmsymbind(ppufile.getbyte) of
  547. AB_EXTERNAL :
  548. bindstr:='External';
  549. AB_COMMON :
  550. bindstr:='Common';
  551. AB_LOCAL :
  552. bindstr:='Local';
  553. AB_GLOBAL :
  554. bindstr:='Global';
  555. AB_WEAK_EXTERNAL :
  556. bindstr:='Weak external';
  557. AB_PRIVATE_EXTERN :
  558. bindstr:='Private extern';
  559. AB_LAZY :
  560. bindstr:='Lazy';
  561. AB_IMPORT :
  562. bindstr:='Import';
  563. else
  564. begin
  565. bindstr:='<Error !!>';
  566. has_errors:=true;
  567. end;
  568. end;
  569. case tasmsymtype(ppufile.getbyte) of
  570. AT_FUNCTION :
  571. typestr:='Function';
  572. AT_DATA :
  573. typestr:='Data';
  574. AT_SECTION :
  575. typestr:='Section';
  576. AT_LABEL :
  577. typestr:='Label';
  578. AT_ADDR :
  579. typestr:='Label (with address taken)';
  580. else
  581. begin
  582. typestr:='<Error !!>';
  583. has_errors:=true;
  584. end;
  585. end;
  586. Writeln(space,' ',i,' : ',s,' [',bindstr,',',typestr,']');
  587. inc(i);
  588. end;
  589. end;
  590. function getexprint:Tconstexprint;
  591. begin
  592. getexprint.overflow:=false;
  593. getexprint.signed:=boolean(ppufile.getbyte);
  594. getexprint.svalue:=ppufile.getint64;
  595. end;
  596. Procedure ReadPosInfo;
  597. var
  598. info : byte;
  599. fileindex,line,column : longint;
  600. begin
  601. with ppufile do
  602. begin
  603. {
  604. info byte layout in bits:
  605. 0-1 - amount of bytes for fileindex
  606. 2-3 - amount of bytes for line
  607. 4-5 - amount of bytes for column
  608. }
  609. info:=getbyte;
  610. case (info and $03) of
  611. 0 : fileindex:=getbyte;
  612. 1 : fileindex:=getword;
  613. 2 : fileindex:=(getbyte shl 16) or getword;
  614. 3 : fileindex:=getlongint;
  615. end;
  616. case ((info shr 2) and $03) of
  617. 0 : line:=getbyte;
  618. 1 : line:=getword;
  619. 2 : line:=(getbyte shl 16) or getword;
  620. 3 : line:=getlongint;
  621. end;
  622. case ((info shr 4) and $03) of
  623. 0 : column:=getbyte;
  624. 1 : column:=getword;
  625. 2 : column:=(getbyte shl 16) or getword;
  626. 3 : column:=getlongint;
  627. end;
  628. Writeln(fileindex,' (',line,',',column,')');
  629. end;
  630. end;
  631. procedure readderef(const derefspace: string);
  632. var
  633. b : tdereftype;
  634. first : boolean;
  635. idx : longint;
  636. i,n : byte;
  637. pdata : pbyte;
  638. begin
  639. if not assigned(derefdata) then
  640. exit;
  641. first:=true;
  642. idx:=ppufile.getlongint;
  643. if (idx>derefdatalen) then
  644. begin
  645. writeln('!! Error: Deref idx ',idx,' > ',derefdatalen);
  646. has_errors:=true;
  647. exit;
  648. end;
  649. write(derefspace,'(',idx,') ');
  650. pdata:=@derefdata[idx];
  651. i:=0;
  652. n:=pdata[i];
  653. inc(i);
  654. if n<1 then
  655. begin
  656. WriteError('!! Error: Deref len < 1');
  657. exit;
  658. end;
  659. while (i<=n) do
  660. begin
  661. if not first then
  662. write(', ')
  663. else
  664. first:=false;
  665. b:=tdereftype(pdata[i]);
  666. inc(i);
  667. case b of
  668. deref_nil :
  669. write('Nil');
  670. deref_symid :
  671. begin
  672. idx:=pdata[i] shl 24 or pdata[i+1] shl 16 or pdata[i+2] shl 8 or pdata[i+3];
  673. inc(i,4);
  674. write('SymId ',idx);
  675. end;
  676. deref_defid :
  677. begin
  678. idx:=pdata[i] shl 24 or pdata[i+1] shl 16 or pdata[i+2] shl 8 or pdata[i+3];
  679. inc(i,4);
  680. write('DefId ',idx);
  681. end;
  682. deref_unit :
  683. begin
  684. idx:=pdata[i] shl 8 or pdata[i+1];
  685. inc(i,2);
  686. write('Unit ',idx);
  687. end;
  688. else
  689. begin
  690. writeln('!! unsupported dereftyp: ',ord(b));
  691. has_errors:=true;
  692. break;
  693. end;
  694. end;
  695. end;
  696. writeln;
  697. end;
  698. procedure readpropaccesslist(const s:string);
  699. { type tsltype is in symconst unit }
  700. const
  701. slstr : array[tsltype] of string[12] = (
  702. '',
  703. 'load',
  704. 'call',
  705. 'subscript',
  706. 'vec',
  707. 'typeconv',
  708. 'absolutetype'
  709. );
  710. var
  711. sl : tsltype;
  712. begin
  713. readderef('');
  714. repeat
  715. sl:=tsltype(ppufile.getbyte);
  716. if sl=sl_none then
  717. break;
  718. write(s,'(',slstr[sl],') ');
  719. case sl of
  720. sl_call,
  721. sl_load,
  722. sl_subscript :
  723. readderef('');
  724. sl_absolutetype,
  725. sl_typeconv :
  726. readderef('');
  727. sl_vec :
  728. begin
  729. writeln(ppufile.getlongint);
  730. readderef('');
  731. end;
  732. end;
  733. until false;
  734. end;
  735. procedure readsymoptions(space : string);
  736. type
  737. tsymopt=record
  738. mask : tsymoption;
  739. str : string[30];
  740. end;
  741. const
  742. symopts=ord(high(tsymoption)) - ord(low(tsymoption));
  743. { sp_none = 0 corresponds to nothing }
  744. symopt : array[1..symopts] of tsymopt=(
  745. (mask:sp_static; str:'Static'),
  746. (mask:sp_hint_deprecated; str:'Hint Deprecated'),
  747. (mask:sp_hint_platform; str:'Hint Platform'),
  748. (mask:sp_hint_library; str:'Hint Library'),
  749. (mask:sp_hint_unimplemented; str:'Hint Unimplemented'),
  750. (mask:sp_hint_experimental; str:'Hint Experimental'),
  751. (mask:sp_has_overloaded; str:'Has overloaded'),
  752. (mask:sp_internal; str:'Internal'),
  753. (mask:sp_implicitrename; str:'Implicit Rename'),
  754. (mask:sp_generic_para; str:'Generic Parameter'),
  755. (mask:sp_has_deprecated_msg; str:'Has Deprecated Message')
  756. );
  757. var
  758. symoptions : tsymoptions;
  759. i : longint;
  760. first : boolean;
  761. begin
  762. ppufile.getsmallset(symoptions);
  763. if symoptions<>[] then
  764. begin
  765. first:=true;
  766. for i:=1to symopts do
  767. if (symopt[i].mask in symoptions) then
  768. begin
  769. if first then
  770. first:=false
  771. else
  772. write(', ');
  773. write(symopt[i].str);
  774. end;
  775. end;
  776. writeln;
  777. if sp_has_deprecated_msg in symoptions then
  778. writeln(space,'Deprecated : ', ppufile.getstring);
  779. end;
  780. procedure readcommonsym(const s:string);
  781. begin
  782. writeln(space,'** Symbol Id ',ppufile.getlongint,' **');
  783. writeln(space,s,ppufile.getstring);
  784. write (space,' File Pos : ');
  785. readposinfo;
  786. writeln(space,' Visibility : ',Visibility2Str(ppufile.getbyte));
  787. write (space,' SymOptions : ');
  788. readsymoptions(space+' ');
  789. end;
  790. var
  791. { needed during tobjectdef parsing... }
  792. current_defoptions : tdefoptions;
  793. current_objectoptions : tobjectoptions;
  794. procedure readcommondef(const s:string; out defoptions: tdefoptions);
  795. type
  796. tdefopt=record
  797. mask : tdefoption;
  798. str : string[30];
  799. end;
  800. tdefstateinfo=record
  801. mask : tdefstate;
  802. str : string[30];
  803. end;
  804. ptoken=^ttoken;
  805. pmsgstate =^tmsgstate;
  806. const
  807. defopt : array[1..ord(high(tdefoption))] of tdefopt=(
  808. (mask:df_unique; str:'Unique Type'),
  809. (mask:df_generic; str:'Generic'),
  810. (mask:df_specialization; str:'Specialization'),
  811. (mask:df_copied_def; str:'Copied Typedef')
  812. );
  813. defstate : array[1..ord(high(tdefstate))] of tdefstateinfo=(
  814. (mask:ds_vmt_written; str:'VMT Written'),
  815. (mask:ds_rtti_table_used; str:'RTTITable Used'),
  816. (mask:ds_init_table_used; str:'InitTable Used'),
  817. (mask:ds_rtti_table_written; str:'RTTITable Written'),
  818. (mask:ds_init_table_written; str:'InitTable Written'),
  819. (mask:ds_dwarf_dbg_info_used; str:'Dwarf DbgInfo Used'),
  820. (mask:ds_dwarf_dbg_info_written;str:'Dwarf DbgInfo Written')
  821. );
  822. var
  823. defstates : tdefstates;
  824. i, nb, msgvalue, mesgnb : longint;
  825. first : boolean;
  826. copy_size, min_size, tokenbufsize : longint;
  827. tokenbuf : pbyte;
  828. idtoken,
  829. token : ttoken;
  830. state : tmsgstate;
  831. new_settings : Tsettings;
  832. len : sizeint;
  833. wstring : widestring;
  834. astring : ansistring;
  835. function readtoken: ttoken;
  836. var
  837. b,b2 : byte;
  838. begin
  839. b:=tokenbuf[i];
  840. inc(i);
  841. if (b and $80)<>0 then
  842. begin
  843. b2:=tokenbuf[i];
  844. inc(i);
  845. result:=ttoken(((b and $7f) shl 8) or b2);
  846. end
  847. else
  848. result:=ttoken(b);
  849. end;
  850. function gettokenbufsizeint : int64;
  851. var
  852. var64 : int64;
  853. var32 : longint;
  854. var16 : smallint;
  855. begin
  856. if CpuAddrBitSize[cpu]=64 then
  857. begin
  858. var64:=pint64(@tokenbuf[i])^;
  859. inc(i,sizeof(int64));
  860. result:=var64;
  861. end
  862. else if CpuAddrBitSize[cpu]=32 then
  863. begin
  864. var32:=plongint(@tokenbuf[i])^;
  865. inc(i,sizeof(longint));
  866. result:=var32;
  867. end
  868. else if CpuAddrBitSize[cpu]=16 then
  869. begin
  870. var16:=psmallint(@tokenbuf[i])^;
  871. inc(i,sizeof(smallint));
  872. result:=var32;
  873. end
  874. else
  875. begin
  876. WriteError('Wrong CpuAddrBitSize');
  877. result:=0;
  878. end;
  879. end;
  880. begin
  881. writeln(space,'** Definition Id ',ppufile.getlongint,' **');
  882. writeln(space,s);
  883. write (space,' Type symbol : ');
  884. readderef('');
  885. write (space,' DefOptions : ');
  886. ppufile.getsmallset(defoptions);
  887. if defoptions<>[] then
  888. begin
  889. first:=true;
  890. for i:=1to high(defopt) do
  891. if (defopt[i].mask in defoptions) then
  892. begin
  893. if first then
  894. first:=false
  895. else
  896. write(', ');
  897. write(defopt[i].str);
  898. end;
  899. end;
  900. writeln;
  901. write (space,' DefStates : ');
  902. ppufile.getsmallset(defstates);
  903. if defstates<>[] then
  904. begin
  905. first:=true;
  906. for i:=1 to high(defstate) do
  907. if (defstate[i].mask in defstates) then
  908. begin
  909. if first then
  910. first:=false
  911. else
  912. write(', ');
  913. write(defstate[i].str);
  914. end;
  915. end;
  916. writeln;
  917. if df_generic in defoptions then
  918. begin
  919. tokenbufsize:=ppufile.getlongint;
  920. writeln(space,' Tokenbuffer size : ',tokenbufsize);
  921. tokenbuf:=allocmem(tokenbufsize);
  922. ppufile.getdata(tokenbuf^,tokenbufsize);
  923. i:=0;
  924. write(space,' Tokens: ');
  925. while i<tokenbufsize do
  926. begin
  927. token:=readtoken;
  928. if token<>_GENERICSPECIALTOKEN then
  929. begin
  930. if token <= high(ttoken) then
  931. write(arraytokeninfo[token].str)
  932. else
  933. begin
  934. HasMoreInfos;
  935. write('Error in Token List');
  936. break;
  937. end;
  938. idtoken:=readtoken;
  939. end;
  940. case token of
  941. _CWCHAR,
  942. _CWSTRING :
  943. begin
  944. len:=gettokenbufsizeint;
  945. setlength(wstring,len);
  946. move(tokenbuf[i],wstring[1],len*2);
  947. write(' ',wstring);
  948. inc(i,len*2);
  949. end;
  950. _CSTRING:
  951. begin
  952. len:=gettokenbufsizeint;
  953. setlength(astring,len);
  954. move(tokenbuf[i],astring[1],len);
  955. write(' ',astring);
  956. inc(i,len);
  957. end;
  958. _CCHAR,
  959. _INTCONST,
  960. _REALNUMBER :
  961. begin
  962. write(' ',pshortstring(@tokenbuf[i])^);
  963. inc(i,tokenbuf[i]+1);
  964. end;
  965. _ID :
  966. begin
  967. write(' ',pshortstring(@tokenbuf[i])^);
  968. inc(i,tokenbuf[i]+1);
  969. {
  970. replaytokenbuf.read(orgpattern[0],1);
  971. replaytokenbuf.read(orgpattern[1],length(orgpattern));
  972. pattern:=upper(orgpattern);
  973. }
  974. end;
  975. _GENERICSPECIALTOKEN:
  976. begin
  977. if (tokenbuf[i] and $80)<>0 then
  978. begin
  979. write('Col: ',tokenbuf[i] and $7f);
  980. inc(i);
  981. end
  982. else
  983. case tspecialgenerictoken(tokenbuf[i]) of
  984. ST_LOADSETTINGS:
  985. begin
  986. inc(i);
  987. write('Settings');
  988. { This does not load pmessage pointer }
  989. new_settings.pmessage:=nil;
  990. { TSettings size depends in target...
  991. We first read the size of the copied part }
  992. copy_size:=gettokenbufsizeint;
  993. if copy_size < sizeof(tsettings)-sizeof(pointer) then
  994. min_size:=copy_size
  995. else
  996. min_size:= sizeof(tsettings)-sizeof(pointer);
  997. move(tokenbuf[i],new_settings, min_size);
  998. inc(i,copy_size);
  999. end;
  1000. ST_LOADMESSAGES:
  1001. begin
  1002. inc(i);
  1003. write('Messages:');
  1004. mesgnb:=tokenbuf[i];
  1005. inc(i);
  1006. for nb:=1 to mesgnb do
  1007. begin
  1008. msgvalue:=gettokenbufsizeint;
  1009. inc(i,sizeof(sizeint));
  1010. state:=tmsgstate(gettokenbufsizeint);
  1011. end;
  1012. end;
  1013. ST_LINE:
  1014. begin
  1015. inc(i);
  1016. write('Line: ',pdword(@tokenbuf[i])^);
  1017. inc(i,4);
  1018. end;
  1019. ST_COLUMN:
  1020. begin
  1021. inc(i);
  1022. write('Col: ',pword(@tokenbuf[i])^);
  1023. inc(i,2);
  1024. end;
  1025. ST_FILEINDEX:
  1026. begin
  1027. inc(i);
  1028. write('File: ',pword(@tokenbuf[i])^);
  1029. inc(i,2);
  1030. end;
  1031. end;
  1032. {
  1033. replaytokenbuf.read(specialtoken,1);
  1034. case specialtoken of
  1035. ST_LOADSETTINGS:
  1036. begin
  1037. replaytokenbuf.read(current_settings,sizeof(current_settings));
  1038. end
  1039. else
  1040. internalerror(2006103010);
  1041. end;
  1042. continue;
  1043. }
  1044. end;
  1045. end;
  1046. if i<tokenbufsize then
  1047. write(',');
  1048. end;
  1049. writeln;
  1050. freemem(tokenbuf);
  1051. end;
  1052. if df_specialization in defoptions then
  1053. begin
  1054. write (space,' Orig. GenericDef : ');
  1055. readderef('');
  1056. end;
  1057. current_defoptions:=defoptions;
  1058. end;
  1059. { Read abstract procdef and return if inline procdef }
  1060. { type tproccalloption is in globtype unit }
  1061. { type tproctypeoption is in globtype unit }
  1062. { type tprocoption is in globtype unit }
  1063. procedure read_abstract_proc_def(var proccalloption:tproccalloption;var procoptions:tprocoptions);
  1064. type
  1065. tproccallopt=record
  1066. mask : tproccalloption;
  1067. str : string[30];
  1068. end;
  1069. tproctypeopt=record
  1070. mask : tproctypeoption;
  1071. str : string[30];
  1072. end;
  1073. tprocopt=record
  1074. mask : tprocoption;
  1075. str : string[30];
  1076. end;
  1077. const
  1078. {proccalloptionStr is also in globtype unit }
  1079. proctypeopt : array[1..ord(high(tproctypeoption))] of tproctypeopt=(
  1080. (mask:potype_proginit; str:'ProgInit'),
  1081. (mask:potype_unitinit; str:'UnitInit'),
  1082. (mask:potype_unitfinalize; str:'UnitFinalize'),
  1083. (mask:potype_constructor; str:'Constructor'),
  1084. (mask:potype_destructor; str:'Destructor'),
  1085. (mask:potype_operator; str:'Operator'),
  1086. (mask:potype_procedure; str:'Procedure'),
  1087. (mask:potype_function; str:'Function'),
  1088. (mask:potype_class_constructor; str:'Class Constructor'),
  1089. (mask:potype_class_destructor; str:'Class Destructor'),
  1090. { Dispinterface property accessors }
  1091. (mask:potype_propgetter; str:'Property Getter'),
  1092. (mask:potype_propsetter; str:'Property Setter')
  1093. );
  1094. procopt : array[1..ord(high(tprocoption))] of tprocopt=(
  1095. (mask:po_classmethod; str:'ClassMethod'),
  1096. (mask:po_virtualmethod; str:'VirtualMethod'),
  1097. (mask:po_abstractmethod; str:'AbstractMethod'),
  1098. (mask:po_finalmethod; str:'FinalMethod'),
  1099. (mask:po_staticmethod; str:'StaticMethod'),
  1100. (mask:po_overridingmethod;str:'OverridingMethod'),
  1101. (mask:po_methodpointer; str:'MethodPointer'),
  1102. (mask:po_interrupt; str:'Interrupt'),
  1103. (mask:po_iocheck; str:'IOCheck'),
  1104. (mask:po_assembler; str:'Assembler'),
  1105. (mask:po_msgstr; str:'MsgStr'),
  1106. (mask:po_msgint; str:'MsgInt'),
  1107. (mask:po_exports; str:'Exports'),
  1108. (mask:po_external; str:'External'),
  1109. (mask:po_overload; str:'Overload'),
  1110. (mask:po_varargs; str:'VarArgs'),
  1111. (mask:po_internconst; str:'InternConst'),
  1112. (mask:po_addressonly; str:'AddressOnly'),
  1113. (mask:po_public; str:'Public'),
  1114. (mask:po_hascallingconvention;str:'HasCallingConvention'),
  1115. (mask:po_reintroduce; str:'ReIntroduce'),
  1116. (mask:po_explicitparaloc; str:'ExplicitParaloc'),
  1117. (mask:po_nostackframe; str:'NoStackFrame'),
  1118. (mask:po_has_mangledname; str:'HasMangledName'),
  1119. (mask:po_has_public_name; str:'HasPublicName'),
  1120. (mask:po_forward; str:'Forward'),
  1121. (mask:po_global; str:'Global'),
  1122. (mask:po_has_inlininginfo;str:'HasInliningInfo'),
  1123. (mask:po_syscall_legacy; str:'SyscallLegacy'),
  1124. (mask:po_syscall_sysv; str:'SyscallSysV'),
  1125. (mask:po_syscall_basesysv;str:'SyscallBaseSysV'),
  1126. (mask:po_syscall_sysvbase;str:'SyscallSysVBase'),
  1127. (mask:po_syscall_r12base; str:'SyscallR12Base'),
  1128. (mask:po_inline; str:'Inline'),
  1129. (mask:po_compilerproc; str:'CompilerProc'),
  1130. (mask:po_has_importdll; str:'HasImportDLL'),
  1131. (mask:po_has_importname; str:'HasImportName'),
  1132. (mask:po_kylixlocal; str:'KylixLocal'),
  1133. (mask:po_dispid; str:'DispId'),
  1134. (mask:po_weakexternal; str:'WeakExternal'),
  1135. (mask:po_objc; str:'ObjC'),
  1136. (mask:po_enumerator_movenext; str:'EnumeratorMoveNext'),
  1137. (mask:po_optional; str: 'Optional'),
  1138. (mask:po_delphi_nested_cc;str: 'Delphi-style nested frameptr')
  1139. );
  1140. var
  1141. proctypeoption : tproctypeoption;
  1142. i : longint;
  1143. first : boolean;
  1144. tempbuf : array[0..255] of byte;
  1145. begin
  1146. write(space,' Return type : ');
  1147. readderef('');
  1148. writeln(space,' Fpu used : ',ppufile.getbyte);
  1149. proctypeoption:=tproctypeoption(ppufile.getbyte);
  1150. write(space,' TypeOption : ');
  1151. first:=true;
  1152. for i:=1 to high(proctypeopt) do
  1153. if (proctypeopt[i].mask=proctypeoption) then
  1154. begin
  1155. if first then
  1156. first:=false
  1157. else
  1158. write(', ');
  1159. write(proctypeopt[i].str);
  1160. end;
  1161. writeln;
  1162. proccalloption:=tproccalloption(ppufile.getbyte);
  1163. writeln(space,' CallOption : ',proccalloptionStr[proccalloption]);
  1164. ppufile.getnormalset(procoptions);
  1165. if procoptions<>[] then
  1166. begin
  1167. write(space,' Options : ');
  1168. first:=true;
  1169. for i:=1 to high(procopt) do
  1170. if (procopt[i].mask in procoptions) then
  1171. begin
  1172. if first then
  1173. first:=false
  1174. else
  1175. write(', ');
  1176. write(procopt[i].str);
  1177. end;
  1178. writeln;
  1179. end;
  1180. if (po_explicitparaloc in procoptions) then
  1181. begin
  1182. i:=ppufile.getbyte;
  1183. ppufile.getdata(tempbuf,i);
  1184. end;
  1185. end;
  1186. { type tvaroption is in unit symconst }
  1187. { register variable }
  1188. { type tvarregable is in unit symconst }
  1189. procedure readabstractvarsym(const s:string;var varoptions:tvaroptions);
  1190. type
  1191. tvaropt=record
  1192. mask : tvaroption;
  1193. str : string[30];
  1194. end;
  1195. const
  1196. varopt : array[1..ord(high(tvaroption))] of tvaropt=(
  1197. (mask:vo_is_external; str:'External'),
  1198. (mask:vo_is_dll_var; str:'DLLVar'),
  1199. (mask:vo_is_thread_var; str:'ThreadVar'),
  1200. (mask:vo_has_local_copy; str:'HasLocalCopy'),
  1201. (mask:vo_is_const; str:'Constant'),
  1202. (mask:vo_is_public; str:'Public'),
  1203. (mask:vo_is_high_para; str:'HighValue'),
  1204. (mask:vo_is_funcret; str:'Funcret'),
  1205. (mask:vo_is_self; str:'Self'),
  1206. (mask:vo_is_vmt; str:'VMT'),
  1207. (mask:vo_is_result; str:'Result'),
  1208. (mask:vo_is_parentfp; str:'ParentFP'),
  1209. (mask:vo_is_loop_counter; str:'LoopCounter'),
  1210. (mask:vo_is_hidden_para; str:'Hidden'),
  1211. (mask:vo_has_explicit_paraloc;str:'ExplicitParaloc'),
  1212. (mask:vo_is_syscall_lib; str:'SysCallLib'),
  1213. (mask:vo_has_mangledname; str:'HasMangledName'),
  1214. (mask:vo_is_typed_const; str:'TypedConst'),
  1215. (mask:vo_is_range_check; str:'RangeCheckSwitch'),
  1216. (mask:vo_is_overflow_check; str:'OverflowCheckSwitch'),
  1217. (mask:vo_is_typinfo_para; str:'TypeInfo'),
  1218. (mask:vo_is_msgsel;str:'MsgSel'),
  1219. (mask:vo_is_weak_external;str:'WeakExternal'),
  1220. (mask:vo_is_first_field;str:'IsFirstField'),
  1221. (mask:vo_volatile;str:'Volatile'),
  1222. (mask:vo_has_section;str:'HasSection'),
  1223. (mask:vo_force_finalize;str:'ForceFinalize')
  1224. );
  1225. var
  1226. i : longint;
  1227. first : boolean;
  1228. begin
  1229. readcommonsym(s);
  1230. writeln(space,' Spez : ',Varspez2Str(ppufile.getbyte));
  1231. writeln(space,' Regable : ',Varregable2Str(ppufile.getbyte));
  1232. writeln(space,' Addr Taken : ',(ppufile.getbyte<>0));
  1233. write (space,' Var Type : ');
  1234. readderef('');
  1235. ppufile.getsmallset(varoptions);
  1236. if varoptions<>[] then
  1237. begin
  1238. write(space,' Options : ');
  1239. first:=true;
  1240. for i:=1 to high(varopt) do
  1241. if (varopt[i].mask in varoptions) then
  1242. begin
  1243. if first then
  1244. first:=false
  1245. else
  1246. write(', ');
  1247. write(varopt[i].str);
  1248. if varopt[i].mask = vo_has_section then
  1249. writeln('Section name:',ppufile.getansistring);
  1250. end;
  1251. writeln;
  1252. end;
  1253. end;
  1254. procedure readobjectdefoptions;
  1255. type
  1256. tsymopt=record
  1257. mask : tobjectoption;
  1258. str : string[30];
  1259. end;
  1260. const
  1261. symopt : array[1..ord(high(tobjectoption))] of tsymopt=(
  1262. (mask:oo_is_forward; str:'IsForward'),
  1263. (mask:oo_is_abstract; str:'IsAbstract'),
  1264. (mask:oo_is_sealed; str:'IsSealed'),
  1265. (mask:oo_has_virtual; str:'HasVirtual'),
  1266. (mask:oo_has_private; str:'HasPrivate'),
  1267. (mask:oo_has_protected; str:'HasProtected'),
  1268. (mask:oo_has_strictprivate; str:'HasStrictPrivate'),
  1269. (mask:oo_has_strictprotected;str:'HasStrictProtected'),
  1270. (mask:oo_has_constructor; str:'HasConstructor'),
  1271. (mask:oo_has_destructor; str:'HasDestructor'),
  1272. (mask:oo_has_vmt; str:'HasVMT'),
  1273. (mask:oo_has_msgstr; str:'HasMsgStr'),
  1274. (mask:oo_has_msgint; str:'HasMsgInt'),
  1275. (mask:oo_can_have_published; str:'CanHavePublished'),
  1276. (mask:oo_has_default_property;str:'HasDefaultProperty'),
  1277. (mask:oo_has_valid_guid; str:'HasValidGUID'),
  1278. (mask:oo_has_enumerator_movenext; str:'HasEnumeratorMoveNext'),
  1279. (mask:oo_has_enumerator_current; str:'HasEnumeratorCurrent'),
  1280. (mask:oo_is_external; str:'External'),
  1281. (mask:oo_is_formal; str:'Formal'),
  1282. (mask:oo_is_classhelper; str:'Class Helper/Category'),
  1283. (mask:oo_has_class_constructor; str:'HasClassConstructor'),
  1284. (mask:oo_has_class_destructor; str:'HasClassDestructor')
  1285. );
  1286. var
  1287. i : longint;
  1288. first : boolean;
  1289. begin
  1290. ppufile.getsmallset(current_objectoptions);
  1291. if current_objectoptions<>[] then
  1292. begin
  1293. first:=true;
  1294. for i:=1 to high(symopt) do
  1295. if (symopt[i].mask in current_objectoptions) then
  1296. begin
  1297. if first then
  1298. first:=false
  1299. else
  1300. write(', ');
  1301. write(symopt[i].str);
  1302. end;
  1303. end;
  1304. writeln;
  1305. end;
  1306. procedure readarraydefoptions;
  1307. { type tarraydefoption is in unit symconst }
  1308. type
  1309. tsymopt=record
  1310. mask : tarraydefoption;
  1311. str : string[30];
  1312. end;
  1313. const
  1314. symopt : array[1..ord(high(tarraydefoption))] of tsymopt=(
  1315. (mask:ado_IsConvertedPointer;str:'ConvertedPointer'),
  1316. (mask:ado_IsDynamicArray; str:'IsDynamicArray'),
  1317. (mask:ado_IsVariant; str:'IsVariant'),
  1318. (mask:ado_IsConstructor; str:'IsConstructor'),
  1319. (mask:ado_IsArrayOfConst; str:'ArrayOfConst'),
  1320. (mask:ado_IsConstString; str:'ConstString'),
  1321. (mask:ado_IsBitPacked; str:'BitPacked')
  1322. );
  1323. var
  1324. symoptions : tarraydefoptions;
  1325. i : longint;
  1326. first : boolean;
  1327. begin
  1328. ppufile.getsmallset(symoptions);
  1329. if symoptions<>[] then
  1330. begin
  1331. first:=true;
  1332. for i:=1 to high(symopt) do
  1333. if (symopt[i].mask in symoptions) then
  1334. begin
  1335. if first then
  1336. first:=false
  1337. else
  1338. write(', ');
  1339. write(symopt[i].str);
  1340. end;
  1341. end;
  1342. writeln;
  1343. end;
  1344. procedure readnodetree;
  1345. var
  1346. l : longint;
  1347. p : pointer;
  1348. begin
  1349. with ppufile do
  1350. begin
  1351. if space<>'' then
  1352. Writeln(space,'------ nodetree ------');
  1353. if readentry=ibnodetree then
  1354. begin
  1355. l:=entrysize;
  1356. Writeln(space,'Tree size : ',l);
  1357. { Read data to prevent error that entry is not completly read }
  1358. getmem(p,l);
  1359. getdata(p^,l);
  1360. freemem(p);
  1361. end
  1362. else
  1363. begin
  1364. WriteError('!! ibnodetree not found');
  1365. end;
  1366. end;
  1367. end;
  1368. procedure ReadCreatedObjTypes;
  1369. var
  1370. i,j,
  1371. len,
  1372. bssize: longint;
  1373. bs: pbyte;
  1374. begin
  1375. if ppufile.readentry<>ibcreatedobjtypes then
  1376. begin
  1377. writeln('!! ibcreatedobjtypes entry not found');
  1378. ppufile.skipdata(ppufile.entrysize);
  1379. has_errors:=true;
  1380. exit
  1381. end;
  1382. writeln;
  1383. writeln(space,'WPO info');
  1384. writeln(space,'--------');
  1385. len:=ppufile.getlongint;
  1386. writeln(space,'** Instantiated Object/Class types: ',len,' **');
  1387. space:=space+' ';
  1388. for i:=0 to len-1 do
  1389. readderef(space);
  1390. setlength(space,length(space)-2);
  1391. len:=ppufile.getlongint;
  1392. writeln(space,'** Instantiated ClassRef types: ',len,' **');
  1393. space:=space+' ';
  1394. for i:=0 to len-1 do
  1395. readderef(space);
  1396. setlength(space,length(space)-2);
  1397. len:=ppufile.getlongint;
  1398. writeln(space,'** Possibly instantiated ClassRef types : ',len,' **');
  1399. space:=space+' ';
  1400. for i:=0 to len-1 do
  1401. readderef(space);
  1402. setlength(space,length(space)-2);
  1403. len:=ppufile.getlongint;
  1404. writeln(space,'** Class types with called virtual methods info : ',len,' **');
  1405. space:=space+' ';
  1406. for i:=0 to len-1 do
  1407. begin
  1408. write(space,'Class def : ');
  1409. readderef('');
  1410. write(space+' ','Called vmtentries : ');
  1411. bssize:=ppufile.getlongint;
  1412. getmem(bs,bssize);
  1413. ppufile.readdata(bs^,bssize);
  1414. for j:=0 to bssize*8-1 do
  1415. if (((bs+j shr 3)^ shr (j and 7)) and 1) <> 0 then
  1416. write(j,', ');
  1417. writeln;
  1418. freemem(bs);
  1419. end;
  1420. setlength(space,length(space)-2);
  1421. end;
  1422. {****************************************************************************
  1423. Read Symbols Part
  1424. ****************************************************************************}
  1425. procedure readsymbols(const s:string);
  1426. type
  1427. pguid = ^tguid;
  1428. tguid = packed record
  1429. D1: LongWord;
  1430. D2: Word;
  1431. D3: Word;
  1432. D4: array[0..7] of Byte;
  1433. end;
  1434. var
  1435. b : byte;
  1436. pc : pchar;
  1437. ch : dword;
  1438. startnewline : boolean;
  1439. i,j,len : longint;
  1440. guid : tguid;
  1441. realvalue : extended;
  1442. tempbuf : array[0..127] of char;
  1443. pw : pcompilerwidestring;
  1444. varoptions : tvaroptions;
  1445. begin
  1446. with ppufile do
  1447. begin
  1448. if space<>'' then
  1449. Writeln(space,'------ ',s,' ------');
  1450. if readentry=ibstartsyms then
  1451. begin
  1452. Writeln(space,'Symtable datasize : ',getlongint);
  1453. Writeln(space,'Symtable alignment: ',getlongint);
  1454. end
  1455. else
  1456. Writeln('!! ibstartsym not found');
  1457. repeat
  1458. b:=readentry;
  1459. case b of
  1460. ibunitsym :
  1461. readcommonsym('Unit symbol ');
  1462. ibnamespacesym :
  1463. begin
  1464. readcommonsym('NameSpace symbol ');
  1465. write(space,' Hidden Unit : ');
  1466. readderef('');
  1467. end;
  1468. iblabelsym :
  1469. readcommonsym('Label symbol ');
  1470. ibtypesym :
  1471. begin
  1472. readcommonsym('Type symbol ');
  1473. write(space,' Result Type : ');
  1474. readderef('');
  1475. write(space,' Pretty Name : ');
  1476. Write(getansistring);
  1477. end;
  1478. ibprocsym :
  1479. begin
  1480. readcommonsym('Procedure symbol ');
  1481. len:=ppufile.getword;
  1482. for i:=1 to len do
  1483. begin
  1484. write(space,' Definition : ');
  1485. readderef('');
  1486. end;
  1487. end;
  1488. ibconstsym :
  1489. begin
  1490. readcommonsym('Constant symbol ');
  1491. b:=getbyte;
  1492. case tconsttyp(b) of
  1493. constord :
  1494. begin
  1495. write (space,' OrdinalType : ');
  1496. readderef('');
  1497. writeln(space,' Value : ',constexp.tostr(getexprint));
  1498. end;
  1499. constpointer :
  1500. begin
  1501. write (space,' PointerType : ');
  1502. readderef('');
  1503. writeln(space,' Value : ',getaint)
  1504. end;
  1505. conststring,
  1506. constresourcestring :
  1507. begin
  1508. len:=getlongint;
  1509. getmem(pc,len+1);
  1510. getdata(pc^,len);
  1511. (pc+len)^:= #0;
  1512. writeln(space,' Length : ',len);
  1513. writeln(space,' Value : "',pc,'"');
  1514. freemem(pc,len+1);
  1515. end;
  1516. constreal :
  1517. begin
  1518. if entryleft=sizeof(extended) then
  1519. realvalue:=getrealsize(sizeof(extended))
  1520. else if entryleft=sizeof(double) then
  1521. realvalue:=getrealsize(sizeof(double))
  1522. else
  1523. begin
  1524. realvalue:=0.0;
  1525. has_errors:=true;
  1526. end;
  1527. writeln(space,' Value : ',realvalue);
  1528. end;
  1529. constset :
  1530. begin
  1531. write (space,' Set Type : ');
  1532. readderef('');
  1533. for i:=1to 4 do
  1534. begin
  1535. write (space,' Value : ');
  1536. for j:=1to 8 do
  1537. begin
  1538. if j>1 then
  1539. write(',');
  1540. write(hexstr(getbyte,2));
  1541. end;
  1542. writeln;
  1543. end;
  1544. end;
  1545. constnil:
  1546. writeln(space,' NIL pointer.');
  1547. constwstring :
  1548. begin
  1549. initwidestring(pw);
  1550. setlengthwidestring(pw,getlongint);
  1551. if widecharsize=2 then
  1552. { don't use getdata, because the compilerwidechars may have to
  1553. be byteswapped
  1554. }
  1555. begin
  1556. for i:=0 to pw^.len-1 do
  1557. pw^.data[i]:=ppufile.getword;
  1558. end
  1559. else if widecharsize=4 then
  1560. begin
  1561. for i:=0 to pw^.len-1 do
  1562. pw^.data[i]:=cardinal(ppufile.getlongint);
  1563. end
  1564. else
  1565. begin
  1566. WriteError('Unsupported tcompilerwidechar size');
  1567. end;
  1568. Writeln(space,'Wide string type');
  1569. startnewline:=true;
  1570. for i:=0 to pw^.len-1 do
  1571. begin
  1572. if startnewline then
  1573. begin
  1574. write(space);
  1575. startnewline:=false;
  1576. end;
  1577. ch:=pw^.data[i];
  1578. if widecharsize=2 then
  1579. write(hexstr(ch,4))
  1580. else
  1581. write(hexstr(ch,8));
  1582. if (i mod 8)= 0 then
  1583. startnewline:=true
  1584. else
  1585. write(', ');
  1586. end;
  1587. donewidestring(pw);
  1588. end;
  1589. constguid:
  1590. begin
  1591. getdata(guid,sizeof(guid));
  1592. write (space,' IID String: {',hexstr(guid.d1,8),'-',hexstr(guid.d2,4),'-',hexstr(guid.d3,4),'-');
  1593. for i:=0 to 7 do
  1594. begin
  1595. write(hexstr(guid.d4[i],2));
  1596. if i=1 then write('-');
  1597. end;
  1598. writeln('}');
  1599. end
  1600. else
  1601. Writeln ('!! Invalid unit format : Invalid const type encountered: ',b);
  1602. end;
  1603. end;
  1604. ibabsolutevarsym :
  1605. begin
  1606. readabstractvarsym('Absolute variable symbol ',varoptions);
  1607. Write (space,' Relocated to ');
  1608. b:=getbyte;
  1609. case absolutetyp(b) of
  1610. tovar :
  1611. readpropaccesslist(space+' Sym : ');
  1612. toasm :
  1613. Writeln('Assembler name : ',getstring);
  1614. toaddr :
  1615. begin
  1616. Write('Address : ',getlongint);
  1617. if tsystemcpu(ppufile.header.cpu)=cpu_i386 then
  1618. WriteLn(' (Far: ',getbyte<>0,')');
  1619. end;
  1620. else
  1621. Writeln ('!! Invalid unit format : Invalid absolute type encountered: ',b);
  1622. end;
  1623. end;
  1624. ibfieldvarsym :
  1625. begin
  1626. readabstractvarsym('Field Variable symbol ',varoptions);
  1627. writeln(space,' Address : ',getaint);
  1628. end;
  1629. ibstaticvarsym :
  1630. begin
  1631. readabstractvarsym('Global Variable symbol ',varoptions);
  1632. write (space,' DefaultConst : ');
  1633. readderef('');
  1634. if (vo_has_mangledname in varoptions) then
  1635. writeln(space,' Mangledname : ',getstring);
  1636. end;
  1637. iblocalvarsym :
  1638. begin
  1639. readabstractvarsym('Local Variable symbol ',varoptions);
  1640. write (space,' DefaultConst : ');
  1641. readderef('');
  1642. end;
  1643. ibparavarsym :
  1644. begin
  1645. readabstractvarsym('Parameter Variable symbol ',varoptions);
  1646. write (space,' DefaultConst : ');
  1647. readderef('');
  1648. writeln(space,' ParaNr : ',getword);
  1649. writeln(space,' Univ : ',boolean(getbyte));
  1650. writeln(space,' VarState : ',getbyte);
  1651. if (vo_has_explicit_paraloc in varoptions) then
  1652. begin
  1653. i:=getbyte;
  1654. getdata(tempbuf,i);
  1655. end;
  1656. end;
  1657. ibenumsym :
  1658. begin
  1659. readcommonsym('Enumeration symbol ');
  1660. write (space,' Definition : ');
  1661. readderef('');
  1662. writeln(space,' Value : ',getlongint);
  1663. end;
  1664. ibsyssym :
  1665. begin
  1666. readcommonsym('Internal system symbol ');
  1667. writeln(space,' Internal Nr : ',getlongint);
  1668. end;
  1669. ibmacrosym :
  1670. begin
  1671. readcommonsym('Macro symbol ');
  1672. writeln(space,' Name: ',getstring);
  1673. writeln(space,' Defined: ',getbyte);
  1674. writeln(space,' Compiler var: ',getbyte);
  1675. len:=getlongint;
  1676. writeln(space,' Value length: ',len);
  1677. if len > 0 then
  1678. begin
  1679. getmem(pc,len+1);
  1680. getdata(pc^,len);
  1681. (pc+len)^:= #0;
  1682. writeln(space,' Value: "',pc,'"');
  1683. freemem(pc,len+1);
  1684. end;
  1685. end;
  1686. ibpropertysym :
  1687. begin
  1688. readcommonsym('Property ');
  1689. i:=getlongint;
  1690. writeln(space,' PropOptions : ',i);
  1691. write (space,' OverrideProp : ');
  1692. readderef('');
  1693. write (space,' Prop Type : ');
  1694. readderef('');
  1695. writeln(space,' Index : ',getlongint);
  1696. writeln(space,' Default : ',getlongint);
  1697. write (space,' Index Type : ');
  1698. readderef('');
  1699. { palt_none }
  1700. readpropaccesslist('');
  1701. write (space,' Readaccess : ');
  1702. readpropaccesslist(space+' Sym: ');
  1703. write (space,' Writeaccess : ');
  1704. readpropaccesslist(space+' Sym: ');
  1705. write (space,' Storedaccess : ');
  1706. readpropaccesslist(space+' Sym: ');
  1707. end;
  1708. iberror :
  1709. begin
  1710. WriteError('!! Error in PPU');
  1711. exit;
  1712. end;
  1713. ibendsyms :
  1714. break;
  1715. else
  1716. begin
  1717. WriteLn('!! Skipping unsupported PPU Entry in Symbols: ',b);
  1718. has_errors:=true;
  1719. end;
  1720. end;
  1721. if not EndOfEntry then
  1722. HasMoreInfos;
  1723. until false;
  1724. end;
  1725. end;
  1726. {****************************************************************************
  1727. Read defintions Part
  1728. ****************************************************************************}
  1729. procedure readdefinitions(const s:string);
  1730. { type tordtype is in symconst unit }
  1731. {
  1732. uvoid,
  1733. u8bit,u16bit,u32bit,u64bit,
  1734. s8bit,s16bit,s32bit,s64bit,
  1735. bool8bit,bool16bit,bool32bit,bool64bit,
  1736. uchar,uwidechar,scurrency
  1737. ); }
  1738. { type tobjecttyp is in symconst unit }
  1739. { type tvarianttype is in symconst unit }
  1740. var
  1741. b : byte;
  1742. l,j : longint;
  1743. calloption : tproccalloption;
  1744. procoptions : tprocoptions;
  1745. procinfooptions : tprocinfoflag;
  1746. defoptions: tdefoptions;
  1747. begin
  1748. with ppufile do
  1749. begin
  1750. if space<>'' then
  1751. Writeln(space,'------ ',s,' ------');
  1752. if readentry<>ibstartdefs then
  1753. Writeln('!! ibstartdefs not found');
  1754. repeat
  1755. b:=readentry;
  1756. case b of
  1757. ibpointerdef :
  1758. begin
  1759. readcommondef('Pointer definition',defoptions);
  1760. write (space,' Pointed Type : ');
  1761. readderef('');
  1762. writeln(space,' Is Far : ',(getbyte<>0));
  1763. writeln(space,' Has Pointer Math : ',(getbyte<>0));
  1764. end;
  1765. iborddef :
  1766. begin
  1767. readcommondef('Ordinal definition',defoptions);
  1768. write (space,' Base type : ');
  1769. b:=getbyte;
  1770. case tordtype(b) of
  1771. uvoid : writeln('uvoid');
  1772. u8bit : writeln('u8bit');
  1773. u16bit : writeln('u16bit');
  1774. u32bit : writeln('s32bit');
  1775. u64bit : writeln('u64bit');
  1776. s8bit : writeln('s8bit');
  1777. s16bit : writeln('s16bit');
  1778. s32bit : writeln('s32bit');
  1779. s64bit : writeln('s64bit');
  1780. bool8bit : writeln('bool8bit');
  1781. bool16bit : writeln('bool16bit');
  1782. bool32bit : writeln('bool32bit');
  1783. bool64bit : writeln('bool64bit');
  1784. uchar : writeln('uchar');
  1785. uwidechar : writeln('uwidechar');
  1786. scurrency : writeln('ucurrency');
  1787. else writeln('!! Warning: Invalid base type ',b);
  1788. end;
  1789. writeln(space,' Range : ',constexp.tostr(getexprint),' to ',constexp.tostr(getexprint));
  1790. end;
  1791. ibfloatdef :
  1792. begin
  1793. readcommondef('Float definition',defoptions);
  1794. writeln(space,' Float type : ',getbyte);
  1795. end;
  1796. ibarraydef :
  1797. begin
  1798. readcommondef('Array definition',defoptions);
  1799. write (space,' Element type : ');
  1800. readderef('');
  1801. write (space,' Range Type : ');
  1802. readderef('');
  1803. writeln(space,' Range : ',getaint,' to ',getaint);
  1804. write (space,' Options : ');
  1805. readarraydefoptions;
  1806. readsymtableoptions('symbols');
  1807. readdefinitions('symbols');
  1808. readsymbols('symbols');
  1809. end;
  1810. ibprocdef :
  1811. begin
  1812. readcommondef('Procedure definition',defoptions);
  1813. read_abstract_proc_def(calloption,procoptions);
  1814. if (po_has_mangledname in procoptions) then
  1815. writeln(space,' Mangled name : ',getstring);
  1816. writeln(space,' Number : ',getword);
  1817. writeln(space,' Level : ',getbyte);
  1818. write (space,' Class : ');
  1819. readderef('');
  1820. write (space,' Procsym : ');
  1821. readderef('');
  1822. write (space,' File Pos : ');
  1823. readposinfo;
  1824. writeln(space,' Visibility : ',Visibility2Str(ppufile.getbyte));
  1825. write (space,' SymOptions : ');
  1826. readsymoptions(space+' ');
  1827. if tsystemcpu(ppufile.header.cpu)=cpu_powerpc then
  1828. begin
  1829. { library symbol for AmigaOS/MorphOS }
  1830. write (space,' Library symbol : ');
  1831. readderef('');
  1832. end;
  1833. if (po_has_importdll in procoptions) then
  1834. writeln(space,' Import DLL : ',getstring);
  1835. if (po_has_importname in procoptions) then
  1836. writeln(space,' Import Name : ',getstring);
  1837. writeln(space,' Import Nr : ',getword);
  1838. if (po_msgint in procoptions) then
  1839. writeln(space,' MsgInt : ',getlongint);
  1840. if (po_msgstr in procoptions) then
  1841. writeln(space,' MsgStr : ',getstring);
  1842. if (po_dispid in procoptions) then
  1843. writeln(space,' DispID: ',ppufile.getlongint);
  1844. if (po_has_inlininginfo in procoptions) then
  1845. begin
  1846. write (space,' FuncretSym : ');
  1847. readderef('');
  1848. ppufile.getsmallset(procinfooptions);
  1849. writeln(space,' ProcInfoOptions : ',dword(procinfooptions));
  1850. end;
  1851. b:=ppufile.getbyte;
  1852. if b<>0 then
  1853. begin
  1854. write (space,' Alias names : ');
  1855. for j:=1 to b do
  1856. begin
  1857. write(ppufile.getstring);
  1858. if j<b then
  1859. write(', ');
  1860. end;
  1861. writeln;
  1862. end;
  1863. if not EndOfEntry then
  1864. HasMoreInfos;
  1865. space:=' '+space;
  1866. { parast }
  1867. readsymtableoptions('parast');
  1868. readdefinitions('parast');
  1869. readsymbols('parast');
  1870. { localst }
  1871. if (po_has_inlininginfo in procoptions) then
  1872. begin
  1873. readsymtableoptions('localst');
  1874. readdefinitions('localst');
  1875. readsymbols('localst');
  1876. end;
  1877. if (po_has_inlininginfo in procoptions) then
  1878. readnodetree;
  1879. delete(space,1,4);
  1880. end;
  1881. ibprocvardef :
  1882. begin
  1883. readcommondef('Procedural type (ProcVar) definition',defoptions);
  1884. read_abstract_proc_def(calloption,procoptions);
  1885. writeln(space,' Symtable level :',ppufile.getbyte);
  1886. if not EndOfEntry then
  1887. HasMoreInfos;
  1888. space:=' '+space;
  1889. { parast }
  1890. readsymtableoptions('parast');
  1891. readdefinitions('parast');
  1892. readsymbols('parast');
  1893. delete(space,1,4);
  1894. end;
  1895. ibshortstringdef :
  1896. begin
  1897. readcommondef('ShortString definition',defoptions);
  1898. writeln(space,' Length : ',getbyte);
  1899. end;
  1900. ibwidestringdef :
  1901. begin
  1902. readcommondef('WideString definition',defoptions);
  1903. writeln(space,' Length : ',getaint);
  1904. end;
  1905. ibunicodestringdef :
  1906. begin
  1907. readcommondef('UnicodeString definition',defoptions);
  1908. writeln(space,' Length : ',getaint);
  1909. end;
  1910. ibansistringdef :
  1911. begin
  1912. readcommondef('AnsiString definition',defoptions);
  1913. writeln(space,' Length : ',getaint);
  1914. end;
  1915. iblongstringdef :
  1916. begin
  1917. readcommondef('Longstring definition',defoptions);
  1918. writeln(space,' Length : ',getaint);
  1919. end;
  1920. ibrecorddef :
  1921. begin
  1922. readcommondef('Record definition',defoptions);
  1923. writeln(space,' Name of Record : ',getstring);
  1924. write (space,' Options : ');
  1925. readobjectdefoptions;
  1926. writeln(space,' FieldAlign : ',shortint(getbyte));
  1927. writeln(space,' RecordAlign : ',shortint(getbyte));
  1928. writeln(space,' PadAlign : ',shortint(getbyte));
  1929. writeln(space,'UseFieldAlignment : ',shortint(getbyte));
  1930. writeln(space,' DataSize : ',getasizeint);
  1931. writeln(space,' PaddingSize : ',getword);
  1932. if not EndOfEntry then
  1933. HasMoreInfos;
  1934. {read the record definitions and symbols}
  1935. space:=' '+space;
  1936. readrecsymtableoptions;
  1937. readsymtableoptions('fields');
  1938. readdefinitions('fields');
  1939. readsymbols('fields');
  1940. Delete(space,1,4);
  1941. end;
  1942. ibobjectdef :
  1943. begin
  1944. readcommondef('Object/Class definition',defoptions);
  1945. writeln(space,' Name of Class : ',getstring);
  1946. write (space,' Options : ');
  1947. readobjectdefoptions;
  1948. b:=getbyte;
  1949. write (space,' Type : ');
  1950. case tobjecttyp(b) of
  1951. odt_class : writeln('class');
  1952. odt_object : writeln('object');
  1953. odt_interfacecom : writeln('interfacecom');
  1954. odt_interfacecorba : writeln('interfacecorba');
  1955. odt_cppclass : writeln('cppclass');
  1956. odt_dispinterface : writeln('dispinterface');
  1957. odt_objcclass : writeln('objcclass');
  1958. odt_objcprotocol : writeln('objcprotocol');
  1959. odt_helper : writeln('helper');
  1960. else writeln('!! Warning: Invalid object type ',b);
  1961. end;
  1962. writeln(space,' External name : ',getstring);
  1963. writeln(space,' Import lib : ',getstring);
  1964. writeln(space,' DataSize : ',getasizeint);
  1965. writeln(space,' PaddingSize : ',getword);
  1966. writeln(space,' FieldAlign : ',shortint(getbyte));
  1967. writeln(space,' RecordAlign : ',shortint(getbyte));
  1968. writeln(space,' Vmt offset : ',getlongint);
  1969. write (space, ' Ancestor Class : ');
  1970. readderef('');
  1971. if tobjecttyp(b) in [odt_interfacecom,odt_interfacecorba,odt_dispinterface] then
  1972. begin
  1973. { IIDGUID }
  1974. for j:=1to 16 do
  1975. getbyte;
  1976. writeln(space,' IID String : ',getstring);
  1977. end;
  1978. if (tobjecttyp(b)=odt_helper) or
  1979. (oo_is_classhelper in current_objectoptions) then
  1980. begin
  1981. write(space,' Helper parent : ');
  1982. readderef('');
  1983. end;
  1984. l:=getlongint;
  1985. writeln(space,' VMT entries: ',l);
  1986. for j:=1 to l do
  1987. begin
  1988. write(space,' ');
  1989. readderef('');
  1990. writeln(space,' Visibility: ',Visibility2Str(getbyte));
  1991. end;
  1992. if tobjecttyp(b) in [odt_class,odt_interfacecorba,odt_objcclass,odt_objcprotocol] then
  1993. begin
  1994. l:=getlongint;
  1995. writeln(space,' Impl Intf Count : ',l);
  1996. for j:=1 to l do
  1997. begin
  1998. write (space,' - Definition : ');
  1999. readderef('');
  2000. writeln(space,' IOffset : ',getlongint);
  2001. end;
  2002. end;
  2003. if df_copied_def in current_defoptions then
  2004. begin
  2005. writeln(' Copy of def: ');
  2006. readderef('');
  2007. end;
  2008. if not EndOfEntry then
  2009. HasMoreInfos;
  2010. if not(df_copied_def in current_defoptions) then
  2011. begin
  2012. {read the record definitions and symbols}
  2013. space:=' '+space;
  2014. readrecsymtableoptions;
  2015. readsymtableoptions('fields');
  2016. readdefinitions('fields');
  2017. readsymbols('fields');
  2018. Delete(space,1,4);
  2019. end;
  2020. end;
  2021. ibfiledef :
  2022. begin
  2023. ReadCommonDef('File definition',defoptions);
  2024. write (space,' Type : ');
  2025. case getbyte of
  2026. 0 : writeln('Text');
  2027. 1 : begin
  2028. writeln('Typed');
  2029. write (space,' File of Type : ');
  2030. readderef('');
  2031. end;
  2032. 2 : writeln('Untyped');
  2033. end;
  2034. end;
  2035. ibformaldef :
  2036. begin
  2037. readcommondef('Generic definition (void-typ)',defoptions);
  2038. writeln(space,' Is Typed : ',(getbyte<>0));
  2039. end;
  2040. ibundefineddef :
  2041. readcommondef('Undefined definition (generic parameter)',defoptions);
  2042. ibenumdef :
  2043. begin
  2044. readcommondef('Enumeration type definition',defoptions);
  2045. writeln(space,' Smallest element : ',getaint);
  2046. writeln(space,' Largest element : ',getaint);
  2047. writeln(space,' Size : ',getaint);
  2048. if df_copied_def in defoptions then
  2049. begin
  2050. write(space,'Base enumeration type : ');
  2051. readderef('');
  2052. end
  2053. else
  2054. begin
  2055. space:=' '+space;
  2056. readsymtableoptions('elements');
  2057. readdefinitions('elements');
  2058. readsymbols('elements');
  2059. delete(space,1,4);
  2060. end;
  2061. end;
  2062. ibclassrefdef :
  2063. begin
  2064. readcommondef('Class reference definition',defoptions);
  2065. write (space,' Pointed Type : ');
  2066. readderef('');
  2067. end;
  2068. ibsetdef :
  2069. begin
  2070. readcommondef('Set definition',defoptions);
  2071. write (space,' Element type : ');
  2072. readderef('');
  2073. writeln(space,' Size : ',getaint);
  2074. writeln(space,' Set Base : ',getaint);
  2075. writeln(space,' Set Max : ',getaint);
  2076. end;
  2077. ibvariantdef :
  2078. begin
  2079. readcommondef('Variant definition',defoptions);
  2080. write (space,' Varianttype : ');
  2081. b:=getbyte;
  2082. case tvarianttype(b) of
  2083. vt_normalvariant :
  2084. writeln('Normal');
  2085. vt_olevariant :
  2086. writeln('OLE');
  2087. else
  2088. writeln('!! Warning: Invalid varianttype ',b);
  2089. end;
  2090. end;
  2091. iberror :
  2092. begin
  2093. WriteError('!! Error in PPU');
  2094. exit;
  2095. end;
  2096. ibenddefs :
  2097. break;
  2098. else
  2099. begin
  2100. WriteLn('!! Skipping unsupported PPU Entry in definitions: ',b);
  2101. has_errors:=true;
  2102. end;
  2103. end;
  2104. if not EndOfEntry then
  2105. HasMoreInfos;
  2106. until false;
  2107. end;
  2108. end;
  2109. procedure readmoduleoptions(space : string);
  2110. type
  2111. { tmoduleoption type is in unit fmodule }
  2112. tmoduleoption = (mo_none,
  2113. mo_hint_deprecated,
  2114. mo_hint_platform,
  2115. mo_hint_library,
  2116. mo_hint_unimplemented,
  2117. mo_hint_experimental,
  2118. mo_has_deprecated_msg
  2119. );
  2120. tmoduleoptions = set of tmoduleoption;
  2121. tmoduleopt=record
  2122. mask : tmoduleoption;
  2123. str : string[30];
  2124. end;
  2125. const
  2126. moduleopts=ord(high(tmoduleoption));
  2127. moduleopt : array[1..moduleopts] of tmoduleopt=(
  2128. (mask:mo_hint_deprecated; str:'Hint Deprecated'),
  2129. (mask:mo_hint_platform; str:'Hint Platform'),
  2130. (mask:mo_hint_library; str:'Hint Library'),
  2131. (mask:mo_hint_unimplemented; str:'Hint Unimplemented'),
  2132. (mask:mo_hint_experimental; str:'Hint Experimental'),
  2133. (mask:mo_has_deprecated_msg; str:'Has Deprecated Message')
  2134. );
  2135. var
  2136. moduleoptions : tmoduleoptions;
  2137. i : longint;
  2138. first : boolean;
  2139. begin
  2140. ppufile.getsmallset(moduleoptions);
  2141. if moduleoptions<>[] then
  2142. begin
  2143. first:=true;
  2144. for i:=1to moduleopts do
  2145. if (moduleopt[i].mask in moduleoptions) then
  2146. begin
  2147. if first then
  2148. first:=false
  2149. else
  2150. write(', ');
  2151. write(moduleopt[i].str);
  2152. end;
  2153. end;
  2154. writeln;
  2155. if mo_has_deprecated_msg in moduleoptions then
  2156. writeln(space,'Deprecated : ', ppufile.getstring);
  2157. end;
  2158. {****************************************************************************
  2159. Read General Part
  2160. ****************************************************************************}
  2161. procedure readinterface;
  2162. var
  2163. b : byte;
  2164. sourcenumber : longint;
  2165. begin
  2166. with ppufile do
  2167. begin
  2168. repeat
  2169. b:=readentry;
  2170. case b of
  2171. ibmodulename :
  2172. Writeln('Module Name: ',getstring);
  2173. ibmoduleoptions:
  2174. readmoduleoptions(' ');
  2175. ibsourcefiles :
  2176. begin
  2177. sourcenumber:=1;
  2178. while not EndOfEntry do
  2179. begin
  2180. Writeln('Source file ',sourcenumber,' : ',getstring,' ',filetimestring(getlongint));
  2181. inc(sourcenumber);
  2182. end;
  2183. end;
  2184. {$IFDEF MACRO_DIFF_HINT}
  2185. ibusedmacros :
  2186. begin
  2187. while not EndOfEntry do
  2188. begin
  2189. Write('Conditional ',getstring);
  2190. b:=getbyte;
  2191. if boolean(b)=true then
  2192. write(' defined at startup')
  2193. else
  2194. write(' not defined at startup');
  2195. b:=getbyte;
  2196. if boolean(b)=true then
  2197. writeln(' was used')
  2198. else
  2199. writeln;
  2200. end;
  2201. end;
  2202. {$ENDIF}
  2203. ibloadunit :
  2204. ReadLoadUnit;
  2205. iblinkunitofiles :
  2206. ReadLinkContainer('Link unit object file: ');
  2207. iblinkunitstaticlibs :
  2208. ReadLinkContainer('Link unit static lib: ');
  2209. iblinkunitsharedlibs :
  2210. ReadLinkContainer('Link unit shared lib: ');
  2211. iblinkotherofiles :
  2212. ReadLinkContainer('Link other object file: ');
  2213. iblinkotherstaticlibs :
  2214. ReadLinkContainer('Link other static lib: ');
  2215. iblinkothersharedlibs :
  2216. ReadLinkContainer('Link other shared lib: ');
  2217. iblinkotherframeworks:
  2218. ReadLinkContainer('Link framework: ');
  2219. ibmainname:
  2220. Writeln('Specified main program symbol name: ',getstring);
  2221. ibImportSymbols :
  2222. ReadImportSymbols;
  2223. ibderefdata :
  2224. ReadDerefData;
  2225. ibderefmap :
  2226. ReadDerefMap;
  2227. ibwpofile :
  2228. ReadWpoFileInfo;
  2229. ibresources :
  2230. ReadLinkContainer('Resource file: ');
  2231. iberror :
  2232. begin
  2233. WriteError('Error in PPU');
  2234. exit;
  2235. end;
  2236. ibendinterface :
  2237. break;
  2238. else
  2239. begin
  2240. WriteLn('!! Skipping unsupported PPU Entry in General Part: ',b);
  2241. has_errors:=true;
  2242. end;
  2243. end;
  2244. until false;
  2245. end;
  2246. end;
  2247. {****************************************************************************
  2248. Read Implementation Part
  2249. ****************************************************************************}
  2250. procedure readimplementation;
  2251. var
  2252. b : byte;
  2253. begin
  2254. with ppufile do
  2255. begin
  2256. repeat
  2257. b:=readentry;
  2258. case b of
  2259. ibasmsymbols :
  2260. ReadAsmSymbols;
  2261. ibloadunit :
  2262. ReadLoadUnit;
  2263. iberror :
  2264. begin
  2265. WriteError('Error in PPU');
  2266. exit;
  2267. end;
  2268. ibendimplementation :
  2269. break;
  2270. else
  2271. begin
  2272. WriteLn('!! Skipping unsupported PPU Entry in Implementation: ',b);
  2273. has_errors:=true;
  2274. end;
  2275. end;
  2276. until false;
  2277. end;
  2278. end;
  2279. procedure dofile (filename : string);
  2280. begin
  2281. { reset }
  2282. space:='';
  2283. { fix filename }
  2284. if pos('.',filename)=0 then
  2285. filename:=filename+'.ppu';
  2286. ppufile:=tppufile.create(filename);
  2287. if not ppufile.openfile then
  2288. begin
  2289. WriteError('IO-Error when opening : '+filename+', Skipping');
  2290. exit;
  2291. end;
  2292. { PPU File is open, check for PPU Id }
  2293. if not ppufile.CheckPPUID then
  2294. begin
  2295. writeln(Filename,' : Not a valid PPU file, Skipping');
  2296. has_errors:=true;
  2297. exit;
  2298. end;
  2299. { Check PPU Version }
  2300. ppuversion:=ppufile.GetPPUVersion;
  2301. Writeln('Analyzing ',filename,' (v',PPUVersion,')');
  2302. if PPUVersion<16 then
  2303. begin
  2304. writeln(Filename,' : Old PPU Formats (<v16) are not supported, Skipping');
  2305. has_errors:=true;
  2306. exit;
  2307. end;
  2308. { Write PPU Header Information }
  2309. if (verbose and v_header)<>0 then
  2310. begin
  2311. Writeln;
  2312. Writeln('Header');
  2313. Writeln('-------');
  2314. with ppufile.header do
  2315. begin
  2316. Writeln('Compiler version : ',ppufile.header.compiler shr 14,'.',
  2317. (ppufile.header.compiler shr 7) and $7f,'.',
  2318. ppufile.header.compiler and $7f);
  2319. WriteLn('Target processor : ',Cpu2Str(cpu));
  2320. WriteLn('Target operating system : ',Target2Str(target));
  2321. Writeln('Unit flags : ',PPUFlags2Str(flags));
  2322. Writeln('FileSize (w/o header) : ',size);
  2323. Writeln('Checksum : ',hexstr(checksum,8));
  2324. Writeln('Interface Checksum : ',hexstr(interface_checksum,8));
  2325. Writeln('Indirect Checksum : ',hexstr(indirect_checksum,8));
  2326. Writeln('Definitions stored : ',tostr(deflistsize));
  2327. Writeln('Symbols stored : ',tostr(symlistsize));
  2328. end;
  2329. end;
  2330. {read the general stuff}
  2331. if (verbose and v_interface)<>0 then
  2332. begin
  2333. Writeln;
  2334. Writeln('Interface section');
  2335. Writeln('------------------');
  2336. readinterface;
  2337. end
  2338. else
  2339. ppufile.skipuntilentry(ibendinterface);
  2340. Writeln;
  2341. Writeln('Interface symtable');
  2342. Writeln('----------------------');
  2343. readsymtableoptions('interface');
  2344. {read the definitions}
  2345. if (verbose and v_defs)<>0 then
  2346. begin
  2347. Writeln;
  2348. Writeln('Interface definitions');
  2349. Writeln('----------------------');
  2350. readdefinitions('interface');
  2351. end
  2352. else
  2353. ppufile.skipuntilentry(ibenddefs);
  2354. {read the symbols}
  2355. if (verbose and v_syms)<>0 then
  2356. begin
  2357. Writeln;
  2358. Writeln('Interface Symbols');
  2359. Writeln('------------------');
  2360. readsymbols('interface');
  2361. end
  2362. else
  2363. ppufile.skipuntilentry(ibendsyms);
  2364. {read the macro symbols}
  2365. if (verbose and v_syms)<>0 then
  2366. begin
  2367. Writeln;
  2368. Writeln('Interface Macro Symbols');
  2369. Writeln('-----------------------');
  2370. end;
  2371. if ppufile.readentry<>ibexportedmacros then
  2372. begin
  2373. WriteError('!! Error in PPU');
  2374. exit;
  2375. end;
  2376. if boolean(ppufile.getbyte) then
  2377. begin
  2378. readsymtableoptions('interface macro');
  2379. {skip the definition section for macros (since they are never used) }
  2380. ppufile.skipuntilentry(ibenddefs);
  2381. {read the macro symbols}
  2382. if (verbose and v_syms)<>0 then
  2383. readsymbols('interface macro')
  2384. else
  2385. ppufile.skipuntilentry(ibendsyms);
  2386. end
  2387. else
  2388. Writeln('(no exported macros)');
  2389. {read the implementation stuff}
  2390. if (verbose and v_implementation)<>0 then
  2391. begin
  2392. Writeln;
  2393. Writeln('Implementation section');
  2394. Writeln('-----------------------');
  2395. readimplementation;
  2396. end
  2397. else
  2398. ppufile.skipuntilentry(ibendimplementation);
  2399. {read the static symtable}
  2400. Writeln;
  2401. Writeln('Implementation symtable');
  2402. Writeln('----------------------');
  2403. readsymtableoptions('implementation');
  2404. if (ppufile.header.flags and uf_local_symtable)<>0 then
  2405. begin
  2406. if (verbose and v_defs)<>0 then
  2407. begin
  2408. Writeln;
  2409. Writeln('Static definitions');
  2410. Writeln('----------------------');
  2411. readdefinitions('implementation');
  2412. end
  2413. else
  2414. ppufile.skipuntilentry(ibenddefs);
  2415. {read the symbols}
  2416. if (verbose and v_syms)<>0 then
  2417. begin
  2418. Writeln;
  2419. Writeln('Static Symbols');
  2420. Writeln('------------------');
  2421. readsymbols('implementation');
  2422. end
  2423. else
  2424. ppufile.skipuntilentry(ibendsyms);
  2425. end;
  2426. ReadCreatedObjTypes;
  2427. FreeDerefdata;
  2428. {shutdown ppufile}
  2429. ppufile.closefile;
  2430. ppufile.free;
  2431. Writeln;
  2432. end;
  2433. procedure help;
  2434. begin
  2435. writeln('usage: ppudump [options] <filename1> <filename2>...');
  2436. writeln;
  2437. writeln('[options] can be:');
  2438. writeln(' -M Exit with ExitCode=2 if more information is available');
  2439. writeln(' -V<verbose> Set verbosity to <verbose>');
  2440. writeln(' H - Show header info');
  2441. writeln(' I - Show interface');
  2442. writeln(' M - Show implementation');
  2443. writeln(' S - Show interface symbols');
  2444. writeln(' D - Show interface definitions');
  2445. // writeln(' B - Show browser info');
  2446. writeln(' A - Show all');
  2447. writeln(' -h, -? This helpscreen');
  2448. halt;
  2449. end;
  2450. var
  2451. startpara,
  2452. nrfile,i : longint;
  2453. para : string;
  2454. const
  2455. error_on_more : boolean = false;
  2456. begin
  2457. writeln(Title+' '+Version);
  2458. writeln(Copyright);
  2459. writeln;
  2460. if paramcount<1 then
  2461. begin
  2462. writeln('usage: dumpppu [options] <filename1> <filename2>...');
  2463. halt(1);
  2464. end;
  2465. { turn verbose on by default }
  2466. verbose:=v_all;
  2467. { read options }
  2468. startpara:=1;
  2469. while copy(paramstr(startpara),1,1)='-' do
  2470. begin
  2471. para:=paramstr(startpara);
  2472. case upcase(para[2]) of
  2473. 'M' : error_on_more:=true;
  2474. 'V' : begin
  2475. verbose:=0;
  2476. for i:=3 to length(para) do
  2477. case upcase(para[i]) of
  2478. 'H' : verbose:=verbose or v_header;
  2479. 'I' : verbose:=verbose or v_interface;
  2480. 'M' : verbose:=verbose or v_implementation;
  2481. 'D' : verbose:=verbose or v_defs;
  2482. 'S' : verbose:=verbose or v_syms;
  2483. 'A' : verbose:=verbose or v_all;
  2484. end;
  2485. end;
  2486. 'H' : help;
  2487. '?' : help;
  2488. end;
  2489. inc(startpara);
  2490. end;
  2491. { process files }
  2492. for nrfile:=startpara to paramcount do
  2493. dofile (paramstr(nrfile));
  2494. if has_errors then
  2495. Halt(1);
  2496. if error_on_more and has_more_infos then
  2497. Halt(2);
  2498. end.