Comments on: Crash Handling https:/code-sample/crash-handling/ Developer resources for the X-Plane flight simulator Wed, 27 Apr 2022 20:22:48 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: Tomasz https:/code-sample/crash-handling/#comment-41273 Wed, 27 Apr 2022 20:22:48 +0000 http://developer.x-plane.com/?post_type=code-sample&p=39932#comment-41273 This example doen’t compile on Linux. It uses C99 feature “designated initializers” that is not avaliable in CPP.

root# make
mkdir -p build/obj64/
g++ -DXPLM200=1 -DXPLM210=1 -DXPLM300=1 -DXPLM301=1 -DXPLM302=1 -DXPLM303=1 -DAPL=0 -DIBM=0 -DLIN=1 -I./SDK/CHeaders/XPLM -I./SDK/CHeaders/Widgets -fPIC -fvisibility=hidden -m64 -c Crash-Handling.cpp -o build/obj64/Crash-Handling.o
Crash-Handling.cpp: In function ‘void register_crash_handler()’:
Crash-Handling.cpp:98:34: error: expected primary-expression before ‘.’ token
98 | struct sigaction sig_action = { .sa_sigaction = handle_posix_sig };
| ^
Crash-Handling.cpp:108:2: error: designator order for field ‘stack_t::ss_flags’ does not match declaration order in ‘stack_t’
108 | };
| ^
Crash-Handling.cpp: In function ‘void handle_posix_sig(int, siginfo_t*, void*)’:
Crash-Handling.cpp:212:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
212 | handle_crash((void *)sig);
| ^~~
make: *** [Makefile:66: build/obj64/Crash-Handling.o] Error 1

]]>
By: Folko https:/code-sample/crash-handling/#comment-37892 Wed, 15 Jul 2020 19:37:59 +0000 http://developer.x-plane.com/?post_type=code-sample&p=39932#comment-37892 Hint: If you’re using gcc on Windows instead of Visual Studio, here’s a special version of gdb that can read the DMP files and use the gcc debug symbols in your XPL. It can also show the backtrace and some other stuff: https://github.com/ssbssa/gdb/releases

]]>
By: Ben Supnik https:/code-sample/crash-handling/#comment-37457 Sun, 14 Jun 2020 20:28:49 +0000 http://developer.x-plane.com/?post_type=code-sample&p=39932#comment-37457 In reply to Peter Buckner.

It is not a suggestion that you add crash handling; it provides examples and guidelines so that if you _do_ provide crash handling, you do so in a way that doesn’t interfere with everyone else’s crash handling.

It is not meant to be illustrative of signal handling in general – your plugin should not be using posix signals, except as shown here to catch seg faults.

]]>
By: Peter Buckner https:/code-sample/crash-handling/#comment-37454 Sun, 14 Jun 2020 14:50:57 +0000 http://developer.x-plane.com/?post_type=code-sample&p=39932#comment-37454 Is this a suggestion that plugin developers add similar crash detection into their plugins, or is this just meant to be illustrative of signal handling?

]]>