This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] GDB friendly assert
- To: Mark Kettenis <kettenis at wins dot uva dot nl>
- Subject: Re: [PATCH] GDB friendly assert
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Tue, 24 Oct 2000 23:46:47 +1100
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <200009031729.e83HTgg00915@delius.kettenis.local>
Mark Kettenis wrote:
>
> FYI, I have checked in a GDB-friendly replacement for <assert.h>. So
> now you can use assertions all over your code without unconditionally
> crashing GDB when an assertion is tripped. Simply use gdb_assert()
> where you traditionally assert(). It calls internal_error(), so the
> user gets the option of exiting GDB (with or without core dump) or
> continuing the session.
>
> Since gdb_assert() is modelled after the glibc assert(), it also
> prints the name of the function that contains the assertion if GDB was
> compiled with GCC or an ISO C99 compiler.
>
> I think I addressed the objections that Andrew had with the proposal I
> posted some time ago (I changed the name into gdb_assert() and
> assert_perror() is gone, it isn't useful for GDB).
>
> Mark
>
> 2000-09-03 Mark Kettenis <kettenis@gnu.org>
>
> * gdb_assert.h: New file.
Thanks! Good move.
My only (A.R.) thought is to make the macro upper case so it is very
clear to developers that they are using a MACRO and not a function.
Andrew