Sign in Join

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

Mailing lists / fpc-pascal / 2013-03

Get error information

9 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Rainer Stratmann

Is it possible to collect the error information when a program crashes?

OS: Linux

One program starts the program that crashes sometines. If the 2nd program crashes it goes back to the 1st program wich calls the 2nd program.

It would be good if the 1st program can collect automatically somehow the information which is on the screen.

Rainer Stratmann
to leledumbo
leledumbo wrote
If the 2nd program is FPC program and is compiled with -gl, then upon crash StdErr will contain the runtime erorr information. 1st program can read that when the 2nd program dies.

Yes, I know some kind of that, but I need the whole error messages. For example which lines the crash was and the positions in the source file.

Rainer Stratmann
to leledumbo
leledumbo wrote
You'll get it if you do as I say (compile 2nd program with -gl, up to all units you want the error line information from)

Ok, sorry I misunderstood. I thought you ment the error number. Thanks.

How can I access the information stderr contains?

Rainer Stratmann
to leledumbo: If the 2nd program is FPC program and is compiled with -gl, then upon crash StdErr will…
leledumbo wrote
If the 2nd program is FPC program and is compiled with -gl, then upon crash StdErr will contain the runtime erorr information. 1st program can read that when the 2nd program dies.

How to read the information?
Ist stderr equal with /dev/stderr ?

I got the information on the development computer.

But the software runs also on embedded computers (http://linux.voyage.hk/) where I did not get the information. That's why I ask if there are may ceveral ways to get the error information.

leledumbo
to Rainer Stratmann
How to read the information?

You can take a look at the wiki article Executing External Programs, substituting Output property with StdErr. Or if you use FPC 2.7.1, you can see how RunCommand*** functions are implemented. Same as above article, subsitute Output with StdErr.

Ist stderr equal with /dev/stderr ?

No idea.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Get-error-information-tp5713366p5713407.html Sent from the Free Pascal - General mailing list .