Sign in Join

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

Mailing lists / fpc-pascal / 2006-07

Source line numbers during execution

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Arí Ricardo Ody

I've tried to make programs generated by FPC inform the line number or exceptions in execution time and I can't.

I use fpc.cfg standard installed during Lazarus 0.9.16 installation and I put -CX -XX -gl after the name of the source in the FPC compilation.

May someone of you tell me a step-by-step script about what I must do to get source line numbers with execution exception messages?

Greetings from Sao Paulo - Brazil

Ricardo

P.S.: I've spent too much time debugging executables via Writeln...

Reply by email

Vincent Snijders
to Arí Ricardo Ody
Arí Ricardo Ody wrote 11 lines
I've tried to make programs generated by FPC inform the line number or exceptions in execution time and I can't. I use fpc.cfg standard installed during Lazarus 0.9.16 installation and I put -CX -XX -gl after the name of the source in the FPC compilation. May someone of you tell me a step-by-step script about what I must do to get source line numbers with execution exception messages? Greetings from Sao Paulo - Brazil

(Quickly typed in the editor, so not checked by the compiler) In LCL applications:

uses LCLProc;

...

procedure DoSomething;
begin
   try
     // your code here
   except
     DumpExceptionBackTrace;
   end;
end;

Vincent

Reply by email

Luiz Americo Pereira Camara
to Arí Ricardo Ody: I've tried to make programs generated by FPC inform the line number or exceptions in…
Arí Ricardo Ody wrote 16 lines
I've tried to make programs generated by FPC inform the line number or exceptions in execution time and I can't. I use fpc.cfg standard installed during Lazarus 0.9.16 installation and I put -CX -XX -gl after the name of the source in the FPC compilation. May someone of you tell me a step-by-step script about what I must do to get source line numbers with execution exception messages? Greetings from Sao Paulo - Brazil Ricardo P.S.: I've spent too much time debugging executables via Writeln...

You can try MultiLog. I has a SendCallStack function that sends the current call stack (when compiled with -gl) to a file or an external tool among others features.
See http://wiki.lazarus.freepascal.org/index.php/MultiLog

Luiz

Reply by email

Graeme Geldenhuys
to Luiz Americo Pereira Camara

Hi Luiz,

I had a look at the wiki site and that tools looks interesting. Does it work under Linux as well, or is it a Windows only app. Your only requirement on the wiki is Lazarus.

Regards,
Graeme.

Luiz Americo Pereira Camara wrote 6 lines
You can try MultiLog. I has a SendCallStack function that sends the current call stack (when compiled with -gl) to a file or an external tool among others features. See http://wiki.lazarus.freepascal.org/index.php/MultiLog Luiz
There's no place like 127.0.0.1

Reply by email

Luiz Americo Pereira Camara
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
Hi Luiz, I had a look at the wiki site and that tools looks interesting. Does it work under Linux as well, or is it a Windows only app. Your only requirement on the wiki is Lazarus.

It works under Linux, it uses Simpleipc for app comunication. I tested it in Ubuntu Dapper Drake. The only issues i am having are related in Know Issues section.

Luiz

Show quoted text 14 lines
Regards, Graeme. On 7/10/06, Luiz Americo Pereira Camara wrote: > You can try MultiLog. I has a SendCallStack function that sends the > current call stack (when compiled with -gl) to a file or an external > tool among others features. > See http://wiki.lazarus.freepascal.org/index.php/MultiLog > > Luiz

Reply by email

Graeme Geldenhuys
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote 5 lines
It works under Linux, it uses Simpleipc for app comunication. I tested it in Ubuntu Dapper Drake. The only issues i am having are related in Know Issues section. Luiz

Excellent! Thanks Luiz...

Graeme.

There's no place like 127.0.0.1

Reply by email

bartek
to Graeme Geldenhuys
Show quoted text 13 lines
On 7/11/06, Luiz Americo Pereira Camara wrote: > It works under Linux, it uses Simpleipc for app comunication. I tested > it in Ubuntu Dapper Drake. The only issues i am having are related in > Know Issues section. > > Luiz Excellent! Thanks Luiz... Graeme.

Don't know whether you can use it, but this is the function I use for my stack traces.

procedure csl_log(e: Exception);
var
  FrameCount:  integer;
  Frames:      PPointer;
  FrameNumber: integer;
begin
  csl_log(1, 'EXCEPTION   ' + e.message); // this csl_log simply is
csl_log(depth: integer; log: string); depth defines the indent in my log
  csl_log(0, 'Class: ' + e.ClassName);
  csl_log(1, 'Stack trace:');
  csl_log(0, BackTraceStrFunc(ExceptAddr));
  FrameCount := ExceptFrameCount;
  Frames := ExceptFrames;
  for FrameNumber := 0 to FrameCount - 1 do csl_log(0,
BackTraceStrFunc(Frames[FrameNumber]));
  csl_log(-1, 'done');
  csl_log(-1, 'catched');
end;

If anything can be made better, feel free to contact me.

bartek

Reply by email