[PATCH] GDB friendly assert
Andrew Cagney
ac131313@cygnus.com
Tue Oct 24 05:52:00 GMT 2000
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
More information about the Gdb-patches
mailing list