Source line numbers during execution

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Source line numbers during execution

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...

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Source line numbers during execution

Vincent Snijders
Arí Ricardo Ody wrote:

> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Source line numbers during execution

Luiz Americo Pereira Camara-2
In reply to this post by Arí Ricardo Ody
Arí Ricardo Ody escreveu:

> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Source line numbers during execution

Graeme Geldenhuys-2
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.



On 7/10/06, Luiz Americo Pereira Camara <[hidden email]> 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


--
There's no place like 127.0.0.1
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Source line numbers during execution

Luiz Americo Pereira Camara-2
Graeme Geldenhuys escreveu:
> 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

> Regards,
>  Graeme.
>
>
>
> On 7/10/06, Luiz Americo Pereira Camara <[hidden email]> 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
>
>

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Source line numbers during execution

Graeme Geldenhuys-2
On 7/11/06, Luiz Americo Pereira Camara <[hidden email]> 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.


--
There's no place like 127.0.0.1
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Source line numbers during execution

Bartek-9
Graeme Geldenhuys schrieb:

> On 7/11/06, Luiz Americo Pereira Camara <[hidden email]> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal