From: Gary Benson <gbenson@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org, Pedro Alves <palves@redhat.com>,
Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH 1/3 v4] Introduce common/errors.h
Date: Fri, 25 Jul 2014 09:34:00 -0000 [thread overview]
Message-ID: <20140725085134.GB4812@blade.nx> (raw)
In-Reply-To: <21457.17973.551020.113918@ruffy.mtv.corp.google.com>
Doug Evans wrote:
> ...it's odd to then not have just one copy of perror_with_name and
> malloc_failure given that their function comment says:
>
> perror_with_name:
> /* A special case of "error" which constructs the error message by ...
>
> and
>
> malloc_failure:
> /* A special case of internal error used to handle memory allocation ...
>
> When I read "special case of ..." the first thing that comes to mind
> is that the function is a utility wrapper around the corresponding
> function, and given that it's not I'm left wondering "Why not?".
[snip]
> So, *if* you want to keep *this* part of the patch basically as-is
> (which is fine by me) I would rephrase this comment to something
> like:
>
> /* Call this function to handle memory allocation failures.
> This function does not return. */
>
> I don't have too strong opinion on the wording. If someone wants a
> different wording, go for it.
I pretty much agree with you 100% here. I wasn't happy with the
comments for either of these, and I'll gladly change them.
> In the case of malloc_failure, it's not really an *internal* error,
No--and certainly not by the description of internal_error earlier in
the file.
> even if in the case of gdb it calls internal_error, though arguably
> it should do something different - it's more of a "fatal". :-)
> Though I'm not suggesting trying to go down that path. :-)
I spoke with Pedro about this in Cambridge. malloc failure is a funny
one: sometimes it's fatal, other times it's not an issue; it depends
entirely on what the memory you were trying to allocate was for.
> It might be possible come up with a name other than "fatal" that
> could apply to both gdb and gdbserver so that malloc_failure could
> call it, but no need to try to do that now.
I don't know if you saw but I removed "fatal" from GDB the other day
(http://tinyurl.com/k6neuwd) so the path is clear to add a "fatal" if
we want one. It would be nice if such a function were smart enough to
work even if called before exceptions and cleanups were set up. It
might be a nice general thing if all error-handling functions worked
that way (error and internal_error could work like gdbserver's "fatal"
if called early.) That might even be a prerequisite to moving
exceptions and cleanups into common code and making gdbserver use
them.
(I'm not planning to do any of this now, this is just thinking aloud!)
Cheers,
Gary
--
http://gbenson.net/
next prev parent reply other threads:[~2014-07-25 8:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 12:51 [PATCH 0/3 v4] Common code cleanups (part 1) Gary Benson
2014-07-24 12:51 ` [PATCH 2/3 v4] Remove some GDBSERVER checks from linux-ptrace Gary Benson
2014-07-24 13:25 ` Pedro Alves
2014-07-24 14:09 ` Tom Tromey
2014-07-24 14:17 ` Pedro Alves
2014-07-24 14:13 ` [PATCH 2/3 v5] " Gary Benson
2014-07-24 14:25 ` Pedro Alves
2014-07-24 15:05 ` Gary Benson
2014-07-24 12:51 ` [PATCH 1/3 v4] Introduce common/errors.h Gary Benson
2014-07-24 13:24 ` Pedro Alves
2014-07-24 18:03 ` Doug Evans
2014-07-25 8:51 ` Gary Benson
2014-07-25 10:32 ` Pedro Alves
2014-07-25 11:38 ` Gary Benson
2014-07-25 12:13 ` Pedro Alves
2014-07-25 13:34 ` Gary Benson
2014-07-29 16:44 ` Doug Evans
2014-07-29 17:45 ` Pedro Alves
2014-07-30 9:43 ` Gary Benson
2014-07-25 10:19 ` Pedro Alves
2014-07-24 17:52 ` Doug Evans
2014-07-24 22:39 ` Doug Evans
2014-07-25 9:34 ` Gary Benson [this message]
2014-07-28 20:16 ` Doug Evans
2014-07-24 13:08 ` [PATCH 3/3 v4] Make gdbserver CORE_ADDR unsigned Gary Benson
2014-07-24 13:36 ` Pedro Alves
2014-07-24 14:07 ` Gary Benson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140725085134.GB4812@blade.nx \
--to=gbenson@redhat.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox