symsym.inc 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl, Pierre Muller
  4. Implementation for the symbols types of the symtable
  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. }
  18. {****************************************************************************
  19. TSYM (base for all symtypes)
  20. ****************************************************************************}
  21. constructor tsym.init(const n : string);
  22. begin
  23. left:=nil;
  24. right:=nil;
  25. setname(n);
  26. typ:=abstractsym;
  27. properties:=current_object_option;
  28. {$ifdef GDB}
  29. isstabwritten := false;
  30. {$endif GDB}
  31. fileinfo:=aktfilepos;
  32. {$ifdef UseBrowser}
  33. defref:=nil;
  34. lastwritten:=nil;
  35. refcount:=0;
  36. if (cs_browser in aktmoduleswitches) and make_ref then
  37. begin
  38. defref:=new(pref,init(defref,@tokenpos));
  39. inc(refcount);
  40. end;
  41. lastref:=defref;
  42. {$endif UseBrowser}
  43. end;
  44. constructor tsym.load;
  45. begin
  46. left:=nil;
  47. right:=nil;
  48. setname(readstring);
  49. typ:=abstractsym;
  50. fillchar(fileinfo,sizeof(fileinfo),0);
  51. if object_options then
  52. properties:=symprop(readbyte)
  53. else
  54. properties:=sp_public;
  55. {$ifdef UseBrowser}
  56. lastref:=nil;
  57. defref:=nil;
  58. lastwritten:=nil;
  59. refcount:=0;
  60. {$endif UseBrowser}
  61. {$ifdef GDB}
  62. isstabwritten := false;
  63. {$endif GDB}
  64. end;
  65. {$ifdef UseBrowser}
  66. procedure tsym.load_references;
  67. var
  68. pos : tfileposinfo;
  69. begin
  70. while (not current_ppu^.endofentry) do
  71. begin
  72. readposinfo(pos);
  73. inc(refcount);
  74. lastref:=new(pref,init(lastref,@pos));
  75. if refcount=1 then
  76. defref:=lastref;
  77. end;
  78. lastwritten:=lastref;
  79. end;
  80. procedure tsym.write_references;
  81. var
  82. ref : pref;
  83. prdef : pdef;
  84. begin
  85. if lastwritten=lastref then
  86. exit;
  87. { write address to this symbol }
  88. writesymref(@self);
  89. { write symbol refs }
  90. if assigned(lastwritten) then
  91. ref:=lastwritten
  92. else
  93. ref:=defref;
  94. while assigned(ref) do
  95. begin
  96. writeposinfo(ref^.posinfo);
  97. ref:=ref^.nextref;
  98. end;
  99. lastwritten:=lastref;
  100. current_ppu^.writeentry(ibsymref);
  101. { when it's a procsym then write also the refs to the definition
  102. due the overloading }
  103. if typ=procsym then
  104. begin
  105. prdef:=pprocsym(@self)^.definition;
  106. while assigned(prdef) do
  107. begin
  108. pprocdef(prdef)^.write_references;
  109. prdef:=pprocdef(prdef)^.nextoverloaded;
  110. end;
  111. end;
  112. end;
  113. procedure tsym.add_to_browserlog;
  114. var
  115. prdef : pprocdef;
  116. begin
  117. if assigned(defref) then
  118. begin
  119. Browse.AddLog('***'+name+'***');
  120. Browse.AddLogRefs(defref);
  121. end;
  122. { when it's a procsym then write also the refs to the definition
  123. due the overloading }
  124. if typ=procsym then
  125. begin
  126. prdef:=pprocsym(@self)^.definition;
  127. while assigned(prdef) do
  128. begin
  129. pprocdef(prdef)^.add_to_browserlog;
  130. prdef:=pprocdef(prdef)^.nextoverloaded;
  131. end;
  132. end;
  133. end;
  134. {$endif UseBrowser}
  135. destructor tsym.done;
  136. begin
  137. {$ifdef tp}
  138. if not(use_big) then
  139. {$endif tp}
  140. strdispose(_name);
  141. {$ifdef UseBrowser}
  142. if assigned(defref) then
  143. dispose(defref,done);
  144. {$endif UseBrowser}
  145. if assigned(left) then
  146. dispose(left,done);
  147. if assigned(right) then
  148. dispose(right,done);
  149. end;
  150. destructor tsym.single_done;
  151. begin
  152. {$ifdef tp}
  153. if not(use_big) then
  154. {$endif tp}
  155. strdispose(_name);
  156. end;
  157. procedure tsym.write;
  158. begin
  159. writestring(name);
  160. if object_options then
  161. writebyte(byte(properties));
  162. {$ifdef UseBrowser}
  163. { if cs_browser in aktmoduleswitches then
  164. write_references; }
  165. {$endif UseBrowser}
  166. end;
  167. procedure tsym.deref;
  168. begin
  169. end;
  170. function tsym.name : string;
  171. {$ifdef tp}
  172. var
  173. s : string;
  174. b : byte;
  175. {$endif}
  176. begin
  177. {$ifdef tp}
  178. if use_big then
  179. begin
  180. symbolstream.seek(longint(_name));
  181. symbolstream.read(b,1);
  182. symbolstream.read(s[1],b);
  183. s[0]:=chr(b);
  184. name:=s;
  185. end
  186. else
  187. {$endif}
  188. if assigned(_name) then
  189. name:=strpas(_name)
  190. else
  191. name:='';
  192. end;
  193. function tsym.mangledname : string;
  194. begin
  195. mangledname:=name;
  196. end;
  197. procedure tsym.setname(const s : string);
  198. begin
  199. setstring(_name,s);
  200. end;
  201. { for most symbol types ther is nothing to do at all }
  202. procedure tsym.insert_in_data;
  203. begin
  204. end;
  205. {$ifdef GDB}
  206. function tsym.stabstring : pchar;
  207. begin
  208. stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+
  209. tostr(fileinfo.line)+',0');
  210. end;
  211. procedure tsym.concatstabto(asmlist : paasmoutput);
  212. var stab_str : pchar;
  213. begin
  214. if not isstabwritten then
  215. begin
  216. stab_str := stabstring;
  217. if asmlist = debuglist then do_count_dbx := true;
  218. { count_dbx(stab_str); moved to GDB.PAS }
  219. asmlist^.concat(new(pai_stabs,init(stab_str)));
  220. isstabwritten:=true;
  221. end;
  222. end;
  223. {$endif GDB}
  224. {****************************************************************************
  225. TLABELSYM
  226. ****************************************************************************}
  227. constructor tlabelsym.init(const n : string; l : plabel);
  228. begin
  229. inherited init(n);
  230. typ:=labelsym;
  231. number:=l;
  232. number^.is_used:=false;
  233. number^.is_set:=true;
  234. number^.refcount:=0;
  235. defined:=false;
  236. end;
  237. destructor tlabelsym.done;
  238. begin
  239. if not(defined) then
  240. Message1(sym_e_label_not_defined,name);
  241. inherited done;
  242. end;
  243. function tlabelsym.mangledname : string;
  244. begin
  245. { this also sets the is_used field }
  246. mangledname:=lab2str(number);
  247. end;
  248. procedure tlabelsym.write;
  249. begin
  250. Message(sym_e_ill_label_decl);
  251. end;
  252. {****************************************************************************
  253. TUNITSYM
  254. ****************************************************************************}
  255. constructor tunitsym.init(const n : string;ref : punitsymtable);
  256. var
  257. old_make_ref : boolean;
  258. begin
  259. old_make_ref:=make_ref;
  260. make_ref:=false;
  261. inherited init(n);
  262. make_ref:=old_make_ref;
  263. typ:=unitsym;
  264. unitsymtable:=ref;
  265. prevsym:=ref^.unitsym;
  266. ref^.unitsym:=@self;
  267. refs:=0;
  268. end;
  269. destructor tunitsym.done;
  270. begin
  271. if assigned(unitsymtable) and (unitsymtable^.unitsym=@self) then
  272. unitsymtable^.unitsym:=prevsym;
  273. inherited done;
  274. end;
  275. procedure tunitsym.write;
  276. begin
  277. end;
  278. {$ifdef GDB}
  279. procedure tunitsym.concatstabto(asmlist : paasmoutput);
  280. begin
  281. {Nothing to write to stabs !}
  282. end;
  283. {$endif GDB}
  284. {****************************************************************************
  285. TPROCSYM
  286. ****************************************************************************}
  287. constructor tprocsym.init(const n : string);
  288. begin
  289. tsym.init(n);
  290. typ:=procsym;
  291. definition:=nil;
  292. owner:=nil;
  293. {$ifdef GDB}
  294. is_global := false;
  295. {$endif GDB}
  296. end;
  297. constructor tprocsym.load;
  298. begin
  299. tsym.load;
  300. typ:=procsym;
  301. definition:=pprocdef(readdefref);
  302. {$ifdef GDB}
  303. is_global := false;
  304. {$endif GDB}
  305. end;
  306. destructor tprocsym.done;
  307. begin
  308. check_forward;
  309. tsym.done;
  310. end;
  311. function tprocsym.mangledname : string;
  312. begin
  313. mangledname:=definition^.mangledname;
  314. end;
  315. function tprocsym.demangledname:string;
  316. begin
  317. demangledname:=name+definition^.demangled_paras;
  318. end;
  319. procedure tprocsym.check_forward;
  320. var
  321. pd : pprocdef;
  322. oldaktfilepos : tfileposinfo;
  323. begin
  324. pd:=definition;
  325. while assigned(pd) do
  326. begin
  327. if pd^.forwarddef then
  328. begin
  329. oldaktfilepos:=aktfilepos;
  330. aktfilepos:=fileinfo;
  331. if assigned(pd^._class) then
  332. Message1(sym_e_forward_not_resolved,pd^._class^.name^+'.'+name+demangledparas(pd^.demangled_paras))
  333. else
  334. Message1(sym_e_forward_not_resolved,name+pd^.demangled_paras);
  335. aktfilepos:=oldaktfilepos;
  336. end;
  337. pd:=pd^.nextoverloaded;
  338. end;
  339. end;
  340. procedure tprocsym.deref;
  341. var t : ttoken;
  342. last : pprocdef;
  343. begin
  344. resolvedef(pdef(definition));
  345. if (definition^.options and pooperator) <> 0 then
  346. begin
  347. last:=definition;
  348. while assigned(last^.nextoverloaded) do
  349. last:=last^.nextoverloaded;
  350. for t:=PLUS to last_overloaded do
  351. if (name=overloaded_names[t]) then
  352. begin
  353. if assigned(overloaded_operators[t]) then
  354. last^.nextoverloaded:=overloaded_operators[t]^.definition;
  355. overloaded_operators[t]:=@self;
  356. end;
  357. end;
  358. end;
  359. procedure tprocsym.write;
  360. begin
  361. tsym.write;
  362. writedefref(pdef(definition));
  363. current_ppu^.writeentry(ibprocsym);
  364. end;
  365. {$ifdef GDB}
  366. function tprocsym.stabstring : pchar;
  367. Var RetType : Char;
  368. Obj,Info : String;
  369. begin
  370. obj := name;
  371. info := '';
  372. if is_global then
  373. RetType := 'F'
  374. else
  375. RetType := 'f';
  376. if assigned(owner) then
  377. begin
  378. if (owner^.symtabletype = objectsymtable) then
  379. obj := owner^.name^+'__'+name;
  380. if (owner^.symtabletype=localsymtable) and assigned(owner^.name) then
  381. info := ','+name+','+owner^.name^;
  382. end;
  383. stabstring :=strpnew('"'+obj+':'+RetType
  384. +definition^.retdef^.numberstring+info+'",'+tostr(n_function)
  385. +',0,'+
  386. tostr(aktfilepos.line)
  387. +','+definition^.mangledname);
  388. end;
  389. procedure tprocsym.concatstabto(asmlist : paasmoutput);
  390. begin
  391. if (definition^.options and pointernproc) <> 0 then exit;
  392. if not isstabwritten then
  393. asmlist^.concat(new(pai_stabs,init(stabstring)));
  394. isstabwritten := true;
  395. if assigned(definition^.parast) then
  396. definition^.parast^.concatstabto(asmlist);
  397. if assigned(definition^.localst) then
  398. definition^.localst^.concatstabto(asmlist);
  399. definition^.is_def_stab_written := true;
  400. end;
  401. {$endif GDB}
  402. {****************************************************************************
  403. TPROGRAMSYM
  404. ****************************************************************************}
  405. constructor tprogramsym.init(const n : string);
  406. begin
  407. inherited init(n);
  408. typ:=programsym;
  409. end;
  410. {****************************************************************************
  411. TERRORSYM
  412. ****************************************************************************}
  413. constructor terrorsym.init;
  414. begin
  415. inherited init('');
  416. typ:=errorsym;
  417. end;
  418. {****************************************************************************
  419. TPROPERTYSYM
  420. ****************************************************************************}
  421. constructor tpropertysym.init(const n : string);
  422. begin
  423. inherited init(n);
  424. typ:=propertysym;
  425. options:=0;
  426. proptype:=nil;
  427. readaccessdef:=nil;
  428. writeaccessdef:=nil;
  429. readaccesssym:=nil;
  430. writeaccesssym:=nil;
  431. index:=$0;
  432. end;
  433. destructor tpropertysym.done;
  434. begin
  435. inherited done;
  436. end;
  437. constructor tpropertysym.load;
  438. begin
  439. inherited load;
  440. typ:=propertysym;
  441. proptype:=readdefref;
  442. options:=readlong;
  443. index:=readlong;
  444. { it's hack ... }
  445. readaccesssym:=psym(stringdup(readstring));
  446. writeaccesssym:=psym(stringdup(readstring));
  447. { now the defs: }
  448. readaccessdef:=readdefref;
  449. writeaccessdef:=readdefref;
  450. end;
  451. procedure tpropertysym.deref;
  452. begin
  453. resolvedef(proptype);
  454. resolvedef(readaccessdef);
  455. resolvedef(writeaccessdef);
  456. { solve the hack we did in load: }
  457. if pstring(readaccesssym)^<>'' then
  458. begin
  459. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(readaccesssym)^);
  460. if not(assigned(srsym)) then
  461. srsym:=generrorsym;
  462. end
  463. else
  464. srsym:=nil;
  465. stringdispose(pstring(readaccesssym));
  466. readaccesssym:=srsym;
  467. if pstring(writeaccesssym)^<>'' then
  468. begin
  469. srsym:=search_class_member(pobjectdef(owner^.defowner),pstring(writeaccesssym)^);
  470. if not(assigned(srsym)) then
  471. srsym:=generrorsym;
  472. end
  473. else
  474. srsym:=nil;
  475. stringdispose(pstring(writeaccesssym));
  476. writeaccesssym:=srsym;
  477. end;
  478. function tpropertysym.getsize : longint;
  479. begin
  480. getsize:=0;
  481. end;
  482. procedure tpropertysym.write;
  483. begin
  484. tsym.write;
  485. writedefref(proptype);
  486. writelong(options);
  487. writelong(index);
  488. if assigned(readaccesssym) then
  489. writestring(readaccesssym^.name)
  490. else
  491. writestring('');
  492. if assigned(writeaccesssym) then
  493. writestring(writeaccesssym^.name)
  494. else
  495. writestring('');
  496. writedefref(readaccessdef);
  497. writedefref(writeaccessdef);
  498. current_ppu^.writeentry(ibpropertysym);
  499. end;
  500. {$ifdef GDB}
  501. function tpropertysym.stabstring : pchar;
  502. begin
  503. { !!!! don't know how to handle }
  504. stabstring:=strpnew('');
  505. end;
  506. procedure tpropertysym.concatstabto(asmlist : paasmoutput);
  507. begin
  508. { !!!! don't know how to handle }
  509. end;
  510. {$endif GDB}
  511. {****************************************************************************
  512. TFUNCRETSYM
  513. ****************************************************************************}
  514. {$ifdef TEST_FUNCRET}
  515. constructor tfuncretsym.init(const n : string;approcinfo : pointer{pprocinfo});
  516. begin
  517. tsym.init(n);
  518. typ:=funcretsym;
  519. funcretprocinfo:=approcinfo;
  520. funcretdef:=pprocinfo(approcinfo)^.retdef;
  521. { address valid for ret in param only }
  522. { otherwise set by insert }
  523. address:=pprocinfo(approcinfo)^.retoffset;
  524. end;
  525. {$ifdef GDB}
  526. procedure tfuncretsym.concatstabto(asmlist : paasmoutput);
  527. begin
  528. { Nothing to do here, it is done in genexitcode }
  529. end;
  530. {$endif GDB}
  531. {$endif TEST_FUNCRET}
  532. {****************************************************************************
  533. TABSOLUTESYM
  534. ****************************************************************************}
  535. { constructor tabsolutesym.init(const s : string;p : pdef;newref : psym);
  536. begin
  537. inherited init(s,p);
  538. ref:=newref;
  539. typ:=absolutesym;
  540. end; }
  541. constructor tabsolutesym.load;
  542. begin
  543. tvarsym.load;
  544. typ:=absolutesym;
  545. ref:=nil;
  546. address:=0;
  547. asmname:=nil;
  548. abstyp:=absolutetyp(readbyte);
  549. absseg:=false;
  550. case abstyp of
  551. tovar : begin
  552. asmname:=stringdup(readstring);
  553. ref:=srsym;
  554. end;
  555. toasm : asmname:=stringdup(readstring);
  556. toaddr : address:=readlong;
  557. end;
  558. end;
  559. procedure tabsolutesym.write;
  560. begin
  561. tsym.write;
  562. writebyte(byte(varspez));
  563. if read_member then
  564. writelong(address);
  565. writedefref(definition);
  566. writebyte(byte(abstyp));
  567. case abstyp of
  568. tovar : writestring(ref^.name);
  569. toasm : writestring(asmname^);
  570. toaddr : writelong(address);
  571. end;
  572. current_ppu^.writeentry(ibabsolutesym);
  573. end;
  574. procedure tabsolutesym.deref;
  575. begin
  576. resolvedef(definition);
  577. if (abstyp=tovar) and (asmname<>nil) then
  578. begin
  579. { search previous loaded symtables }
  580. getsym(asmname^,false);
  581. if not(assigned(srsym)) then
  582. getsymonlyin(owner,asmname^);
  583. if not(assigned(srsym)) then
  584. srsym:=generrorsym;
  585. ref:=srsym;
  586. stringdispose(asmname);
  587. end;
  588. end;
  589. function tabsolutesym.mangledname : string;
  590. begin
  591. case abstyp of
  592. tovar : mangledname:=ref^.mangledname;
  593. toasm : mangledname:=asmname^;
  594. toaddr : mangledname:='$'+tostr(address);
  595. else
  596. internalerror(10002);
  597. end;
  598. end;
  599. procedure tabsolutesym.insert_in_data;
  600. begin
  601. end;
  602. {$ifdef GDB}
  603. procedure tabsolutesym.concatstabto(asmlist : paasmoutput);
  604. begin
  605. { I don't know how to handle this !! }
  606. end;
  607. {$endif GDB}
  608. {****************************************************************************
  609. TVARSYM
  610. ****************************************************************************}
  611. constructor tvarsym.init(const n : string;p : pdef);
  612. begin
  613. tsym.init(n);
  614. typ:=varsym;
  615. definition:=p;
  616. _mangledname:=nil;
  617. varspez:=vs_value;
  618. address:=0;
  619. refs:=0;
  620. is_valid := 1;
  621. var_options:=0;
  622. { can we load the value into a register ? }
  623. case p^.deftype of
  624. pointerdef,
  625. enumdef,
  626. procvardef : var_options:=var_options or vo_regable;
  627. orddef : case porddef(p)^.typ of
  628. u8bit,u16bit,u32bit,
  629. bool8bit,bool16bit,bool32bit,
  630. s8bit,s16bit,s32bit :
  631. var_options:=var_options or vo_regable;
  632. else
  633. var_options:=var_options and not vo_regable;
  634. end;
  635. else
  636. var_options:=var_options and not vo_regable;
  637. end;
  638. reg:=R_NO;
  639. end;
  640. constructor tvarsym.load;
  641. begin
  642. tsym.load;
  643. typ:=varsym;
  644. _mangledname:=nil;
  645. varspez:=tvarspez(readbyte);
  646. if read_member then
  647. address:=readlong
  648. else
  649. address:=0;
  650. definition:=readdefref;
  651. refs := 0;
  652. is_valid := 1;
  653. { symbols which are load are never candidates for a register }
  654. var_options:=0;
  655. { was regable:=false; }
  656. reg:=R_NO;
  657. end;
  658. constructor tvarsym.init_C(const n,mangled : string;p : pdef);
  659. begin
  660. { The tvarsym is necessary for 0.99.5 (PFV) }
  661. tvarsym.init(n,p);
  662. var_options:=var_options or vo_is_C_var;
  663. _mangledname:=strpnew(target_os.Cprefix+mangled);
  664. end;
  665. constructor tvarsym.load_C;
  666. begin
  667. { Adding tvarsym removes the warning }
  668. tvarsym.load;
  669. typ:=varsym;
  670. var_options:=readbyte;
  671. _mangledname:=strpnew(readstring);
  672. end;
  673. procedure tvarsym.deref;
  674. begin
  675. resolvedef(definition);
  676. end;
  677. procedure tvarsym.write;
  678. begin
  679. tsym.write;
  680. writebyte(byte(varspez));
  681. if read_member then
  682. writelong(address);
  683. writedefref(definition);
  684. if (var_options and vo_is_C_var)<>0 then
  685. begin
  686. writebyte(var_options);
  687. writestring(mangledname);
  688. end;
  689. if (var_options and vo_is_C_var)<>0 then
  690. current_ppu^.writeentry(ibvarsym_C)
  691. else
  692. current_ppu^.writeentry(ibvarsym);
  693. end;
  694. function tvarsym.mangledname : string;
  695. var
  696. prefix : string;
  697. begin
  698. if assigned(_mangledname) then
  699. begin
  700. mangledname:=strpas(_mangledname);
  701. exit;
  702. end;
  703. case owner^.symtabletype of
  704. staticsymtable : if (cs_smartlink in aktmoduleswitches) then
  705. prefix:='_'+owner^.name^+'$$$_'
  706. else
  707. prefix:='_';
  708. unitsymtable,
  709. globalsymtable : prefix:='U_'+owner^.name^+'_';
  710. else
  711. Message(sym_e_invalid_call_tvarsymmangledname);
  712. end;
  713. mangledname:=prefix+name;
  714. end;
  715. function tvarsym.getsize : longint;
  716. begin
  717. { only if the definition is set, we could determine the }
  718. { size, this is if an error occurs while reading the type }
  719. { also used for operator, this allows not to allocate the }
  720. { return size twice }
  721. if assigned(definition) then
  722. begin
  723. case varspez of
  724. vs_value : getsize:=definition^.size;
  725. vs_var : begin
  726. { open arrays push also the high valye }
  727. if (definition^.deftype=arraydef) and
  728. (parraydef(definition)^.lowrange=0) and
  729. (parraydef(definition)^.highrange=-1) then
  730. getsize:=sizeof(pointer)+4
  731. else
  732. getsize:=sizeof(pointer);
  733. end;
  734. vs_const : begin
  735. case definition^.deftype of
  736. stringdef,
  737. recorddef,
  738. objectdef,
  739. setdef : getsize:=sizeof(pointer);
  740. arraydef : begin
  741. { open arrays push also the high valye }
  742. if (parraydef(definition)^.lowrange=0) and
  743. (parraydef(definition)^.highrange=-1) then
  744. getsize:=sizeof(pointer)+4
  745. else
  746. getsize:=sizeof(pointer);
  747. end;
  748. else
  749. getsize:=definition^.size;
  750. end;
  751. end;
  752. end;
  753. end
  754. else
  755. getsize:=0;
  756. end;
  757. procedure tvarsym.insert_in_data;
  758. var
  759. l,modulo : longint;
  760. begin
  761. if (var_options and vo_is_external)<>0 then
  762. exit;
  763. { handle static variables of objects especially }
  764. if read_member and (owner^.symtabletype=objectsymtable) and
  765. ((properties and sp_static)<>0) then
  766. begin
  767. { the data filed is generated in parser.pas
  768. with a tobject_FIELDNAME variable }
  769. { this symbol can't be loaded to a register }
  770. var_options:=var_options and not vo_regable;
  771. end
  772. else
  773. if not(read_member) then
  774. begin
  775. { made problems with parameters etc. ! (FK) }
  776. { check for instance of an abstract object or class }
  777. {
  778. if (pvarsym(sym)^.definition^.deftype=objectdef) and
  779. ((pobjectdef(pvarsym(sym)^.definition)^.options and oois_abstract)<>0) then
  780. Message(sym_e_no_instance_of_abstract_object);
  781. }
  782. l:=getsize;
  783. case owner^.symtabletype of
  784. stt_exceptsymtable:
  785. { can contain only one symbol, address calculated later }
  786. ;
  787. localsymtable : begin
  788. is_valid := 0;
  789. modulo:=owner^.datasize and 3;
  790. {$ifdef m68k}
  791. { word alignment required for motorola }
  792. if (l=1) then
  793. l:=2
  794. else
  795. {$endif}
  796. if (l>=4) and (modulo<>0) then
  797. inc(l,4-modulo)
  798. else
  799. if (l>=2) and ((modulo and 1)<>0) then
  800. inc(l,2-(modulo and 1));
  801. inc(owner^.datasize,l);
  802. address:=owner^.datasize;
  803. end;
  804. staticsymtable : begin
  805. if (cs_smartlink in aktmoduleswitches) then
  806. bsssegment^.concat(new(pai_cut,init));
  807. {$ifdef GDB}
  808. if cs_debuginfo in aktmoduleswitches then
  809. concatstabto(bsssegment);
  810. {$endif GDB}
  811. if (cs_smartlink in aktmoduleswitches) or
  812. ((var_options and vo_is_c_var)<>0) then
  813. bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)))
  814. else
  815. bsssegment^.concat(new(pai_datablock,init(mangledname,l)));
  816. { increase datasize }
  817. inc(owner^.datasize,l);
  818. { this symbol can't be loaded to a register }
  819. var_options:=var_options and not vo_regable;
  820. end;
  821. globalsymtable : begin
  822. if (cs_smartlink in aktmoduleswitches) then
  823. bsssegment^.concat(new(pai_cut,init));
  824. {$ifdef GDB}
  825. if cs_debuginfo in aktmoduleswitches then
  826. concatstabto(bsssegment);
  827. {$endif GDB}
  828. bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)));
  829. inc(owner^.datasize,l);
  830. { this symbol can't be loaded to a register }
  831. var_options:=var_options and not vo_regable;
  832. end;
  833. recordsymtable,
  834. objectsymtable : begin
  835. { this symbol can't be loaded to a register }
  836. var_options:=var_options and not vo_regable;
  837. { align record and object fields }
  838. if (l=1) or (aktpackrecords=1) then
  839. begin
  840. address:=owner^.datasize;
  841. inc(owner^.datasize,l)
  842. end
  843. else
  844. if (l=2) or (aktpackrecords=2) then
  845. begin
  846. owner^.datasize:=(owner^.datasize+1) and (not 1);
  847. address:=owner^.datasize;
  848. inc(owner^.datasize,l)
  849. end
  850. else
  851. if (l<=4) or (aktpackrecords=4) then
  852. begin
  853. owner^.datasize:=(owner^.datasize+3) and (not 3);
  854. address:=owner^.datasize;
  855. inc(owner^.datasize,l);
  856. end
  857. else
  858. if (l<=16) or (aktpackrecords=16) then
  859. begin
  860. owner^.datasize:=(owner^.datasize+15) and (not 15);
  861. address:=owner^.datasize;
  862. inc(owner^.datasize,l);
  863. end;
  864. end;
  865. parasymtable : begin
  866. address:=owner^.datasize;
  867. { needs word alignment }
  868. if odd(l) then
  869. inc(owner^.datasize,l+1)
  870. else
  871. inc(owner^.datasize,l);
  872. end
  873. else
  874. begin
  875. modulo:=owner^.datasize and 3 ;
  876. if (l>=4) and (modulo<>0) then
  877. inc(owner^.datasize,4-modulo)
  878. else
  879. if (l>=2) and ((modulo and 1)<>0) then
  880. { nice piece of code !!
  881. inc(owner^.datasize,2-(datasize and 1));
  882. 2 - (datasize and 1) is allways 1 in this case
  883. Florian when will your global stream analyser
  884. find this out ?? }
  885. inc(owner^.datasize);
  886. address:=owner^.datasize;
  887. inc(owner^.datasize,l);
  888. end;
  889. end;
  890. end;
  891. end;
  892. {$ifdef GDB}
  893. function tvarsym.stabstring : pchar;
  894. var
  895. st : char;
  896. begin
  897. if (owner^.symtabletype = objectsymtable) and
  898. ((properties and sp_static)<>0) then
  899. begin
  900. if use_gsym then st := 'G' else st := 'S';
  901. stabstring := strpnew('"'+owner^.name^+'__'+name+':'+
  902. +definition^.numberstring+'",'+
  903. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  904. end
  905. else if (owner^.symtabletype = globalsymtable) or
  906. (owner^.symtabletype = unitsymtable) then
  907. begin
  908. { Here we used S instead of
  909. because with G GDB doesn't look at the address field
  910. but searches the same name or with a leading underscore
  911. but these names don't exist in pascal !}
  912. if use_gsym then st := 'G' else st := 'S';
  913. stabstring := strpnew('"'+name+':'+st
  914. +definition^.numberstring+'",'+
  915. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  916. end
  917. else if owner^.symtabletype = staticsymtable then
  918. begin
  919. stabstring := strpnew('"'+name+':S'
  920. +definition^.numberstring+'",'+
  921. tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
  922. end
  923. else if (owner^.symtabletype=parasymtable) then
  924. begin
  925. case varspez of
  926. vs_value : st := 'p';
  927. vs_var : st := 'v';
  928. vs_const : if dont_copy_const_param(definition) then
  929. st := 'v'{ should be 'i' but 'i' doesn't work }
  930. else
  931. st := 'p';
  932. end;
  933. stabstring := strpnew('"'+name+':'+st
  934. +definition^.numberstring+'",'+
  935. tostr(N_PSYM)+',0,'+tostr(fileinfo.line)+','+
  936. tostr(address+owner^.call_offset));
  937. {offset to ebp => will not work if the framepointer is esp
  938. so some optimizing will make things harder to debug }
  939. end
  940. else if (owner^.symtabletype=localsymtable) then
  941. {$ifdef i386}
  942. if reg<>R_NO then
  943. begin
  944. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  945. { this is the register order for GDB}
  946. stabstring:=strpnew('"'+name+':r'
  947. +definition^.numberstring+'",'+
  948. tostr(N_RSYM)+',0,'+
  949. tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
  950. end
  951. else
  952. {$endif i386}
  953. stabstring := strpnew('"'+name+':'
  954. +definition^.numberstring+'",'+
  955. tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',-'+tostr(address))
  956. else
  957. stabstring := inherited stabstring;
  958. end;
  959. procedure tvarsym.concatstabto(asmlist : paasmoutput);
  960. {$ifdef i386}
  961. var stab_str : pchar;
  962. {$endif i386}
  963. begin
  964. inherited concatstabto(asmlist);
  965. {$ifdef i386}
  966. if (owner^.symtabletype=parasymtable) and
  967. (reg<>R_NO) then
  968. begin
  969. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  970. { this is the register order for GDB}
  971. stab_str:=strpnew('"'+name+':r'
  972. +definition^.numberstring+'",'+
  973. tostr(N_RSYM)+',0,'+
  974. tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
  975. asmlist^.concat(new(pai_stabs,init(stab_str)));
  976. end;
  977. {$endif i386}
  978. end;
  979. {$endif GDB}
  980. destructor tvarsym.done;
  981. begin
  982. strdispose(_mangledname);
  983. inherited done;
  984. end;
  985. {****************************************************************************
  986. TTYPEDCONSTSYM
  987. *****************************************************************************}
  988. constructor ttypedconstsym.init(const n : string;p : pdef);
  989. begin
  990. tsym.init(n);
  991. typ:=typedconstsym;
  992. definition:=p;
  993. prefix:=stringdup(procprefix);
  994. end;
  995. constructor ttypedconstsym.load;
  996. begin
  997. tsym.load;
  998. typ:=typedconstsym;
  999. definition:=readdefref;
  1000. prefix:=stringdup(readstring);
  1001. end;
  1002. destructor ttypedconstsym.done;
  1003. begin
  1004. stringdispose(prefix);
  1005. tsym.done;
  1006. end;
  1007. function ttypedconstsym.mangledname : string;
  1008. begin
  1009. mangledname:='TC_'+prefix^+'_'+name;
  1010. end;
  1011. procedure ttypedconstsym.deref;
  1012. begin
  1013. resolvedef(definition);
  1014. end;
  1015. procedure ttypedconstsym.write;
  1016. begin
  1017. tsym.write;
  1018. writedefref(definition);
  1019. writestring(prefix^);
  1020. current_ppu^.writeentry(ibtypedconstsym);
  1021. end;
  1022. { for most symbol types ther is nothing to do at all }
  1023. procedure ttypedconstsym.insert_in_data;
  1024. begin
  1025. { here there is a problem for ansistrings !! }
  1026. { we must write the label only after the 12 header bytes (PM)
  1027. if not is_ansistring(definition) then
  1028. }
  1029. { solved, the ansis string is moved to consts (FK) }
  1030. really_insert_in_data;
  1031. end;
  1032. procedure ttypedconstsym.really_insert_in_data;
  1033. begin
  1034. if owner^.symtabletype=globalsymtable then
  1035. begin
  1036. if (cs_smartlink in aktmoduleswitches) then
  1037. datasegment^.concat(new(pai_cut,init));
  1038. {$ifdef GDB}
  1039. if cs_debuginfo in aktmoduleswitches then
  1040. concatstabto(datasegment);
  1041. {$endif GDB}
  1042. datasegment^.concat(new(pai_symbol,init_global(mangledname)));
  1043. end
  1044. else
  1045. if owner^.symtabletype<>unitsymtable then
  1046. begin
  1047. if (cs_smartlink in aktmoduleswitches) then
  1048. datasegment^.concat(new(pai_cut,init));
  1049. {$ifdef GDB}
  1050. if cs_debuginfo in aktmoduleswitches then
  1051. concatstabto(datasegment);
  1052. {$endif GDB}
  1053. if (cs_smartlink in aktmoduleswitches) then
  1054. datasegment^.concat(new(pai_symbol,init_global(mangledname)))
  1055. else
  1056. datasegment^.concat(new(pai_symbol,init(mangledname)));
  1057. end;
  1058. end;
  1059. {$ifdef GDB}
  1060. function ttypedconstsym.stabstring : pchar;
  1061. var
  1062. st : char;
  1063. begin
  1064. if use_gsym and (owner^.symtabletype in [unitsymtable,globalsymtable]) then
  1065. st := 'G'
  1066. else
  1067. st := 'S';
  1068. stabstring := strpnew('"'+name+':'+st+
  1069. definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+
  1070. tostr(fileinfo.line)+','+mangledname);
  1071. end;
  1072. {$endif GDB}
  1073. {****************************************************************************
  1074. TCONSTSYM
  1075. ****************************************************************************}
  1076. constructor tconstsym.init(const n : string;t : tconsttype;v : longint;def : pdef);
  1077. begin
  1078. tsym.init(n);
  1079. typ:=constsym;
  1080. definition:=def;
  1081. consttype:=t;
  1082. value:=v;
  1083. end;
  1084. constructor tconstsym.load;
  1085. var
  1086. pd : pbestreal;
  1087. ps : pnormalset;
  1088. begin
  1089. tsym.load;
  1090. typ:=constsym;
  1091. consttype:=tconsttype(readbyte);
  1092. case consttype of
  1093. constint,
  1094. constbool,
  1095. constchar : value:=readlong;
  1096. constord : begin
  1097. definition:=readdefref;
  1098. value:=readlong;
  1099. end;
  1100. conststring : value:=longint(stringdup(readstring));
  1101. constreal : begin
  1102. new(pd);
  1103. pd^:=readreal;
  1104. value:=longint(pd);
  1105. end;
  1106. constseta : begin
  1107. definition:=readdefref;
  1108. new(ps);
  1109. readnormalset(ps^);
  1110. value:=longint(ps);
  1111. end;
  1112. else
  1113. Message1(unit_f_ppu_invalid_entry,tostr(ord(consttype)));
  1114. end;
  1115. end;
  1116. destructor tconstsym.done;
  1117. begin
  1118. case consttype of
  1119. conststring : stringdispose(pstring(value));
  1120. constreal : dispose(pbestreal(value));
  1121. constseta : dispose(pnormalset(value));
  1122. end;
  1123. inherited done;
  1124. end;
  1125. function tconstsym.mangledname : string;
  1126. begin
  1127. mangledname:=name;
  1128. end;
  1129. procedure tconstsym.deref;
  1130. begin
  1131. if consttype in [constord,constseta] then
  1132. resolvedef(pdef(definition));
  1133. end;
  1134. procedure tconstsym.write;
  1135. begin
  1136. tsym.write;
  1137. writebyte(byte(consttype));
  1138. case consttype of
  1139. constint,
  1140. constbool,
  1141. constchar : writelong(value);
  1142. constord : begin
  1143. writedefref(definition);
  1144. writelong(value);
  1145. end;
  1146. conststring : writestring(pstring(value)^);
  1147. constreal : writereal(pbestreal(value)^);
  1148. constseta : begin
  1149. writedefref(definition);
  1150. writenormalset(pointer(value)^);
  1151. end;
  1152. else
  1153. internalerror(13);
  1154. end;
  1155. current_ppu^.writeentry(ibconstsym);
  1156. end;
  1157. {$ifdef GDB}
  1158. function tconstsym.stabstring : pchar;
  1159. var st : string;
  1160. begin
  1161. {even GDB v4.16 only now 'i' 'r' and 'e' !!!}
  1162. case consttype of
  1163. conststring : begin
  1164. { I had to remove ibm2ascii !! }
  1165. st := pstring(value)^;
  1166. {st := ibm2ascii(pstring(value)^);}
  1167. st := 's'''+st+'''';
  1168. end;
  1169. constbool, constint, constord, constchar : st := 'i'+tostr(value);
  1170. constreal : begin
  1171. system.str(pbestreal(value)^,st);
  1172. st := 'r'+st;
  1173. end;
  1174. { if we don't know just put zero !! }
  1175. else st:='i0';
  1176. {***SETCONST}
  1177. {constset:;} {*** I don't know what to do with a set.}
  1178. { sets are not recognized by GDB}
  1179. {***}
  1180. end;
  1181. stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+
  1182. tostr(fileinfo.line)+',0');
  1183. end;
  1184. procedure tconstsym.concatstabto(asmlist : paasmoutput);
  1185. begin
  1186. if consttype <> conststring then
  1187. inherited concatstabto(asmlist);
  1188. end;
  1189. {$endif GDB}
  1190. {****************************************************************************
  1191. TENUMSYM
  1192. ****************************************************************************}
  1193. constructor tenumsym.init(const n : string;def : penumdef;v : longint);
  1194. begin
  1195. tsym.init(n);
  1196. typ:=enumsym;
  1197. definition:=def;
  1198. value:=v;
  1199. {$ifdef GDB}
  1200. order;
  1201. {$endif GDB}
  1202. end;
  1203. constructor tenumsym.load;
  1204. begin
  1205. tsym.load;
  1206. typ:=enumsym;
  1207. definition:=penumdef(readdefref);
  1208. value:=readlong;
  1209. {$ifdef GDB}
  1210. next := Nil;
  1211. {$endif GDB}
  1212. end;
  1213. procedure tenumsym.deref;
  1214. begin
  1215. resolvedef(pdef(definition));
  1216. {$ifdef GDB}
  1217. order;
  1218. {$endif}
  1219. end;
  1220. {$ifdef GDB}
  1221. procedure tenumsym.order;
  1222. var sym : penumsym;
  1223. begin
  1224. sym := definition^.first;
  1225. if sym = nil then
  1226. begin
  1227. definition^.first := @self;
  1228. next := nil;
  1229. exit;
  1230. end;
  1231. {reorder the symbols in increasing value }
  1232. if value < sym^.value then
  1233. begin
  1234. next := sym;
  1235. definition^.first := @self;
  1236. end else
  1237. begin
  1238. while (sym^.value <= value) and assigned(sym^.next) do
  1239. sym := sym^.next;
  1240. next := sym^.next;
  1241. sym^.next := @self;
  1242. end;
  1243. end;
  1244. {$endif GDB}
  1245. procedure tenumsym.write;
  1246. begin
  1247. tsym.write;
  1248. writedefref(definition);
  1249. writelong(value);
  1250. current_ppu^.writeentry(ibenumsym);
  1251. end;
  1252. {$ifdef GDB}
  1253. procedure tenumsym.concatstabto(asmlist : paasmoutput);
  1254. begin
  1255. {enum elements have no stab !}
  1256. end;
  1257. {$EndIf GDB}
  1258. {****************************************************************************
  1259. TTYPESYM
  1260. ****************************************************************************}
  1261. constructor ttypesym.init(const n : string;d : pdef);
  1262. begin
  1263. tsym.init(n);
  1264. typ:=typesym;
  1265. definition:=d;
  1266. {$ifdef GDB}
  1267. isusedinstab := false;
  1268. {$endif GDB}
  1269. forwardpointer:=nil;
  1270. { this allows to link definitions with the type with declares }
  1271. { them }
  1272. if assigned(definition) then
  1273. if definition^.sym=nil then
  1274. definition^.sym:=@self;
  1275. end;
  1276. constructor ttypesym.load;
  1277. begin
  1278. tsym.load;
  1279. typ:=typesym;
  1280. forwardpointer:=nil;
  1281. {$ifdef GDB}
  1282. isusedinstab := false;
  1283. {$endif GDB}
  1284. definition:=readdefref;
  1285. end;
  1286. destructor ttypesym.done;
  1287. begin
  1288. if assigned(definition) then
  1289. if definition^.sym=@self then
  1290. definition^.sym:=nil;
  1291. inherited done;
  1292. end;
  1293. procedure ttypesym.deref;
  1294. begin
  1295. resolvedef(definition);
  1296. if assigned(definition) then
  1297. begin
  1298. if definition^.sym=nil then
  1299. definition^.sym:=@self;
  1300. if definition^.deftype=recorddef then
  1301. precdef(definition)^.symtable^.name:=stringdup('record '+name);
  1302. end;
  1303. end;
  1304. procedure ttypesym.write;
  1305. begin
  1306. tsym.write;
  1307. writedefref(definition);
  1308. current_ppu^.writeentry(ibtypesym);
  1309. end;
  1310. {$ifdef GDB}
  1311. function ttypesym.stabstring : pchar;
  1312. var stabchar : string[2];
  1313. short : string;
  1314. begin
  1315. if definition^.deftype in tagtypes then
  1316. stabchar := 'Tt'
  1317. else
  1318. stabchar := 't';
  1319. short := '"'+name+':'+stabchar+definition^.numberstring
  1320. +'",'+tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',0';
  1321. stabstring := strpnew(short);
  1322. end;
  1323. procedure ttypesym.concatstabto(asmlist : paasmoutput);
  1324. begin
  1325. {not stabs for forward defs }
  1326. if assigned(definition) then
  1327. if (definition^.sym = @self) then
  1328. definition^.concatstabto(asmlist)
  1329. else
  1330. inherited concatstabto(asmlist);
  1331. end;
  1332. {$endif GDB}
  1333. {****************************************************************************
  1334. TSYSSYM
  1335. ****************************************************************************}
  1336. constructor tsyssym.init(const n : string;l : longint);
  1337. begin
  1338. inherited init(n);
  1339. typ:=syssym;
  1340. number:=l;
  1341. end;
  1342. procedure tsyssym.write;
  1343. begin
  1344. end;
  1345. {$ifdef GDB}
  1346. procedure tsyssym.concatstabto(asmlist : paasmoutput);
  1347. begin
  1348. end;
  1349. {$endif GDB}
  1350. {****************************************************************************
  1351. TMACROSYM
  1352. ****************************************************************************}
  1353. constructor tmacrosym.init(const n : string);
  1354. begin
  1355. inherited init(n);
  1356. defined:=true;
  1357. buftext:=nil;
  1358. buflen:=0;
  1359. end;
  1360. destructor tmacrosym.done;
  1361. begin
  1362. if assigned(buftext) then
  1363. freemem(buftext,buflen);
  1364. inherited done;
  1365. end;
  1366. {
  1367. $Log$
  1368. Revision 1.33 1998-08-20 12:53:27 peter
  1369. * object_options are always written for object syms
  1370. Revision 1.32 1998/08/20 09:26:46 pierre
  1371. + funcret setting in underproc testing
  1372. compile with _dTEST_FUNCRET
  1373. Revision 1.31 1998/08/17 10:10:12 peter
  1374. - removed OLDPPU
  1375. Revision 1.30 1998/08/13 10:57:29 peter
  1376. * constant sets are now written correctly to the ppufile
  1377. Revision 1.29 1998/08/11 15:31:42 peter
  1378. * write extended to ppu file
  1379. * new version 0.99.7
  1380. Revision 1.28 1998/08/11 14:07:27 peter
  1381. * fixed pushing of high value for openarray
  1382. Revision 1.27 1998/08/10 14:50:31 peter
  1383. + localswitches, moduleswitches, globalswitches splitting
  1384. Revision 1.26 1998/08/10 10:18:35 peter
  1385. + Compiler,Comphook unit which are the new interface units to the
  1386. compiler
  1387. Revision 1.25 1998/07/30 11:18:19 florian
  1388. + first implementation of try ... except on .. do end;
  1389. * limitiation of 65535 bytes parameters for cdecl removed
  1390. Revision 1.24 1998/07/20 18:40:16 florian
  1391. * handling of ansi string constants should now work
  1392. Revision 1.23 1998/07/14 21:37:24 peter
  1393. * fixed packrecords as discussed at the alias
  1394. Revision 1.22 1998/07/14 14:47:08 peter
  1395. * released NEWINPUT
  1396. Revision 1.21 1998/07/13 21:17:38 florian
  1397. * changed to compile with TP
  1398. Revision 1.20 1998/07/10 00:00:05 peter
  1399. * fixed ttypesym bug finally
  1400. * fileinfo in the symtable and better using for unused vars
  1401. Revision 1.19 1998/07/07 17:40:39 peter
  1402. * packrecords 4 works
  1403. * word aligning of parameters
  1404. Revision 1.18 1998/07/07 11:20:15 peter
  1405. + NEWINPUT for a better inputfile and scanner object
  1406. Revision 1.17 1998/06/24 14:48:40 peter
  1407. * ifdef newppu -> ifndef oldppu
  1408. Revision 1.16 1998/06/19 15:40:42 peter
  1409. * removed cosntructor/constructor warning and 0.99.5 recompiles it again
  1410. Revision 1.15 1998/06/17 14:10:18 peter
  1411. * small os2 fixes
  1412. * fixed interdependent units with newppu (remake3 under linux works now)
  1413. Revision 1.14 1998/06/16 08:56:34 peter
  1414. + targetcpu
  1415. * cleaner pmodules for newppu
  1416. Revision 1.13 1998/06/15 15:38:10 pierre
  1417. * small bug in systems.pas corrected
  1418. + operators in different units better hanlded
  1419. Revision 1.12 1998/06/15 14:23:44 daniel
  1420. * Reverted my changes.
  1421. Revision 1.10 1998/06/13 00:10:18 peter
  1422. * working browser and newppu
  1423. * some small fixes against crashes which occured in bp7 (but not in
  1424. fpc?!)
  1425. Revision 1.9 1998/06/12 16:15:35 pierre
  1426. * external name 'C_var';
  1427. export name 'intern_C_var';
  1428. cdecl;
  1429. cdecl;external;
  1430. are now supported only with -Sv switch
  1431. Revision 1.8 1998/06/11 10:11:59 peter
  1432. * -gb works again
  1433. Revision 1.7 1998/06/09 16:01:51 pierre
  1434. + added procedure directive parsing for procvars
  1435. (accepted are popstack cdecl and pascal)
  1436. + added C vars with the following syntax
  1437. var C calias 'true_c_name';(can be followed by external)
  1438. reason is that you must add the Cprefix
  1439. which is target dependent
  1440. Revision 1.6 1998/06/08 22:59:53 peter
  1441. * smartlinking works for win32
  1442. * some defines to exclude some compiler parts
  1443. Revision 1.5 1998/06/04 23:52:02 peter
  1444. * m68k compiles
  1445. + .def file creation moved to gendef.pas so it could also be used
  1446. for win32
  1447. Revision 1.4 1998/06/04 09:55:46 pierre
  1448. * demangled name of procsym reworked to become independant of the mangling scheme
  1449. Revision 1.3 1998/06/03 22:14:20 florian
  1450. * problem with sizes of classes fixed (if the anchestor was declared
  1451. forward, the compiler doesn't update the child classes size)
  1452. Revision 1.2 1998/05/28 14:40:29 peter
  1453. * fixes for newppu, remake3 works now with it
  1454. Revision 1.1 1998/05/27 19:45:09 peter
  1455. * symtable.pas splitted into includefiles
  1456. * symtable adapted for $ifndef OLDPPU
  1457. }