ppudump.pp 60 KB

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