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: RFC: internal_error() change + abort()


Andrew Cagney wrote:
> 
> Michael Snyder wrote:
> >
> > Andrew Cagney wrote:
> > >
> > > Michael Snyder wrote:
> > >
> > > > How do you decide when it's safe to NOT abort?
> > > > Eg. if a malloc call fails, you're probably completely
> > > > out of virtual memory.  Are you sure printf will work
> > > > under such a circumstance?
> > >
> > > Internal error asks for permission to abort.  If the user really does
> > > want to continue they can (but they have been warned :-).
> > > internal_error() its self keeps an eye out for a re-entrant call (say
> > > the printf failed) and will do a write() abort() in that case.
> > >
> > > Of course, a lack of stack space is always fatal :-)
> >
> > What I meant was, how do you know if internal_error can
> > call printf, or prompt the user to decide whether to
> > continue, if there is no virtual memory or heap space left?
> 
> You don't know. internal_verror() eventually calls asprintf() (via
> vfprintf_unfiltered()).  That calls malloc().  If that malloc() call
> fails, it will re-call internal_verror().  The rentrant call should
> trigger a failsafe abort:

OK, I'm happy.   ;-)

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