Code Search for Developers
 
 
  

assert.cc from Gdb at Krugle


Show assert.cc syntax highlighted

/* assert.cc: Handle the assert macro for WIN32.

   Copyright 1997, 1998, 2000, 2001 Red Hat, Inc.

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details. */

#include "winsup.h"
#include "security.h"
#include <wingdi.h>
#include <winuser.h>

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>

/* This function is called when the assert macro fails.  This will
   override the function of the same name in newlib.  */

extern "C" void
__assert (const char *file, int line, const char *failedexpr)
{
  HANDLE h;

  /* If we don't have a console in a Windows program, then bring up a
     message box for the assertion failure.  */

  h = CreateFile ("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, &sec_none_nih,
		  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  if (h == INVALID_HANDLE_VALUE)
    {
      char *buf;

      buf = (char *) alloca (100 + strlen (failedexpr));
      __small_sprintf (buf, "Failed assertion\n\t%s\nat line %d of file %s",
		failedexpr, line, file);
      MessageBox (NULL, buf, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
    }
  else
    {
      CloseHandle (h);
      small_printf ("assertion \"%s\" failed: file \"%s\", line %d\n",
		    failedexpr, file, line);
    }

#ifdef DEBUGGING
  try_to_debug ();
#endif
  abort ();	// FIXME: Someday this should work.

  /* NOTREACHED */
}




See more files for this project here

Gdb

GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed.

Project homepage: http://sources.redhat.com/gdb/
Programming language(s): Assembly,C,C++,Expect
License: other

  config/
  include/
  lib/
  libc/
  regex/
  regexp/
  CYGWIN_LICENSE
  ChangeLog
  ChangeLog-1995
  ChangeLog-1996
  ChangeLog-1997
  ChangeLog-1998
  ChangeLog-1999
  ChangeLog-2000
  ChangeLog-2001
  ChangeLog-2002
  ChangeLog-2003
  ChangeLog-2004
  ChangeLog-2005
  ChangeLog-2006
  Makefile.in
  ROADMAP
  acconfig.h
  aclocal.m4
  analyze_sigfe
  ansi.sgml
  assert.cc
  autoload.cc
  automode.c
  binmode.c
  child_info.h
  config.h.in
  configure
  configure.in
  cpuid.h
  crt0.c
  ctype.cc
  cxx.cc
  cygerrno.h
  cygheap.cc
  cygheap.h
  cyglsa.h
  cygmagic
  cygmalloc.h
  cygserver.h
  cygserver_ipc.h
  cygserver_msg.h
  cygserver_sem.h
  cygserver_shm.h
  cygthread.cc
  cygthread.h
  cygtls.cc
  cygtls.h
  cygwin-shilka
  cygwin.din
  cygwin.sc
  cygwin_version.h
  dcrt0.cc
  debug.cc
  debug.h
  delqueue.cc
  devices.cc
  devices.h
  devices.in
  dir.cc
  dlfcn.cc
  dll_init.cc
  dll_init.h
  dll_init.sgml
  dllfixdbg
  dlmalloc.c
  dlmalloc.h
  dtable.cc
  dtable.h
  dtable.sgml
  environ.cc
  environ.h
  errno.cc
  exceptions.cc
  exec.cc
  external.cc
  external.sgml
  fcntl.cc
  fhandler.cc
  fhandler.h
  fhandler_clipboard.cc
  fhandler_console.cc
  fhandler_disk_file.cc
  fhandler_dsp.cc
  fhandler_fifo.cc
  fhandler_floppy.cc
  fhandler_mailslot.cc
  fhandler_mem.cc
  fhandler_netdrive.cc
  fhandler_nodevice.cc
  fhandler_proc.cc
  fhandler_process.cc
  fhandler_procnet.cc
  fhandler_random.cc
  fhandler_raw.cc
  fhandler_registry.cc
  fhandler_serial.cc
  fhandler_socket.cc
  fhandler_tape.cc
  fhandler_termios.cc
  fhandler_tty.cc
  fhandler_virtual.cc
  fhandler_windows.cc
  fhandler_zero.cc
  flock.cc
  fork.cc
  gcrt0.c
  gendef
  gendevices
  gentls_offsets
  glob.cc
  gmon.c
  gmon.h
  grp.cc
  heap.cc
  heap.h
  hires.h
  hookapi.cc
  how-autoload-works.txt
  how-cygheap-works.txt