This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [RFC] Never silently discard internal errors


Daniel Jacobowitz <drow@false.org> writes:
> Here's a problem that one of our customers turned up.  He runs GDB
> from inside Emacs, which means that its standard input is considered
> to be a pipe, which is not a terminal.  Accordingly query is suppressed.
> Whether this is right everywhere or not is a question for another day,
> but one particular thing we discovered was that GDB would mysteriously
> quit out from under him, without telling him what it was doing.
>
> Eventually we tracked it down to an unrelated problem in the code he was
> testing for me.  Not too surprising - that's what all the gdb_assert's
> and such are for, after all :-)  But not only was it not asking permission
> before it bailed, but it wasn't even leaving a useful message.
>
> I think the attached patch is reasonable.  It changes error handling
> such that if query is a no-op - for instance, from a script file,
> or from a pipe - we dump out a message to stdout anyway before quitting
> or dumping core.
>
> It's easy to see this behavior for yourself.  Just put the line
> "maint internal-error" in a text file, and start gdb with -x filename.
> Watch it abort without saying goodbye.
>
> Any thoughts on this patch?  Shall I commit it?

What if we simply had 'query' itself print out the prompt, followed by
"[answering 'y', since standard input is not a terminal]" (or
something more tasteful)?  Then you wouldn't have to go around
decorating all the calls to query.


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