From 3dfde8c3970049c0b92e9c61916ce207a4b5c06e Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 26 Jan 2004 22:08:20 +0000 Subject: [PATCH] * Bugfix on constant strings stab generation. Never worked and still doesn't work for unknown reasons. --- compiler/cutils.pas | 22 +++++++++++++++++++++- compiler/symsym.pas | 10 +++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/compiler/cutils.pas b/compiler/cutils.pas index c6d39ef7d3..a169a28ce5 100644 --- a/compiler/cutils.pas +++ b/compiler/cutils.pas @@ -34,6 +34,7 @@ interface type pstring = ^string; get_var_value_proc=function(const s:string):string of object; + Tcharset=set of char; {# Returns the minimal value between @var(a) and @var(b) } @@ -73,6 +74,7 @@ interface exponent value is returned in power. } function ispowerof2(value : int64;var power : longint) : boolean; + function backspace_quote(const s:string;const qchars:Tcharset):string; function maybequoted(const s:string):string; function CompareText(S1, S2: string): longint; @@ -610,6 +612,20 @@ uses end; + function backspace_quote(const s:string;const qchars:Tcharset):string; + + var i:byte; + + begin + backspace_quote:=''; + for i:=1 to length(s) do + begin + if s[i] in qchars then + backspace_quote:=backspace_quote+'\'; + backspace_quote:=backspace_quote+s[i]; + end; + end; + function maybequoted(const s:string):string; var s1 : string; @@ -1104,7 +1120,11 @@ initialization end. { $Log$ - Revision 1.33 2004-01-25 13:18:59 daniel + Revision 1.34 2004-01-26 22:08:20 daniel + * Bugfix on constant strings stab generation. Never worked and still + doesn't work for unknown reasons. + + Revision 1.33 2004/01/25 13:18:59 daniel * Made varags parameter constant Revision 1.32 2004/01/25 11:33:48 daniel diff --git a/compiler/symsym.pas b/compiler/symsym.pas index 5fdf530dac..2eb1f7f6cd 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -2150,7 +2150,7 @@ implementation {even GDB v4.16 only now 'i' 'r' and 'e' !!!} case consttyp of conststring: - st:='s'''+strpas(pchar(value.valueptr))+''''; + st:='s'''+backspace_quote(strpas(pchar(value.valueptr)),['''','"','\'])+''''; constbool, constint, constord, @@ -2171,7 +2171,7 @@ implementation { sets are not recognized by GDB} {***} end; - stabstring:=stabstr_evaluate('"${name}:c=$1",${N_FUNCTION},0,${line},0',[st]); + stabstring:=stabstr_evaluate('"${name}:c=$1",${N_FUNCTION},0,${line},0;',[st]); end; {$endif GDB} @@ -2547,7 +2547,11 @@ implementation end. { $Log$ - Revision 1.145 2004-01-26 16:12:28 daniel + Revision 1.146 2004-01-26 22:08:20 daniel + * Bugfix on constant strings stab generation. Never worked and still + doesn't work for unknown reasons. + + Revision 1.145 2004/01/26 16:12:28 daniel * reginfo now also only allocated during register allocation * third round of gdb cleanups: kick out most of concatstabto