Recent

Author Topic: make_mangledname  (Read 2246 times)

engkin

  • Hero Member
  • *****
  • Posts: 3112
make_mangledname
« on: October 10, 2017, 07:44:41 am »
Unit symdef has a function named make_mangledname:
Code: Pascal  [Select][+][-]
  1.     function make_mangledname(const typeprefix:TSymStr;st:TSymtable;const suffix:TSymStr):TSymStr;
  2. ...
  3.         { The mangled name is made out of at most 4 parts:
  4.          1) Optional typeprefix given as first parameter
  5.             with '_$' appended if not empty
  6.          2) Unit name or 'P$'+program name (never empty)
  7.          3) optional prefix variable that contains a unique
  8.             name for the local symbol table (prepended with '$_$'
  9.             if not empty)
  10.          4) suffix as given as third parameter,
  11.             also optional (i.e. can be empty)
  12.             prepended by '_$$_' if not empty }
  13.  
Where do I find the reference for this comment?

GDB is able to call a function:
Code: Pascal  [Select][+][-]
  1. function TestI: integer;

but fails to find a class method:
Code: Pascal  [Select][+][-]
  1.   TTest=class
  2.     public
  3.       class function sfoo: integer;

The compiler emits the following mangled names for the above functions (DWARF2 and STABS):
P$GDBTEST_$$_TESTI$$LONGINT
P$GDBTEST$_$TTEST_$__$$_SFOO$$LONGINT

Is the second name correct?

 

TinyPortal © 2005-2018