How would you tell if wine crashed programmatically?

Questions about Wine on Linux
Locked
JordanPlayz158
Newbie
Newbie
Posts: 4
Joined: Sat Mar 19, 2022 7:02 pm

How would you tell if wine crashed programmatically?

Post by JordanPlayz158 »

I have checked this guide https://wiki.winehq.org/Wine_Developer% ... gging_Wine but did not see any way to do this and used the search function with 0 results, I'd presume you can check how wine exited with winedbg but I don't see a section for that specifically, is there a way to do that as we need to see if wine exited normally, crashed, etc and then based on that information, do things like notify the user to check and submit logs.
madewokherd
Level 4
Level 4
Posts: 149
Joined: Mon Jun 02, 2008 5:03 pm

Re: How would you tell if wine crashed programmatically?

Post by madewokherd »

I think you would have to modify or replace winedbg. Or do it less perfectly by scanning logs.
JordanPlayz158
Newbie
Newbie
Posts: 4
Joined: Sat Mar 19, 2022 7:02 pm

Re: How would you tell if wine crashed programmatically?

Post by JordanPlayz158 »

Oh, so no way exists currently to check if a wine program has crashed, wine doesn't exit with a nonstandard exit code (i.e other than 0) or there isn't a command to check, is there a concrete log message when a wine program crashes, at the end of it's execution? I believe there is text but I don't think it's consistent, but i'll look into that avenue next.
madewokherd
Level 4
Level 4
Posts: 149
Joined: Mon Jun 02, 2008 5:03 pm

Re: How would you tell if wine crashed programmatically?

Post by madewokherd »

Well, a single Wine process crashing doesn't necessarily mean the program you directly called will exit, and it appears the return code is determined by the exception code.

You can look for "wine: %s (thread %04lx), starting debugger..\n" from the start_debugger function.
JordanPlayz158
Newbie
Newbie
Posts: 4
Joined: Sat Mar 19, 2022 7:02 pm

Re: How would you tell if wine crashed programmatically?

Post by JordanPlayz158 »

Well that sounds perfect, we can check if the return code is one of the exception codes or perhaps not the default return code and then know if it crashed, will look into it and thank you for the help!
madewokherd
Level 4
Level 4
Posts: 149
Joined: Mon Jun 02, 2008 5:03 pm

Re: How would you tell if wine crashed programmatically?

Post by madewokherd »

One problem with checking the return value is that on Linux return values range from 0-255 while Windows has them as 32-bit values (you'd need to start the program from a Wine process to get the full return value). Also, the application could return any value under normal circumstances, and if the developer didn't specify one in C it's effectively random.
JordanPlayz158
Newbie
Newbie
Posts: 4
Joined: Sat Mar 19, 2022 7:02 pm

Re: How would you tell if wine crashed programmatically?

Post by JordanPlayz158 »

First off, thank you for the information about return code limits on Linux vs Windows, didn't even consider that (what happens when it's 256 or -1, does it get rounded accordingly to 255 and 0?), also, didn't think about developers returning nonstandard ones on success, isn't 0 regarded as the good/default error code meaning no errors, also who worked on C thought it'd be a good idea to make the exit code random if not specified, unless by effectively you didn't really mean like an RNG thing and then it spits that out, but if it spits out 0 if non specified, that is fine but if it's random, I am questioning why people think C is a good language or what the people who worked on C were thinking.
madewokherd
Level 4
Level 4
Posts: 149
Joined: Mon Jun 02, 2008 5:03 pm

Re: How would you tell if wine crashed programmatically?

Post by madewokherd »

Not sure about return values, but I think it just takes the lower 8 bits.

I should've just said "undefined". A C developer might declare their main method as "void main" or leave out the return statement. In practice it probably means whatever was in some hardware register when it returned.
Locked