Re: [fpc-pascal] Program crash - read the error messages

2023-09-01 Thread Rainer Stratmann via fpc-pascal
Am Freitag, 1. September 2023, 18:46:06 CEST schrieb Peter B via fpc-pascal:
> Can you compile the crashing program with  -gl?

Yes, I can. I know this, but then the program is bigger. For finding the error 
it is useful, yes. Otherwise I switch it off. There are around 100 clients that 
download the program automatically.

> That should give you a useful stack dump with line numbers.
:-)


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Program crash - read the error messages

2023-09-01 Thread Rainer Stratmann via fpc-pascal
Am Freitag, 1. September 2023, 17:57:26 CEST schrieb Tomas Hajny via fpc-
pascal:
> On 2023-09-01 17:39, Rainer Stratmann via fpc-pascal wrote:
> > Ah, sorry. I Forgot it totally.
> > 
> > It is a plain console program under Linux.
> > 
> > Yes, the remaining program starts the crashing one and I would like to
> > check
> > the results? Yes, a run-time error was there.
> > 
> > I start the program with a console command.
> > 
> > An unhandled exception occured at $0814EC41:
> > EAccessViolation:  Access violation
> > 
> >   $0814EC41
> >   ...
> >   ...
> >   ...
> > 
> > This messages I need to read automatically
> 
> OK. You still missed to provide information on how you start the
> crashing program from the remaining program

Look above.
> > I start the program with a console command.
More precisely: I start the crashing program with a shell command from the 
remaining program.

Everything runs as root. These are more or less the only programs on this 
(mini-itx embedded) computer running. I have full control then.

> - certain approaches don't
> allow simple access to the result (e.g. checking whether it's still
> running or accessing the process exit code), whereas others do. However,
> in general, you need to redirect the output and stderr handles (e.g. to
> a pipe if doing it under Linux, but a file would do as well) and read
> them from the remaining program. As an example, TProcess (in unit
> Process) provides means for all of this.

If I start the program with

program 2>output.txt

it works! Thank you.

> 
> Tomas
> 
> > Am Freitag, 1. September 2023, 16:13:54 CEST schrieb Tomas Hajny via
> > fpc-
> > 
> > pascal:
> >> On 2023-09-01 15:43, Rainer Stratmann via fpc-pascal wrote:
> >> 
> >> 
> >> Hello,
> >> 
> >> > Where can I find the output of the error messages if a program crashes.
> >> > 
> >> > There is another program that still is running.
> >> > I want to read the error messages automatically if that is possible.
> >> 
> >> I'm afraid that we'd need a bit more information on what is your
> >> situation and what you try to achieve. In particular:
> >> 
> >> 1) What kind of an application is your program (console, GUI, ...),
> >> under which operating system?
> >> 
> >> 2) You mention that there is another program that is still running -
> >> do
> >> you mean that the remaining program starts the crashing one and you
> >> would like to check the results? If this is the case, how you start
> >> the
> >> program (Dos.Exec, SysUtils.ExecuteProcess, Process.TProcess, ...)?
> >> 
> >> 3) What do you mean if you say "crashes" - a run-time error? Or a GUI
> >> message box stating that the program crashed? Or...?
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Program crash - read the error messages

2023-09-01 Thread Peter B via fpc-pascal

Can you compile the crashing program with  -gl    ?

That should give you a useful stack dump with line numbers.




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Program crash - read the error messages

2023-09-01 Thread Tomas Hajny via fpc-pascal

On 2023-09-01 17:39, Rainer Stratmann via fpc-pascal wrote:

Ah, sorry. I Forgot it totally.

It is a plain console program under Linux.

Yes, the remaining program starts the crashing one and I would like to 
check

the results? Yes, a run-time error was there.

I start the program with a console command.

An unhandled exception occured at $0814EC41:
EAccessViolation:  Access violation
  $0814EC41
  ...
  ...
  ...

This messages I need to read automatically


