astobj2: Add backtrace to log_bad_ao2.

* Compile __ast_assert_failed unconditionally.
* Use __ast_assert_failed to log messages from log_bad_ao2
* Remove calls to ast_assert(0) that happen after log_bad_ao2 was run.

Change-Id: I48f1af44b2718ad74a421ff75cb6397b924a9751
This commit is contained in:
Corey Farrell
2016-10-07 18:32:16 -04:00
parent f166681c12
commit dd873bcada
6 changed files with 42 additions and 37 deletions

View File

@@ -2437,17 +2437,16 @@ void DO_CRASH_NORETURN ast_do_crash(void)
#endif /* defined(DO_CRASH) */
}
#if defined(AST_DEVMODE)
void DO_CRASH_NORETURN __ast_assert_failed(int condition, const char *condition_str, const char *file, int line, const char *function)
{
/*
* Attempt to put it into the logger, but hope that at least
* someone saw the message on stderr ...
*/
ast_log(__LOG_ERROR, file, line, function, "FRACK!, Failed assertion %s (%d)\n",
condition_str, condition);
fprintf(stderr, "FRACK!, Failed assertion %s (%d) at line %d in %s of %s\n",
condition_str, condition, line, function, file);
ast_log(__LOG_ERROR, file, line, function, "FRACK!, Failed assertion %s (%d)\n",
condition_str, condition);
/* Generate a backtrace for the assert */
ast_log_backtrace();
@@ -2460,7 +2459,6 @@ void DO_CRASH_NORETURN __ast_assert_failed(int condition, const char *condition_
usleep(1);
ast_do_crash();
}
#endif /* defined(AST_DEVMODE) */
char *ast_eid_to_str(char *s, int maxlen, struct ast_eid *eid)
{