FWGS / hlsdk-portable

Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
https://xash.su
Other
273 stars 126 forks source link

Show message box when crash happens in client or server library built in Debug mode #487

Open FreeSlave opened 4 days ago

FreeSlave commented 4 days ago

I wonder if it's possible, at least on Windows. I remember in the past seeing "has stopped working" message in some applications and if VS is installed it even suggested I take a look in the debugger. But I'm not sure what enables or disables such behavior and whether it could show the problematic code line.

If it shows the problematic line in the message box, it would help to track down the crashes when user encounters any that are hard to replicate them from the dev side. Just let the user download the Debug build, reproduce the bug and make the screenshot of the message.

a1batross commented 4 days ago

In Xash we're just setting up a crash handler, unwind the stack and pass it to dbghelp.dll functions on Windows.

If it can find PDB and system-wide dbghelp.dll can decode it, it will show the file and line info.

a1batross commented 4 days ago

I remember in the past seeing "has stopped working" message in some applications and if VS is installed it even suggested I take a look in the debugger

It also probably shown only if application doesn't setups custom crashhandler. GoldSrc probably does it, because, at least on Linux, it shows some lines about breakpad, which is a crash data collection library.

FreeSlave commented 4 days ago

I introduced the intentional segfault in my code, but Half-Life just closes without any message box on Windows.

It does produce a .dmp file in AppData/Local/CrashDumps though.

a1batross commented 4 days ago

Yeah, that looks like a breakpad