OK. You still missed to provide information on how you start the 
crashing program from the remaining program - certain approaches don't 
allow simple access to the result (e.g. checking whether it's still 
running or accessing the process exit code), whereas others do. However, 
in general, you need to redirect the output and stderr handles (e.g. to 
a pipe if doing it under Linux, but a file would do as well) and read 
them from the remaining program. As an example, TProcess (in unit 
Process) provides means for all of this.


Tomas





Am Freitag, 1. September 2023, 16:13:54 CEST schrieb Tomas Hajny via 
fpc-

pascal:

On 2023-09-01 15:43, Rainer Stratmann via fpc-pascal wrote:


Hello,

> Where can I find the output of the error messages if a program crashes.
>
> There is another program that still is running.
> I want to read the error messages automatically if that is possible.

I'm afraid that we'd need a bit more information on what is your
situation and what you try to achieve. In particular:

1) What kind of an application is your program (console, GUI, ...),
under which operating system?

2) You mention that there is another program that is still running - 
do

you mean that the remaining program starts the crashing one and you
would like to check the results? If this is the case, how you start 
the

program (Dos.Exec, SysUtils.ExecuteProcess, Process.TProcess, ...)?

3) What do you mean if you say "crashes" - a run-time error? Or a GUI
message box stating that the program crashed? Or...?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Program crash - read the error messages

2023-09-01 Thread Marco van de Voort via fpc-pascal



On 1-9-2023 15:43, Rainer Stratmann via fpc-pascal wrote:

Where can I find the output of the error messages if a program crashes.

There is another program that still is running.
I want to read the error messages automatically if that is possible.


How do you start it? TProcess, Runcommand have piping options.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Program crash - read the error messages

2023-09-01 Thread Rainer Stratmann via fpc-pascal
Ah, sorry. I Forgot it totally.

It is a plain console program under Linux.

Yes, the remaining program starts the crashing one and I would like to check 
the results? Yes, a run-time error was there.

I start the program with a console command.

An unhandled exception occured at $0814EC41:
EAccessViolation:  Access violation
  $0814EC41
  ...
  ...
  ...

This messages I need to read automatically

Am Freitag, 1. September 2023, 16:13:54 CEST schrieb Tomas Hajny via fpc-
pascal:
> On 2023-09-01 15:43, Rainer Stratmann via fpc-pascal wrote:
> 
> 
> Hello,
> 
> > Where can I find the output of the error messages if a program crashes.
> > 
> > There is another program that still is running.
> > I want to read the error messages automatically if that is possible.
> 
> I'm afraid that we'd need a bit more information on what is your
> situation and what you try to achieve. In particular:
> 
> 1) What kind of an application is your program (console, GUI, ...),
> under which operating system?
> 
> 2) You mention that there is another program that is still running - do
> you mean that the remaining program starts the crashing one and you
> would like to check the results? If this is the case, how you start the
> program (Dos.Exec, SysUtils.ExecuteProcess, Process.TProcess, ...)?
> 
> 3) What do you mean if you say "crashes" - a run-time error? Or a GUI
> message box stating that the program crashed? Or...?
> 
> Tomas
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Program crash - read the error messages

2023-09-01 Thread Tomas Hajny via fpc-pascal

On 2023-09-01 15:43, Rainer Stratmann via fpc-pascal wrote:


Hello,


Where can I find the output of the error messages if a program crashes.

There is another program that still is running.
I want to read the error messages automatically if that is possible.


I'm afraid that we'd need a bit more information on what is your 
situation and what you try to achieve. In particular:


1) What kind of an application is your program (console, GUI, ...), 
under which operating system?


2) You mention that there is another program that is still running - do 
you mean that the remaining program starts the crashing one and you 
would like to check the results? If this is the case, how you start the 
program (Dos.Exec, SysUtils.ExecuteProcess, Process.TProcess, ...)?


3) What do you mean if you say "crashes" - a run-time error? Or a GUI 
message box stating that the program crashed? Or...?


Tomas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Program crash - read the error messages

2023-09-01 Thread Rainer Stratmann via fpc-pascal
Where can I find the output of the error messages if a program crashes.

There is another program that still is running.
I want to read the error messages automatically if that is possible.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal