File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / mpd / src / assert.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Nov 1 09:56:12 2016 UTC (8 years, 1 month ago) by misho
Branches: mpd, MAIN
CVS tags: v5_8p7, v5_8p1_cross, v5_8p1, v5_8, HEAD
mpd 5.8


/*
 * assert.c
 *
 * Written by Archie Cobbs <archie@freebsd.org>
 * Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
 * See ``COPYRIGHT.whistle''
 */

#include "ppp.h"
#include "log.h"

void
DoAssert(const char *file, int line, const char *failedexpr)
{
#ifdef USE_BACKTRACE
  void	*buffer[100];
  char	**strings;
  int	n, k;

  n = backtrace(buffer, 100);
  strings = backtrace_symbols(buffer, n);
  if (strings == NULL) {
    Log(LG_ERR, ("No backtrace symbols found"));
  } else {
    for (k = 0; k < n; k++) {
      Log(LG_ERR, ("%s", strings[k]));
    }
    free(strings);
  }
#endif
  Log(LG_ERR, ("ASSERT \"%s\" failed: file \"%s\", line %d",
    failedexpr, file, line));

  DoExit(EX_ERRDEAD);
}


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>