summaryrefslogtreecommitdiff
path: root/main/astobj2.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2016-09-16 19:54:07 -0400
committerCorey Farrell <git@cfware.com>2016-09-30 19:25:40 -0400
commit2a03575c30b96ab23e75822c3b256fa0cb591aaa (patch)
treede4f50f0fe625ed866efd337b5f60f8c711a1f52 /main/astobj2.c
parent224c2952922d769af2d0e77da5612b8b7a649b42 (diff)
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
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 604e6a1ae..72bfcc819 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -178,22 +178,17 @@ int internal_is_ao2_object(void *user_data)
void log_bad_ao2(void *user_data, const char *file, int line, const char *func)
{
struct astobj2 *p;
+ char bad_magic[100];
if (!user_data) {
- ast_log(__LOG_ERROR, file, line, func, "user_data is NULL\n");
+ __ast_assert_failed(0, "user_data is NULL", file, line, func);
return;
}
p = INTERNAL_OBJ(user_data);
- if (p->priv_data.magic) {
- ast_log(__LOG_ERROR, file, line, func,
- "bad magic number 0x%x for object %p\n",
- p->priv_data.magic, user_data);
- } else {
- ast_log(__LOG_ERROR, file, line, func,
- "bad magic number for object %p. Object is likely destroyed.\n",
- user_data);
- }
+ snprintf(bad_magic, sizeof(bad_magic), "bad magic number 0x%x for object %p",
+ p->priv_data.magic, user_data);
+ __ast_assert_failed(0, bad_magic, file, line, func);
}
int __ao2_lock(void *user_data, enum ao2_lock_req lock_how, const char *file, const char *func, int line, const char *var)
@@ -205,7 +200,6 @@ int __ao2_lock(void *user_data, enum ao2_lock_req lock_how, const char *file, co
int res = 0;
if (obj == NULL) {
- ast_assert(0);
return -1;
}
@@ -269,7 +263,6 @@ int __ao2_unlock(void *user_data, const char *file, const char *func, int line,
int current_value;
if (obj == NULL) {
- ast_assert(0);
return -1;
}
@@ -323,7 +316,6 @@ int __ao2_trylock(void *user_data, enum ao2_lock_req lock_how, const char *file,
int res = 0;
if (obj == NULL) {
- ast_assert(0);
return -1;
}
@@ -454,7 +446,6 @@ void *ao2_object_get_lockaddr(void *user_data)
obj = INTERNAL_OBJ_CHECK(user_data);
if (obj == NULL) {
- ast_assert(0);
return NULL;
}
@@ -486,7 +477,6 @@ int __ao2_ref(void *user_data, int delta,
user_data, delta, ast_get_tid(), file, line, func, tag ?: "");
fflush(ref_log);
}
- ast_assert(0);
return -1;
}