This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: internal_error() change + abort()
- To: ac131313 at cygnus dot com
- Subject: Re: RFC: internal_error() change + abort()
- From: Eli Zaretskii <eliz at delorie dot com>
- Date: Mon, 24 Jul 2000 01:55:53 -0400 (EDT)
- CC: gdb-patches at sourceware dot cygnus dot com
- References: <397BA3FB.51AE0049@cygnus.com>
- Reply-to: Eli Zaretskii <eliz at is dot elta dot co dot il>
> Date: Mon, 24 Jul 2000 12:03:39 +1000
> From: Andrew Cagney <ac131313@cygnus.com>
>
> Now that we've moved to ISO-C we might as well make use of __LINE__ and
> __FILE__. With that in mind, I'd like to change internal_error()'s
> signature to:
>
> internal_error (const char *file, long line,
> const char *fmt, ...);
>
> with all files updated accordingly.
I agree.
> The second, kind of related change, is to just go through and purge all
> but one call to abort() with a call to:
>
> internal_error (__FILE__, __LINE__, "FIXME: Code was calling abort()");
>
> The abort() calls scattered through out GDB need to eventually be
> converted to error() or internal_error() (case by case). This, somewhat
> brutal change, at least stops GDB dumping core on the poor user.
Assuming that the one call to abort() which you leave is inside
internal_error, I agree.
If not, I'd argue that a call to abort() may be very useful, precisely
_because_ it produces a core file: you can easily see what sequence of
calls led to the problem. In contrast, a simple error message doesn't
tell that.
In fact, I sometimes insert calls to abort() in strategic places when
I hunt elusive bugs which disappear under a debugger, or happen too
seldom.