* move ReplaceForbiddenChars to cpubase of avr so it can be used in dbgstabs as well

* tried to fix dbgstabs so that it doesn't emit illegal chars using ReplaceForbiddenChars, however, dbgstabs accesses symbol names quite often, so this failed

git-svn-id: trunk@18972 -
This commit is contained in:
florian 2011-09-04 19:36:43 +00:00
parent 7bceba2392
commit f1f0cb033a
3 changed files with 21 additions and 14 deletions

View File

@ -94,9 +94,6 @@ interface
end;
function ReplaceForbiddenChars(const s: string): string;
implementation
uses
@ -201,17 +198,6 @@ implementation
#9'.rva'#9,#9'.secrel32'#9,#9'.quad'#9,#9'.long'#9,#9'.short'#9
);
function ReplaceForbiddenChars(const s: string): string;
var
i : longint;
begin
Result:=s;
for i:=1 to Length(Result) do
if Result[i]='$' then
Result[i]:='s';
end;
{****************************************************************************}
{ GNU Assembler writer }
{****************************************************************************}

View File

@ -315,6 +315,8 @@ unit cpubase;
function GetOffsetReg(const r : TRegister;ofs : shortint) : TRegister;
function ReplaceForbiddenChars(const s: string): string;
implementation
uses
@ -458,4 +460,15 @@ unit cpubase;
result:=TRegister(longint(r)+ofs);
end;
function ReplaceForbiddenChars(const s: string): string;
var
i : longint;
begin
Result:=s;
for i:=1 to Length(Result) do
if Result[i]='$' then
Result[i]:='s';
end;
end.

View File

@ -125,6 +125,10 @@ implementation
result := Sym.Name
else
result := Sym.RealName;
{$ifdef avr}
if target_asm.id=as_gas then
result:=ReplaceForbiddenChars(result);
{$endif avr}
end;
function GetSymTableName(SymTable : TSymTable) : string;
@ -133,6 +137,10 @@ implementation
result := SymTable.Name^
else
result := SymTable.RealName^;
{$ifdef avr}
if target_asm.id=as_gas then
result:=ReplaceForbiddenChars(result);
{$endif avr}
end;
const