[fpc-devel] Memory corruption running fcl-db test suite

Luiz Americo Pereira Camara luizmed at oi.com.br
Tue May 1 06:27:03 CEST 2012


Hi, today i hit a strange bug while running the fcl-db test suite.

I'm using fpc from trunk rev 21150 windows xp 32 bit. I'm compiling 
trunk with fpc 260. Attached the script i use.

I compiled and ran packages\fcl-db\tests\dbtestframework.pas

All the tests run fine, but in testsuite finalization the cpu usage goes 
to sky taking to long to terminate

While debugging i found that the TTestResult instance memory is 
corrupted even before the tests are run.

Follows gdb output.

Notice that the global variable testResult gets the address 0x5b000

in line 44 (GetTestRegistry.Run(testResult); ) this variable is passed 
as a parameter to TTESTSUITE.RUN

But inside TTESTSUITE.RUN the parameter value (AResult) gets the address 
0x676f0

If i try to dereference (p AResult^) i get a corrupted instance

Further investigation i found that  0x676f0 is the address of this 
(TTestSuite instance).  Dereferencing it (this^) shows correct field values

Any hint on whats going on?

Luiz


Starting program: 
D:\repositories\fpc_trunk\packages\fcl-db\tests/dbtestframework.exe
[New Thread 3960.0x5b4]

Breakpoint 1, main () at dbtestframework.pas:42
42          FXMLResultsWriter.WriteHeader;
(gdb) p testResult
$1 = (^TTESTRESULT) 0x5b000
(gdb) p testResult^
$2 = {<TOBJECT> = {_vptr$ = {0x4eb6d8, 0x0}}, FRUNTESTS = 0, FFAILURES = 
0x6af30,
   FIGNOREDTESTS = 0x6b790, FERRORS = 0x6b7d0, FLISTENERS = 0x6b830, 
FSKIPPEDTESTS = 0x6b810,
   FSTARTINGTIME = 41030.043956875001}
(gdb) n
<testresults>
<testlisting>
44          GetTestRegistry.Run(testResult);
(gdb) s
TTESTSUITE__RUN (ARESULT=0x676f0, this=<error reading variable>)
     at ./fcl-fpcunit/src/fpcunit.pp:1027
1027    begin
(gdb) p ARESULT
$3 = (TTESTRESULT) 0x676f0
(gdb) p ARESULT^
$4 = {<TOBJECT> = {_vptr$ = {0x4eb750, 0x0}}, FRUNTESTS = 0, FFAILURES = 
0x67710,
   FIGNOREDTESTS = 0x0, FERRORS = 0x0, FLISTENERS = 0x1, FSKIPPEDTESTS = 
0xbaadf00d,
   FSTARTINGTIME = 8.2257045098914865e-309}
(gdb) p this
$5 = (TTESTSUITE) 0x676f0
(gdb) p this^
$6 = {<TTEST> = {<TOBJECT> = {_vptr$ = {0x4eb750, 0x0}}, FLASTSTEP = 
STSETUP}, FTESTS = 0x67710,
   FNAME = 0x0, FTESTSUITENAME = 0x0, FENABLEIGNORES = true}
(gdb)








More information about the fpc-devel mailing list