El 15/7/20 a les 17:31, Luca Olivetti via lazarus ha escrit:
El 15/7/20 a les 17:20, Luca Olivetti via lazarus ha escrit:
Hello,

something broke in sdfdataset with fpc 3.2.0 (a segfault that doesn't occur if I compile the same program with fpc 3.0.4) and I'm trying to debug it.

First I tried to compile just the fcl with debug information

cd fpc-3.2.0/packages
OPT=-gl make
sudo make install

[...]

Any hint?

The optimization! I had to use "-g -gl -O-" to get the full call stack.


For the record, the segfault happens here


#0 SYSGETMEM_FIXED(544) at ../inc/heap.inc:963

The memory is hosed, I still don't know why.
I managed to reproduce the problem with a simple lazarus program, however a plain pascal program that does the same doesn't trigger the it.

I'm attaching the lazarus project as well as the simple pascal program if somebody could look into it...


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
program sdfsegfault;

{$R *.res}
uses Classes, sysutils,sdfdata;
procedure ClearData(dataset:TSdfDataset);
var st:TStringStream;
begin
  st:=TStringStream.Create('');
  dataset.LoadFromStream(st);
  st.free;
end;

procedure LoadData(dataset:TSdfDataset);

var
  x, f: Integer;
begin
  for x:=1 to 10 do
  begin
    dataset.append;
    for f:=0 to Dataset.Fields.Count-1 do
      DataSet.Fields[f].AsString:='ABC';
    DataSet.Post;
  end;
end;

var ds:TSdfDataSet;
begin
  ds:=TSdfDataSet.Create(nil);
  with ds do
  begin
    FileMustExist:=true;
    ReadOnly:=false;
    Filename:='dummy';
    Schema.Add('TMA');
    Schema.Add('VISUALIZAR');
    AllowMultiLine:=false;
    Delimiter:=',';
    FirstLineAsSchema:=False;
    StripTrailingDelimiters:=False;
  end;
  ClearData(ds);
  LoadData(ds);
  ds.Free;
end.

<<attachment: project1.zip>>

-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to