apps/system/init: Add C++ terminate handler support#7143
apps/system/init: Add C++ terminate handler support#7143sunghan-chang merged 3 commits intoSamsung:masterfrom
Conversation
| static void __global_terminate_handler(void) | ||
| { | ||
| if (!IS_SECURE_STATE()) { | ||
| sched_lock(); |
There was a problem hiding this comment.
Please share your opinion that sched_lock is needed here or not
There was a problem hiding this comment.
In my opinion, sched_lock isn’t necessary.
However, if we’re going to handle it with PANIC() anyway, it seems worthwhile to ensure that this thread can operate without being preempted by other threads.
On the other hand, depending on the config, the system might not reset after a PANIC(), so it should be paired with sched_unlock.
21ca162 to
f48776f
Compare
|
@aashish-l @amandeep-samsung Could you review this? |
7bffa95 to
2c72f82
Compare
| if (!IS_SECURE_STATE()) { | ||
| sched_lock(); | ||
|
|
||
| #ifdef CONFIG_LIBCXX_EXCEPTION |
There was a problem hiding this comment.
How about using #if defined(CONFIG_LIBCXX_EXCEPTION) && defined(__EXCEPTIONS).
__EXCEPTIONS is defined when -fexceptions is enabled.
| { | ||
| printf("C++ terminate handler called! PID: %d\n", getpid()); | ||
| if (!IS_SECURE_STATE()) { | ||
| sched_lock(); |
There was a problem hiding this comment.
I have an one simple question, All log in try-catch must be printed out totally. can we guarantee it by sched_lock ?
There was a problem hiding this comment.
In SMP configuration, We can't.
If assert or panic occur on other core while terminate_handler printing logs, the log will be lost.
5df8dce to
b525ea4
Compare
This patch adds global terminate handler for unhandled C++ exceptions. The handler will print exception information and call PANIC() when an unhandled exception occurs. and Corrected a typo in `init.c`
artik055s/audio enables LIBCXX_EXCEPTION. but Make.defs does not accept that so fix the mismatching Make.defs and Exception handling requires newer toolchain version. so update defconfig to use 2.0.0 docker image.
…defconfig This PR does fetch for DOCKER version defined in corresponding defconfig file. and apply fetched DOCKER version for CI build configuration.
b525ea4 to
f40f488
Compare
This patch adds global terminate handler for unhandled C++ exceptions. The handler will print exception information and call PANIC() when an unhandled exception occurs.
and Corrected a typo in
init.cThis PR includes defconfig modification to fix CI build error.