We all pretty much stick with the writeln debugger which ships standard with fpc. ;) Cliff
I just committed a fixed version of the compileroptions.pp file with all the C style += replaced with the Pascal version. So the -Sc compiler flag shouldn't be necessary any more.
At the same time, I found a problem. When you open the Compiler Options dialog and press the Apply (or OK) button, everything works just fine the first time. If you press either of those buttons a second time, it crashes Lazarus. I am not absolutely certain, but it appears to be a problem with the xmlcfg.pp or dom.pp unit in the fcl/xml directory. Here is what I have traced down so far.
In the compileroptions.pp file, there is a procedure called TCompilerOptions.SaveCompilerOptions. This procedure is called any time the Apply or OK buttons are pressed. I commented out all the lines in this function except just the first SetValue call. It is as follows:
xmlcfg.SetValue('CompilerOptions/Parsing/Style/Value', Style);Style is an Integer. I added a couple of writeln statements to the bottom of the SetValue method in the xmlcfg.pp file. Here is what the modified function looks like:
procedure TXMLConfig.SetValue(const APath, AValue: String);
var
node, subnode, attr: TDOMNode;
i: Integer;
name, path: String;
begin
node := doc.DocumentElement;
path := APath;
while True do begin
i := Pos('/', path);
if i = 0 then break;
name := Copy(path, 1, i - 1);
path := Copy(path, i + 1, Length(path));
subnode := node.FindNode(name);
if not Assigned(subnode) then begin
subnode := doc.CreateElement(name);
node.AppendChild(subnode);
end;
node := subnode;
end;
attr := node.Attributes.GetNamedItem(path);
if not Assigned(attr) then begin
attr := doc.CreateAttribute(path);
node.Attributes.SetNamedItem(attr);
end;
writeln('++++++++++++++++++++++++ attr.NodeValue := AValue = ' + AValue);
attr.NodeValue := AValue;
writeln('++++++++++++++++++++++++ attr.NodeValue := AValue finished.');
end;So the final writeln should be executed every time the Apply or OK button is pressed. The first time, it is, but the second time it isn't and it crashes on "attr.NodeValue := AValue;". Here are the results that were written out:
1st Apply:
[TControl.GetText] TEDIT got: "./ppc386.cfg"
[TControl.GetText] TEDIT got:
"/opt/fpc/rtl/i386;/opt/fpc/rtl/inc;/opt/fpc/rtl/linux;/opt/fpc/rtl/objpas;/opt/fpc/fcl/inc;/opt/fpc/fcl/linux;/opt/fpc/lazarus/lcl"
[TControl.GetText] TEDIT got:
"/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66"
[TControl.GetText] TEDIT got:
"/opt/fpc/rtl/linux;/opt/fpc/rtl;/opt/fpc/rtl/objpas;/opt/fpc/fcl/linux;/opt/fpc/gtk"
[TControl.GetText] TEDIT got: "/opt/fpc/ppc386"
++++++++++++++++++++++++ attr.NodeValue := AValue = 1
++++++++++++++++++++++++ attr.NodeValue := AValue finished.2nd Apply:
[TControl.GetText] TEDIT got: "./ppc386.cfg"
[TControl.GetText] TEDIT got:
"/opt/fpc/rtl/i386;/opt/fpc/rtl/inc;/opt/fpc/rtl/linux;/opt/fpc/rtl/objpas;/opt/fpc/fcl/inc;/opt/fpc/fcl/linux;/opt/fpc/lazarus/lcl"
[TControl.GetText] TEDIT got:
"/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66"
[TControl.GetText] TEDIT got:
"/opt/fpc/rtl/linux;/opt/fpc/rtl;/opt/fpc/rtl/objpas;/opt/fpc/fcl/linux;/opt/fpc/gtk"
[TControl.GetText] TEDIT got: "/opt/fpc/ppc386"
++++++++++++++++++++++++ attr.NodeValue := AValue = 1 An unhandled exception occurred at 0x08074299 :
EDOMHIERARCHYREQUEST in NodeWC.InsertBefore
0x08074299
0x00000000
It is interesting because the value is the same both times, but it is crashing the second time for some reason.
Can someone take a look at this and see if you can find out what is happening?
Curtis
