diff options
author | RalphNiemeyer <rniemeyer@de.adit-jv.com> | 2017-03-23 10:02:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-23 10:02:50 +0100 |
commit | 84c35df786d30b5fe7828b8400fe7b0d6c087138 (patch) | |
tree | f12e9eed3f87cea332667c5c2825925fd2c5b20c /src | |
parent | 49d5962d3960eabc989796d4e3236a55c14618e6 (diff) | |
parent | fc91110918e948b006fdd18d9851a95c00fc95c3 (diff) | |
download | DLT-daemon-84c35df786d30b5fe7828b8400fe7b0d6c087138.tar.gz |
Merge pull request #6 from clipka/devel_fatal_trap
CMake Option: Trigger segmentation fault in case of FATAL log
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/dlt_user.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c index 0b00070..713bea3 100644 --- a/src/lib/dlt_user.c +++ b/src/lib/dlt_user.c @@ -63,6 +63,18 @@ #include "dlt_user_shared_cfg.h" #include "dlt_user_cfg.h" +#ifdef DLT_FATAL_LOG_RESET_ENABLE +#define DLT_LOG_FATAL_RESET_TRAP(LOGLEVEL) \ + do { \ + if (LOGLEVEL == DLT_LOG_FATAL) { \ + int *p = NULL; \ + *p = 0; \ + } \ + } while(0) +#else /* DLT_FATAL_LOG_RESET_ENABLE */ +#define DLT_LOG_FATAL_RESET_TRAP(LOGLEVEL) +#endif /* DLT_FATAL_LOG_RESET_ENABLE */ + static DltUser dlt_user; static bool dlt_user_initialised = false; static int dlt_user_freeing = 0; @@ -1420,6 +1432,8 @@ inline DltReturnValue dlt_user_log_write_start(DltContext *handle, DltContextDat DltReturnValue dlt_user_log_write_start_id(DltContext *handle, DltContextData *log, DltLogLevelType loglevel, uint32_t messageid) { + DLT_LOG_FATAL_RESET_TRAP(loglevel); + // check nullpointer if (handle == NULL || log == NULL) return DLT_RETURN_WRONG_PARAMETER; |