Annotation of embedaddon/mpd/src/assert.c, revision 1.1.1.2
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"
12:
13: void
14: DoAssert(const char *file, int line, const char *failedexpr)
15: {
1.1.1.2 ! misho 16: #ifdef USE_BACKTRACE
! 17: void *buffer[100];
! 18: char **strings;
! 19: int n, k;
! 20:
! 21: n = backtrace(buffer, 100);
! 22: strings = backtrace_symbols(buffer, n);
! 23: if (strings == NULL) {
! 24: Log(LG_ERR, ("No backtrace symbols found"));
! 25: } else {
! 26: for (k = 0; k < n; k++) {
! 27: Log(LG_ERR, ("%s", strings[k]));
! 28: }
! 29: free(strings);
! 30: }
! 31: #endif
1.1 misho 32: Log(LG_ERR, ("ASSERT \"%s\" failed: file \"%s\", line %d",
33: failedexpr, file, line));
1.1.1.2 ! misho 34:
1.1 misho 35: DoExit(EX_ERRDEAD);
36: }
37:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>