[fpc-devel] FPC and valgrind

2005-03-20 Thread C Western
I tried out valgrind on lazaraus and one of my own lcl programs, and was 
able to get it working by after applying some small patches to valgrind 
(which I have sent to the valgrind mailing lists). valgrind found some 
uninitialised memory reads, which the attached patch fixes.

On a related matter, if I try and look at the stabs info, objdump -g 
gives errors such as:
Bad stab: defALTPROPNAME:c=s''; (My program)
Bad stab: 3391;-2147483647;2147483647; (lazarus)
though gdb is working fine. (System is Fedora Core 3)
Colin
diff -uNr fpc/rtl/inc/sstrings.inc fpc.w/rtl/inc/sstrings.inc
--- fpc/rtl/inc/sstrings.inc2005-02-26 10:58:09.0 +
+++ fpc.w/rtl/inc/sstrings.inc  2005-03-19 22:17:36.672656850 +
@@ -795,11 +795,11 @@
   inc(code);
end;
 { Decimal ? }
-  if (s[code]='.') and (length(s)>=code) then
+  if (length(s)>=code) and (s[code]='.') then
begin
   hd:=1.0;
   inc(code);
-  while (s[code] in ['0'..'9']) and (length(s)>=code) do
+  while (length(s)>=code) and (s[code] in ['0'..'9']) do
 begin
{ Read fractional part. }
flags:=flags or 2;
@@ -816,23 +816,24 @@
   exit;
end;
  { Exponent ? }
-  if (upcase(s[code])='E') and (length(s)>=code) then
+  if (length(s)>=code) and (upcase(s[code])='E') then
begin
   inc(code);
-  if s[code]='+' then
-inc(code)
-  else
-if s[code]='-' then
- begin
-   esign:=-1;
-   inc(code);
- end;
-  if not(s[code] in ['0'..'9']) or (length(s)= code then
+if s[code]='+' then
+  inc(code)
+else
+  if s[code]='-' then
+   begin
+ esign:=-1;
+ inc(code);
+   end;
+  if (length(s)=code) do
+  while (length(s)>=code) and (s[code] in ['0'..'9']) do
 begin
exponent:=exponent*10;
exponent:=exponent+ord(s[code])-ord('0');
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC and valgrind

2005-03-20 Thread Florian Klaempfl
C Western wrote:
I tried out valgrind on lazaraus and one of my own lcl programs, and was 
able to get it working by after applying some small patches to valgrind 
(which I have sent to the valgrind mailing lists). valgrind found some 
uninitialised memory reads, which the attached patch fixes.
You could also use the -gv switch, it generates stabs accepted by valgrind.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC and valgrind

2005-03-20 Thread Colin Western
Florian Klaempfl wrote:
C Western wrote:
I tried out valgrind on lazaraus and one of my own lcl programs, and 
was able to get it working by after applying some small patches to 
valgrind (which I have sent to the valgrind mailing lists). valgrind 
found some uninitialised memory reads, which the attached patch fixes.

You could also use the -gv switch, it generates stabs accepted by 
valgrind.

That works fine also - I guess I should have read the online help. It 
doen't fix the problem with objdump though objdump -g still gives errors.
Colin

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC and valgrind

2005-09-19 Thread Colin Western
I thought the following message on the valgrind users list might be of 
interest - it is in response to a message I posted. (The reply came 
months after the original, so I didn't notice it immediately). I do not 
know how to respond to the question at the end. The first patch at least 
seems to have made it into the 2.4.1 release of valgrind.

Colin

(Original URL: 
)


In message <[EMAIL PROTECTED]>
C. Western <[EMAIL PROTECTED]> wrote:

> My knowledge of stabs is very limited, but with a bit of guess work
> and some help from a bugzilla report I was able to get valgrind
> working on my free pascal programs by applying the attached patch to
> rc4.

Thanks for the report.

> --- ./coregrind/vg_stabs.c.orig2005-03-12 08:22:46.0 +
> +++ ./coregrind/vg_stabs.c 2005-03-19 19:25:21.813549592 +
> @@ -646,6 +646,7 @@
>case -27:   type = VG_(st_mkint)(def, 1, True); break;
>case -28:   type = VG_(st_mkint)(def, 2, True); break;
>case -29:   type = VG_(st_mkint)(def, 4, True); break;
> +  case -30:   type = VG_(st_mkint)(def, 2, False); break;
>case -31:   type = VG_(st_mkint)(def, 8, True); break;
>case -32:   type = VG_(st_mkint)(def, 8, False); break;
>case -33:   type = VG_(st_mkint)(def, 8, False); break;

I"ve committed this to the valgrind 3.0 SVN repository.

> --- ./coregrind/vg_stabs.c.orig2005-03-19 21:33:03.0 +
> +++ ./coregrind/vg_stabs.c 2005-03-19 21:33:29.0 +
> @@ -1610,8 +1610,8 @@
>scope.nsyms = 0;
> }
>  
> -	 vg_assert(scope.addr != 0);

> -   VG_(addScopeInfo)(si, scope.addr, addr, scope.scope);
> +   if (scope.addr != 0)
> +  VG_(addScopeInfo)(si, scope.addr, addr, scope.scope);
>  	 
>  	 /* XXX LEAK: free scope if it or any of its inner scopes was

>never added to a scope range  */

How did you manage to get a scope at address zero? why do you think
such a scope should be ignored rather than added - maybe your program
really does have code at address zero?

Tom


Tom

--
Tom Hughes ([EMAIL PROTECTED])

http://www.compton.nu/

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC and valgrind

2005-09-19 Thread Peter Vreman
> I thought the following message on the valgrind users list might be of
> interest - it is in response to a message I posted. (The reply came
> months after the original, so I didn't notice it immediately). I do not
> know how to respond to the question at the end. The first patch at least
> seems to have made it into the 2.4.1 release of valgrind.

Did you use -gv to generate valgrind compatible debuginfo?



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC and valgrind

2005-09-20 Thread Colin Western

Peter Vreman wrote:


I thought the following message on the valgrind users list might be of
interest - it is in response to a message I posted. (The reply came
months after the original, so I didn't notice it immediately). I do not
know how to respond to the question at the end. The first patch at least
seems to have made it into the 2.4.1 release of valgrind.
   



Did you use -gv to generate valgrind compatible debuginfo?

 

No - the post to the valgrind list was before I found out (from the 
fpc-devel list) about the -gv switch. (I would hope the switch would 
eventually become uneccesary - it is documented, but I did not even 
think to look in the documentation for so specific a switch)


Colin
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel