Annotation of embedaddon/mpd/src/assert.c, revision 1.1.1.3
1.1 misho 1:
2: /*
3: * assert.c
4: *
5: * Written by Archie Cobbs <archie@freebsd.org>
6: * Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
7: * See ``COPYRIGHT.whistle''
8: */
9:
10: #include "ppp.h"
11: #include "log.h"
1.1.1.3 ! misho 12: #ifdef USE_BACKTRACE
! 13: #include <execinfo.h>
! 14: #endif
1.1 misho 15:
16: void
17: DoAssert(const char *file, int line, const char *failedexpr)
18: {
1.1.1.2 misho 19: #ifdef USE_BACKTRACE
1.1.1.3 ! misho 20: void *buffer[100];
! 21: char **strings;
! 22: int n, k;
1.1.1.2 misho 23:
1.1.1.3 ! misho 24: n = backtrace(buffer, 100);
! 25: strings = backtrace_symbols(buffer, n);
! 26: if (strings == NULL) {
! 27: Log(LG_ERR, ("No backtrace symbols found"));
! 28: } else {
! 29: for (k = 0; k < n; k++) {
! 30: Log(LG_ERR, ("%s", strings[k]));
! 31: }
! 32: free(strings);
! 33: }
1.1.1.2 misho 34: #endif
1.1.1.3 ! misho 35: Log(LG_ERR, ("ASSERT \"%s\" failed: file \"%s\", line %d",
! 36: failedexpr, file, line));
1.1.1.2 misho 37:
1.1.1.3 ! misho 38: DoExit(EX_ERRDEAD);
1.1 misho 39: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>