This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] GDB friendly assert


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]