Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-04

Multilog exception tracing

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bogusław Brandys

Hi,

I found a bug in multilog code used by SendException. Exception was no correctly send with stack trace (no source line informations) The problem in my case may be due to encoding,I used example attached to multilog package (encoding UTF8) while multilog using is at CP1250 in my case.

Anyway,changing AStream.Write into AStream.WriteBuffer resolved problem

Look at code below:

procedure TLogger.SendBuffer(AMsgType: Integer; const AText: String;
   var Buffer; Count: LongWord);
var
   AStream: TStream;
begin
   if Count > 0 then
   begin
     AStream:=TMemoryStream.Create;
     AStream.WriteBuffer(Buffer,Count);
//    AStream.Write(Buffer,Count);
   end
   else
     AStream:=nil;
   //SendStream free AStream
   SendStream(AMsgType,AText,AStream);
end;

Best regards
Boguslaw

Reply by email

Bogusław Brandys
to Bogusław Brandys

Bogus?aw Brandys pisze:

Show quoted text 38 lines
Hi, I found a bug in multilog code used by SendException. Exception was no correctly send with stack trace (no source line informations) The problem in my case may be due to encoding,I used example attached to multilog package (encoding UTF8) while multilog using is at CP1250 in my case. Anyway,changing AStream.Write into AStream.WriteBuffer resolved problem Look at code below: procedure TLogger.SendBuffer(AMsgType: Integer; const AText: String; var Buffer; Count: LongWord); var AStream: TStream; begin if Count > 0 then begin AStream:=TMemoryStream.Create; AStream.WriteBuffer(Buffer,Count); // AStream.Write(Buffer,Count); end else AStream:=nil; //SendStream free AStream SendStream(AMsgType,AText,AStream); end; Best regards Boguslaw _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

I see that problem is deeper. It has a source in problem of avoiding infinite recursion while generating stack trace.
The nasty result is that you cannot generate more then one stack trace per program execution ! I mean stack trace with full source/line information :-(

Problem lies inside lineinfo unit.

Any clues ?

Best regards
Boguslaw

Reply by email